不再写图鉴数据,可通过英雄列表数据获取
This commit is contained in:
parent
4f6aafdcde
commit
949037c4b9
@ -903,6 +903,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
|||||||
this.moduleHero.Errorf("err:%v", err)
|
this.moduleHero.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bFirst = true
|
||||||
for _, obj := range heros {
|
for _, obj := range heros {
|
||||||
if obj.HeroID == heroCfgId {
|
if obj.HeroID == heroCfgId {
|
||||||
hero = obj
|
hero = obj
|
||||||
@ -910,7 +911,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if hero != nil { // 没有当前英雄
|
if bFirst { // 没有当前英雄
|
||||||
count -= 1
|
count -= 1
|
||||||
hero, err = this.initHeroOverlying(uid, heroCfgId, 1)
|
hero, err = this.initHeroOverlying(uid, heroCfgId, 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -76,10 +76,9 @@ func (this *Hero) Start() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建单个叠加英雄
|
//创建单个叠加英雄
|
||||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, code pb.ErrorCode) {
|
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, code pb.ErrorCode) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
bFirst bool
|
|
||||||
)
|
)
|
||||||
hero, bFirst, err = this.modelHero.createHero(session, heroCfgId, num)
|
hero, bFirst, err = this.modelHero.createHero(session, heroCfgId, num)
|
||||||
if err == nil && bFirst {
|
if err == nil && bFirst {
|
||||||
@ -270,47 +269,33 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
|
|||||||
var (
|
var (
|
||||||
changeList []*pb.DBHero
|
changeList []*pb.DBHero
|
||||||
firstGet []string
|
firstGet []string
|
||||||
|
bFirst bool
|
||||||
)
|
)
|
||||||
for heroCfgId, num := range heros {
|
for heroCfgId, num := range heros {
|
||||||
if num == 0 { // 数量为0 不做处理
|
if num == 0 { // 数量为0 不做处理
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if hero, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
if hero, bFirst, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success {
|
||||||
this.Errorf("create hero %s failed", heroCfgId)
|
this.Errorf("create hero %s failed", heroCfgId)
|
||||||
return
|
continue
|
||||||
}
|
}
|
||||||
if result, err1 := this.ModuleUser.GetUserExpand(session.GetUserId()); err1 == nil {
|
if bFirst {
|
||||||
initUpdate := map[string]interface{}{}
|
firstGet = append(firstGet, heroCfgId)
|
||||||
sz := result.GetTujian()
|
changeList = append(changeList, hero)
|
||||||
if len(sz) == 0 {
|
|
||||||
sz = make(map[string]int32, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, ok := result.GetTujian()[heroCfgId]; !ok {
|
|
||||||
heroConf := this.modelHero.moduleHero.configure.GetHeroConfig(heroCfgId)
|
|
||||||
if heroConf != nil {
|
|
||||||
if heroConf.Handbook == -1 {
|
|
||||||
sz[heroCfgId] = 0
|
|
||||||
} else {
|
|
||||||
sz[heroCfgId] = 1
|
|
||||||
}
|
|
||||||
initUpdate["tujian"] = sz
|
|
||||||
this.ModuleUser.ChangeUserExpand(session.GetUserId(), initUpdate)
|
|
||||||
firstGet = append(firstGet, heroCfgId)
|
|
||||||
}
|
|
||||||
changeList = append(changeList, hero)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if bPush && len(changeList) > 0 { //推送
|
if bPush { //推送
|
||||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeList})
|
if len(changeList) > 0 {
|
||||||
}
|
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeList})
|
||||||
// 首次获得英雄 则推送
|
}
|
||||||
if len(firstGet) > 0 {
|
|
||||||
session.SendMsg("hero", "firstget", &pb.HeroFirstGetPush{
|
// 首次获得英雄 则推送
|
||||||
HeroId: firstGet,
|
if len(firstGet) > 0 {
|
||||||
})
|
session.SendMsg("hero", "firstget", &pb.HeroFirstGetPush{
|
||||||
|
HeroId: firstGet,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user