英雄接口优化
This commit is contained in:
parent
9fce1aa3f2
commit
f595e78333
@ -91,7 +91,7 @@ type (
|
|||||||
QueryHeroByConfId(uId string, heroCfgId string) (hero *pb.DBHero)
|
QueryHeroByConfId(uId string, heroCfgId string) (hero *pb.DBHero)
|
||||||
|
|
||||||
// 批量创建英雄
|
// 批量创建英雄
|
||||||
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData)
|
CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (atno []*pb.UserAtno, errdata *pb.ErrorData)
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
// heroId 英雄ID
|
// heroId 英雄ID
|
||||||
GetHeroByObjID(uid, heroId string) (hero *pb.DBHero, errdata *pb.ErrorData)
|
GetHeroByObjID(uid, heroId string) (hero *pb.DBHero, errdata *pb.ErrorData)
|
||||||
|
@ -273,11 +273,12 @@ func (this *Hero) EventUserOffline(uid, sessionid string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 批量创建多个英雄
|
// 批量创建多个英雄
|
||||||
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
changeList []*pb.DBHero
|
changeList []*pb.DBHero
|
||||||
firstGet []string
|
firstGet []string
|
||||||
bFirst bool
|
bFirst bool
|
||||||
|
hero *pb.DBHero
|
||||||
)
|
)
|
||||||
for heroCfgId, num := range heros {
|
for heroCfgId, num := range heros {
|
||||||
if num == 0 { // 数量为0 不做处理
|
if num == 0 { // 数量为0 不做处理
|
||||||
|
@ -486,7 +486,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
|||||||
this.Debugf("发放道具资源: %v errdata: %v", items, errdata)
|
this.Debugf("发放道具资源: %v errdata: %v", items, errdata)
|
||||||
}
|
}
|
||||||
if len(heros) > 0 { //卡片资源
|
if len(heros) > 0 { //卡片资源
|
||||||
_, _, errdata = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
_, errdata = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||||
this.Debugf("发放英雄资源: %v errdata: %v", heros, errdata)
|
this.Debugf("发放英雄资源: %v errdata: %v", heros, errdata)
|
||||||
}
|
}
|
||||||
if len(equips) > 0 {
|
if len(equips) > 0 {
|
||||||
@ -718,7 +718,7 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea
|
|||||||
this.Debugf("发放道具资源: %v errdata: %v", items, errdata)
|
this.Debugf("发放道具资源: %v errdata: %v", items, errdata)
|
||||||
}
|
}
|
||||||
if len(heros) > 0 { //卡片资源
|
if len(heros) > 0 { //卡片资源
|
||||||
if _, heroschange, errdata = this.ModuleHero.CreateRepeatHeros(session, heros, bPush); errdata != nil {
|
if heroschange, errdata = this.ModuleHero.CreateRepeatHeros(session, heros, bPush); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
atno = append(atno, heroschange...)
|
atno = append(atno, heroschange...)
|
||||||
|
Loading…
Reference in New Issue
Block a user