满级回响

This commit is contained in:
meixiongfeng 2024-01-29 16:31:00 +08:00
parent 2a3ee38feb
commit 2901d94934
4 changed files with 59 additions and 28 deletions

View File

@ -127,9 +127,11 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
} }
} }
} }
if this.module.configure.GetHeroTalentMaxLv(_hero.HeroID) == _l { if maxlv, err := this.module.configure.GetHeroTalentMaxLv(_hero.HeroID); err == nil {
if maxlv == _l {
bManAwaken = true bManAwaken = true
} }
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race))
if err != nil { // 达到满级觉醒 if err != nil { // 达到满级觉醒
var maxlv int32 var maxlv int32

View File

@ -215,8 +215,8 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
return return
} }
if heroObj.Lv == maxlv { if heroObj.Lv == maxlv {
if maxlv, e := this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID); e == nil {
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) { if maxlv == int32(len(talent.Talent)) {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, heroObj.HeroID)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, heroObj.HeroID))
iHeroId, _ := strconv.Atoi(heroObj.HeroID) iHeroId, _ := strconv.Atoi(heroObj.HeroID)
@ -224,8 +224,10 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
} }
} }
} }
}
// 满回响 // 满回响
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) { if maxlv, e := this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID); e == nil {
if maxlv == int32(len(talent.Talent)) {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, 1, cfg.Race)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, 1, cfg.Race))
if user, err := this.module.GetUserForSession(session); err == nil { if user, err := this.module.GetUserForSession(session); err == nil {
this.chat.SendSysChatToWorld(session, comm.ChatSystem10, heroObj, heroObj.Star, 0, user.Name, heroObj.HeroID) this.chat.SendSysChatToWorld(session, comm.ChatSystem10, heroObj, heroObj.Star, 0, user.Name, heroObj.HeroID)
@ -233,6 +235,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
this.module.Errorf("no found userdata uid:%s", session.GetUserId()) this.module.Errorf("no found userdata uid:%s", session.GetUserId())
} }
} }
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype199, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype199, 1))
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
this.module.ModuleBuried.TriggerBuried(session, tasks...) this.module.ModuleBuried.TriggerBuried(session, tasks...)

View File

@ -75,6 +75,7 @@ type configureComp struct {
// 限定英雄 // 限定英雄
wish *Replace // 许愿英雄招募 wish *Replace // 许愿英雄招募
appoint *Replace // 限定英雄招募 appoint *Replace // 限定英雄招募
talentlv map[string]int32 // 天赋等级
} }
// 组件初始化接口 // 组件初始化接口
@ -211,6 +212,24 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
} }
}) })
configure.RegisterConfigure(hero_talent, cfg.NewGameHeroTalent, func() {
if v, err := this.GetConfigure(hero_talent); err == nil {
if _configure, ok := v.(*cfg.GameHeroTalent); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
this.talentlv = make(map[string]int32)
for _, v := range _configure.GetDataList() {
this.talentlv[v.Hid] += 1
}
return
}
} else {
err = fmt.Errorf("%T no is *cfg.Game_drawCard", v)
}
})
this.GetHeroTalentMaxLv("13001")
return return
} }
func (this *configureComp) GetApportHeroReplaceConfig() *Replace { func (this *configureComp) GetApportHeroReplaceConfig() *Replace {
@ -474,14 +493,19 @@ func (this *configureComp) GetHeroMaxLv(star int32) (maxlv int32, err error) {
err = fmt.Errorf("GetHeroMaxLv err : star:%d", star) err = fmt.Errorf("GetHeroMaxLv err : star:%d", star)
return return
} }
func (this *configureComp) GetHeroTalentMaxLv(heroid string) (maxlv int32) {
if v, err := this.GetConfigure(hero_talentbox); err == nil {
if configure, ok := v.(*cfg.GameTalentBox); ok {
return int32(len(configure.GetDataList()))
}
}
return 0 // 获取满共鸣的等级
func (this *configureComp) GetHeroTalentMaxLv(heroid string) (maxlv int32, err error) {
var (
ok bool
)
this.hlock.RLock()
defer this.hlock.RUnlock()
if maxlv, ok = this.talentlv[heroid]; ok {
return
}
err = comm.NewNotFoundConfErr(moduleName, hero_talent, heroid)
return
} }
// id: 1新手卡池 2 表示普通抽 3表示阵营1 4表示阵营2 ... // id: 1新手卡池 2 表示普通抽 3表示阵营1 4表示阵营2 ...

View File

@ -725,7 +725,8 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
} }
} }
} }
if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { if maxlv, e := this.module.configure.GetHeroTalentMaxLv(hero.HeroID); e == nil {
if maxlv == _l {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, heroconf.Color)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, heroconf.Color))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID))
iHeroId, _ := strconv.Atoi(hero.HeroID) iHeroId, _ := strconv.Atoi(hero.HeroID)
@ -733,6 +734,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
} }
} }
} }
}
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv))