修改英雄升级奖励

This commit is contained in:
liwei1dao 2024-01-12 10:27:55 +08:00
parent 5cba1c5aa9
commit b9207793d8

View File

@ -412,13 +412,13 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
curAddExp = make(map[string]int32, len(heros)) curAddExp = make(map[string]int32, len(heros))
for _, hero := range heros { for _, hero := range heros {
var ( var (
user *pb.DBUser user *pb.DBUser
expConf *cfg.GamePlayerlvData expConf *cfg.GamePlayerlvData
heroconf *cfg.GameHeroData
preLv int32 //加经验之前的等级 preLv int32 //加经验之前的等级
curExp int32 // 加经验之后的经验 curExp int32 // 加经验之后的经验
curLv int32 // 加经验之后的等级 curLv int32 // 加经验之后的等级
update map[string]interface{} // 属性变化 update map[string]interface{} // 属性变化
) )
if hero == nil { if hero == nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
@ -459,7 +459,13 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
} }
return return
} }
if heroconf, err = this.module.configure.GetHeroConfig(hero.HeroID); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Message: err.Error(),
}
return
}
var maxExp int32 var maxExp int32
maxExp = _data.Heroexp maxExp = _data.Heroexp
if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级
@ -489,6 +495,9 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
} else { // 升级操作 } else { // 升级操作
curExp -= maxExp curExp -= maxExp
curLv += 1 // 经验够了 那么等级+1 curLv += 1 // 经验够了 那么等级+1
if upwardconf, err = this.module.configure.GetHeroLvUpWardData(heroconf.Star, curLv); err == nil {
upwardconfs = append(upwardconfs, upwardconf)
}
_data = this.module.configure.GetHeroLv(curLv) _data = this.module.configure.GetHeroLv(curLv)
if _data == nil { // 等级加失败了 回到原来的等级 if _data == nil { // 等级加失败了 回到原来的等级
fullexp = (curExp - maxExp) fullexp = (curExp - maxExp)
@ -530,34 +539,30 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype24, curLv-preLv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype24, curLv-preLv))
// szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID))) // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv))
if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil { tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, heroconf.Color, hero.Lv))
if upwardconf, err = this.module.configure.GetHeroLvUpWardData(cfg.Star, curLv); err != nil { //xx英雄满级、共鸣、觉醒至最高状态
upwardconfs = append(upwardconfs, upwardconf) nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
} if nextAwaken == nil { // 达到满级觉醒
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv)) if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) {
//xx英雄满级、共鸣、觉醒至最高状态 var _l int32
nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId())
if nextAwaken == nil { // 达到满级觉醒 if err == nil {
if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { for _, v := range talent {
var _l int32 if v.HeroId == hero.HeroID {
talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) _l = int32(len(v.Talent))
if err == nil { break
for _, v := range talent {
if v.HeroId == hero.HeroID {
_l = int32(len(v.Talent))
break
}
} }
} }
if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { }
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l {
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, heroconf.Color))
iHeroId, _ := strconv.Atoi(hero.HeroID) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId))) iHeroId, _ := strconv.Atoi(hero.HeroID)
} tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId)))
} }
} }
} }
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))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, hero.Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, hero.Lv))