满级回响

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

View File

@ -215,22 +215,25 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
return
}
if heroObj.Lv == maxlv {
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, heroObj.HeroID))
iHeroId, _ := strconv.Atoi(heroObj.HeroID)
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, heroObj.HeroID, int32(iHeroId)))
if maxlv, e := this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID); e == nil {
if maxlv == int32(len(talent.Talent)) {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, heroObj.HeroID, cfg.Color))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, heroObj.HeroID))
iHeroId, _ := strconv.Atoi(heroObj.HeroID)
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, heroObj.HeroID, int32(iHeroId)))
}
}
}
}
// 满回响
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype128, 1, cfg.Race))
if user, err := this.module.GetUserForSession(session); err == nil {
this.chat.SendSysChatToWorld(session, comm.ChatSystem10, heroObj, heroObj.Star, 0, user.Name, heroObj.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
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))
if user, err := this.module.GetUserForSession(session); err == nil {
this.chat.SendSysChatToWorld(session, comm.ChatSystem10, heroObj, heroObj.Star, 0, user.Name, heroObj.HeroID)
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
}
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype199, 1))

View File

@ -73,8 +73,9 @@ type configureComp struct {
cardPool map[string][]*cfg.GameCardPoolData
// 限定英雄
wish *Replace // 许愿英雄招募
appoint *Replace // 限定英雄招募
wish *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
}
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)
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 ...

View File

@ -725,11 +725,13 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
}
}
}
if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, heroconf.Color))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID))
iHeroId, _ := strconv.Atoi(hero.HeroID)
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId)))
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.Rtype38, hero.HeroID))
iHeroId, _ := strconv.Atoi(hero.HeroID)
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId)))
}
}
}
}