From 9a54411eb14fcc6f78626b3e13d335592bcd6aa4 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 30 Dec 2022 10:16:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=88=98=E6=96=97=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/enchant/api_challenge.go | 2 +- modules/hunting/api_challenge.go | 2 +- modules/viking/api_challenge.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/enchant/api_challenge.go b/modules/enchant/api_challenge.go index 1aa9f51c1..cac07b4cd 100644 --- a/modules/enchant/api_challenge.go +++ b/modules/enchant/api_challenge.go @@ -10,7 +10,7 @@ import ( //参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.EnchantChallengeReq) (code pb.ErrorCode) { - if req.BossType <= 0 || req.Battle != nil { + if req.BossType <= 0 || req.Battle == nil { code = pb.ErrorCode_ReqParameterError return } diff --git a/modules/hunting/api_challenge.go b/modules/hunting/api_challenge.go index cb0ba8bcb..85f335cec 100644 --- a/modules/hunting/api_challenge.go +++ b/modules/hunting/api_challenge.go @@ -10,7 +10,7 @@ import ( //参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.HuntingChallengeReq) (code pb.ErrorCode) { - if req.BossType <= 0 && req.Difficulty > 0 || req.Battle != nil { + if req.BossType <= 0 && req.Difficulty > 0 || req.Battle == nil { code = pb.ErrorCode_ReqParameterError return } diff --git a/modules/viking/api_challenge.go b/modules/viking/api_challenge.go index b6961d95e..e86695bd1 100644 --- a/modules/viking/api_challenge.go +++ b/modules/viking/api_challenge.go @@ -10,7 +10,7 @@ import ( //参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.VikingChallengeReq) (code pb.ErrorCode) { - if req.BossId <= 0 && req.Difficulty > 0 || req.Battle != nil { + if req.BossId <= 0 && req.Difficulty > 0 || req.Battle == nil { code = pb.ErrorCode_ReqParameterError return } From bda90f33cca7d323978377412f3e37f4043e1dc3 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 30 Dec 2022 14:03:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=81=93=E5=85=B7?= =?UTF-8?q?=E5=88=86=E8=A7=A3=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/items/api_decompose.go | 8 ++++---- modules/items/api_sellItem.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/items/api_decompose.go b/modules/items/api_decompose.go index 37d71d452..2a38d49c9 100644 --- a/modules/items/api_decompose.go +++ b/modules/items/api_decompose.go @@ -9,7 +9,7 @@ import ( ) //参数校验 -func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode) { +func (this *apiComp) DecomposeCheck(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode) { if req.GridId == "" || req.Amount <= 0 { code = pb.ErrorCode_ReqParameterError } @@ -17,14 +17,14 @@ func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellI } //出售道具 -func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode, data proto.Message) { +func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode, data proto.Message) { var ( err error item *pb.DB_UserItemData itemcf *cfg.GameItemData sale []*cfg.Gameatn ) - if code = this.SellItemCheck(session, req); code != pb.ErrorCode_Success { + if code = this.DecomposeCheck(session, req); code != pb.ErrorCode_Success { return } if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), req.GridId); err != nil { @@ -73,6 +73,6 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe if code = this.module.AddItemforGrid(session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success { return } - session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellItemResp{GridId: req.GridId, Amount: req.Amount, Issucc: true}) + session.SendMsg(string(this.module.GetType()), "decompose", &pb.ItemsDecomposeResp{GridId: req.GridId, Amount: req.Amount, Issucc: true}) return } diff --git a/modules/items/api_sellItem.go b/modules/items/api_sellItem.go index 57ce30d2c..4cb1cb8a8 100644 --- a/modules/items/api_sellItem.go +++ b/modules/items/api_sellItem.go @@ -9,22 +9,22 @@ import ( ) //参数校验 -func (this *apiComp) DecomposeCheck(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode) { +func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode) { if req.GridId == "" || req.Amount <= 0 { code = pb.ErrorCode_ReqParameterError } return } -//出售道具 -func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode, data proto.Message) { +//分解道具 +func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode, data proto.Message) { var ( err error item *pb.DB_UserItemData itemcf *cfg.GameItemData sale []*cfg.Gameatn ) - if code = this.DecomposeCheck(session, req); code != pb.ErrorCode_Success { + if code = this.SellItemCheck(session, req); code != pb.ErrorCode_Success { return } if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), req.GridId); err != nil { @@ -44,7 +44,7 @@ func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecompose this.module.Errorf("SellItemCheck over all amount:[%d:%d]", req.Amount, item.Amount) return } - sale = make([]*cfg.Gameatn, len(itemcf.Sale)) + sale = make([]*cfg.Gameatn, len(itemcf.DecomposeDeplete)) for i, v := range itemcf.Sale { temp := *v sale[i] = &temp From d400023dabd01916f482794b387f2c9ae2950786 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 30 Dec 2022 14:42:50 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A5=97=E8=A3=85?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/configure_comp.go | 18 ++++++++ modules/hero/model_hero.go | 47 ++++++++++++++------- sys/configure/structs/game.equipSuitData.go | 8 ++-- 3 files changed, 53 insertions(+), 20 deletions(-) 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_ } }