diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 8844f25b0..9260f53a8 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -672,42 +672,9 @@ func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTale if hero.TalentProperty == nil { hero.TalentProperty = make(map[string]int32) } - if conf.Hp != -1 { - if _, ok := hero.TalentProperty[comm.Hp]; ok { - hero.TalentProperty[comm.Hp] += int32(math.Floor((float64(conf.Hp) / 1000) * float64(hero.Property[comm.Hp]))) - } else { - hero.TalentProperty[comm.Hp] = int32(math.Floor((float64(conf.Hp) / 1000) * float64(hero.Property[comm.Hp]))) - } - } - if conf.Atk != -1 { - if _, ok := hero.TalentProperty[comm.Atk]; ok { - hero.TalentProperty[comm.Atk] += int32(math.Floor((float64(conf.Atk) / 1000) * float64(hero.Property[comm.Atk]))) - } else { - hero.TalentProperty[comm.Atk] = int32(math.Floor((float64(conf.Atk) / 1000) * float64(hero.Property[comm.Atk]))) - } - } - if conf.Def != -1 { - if _, ok := hero.TalentProperty[comm.Def]; ok { - hero.TalentProperty[comm.Def] += int32(math.Floor((float64(conf.Def) / 1000) * float64(hero.Property[comm.Def]))) - } else { - hero.TalentProperty[comm.Def] = int32(math.Floor((float64(conf.Def) / 1000) * float64(hero.Property[comm.Def]))) - } - } - if conf.Cri != -1 { - if _, ok := hero.TalentProperty[comm.Cri]; ok { - hero.TalentProperty[comm.Cri] += int32(math.Floor((float64(conf.Cri) / 1000) * float64(hero.Property[comm.Cri]))) - } else { - hero.TalentProperty[comm.Cri] = int32(math.Floor((float64(conf.Cri) / 1000) * float64(hero.Property[comm.Cri]))) - } - } - if conf.Speed != -1 { - if _, ok := hero.TalentProperty[comm.Speed]; ok { - hero.TalentProperty[comm.Speed] += int32(math.Floor((float64(conf.Speed) / 1000) * float64(hero.Property[comm.Speed]))) - } else { - hero.TalentProperty[comm.Speed] = int32(math.Floor((float64(conf.Speed) / 1000) * float64(hero.Property[comm.Speed]))) - } - } + hero.TalentProperty[conf.Attrkey] += int32(math.Floor((float64(conf.Attrvar) / 1000) * float64(hero.Property[conf.Attrkey]))) + _heroMap := make(map[string]interface{}, 0) if conf.Skill != 0 { hero.NormalSkill = append(hero.NormalSkill, &pb.SkillData{ @@ -738,9 +705,7 @@ func (this *ModelHero) cleanTalentProperty(hero *pb.DBHero) { // 重新计算天赋加成 attr hp atk def cri speed func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { - var ( - attr [5]int32 - ) + if hero == nil { return } @@ -748,22 +713,8 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { for _, v := range rst { if v.HeroId == hero.HeroID { // 找到对应的英雄 for k := range v.Talent { - if conf, _ := this.module.configure.GetHeroTalent(k); conf != nil { //获取天赋树 - if conf.Hp != -1 { - attr[0] += conf.Hp - } - if conf.Atk != -1 { - attr[1] += conf.Atk - } - if conf.Def != -1 { - attr[2] += conf.Def - } - if conf.Cri != -1 { - attr[3] += conf.Cri - } - if conf.Speed != -1 { - attr[4] += conf.Speed - } + if conf, _ := this.module.configure.GetHeroTalent(k); conf != nil { //获取天赋 + hero.TalentProperty[conf.Attrkey] = int32(math.Floor((float64(conf.Attrvar) / 1000) * float64(hero.Property[conf.Attrkey]))) } } break @@ -771,25 +722,6 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { } } - hero.TalentProperty = make(map[string]int32) - for k, v := range attr { - if v != 0 { - switch k { - case 0: - hero.TalentProperty[comm.Hp] = int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Hp]))) - case 1: - hero.TalentProperty[comm.Atk] = int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Atk]))) - case 2: - hero.TalentProperty[comm.Def] = int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Def]))) - case 3: - hero.TalentProperty[comm.Cri] = int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Cri]))) - case 4: - hero.TalentProperty[comm.Speed] = int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Speed]))) - - } - } - } - } // 创建一条英雄信息,如果有这个英雄 则转换成对应的碎片 diff --git a/modules/mail/module.go b/modules/mail/module.go index af40a615d..0bbc84884 100644 --- a/modules/mail/module.go +++ b/modules/mail/module.go @@ -414,7 +414,6 @@ func (this *Mail) SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn, } } } - } else { for _, id := range uids { mail := &pb.DBMailData{ @@ -435,7 +434,16 @@ func (this *Mail) SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn, mail.Reward = false } this.modelMail.DB.InsertOne(comm.TableMail, mail) + } } + redot := &pb.ReddotItem{ + Rid: int32(comm.Reddot12102), + Activated: false, + Nextchanagetime: 0, + } + this.SendMsgToUsers("reddot", "change", &pb.ReddotChangePush{ + Rids: []*pb.ReddotItem{redot}, + }, uids...) return true }