gm 满属性英雄 天赋技能带入

This commit is contained in:
meixiongfeng 2024-01-19 11:57:44 +08:00
parent ddc7aef6fd
commit 3d6fc46cc2
4 changed files with 31 additions and 30 deletions

View File

@ -135,7 +135,7 @@ type (
CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32
// 获取所有满星满级满觉醒的英雄
GetAllMaxHero(session IUserSession, bTalent bool) (errdata *pb.ErrorData)
GetAllMaxHero(session IUserSession) (errdata *pb.ErrorData)
// 教习登记
RegisterInstructor(session IUserSession, heroOid []string, registerId int32) (errdata *pb.ErrorData)

View File

@ -193,7 +193,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
return
}
errdata = module1.(comm.IHero).GetAllMaxHero(session, false)
errdata = module1.(comm.IHero).GetAllMaxHero(session)
this.Debug("使用bingo命令:uid = %s ",
log.Field{Key: "uid", Value: session.GetUserId()},
log.Field{Key: "0", Value: datas[0]},
@ -650,7 +650,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
return
}
errdata = module1.(comm.IHero).GetAllMaxHero(session, true)
errdata = module1.(comm.IHero).GetAllMaxHero(session)
module1, err = this.service.GetModule(comm.ModuleMainline)
if err != nil {

View File

@ -728,7 +728,7 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) {
if hero == nil {
return
}
if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err != nil {
if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err == nil {
for _, v := range rst {
if v.HeroId == hero.HeroID { // 找到对应的英雄
for k := range v.Talent {

View File

@ -415,10 +415,10 @@ func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) i
}
// 获取所有满星满级满觉醒的英雄
func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdata *pb.ErrorData) {
if bTalent {
this.modelTalent.CleanAllHeroTalent(session.GetUserId())
}
func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorData) {
this.modelTalent.CleanAllHeroTalent(session.GetUserId())
// 清除所有英雄
this.modelHero.RemoveUserHeroInfo(session.GetUserId())
data := this.modelHero.module.configure.GetHeroConfigData()
@ -478,7 +478,6 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat
break
}
}
//this.modelHero.resetJuexingProperty(hero)
// 获取满级技能
for _, skill := range hero.NormalSkill {
skillMaxLv := this.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID))
@ -489,7 +488,29 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat
hero.Lv = maxLv
hero.Star = maxStar
hero.JuexingLv = int32(maxJux)
if true { // 满天赋
talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID)
data, err := this.configure.GMGetTalentByHeroId(hero.HeroID)
if err == nil {
for _, v := range data {
talent.Talent[v.Skillid] = 1
if v.Skill != 0 {
hero.Talentskill = append(hero.Talentskill, &pb.SkillData{
SkillID: v.Skill,
SkillLv: 1,
})
}
}
}
update := make(map[string]interface{}, 0)
update["talent"] = talent.Talent
if err = this.modelTalent.ChangeHeroTalent(talent, update); err != nil {
this.Errorf("update failed :%v", err)
}
}
this.modelHero.PropertyCompute(hero) // 重新计算属性
_heroMap := map[string]interface{}{
"lv": hero.Lv,
"star": hero.Star,
@ -501,29 +522,9 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat
"horoscopeProperty": hero.HoroscopeProperty,
"juexProperty": hero.JuexProperty,
"awakenskill": hero.Awakenskill,
"talentskill": hero.Talentskill,
}
if bTalent { // 满天赋
talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID)
data, err := this.configure.GMGetTalentByHeroId(hero.HeroID)
if err == nil {
for _, v := range data {
talent.Talent[v.Skillid] = 1
}
}
update := make(map[string]interface{}, 0)
update["talent"] = talent.Talent
if err = this.modelTalent.ChangeHeroTalent(talent, update); err != nil {
this.Errorf("update failed :%v", err)
}
// talent.Talent[req.TalentID] = 1
// update := make(map[string]interface{}, 0)
// update["talent"] = talent.Talent
// if err = this.module.modelTalent.ChangeHeroTalent(talent, update); err != nil {
// this.module.Errorf("update failed :%v", err)
// }
// this.modelHero.setTalentProperty(hero)
}
// 保存数据
err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
if err != nil {