From 353c4d0585651d029bdedd808822cf249ef40e91 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 7 Feb 2023 14:59:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E5=8D=A1=E8=BF=94=E5=9B=9E=20?= =?UTF-8?q?=E7=A2=8E=E7=89=87=E7=AD=89=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_global.json | 3 +- bin/json/game_hero.json | 2 +- bin/json/game_item.json | 44 +++++++++ comm/imodule.go | 2 +- modules/hero/model_hero.go | 118 +++++++++++------------ modules/hero/module.go | 8 +- modules/modulebase.go | 13 +-- sys/configure/structs/game.globalData.go | 2 + 8 files changed, 115 insertions(+), 77 deletions(-) diff --git a/bin/json/game_global.json b/bin/json/game_global.json index 99c6ca3c1..bced51e8d 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -538,6 +538,7 @@ 10, 20, 30 - ] + ], + "generaltp": "500000" } ] \ No newline at end of file diff --git a/bin/json/game_hero.json b/bin/json/game_hero.json index ce3acf7b0..251619978 100644 --- a/bin/json/game_hero.json +++ b/bin/json/game_hero.json @@ -1425,7 +1425,7 @@ "hid": "23003", "name": { "key": "hero_23003", - "text": "泰德·邓普顿" + "text": "黛塔黛恩" }, "star": 3, "color": 2, diff --git a/bin/json/game_item.json b/bin/json/game_item.json index af7d50423..5003f96de 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -6247,6 +6247,50 @@ "text": "波比的天赋点不足" } }, + { + "id": "500000", + "name": { + "key": "itemname_90001", + "text": "通用共鸣道具" + }, + "usetype": 3, + "color": 5, + "bagtype": 1, + "index": 99, + "special_type": 0, + "time": 0, + "effects": "effect_ui_wuping_2", + "box_id": 0, + "synthetize_num": 0, + "access": [ + 155 + ], + "use_skip": 155, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "ytx_js_15005", + "ico": "ytx_js_15005", + "intr": { + "key": "itemdesc_500000", + "text": "亚力克斯天赋点" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "synthetize_deplete": [], + "decompose_deplete": [], + "tipstxt": { + "key": "itemtipstxt_500000", + "text": "波比的天赋点不足" + } + }, { "id": "1000001", "name": { diff --git a/comm/imodule.go b/comm/imodule.go index 2b745176b..fce0a1198 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -51,7 +51,7 @@ type ( QueryHeroAmount(uId string, heroCfgId string) (amount uint32) // 批量创建英雄 - CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode) + CreateRepeatHeros(session IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, code pb.ErrorCode) // 获取英雄 // heroId 英雄ID GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index daa54e1b6..cfc4347f4 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -161,58 +161,6 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int return } -// 该方法适用创建初始英雄 叠加英雄 count叠加数量 -func (this *ModelHero) createHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) { - heros := make([]*pb.DBHero, 0) - if this.moduleHero.IsCross() { - if dbModel, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { - this.moduleHero.Errorln(err) - - } else { - if err = dbModel.GetList(uid, &heros); err != nil { - this.moduleHero.Errorf("err:%v", err) - } - } - } else { - if err = this.GetList(uid, &heros); err != nil { - this.moduleHero.Errorf("err:%v", err) - } - } - for _, obj := range heros { - if obj.HeroID == heroCfgId { // z - return - } - } - for _, h := range heros { - if h.HeroID == heroCfgId && - h.IsOverlying { - h.SameCount += count - data := map[string]interface{}{ - "sameCount": h.SameCount, //叠加数 - } - hero = h - - if this.moduleHero.IsCross() { - if model, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { - this.moduleHero.Errorln(err) - } else { - if err := model.ChangeList(uid, h.Id, data); err != nil { - return nil, err - } - } - } else { - if err := this.ChangeList(uid, h.Id, data); err != nil { - return nil, err - } - } - - return - } - } - - return this.initHeroOverlying(uid, heroCfgId, count) -} - //获取一个英雄(参数唯一objID) func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero { hero := &pb.DBHero{} @@ -863,13 +811,13 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { } // 创建一条英雄信息,如果有这个英雄 则转换成对应的碎片 -func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, err error) { +func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, err error) { heros := make([]*pb.DBHero, 0) uid := session.GetUserId() + if this.moduleHero.IsCross() { if dbModel, err := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { this.moduleHero.Errorln(err) - } else { if err = dbModel.GetList(uid, &heros); err != nil { this.moduleHero.Errorf("err:%v", err) @@ -894,19 +842,67 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c if err != nil { return } + atno = append(atno, &pb.UserAtno{ + A: "hero", + T: hero.HeroID, + N: 1, + O: hero.Id, + }) } // 转碎片处理 if count > 0 { - heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId) - if heroCfg != nil { - res := make([]*cfg.Gameatn, 0) - for i := 0; i < int(count); i++ { - res = append(res, heroCfg.Herofrag...) + // 如果技能是满级 则转成其他道具 + if this.checkHeroAllSkillMax(hero) { + list := this.moduleHero.configure.GetGlobalConf().Moonshopmoney + if list != nil { + heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId) + for pos, v := range list { + if int32(pos)+3 == heroCfg.Star && v > 0 { + res := make([]*cfg.Gameatn, 0) + + res = append(res, &cfg.Gameatn{ + A: "attr", + T: "moongold", + N: v * count, + }) + atno = append(atno, &pb.UserAtno{ + A: "attr", + T: "moongold", + N: v * count, + }) + this.moduleHero.DispenseRes(session, res, true) + break + } + } + } + } else { + heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId) + if heroCfg != nil { + res := make([]*cfg.Gameatn, 0) + for i := 0; i < int(count); i++ { + res = append(res, heroCfg.Herofrag...) + for _, v := range heroCfg.Herofrag { + atno = append(atno, &pb.UserAtno{ + A: v.A, + T: v.T, + N: v.N, + }) + } + } + this.moduleHero.DispenseRes(session, res, true) } - this.moduleHero.DispenseRes(session, res, true) } } - return } + +// 校验当前技能是否是满级 +func (this *ModelHero) checkHeroAllSkillMax(hero *pb.DBHero) bool { + for _, v := range hero.NormalSkill { + if this.moduleHero.configure.GetHeroSkillMaxLvConfig(uint32(v.SkillID)) > v.SkillLv { + return false + } + } + return true +} diff --git a/modules/hero/module.go b/modules/hero/module.go index 9087ac0c5..7418b86e7 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -76,11 +76,11 @@ func (this *Hero) Start() (err error) { } //创建单个叠加英雄 -func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, code pb.ErrorCode) { +func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, code pb.ErrorCode) { var ( err error ) - hero, bFirst, err = this.modelHero.createHero(session, heroCfgId, num) + hero, bFirst, atno, err = this.modelHero.createHero(session, heroCfgId, num) if err == nil && bFirst { //go func(uid string, heroCfgId string) { // 携程处理 图鉴数据 if db.IsCross() { @@ -256,7 +256,7 @@ func (this *Hero) EventUserOffline(session comm.IUserSession) { } // 批量创建多个英雄 -func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, code pb.ErrorCode) { +func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, code pb.ErrorCode) { var ( changeList []*pb.DBHero firstGet []string @@ -266,7 +266,7 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string] if num == 0 { // 数量为0 不做处理 continue } - if hero, bFirst, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success { + if hero, bFirst, atno, code = this.createRepeatHero(session, heroCfgId, num); code != pb.ErrorCode_Success { this.Errorf("create hero %s failed", heroCfgId) continue } diff --git a/modules/modulebase.go b/modules/modulebase.go index 9d0008fff..fd834facd 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -373,7 +373,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat this.Debugf("发放道具资源: %v [%v]", items, code) } if len(heros) > 0 { //卡片资源 - _, code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush) + _, _, code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush) this.Debugf("发放英雄资源: %v [%v]", heros, code) } if len(equips) > 0 { @@ -576,14 +576,9 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea } } if len(heros) > 0 { //卡片资源 - hero, code := this.ModuleHero.CreateRepeatHeros(session, heros, bPush) - this.Debugf("发放英雄资源: %v [%v]", heros, code) - atno = append(atno, &pb.UserAtno{ - A: "hero", - T: hero.HeroID, - N: int32(len(heros)), - O: hero.Id, - }) + hero, atn, code := this.ModuleHero.CreateRepeatHeros(session, heros, bPush) + this.Debugf("发放英雄资源: %v [%v]", hero, code) + atno = append(atno, atn...) } if len(equips) > 0 { change, code := this.ModuleEquipment.AddNewEquipments(session, equips, bPush) diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index 6c66806e8..9dac74d1a 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -174,6 +174,7 @@ type GameGlobalData struct { RotateAngle float32 RotateDizzyTime float32 Moonshopmoney []int32 + Generaltp string } const TypeId_GameGlobalData = 477542761 @@ -736,6 +737,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { } } + { var _ok_ bool; if _v.Generaltp, _ok_ = _buf["generaltp"].(string); !_ok_ { err = errors.New("generaltp error"); return } } return }