diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index a980ed335..01e68c73a 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -12,6 +12,7 @@ import ( ) const ( + equip_suit = "game_equipsuit.json" //装备套装表 new_hero = "game_hero.json" //英雄 hero_stargrow = "game_herostargrow.json" //英雄品质系数 hero_levelgrow = "game_herolevelgrow.json" //英雄成长系数 @@ -51,6 +52,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp err = this.MCompConfigure.Init(service, module, comp, options) this.module = module.(*Hero) err = this.LoadMultiConfigure(map[string]interface{}{ + equip_suit: cfg.NewGameEquipSuit, new_hero: cfg.NewGameHero, hero_stargrow: cfg.NewGameHeroStargrow, hero_levelgrow: cfg.NewGameHeroLevelgrow, @@ -498,3 +500,19 @@ func (this *configureComp) GetHeroStargrowConfigByStar(star int32) int32 { return 1 } + +// 获取英雄升级属性变化相关配置数据 +func (this *configureComp) GetEquipsuit(id int32) (configure *cfg.GameEquipSuitData, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(equip_suit); err == nil { + if configure, ok = v.(*cfg.GameEquipSuit).GetDataMap()[id]; !ok { + err = fmt.Errorf("%T no is *cfg.GameEquipSuit", v) + return + } + + } + return +} diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index c3aefbdeb..662661b38 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -307,22 +307,6 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen for _, v := range v.AdverbEntry { addProperty[v.AttrName] += v.Value + v.EnchValue //附加属性 } - for k, v := range addProperty { - switch k { - case comm.AtkPro: - addProperty[comm.Atk] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Atk]))) - addProperty[comm.AtkPro] = 0 - case comm.DefPro: - addProperty[comm.Def] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Def]))) - addProperty[comm.DefPro] = 0 - case comm.HpPro: - addProperty[comm.Hp] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Hp]))) - addProperty[comm.HpPro] = 0 - case comm.SpeedPro: - addProperty[comm.Speed] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Speed]))) - addProperty[comm.SpeedPro] = 0 - } - } if v.Adverbskill != nil { for _, v := range v.Adverbskill { equipSkill = append(equipSkill, &pb.SkillData{ @@ -332,6 +316,37 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen } } } + + if hero.SuiteId != 0 { //套装 + if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteId); err != nil { + this.moduleHero.Errorln(err) + } else { + for k, v := range configure.SetBonuses { + addProperty[k] += v + } + } + } + if hero.SuiteExtId != 0 { //套装 + if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteExtId); err != nil { + this.moduleHero.Errorln(err) + } else { + for k, v := range configure.SetBonuses { + addProperty[k] += v + } + } + } + for k, v := range addProperty { + switch k { + case comm.AtkPro: + addProperty[comm.Atk] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Atk]))) + case comm.DefPro: + addProperty[comm.Def] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Def]))) + case comm.HpPro: + addProperty[comm.Hp] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Hp]))) + case comm.SpeedPro: + addProperty[comm.Speed] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Speed]))) + } + } this.mergeAddProperty(hero.Uid, hero, addProperty, equipSkill) } diff --git a/sys/configure/structs/game.equipSuitData.go b/sys/configure/structs/game.equipSuitData.go index c8134cc44..dd322795d 100644 --- a/sys/configure/structs/game.equipSuitData.go +++ b/sys/configure/structs/game.equipSuitData.go @@ -16,7 +16,7 @@ type GameEquipSuitData struct { Skill int32 Skillname string Skillintr string - SetBonuses map[string]float32 + SetBonuses map[string]int32 } const TypeId_GameEquipSuitData = -1986764885 @@ -36,15 +36,15 @@ func (_v *GameEquipSuitData)Deserialize(_buf map[string]interface{}) (err error) var _ok_ bool if _arr_, _ok_ = _buf["SetBonuses"].([]interface{}); !_ok_ { err = errors.New("SetBonuses error"); return } - _v.SetBonuses = make(map[string]float32) + _v.SetBonuses = make(map[string]int32) for _, _e_ := range _arr_ { var _kv_ []interface{} if _kv_, _ok_ = _e_.([]interface{}); !_ok_ || len(_kv_) != 2 { err = errors.New("SetBonuses error"); return } var _key_ string { if _key_, _ok_ = _kv_[0].(string); !_ok_ { err = errors.New("_key_ error"); return } } - var _value_ float32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _kv_[1].(float64); !_ok_ { err = errors.New("_value_ error"); return }; _value_ = float32(_x_) } + var _value_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _kv_[1].(float64); !_ok_ { err = errors.New("_value_ error"); return }; _value_ = int32(_x_) } _v.SetBonuses[_key_] = _value_ } }