From d21716fa20b3c6333c181e62f966bca5a75e92ca Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 16 Mar 2023 12:36:30 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=99=BB=E8=AE=B0?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_pandamasjs.json | 6 +- bin/json/game_pandamastj.json | 24 +- bin/json/game_vikingboss.json | 867 ++++++++++++++++------------------ comm/imodule.go | 2 +- modules/hero/module.go | 80 ++-- 5 files changed, 458 insertions(+), 521 deletions(-) diff --git a/bin/json/game_pandamasjs.json b/bin/json/game_pandamasjs.json index 8786cac6b..e5be7e0c6 100644 --- a/bin/json/game_pandamasjs.json +++ b/bin/json/game_pandamasjs.json @@ -1,14 +1,14 @@ [ { "id": 1, - "unlock_condition": 20010 + "unlock_condition": 6000001 }, { "id": 2, - "unlock_condition": 20011 + "unlock_condition": 6000002 }, { "id": 3, - "unlock_condition": 20012 + "unlock_condition": 6000003 } ] \ No newline at end of file diff --git a/bin/json/game_pandamastj.json b/bin/json/game_pandamastj.json index dfefc2aa1..15d8ed7fb 100644 --- a/bin/json/game_pandamastj.json +++ b/bin/json/game_pandamastj.json @@ -104,7 +104,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_13002", "atlas_score": 105 }, { @@ -122,7 +122,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_13001", "atlas_score": 120 }, { @@ -140,7 +140,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_44002", "atlas_score": 135 }, { @@ -158,7 +158,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_24005", "atlas_score": 150 }, { @@ -176,7 +176,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_14005", "atlas_score": 165 }, { @@ -194,7 +194,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_44006", "atlas_score": 180 }, { @@ -212,7 +212,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_43001", "atlas_score": 195 }, { @@ -230,7 +230,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_35002", "atlas_score": 210 }, { @@ -248,7 +248,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_45004", "atlas_score": 225 }, { @@ -266,7 +266,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_35001", "atlas_score": 240 }, { @@ -284,7 +284,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_25001", "atlas_score": 255 }, { @@ -302,7 +302,7 @@ "key": "wuguan_2", "text": "图鉴信息描述" }, - "icon": "", + "icon": "sbkp_js_45001", "atlas_score": 270 }, { diff --git a/bin/json/game_vikingboss.json b/bin/json/game_vikingboss.json index a9baa1d98..091aa4b21 100644 --- a/bin/json/game_vikingboss.json +++ b/bin/json/game_vikingboss.json @@ -3652,237 +3652,12 @@ { "id": 30050, "copytype": 4, - "bossid": 32, + "bossid": 31, "name": { - "key": "viking_boss_1002", - "text": "冰之泰坦" + "key": "viking_boss_1001", + "text": "火焰泰坦" }, - "difficulty": 1, - "BattleReadyID": 112, - "captionrecommend": [ - 25001, - 25004, - 34006, - 35001, - 35002 - ], - "firstprize": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "dropshow": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "equi", - "t": "10110", - "n": 1 - }, - { - "a": "equi", - "t": "10111", - "n": 1 - }, - { - "a": "equi", - "t": "10112", - "n": 1 - }, - { - "a": "equi", - "t": "10113", - "n": 1 - } - ], - "drop": 1011, - "scene": "", - "bossmodel": 11009, - "boss_skill": 51004, - "boss": [ - 710001, - 710001, - 710001 - ], - "ps_consume": [ - { - "a": "item", - "t": "100100", - "n": 6 - } - ], - "ps_mg": [ - { - "a": "item", - "t": "100100", - "n": 5 - } - ] - }, - { - "id": 30060, - "copytype": 4, - "bossid": 32, - "name": { - "key": "viking_boss_1002", - "text": "冰之泰坦" - }, - "difficulty": 2, - "BattleReadyID": 112, - "captionrecommend": [ - 25001, - 25004, - 34006, - 35001, - 35002 - ], - "firstprize": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "dropshow": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "equi", - "t": "10120", - "n": 1 - }, - { - "a": "equi", - "t": "10121", - "n": 1 - }, - { - "a": "equi", - "t": "10122", - "n": 1 - }, - { - "a": "equi", - "t": "10113", - "n": 1 - } - ], - "drop": 1012, - "scene": "", - "bossmodel": 11009, - "boss_skill": 51004, - "boss": [ - 710001, - 710001, - 710001 - ], - "ps_consume": [ - { - "a": "item", - "t": "100100", - "n": 7 - } - ], - "ps_mg": [ - { - "a": "item", - "t": "100100", - "n": 6 - } - ] - }, - { - "id": 30070, - "copytype": 4, - "bossid": 32, - "name": { - "key": "viking_boss_1002", - "text": "冰之泰坦" - }, - "difficulty": 3, - "BattleReadyID": 112, - "captionrecommend": [ - 25001, - 25004, - 34006, - 35001, - 35002 - ], - "firstprize": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "dropshow": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "equi", - "t": "10120", - "n": 1 - }, - { - "a": "equi", - "t": "10121", - "n": 1 - }, - { - "a": "equi", - "t": "10122", - "n": 1 - }, - { - "a": "equi", - "t": "10123", - "n": 1 - } - ], - "drop": 1013, - "scene": "", - "bossmodel": 11009, - "boss_skill": 51004, - "boss": [ - 710001, - 710001, - 710001 - ], - "ps_consume": [ - { - "a": "item", - "t": "100100", - "n": 8 - } - ], - "ps_mg": [ - { - "a": "item", - "t": "100100", - "n": 7 - } - ] - }, - { - "id": 30080, - "copytype": 4, - "bossid": 32, - "name": { - "key": "viking_boss_1002", - "text": "冰之泰坦" - }, - "difficulty": 4, + "difficulty": 5, "BattleReadyID": 112, "captionrecommend": [ 25001, @@ -3925,7 +3700,232 @@ "n": 1 } ], - "drop": 1014, + "drop": 1004, + "scene": "", + "bossmodel": 11009, + "boss_skill": 51004, + "boss": [ + 710001, + 710001, + 710001 + ], + "ps_consume": [ + { + "a": "item", + "t": "100100", + "n": 9 + } + ], + "ps_mg": [ + { + "a": "item", + "t": "100100", + "n": 8 + } + ] + }, + { + "id": 30060, + "copytype": 4, + "bossid": 31, + "name": { + "key": "viking_boss_1001", + "text": "火焰泰坦" + }, + "difficulty": 6, + "BattleReadyID": 112, + "captionrecommend": [ + 25001, + 25004, + 34006, + 35001, + 35002 + ], + "firstprize": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + } + ], + "dropshow": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + }, + { + "a": "equi", + "t": "10130", + "n": 1 + }, + { + "a": "equi", + "t": "10131", + "n": 1 + }, + { + "a": "equi", + "t": "10132", + "n": 1 + }, + { + "a": "equi", + "t": "10123", + "n": 1 + } + ], + "drop": 1004, + "scene": "", + "bossmodel": 11009, + "boss_skill": 51004, + "boss": [ + 710001, + 710001, + 710001 + ], + "ps_consume": [ + { + "a": "item", + "t": "100100", + "n": 9 + } + ], + "ps_mg": [ + { + "a": "item", + "t": "100100", + "n": 8 + } + ] + }, + { + "id": 30070, + "copytype": 4, + "bossid": 31, + "name": { + "key": "viking_boss_1001", + "text": "火焰泰坦" + }, + "difficulty": 7, + "BattleReadyID": 112, + "captionrecommend": [ + 25001, + 25004, + 34006, + 35001, + 35002 + ], + "firstprize": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + } + ], + "dropshow": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + }, + { + "a": "equi", + "t": "10130", + "n": 1 + }, + { + "a": "equi", + "t": "10131", + "n": 1 + }, + { + "a": "equi", + "t": "10132", + "n": 1 + }, + { + "a": "equi", + "t": "10123", + "n": 1 + } + ], + "drop": 1004, + "scene": "", + "bossmodel": 11009, + "boss_skill": 51004, + "boss": [ + 710001, + 710001, + 710001 + ], + "ps_consume": [ + { + "a": "item", + "t": "100100", + "n": 9 + } + ], + "ps_mg": [ + { + "a": "item", + "t": "100100", + "n": 8 + } + ] + }, + { + "id": 30080, + "copytype": 4, + "bossid": 31, + "name": { + "key": "viking_boss_1001", + "text": "火焰泰坦" + }, + "difficulty": 8, + "BattleReadyID": 112, + "captionrecommend": [ + 25001, + 25004, + 34006, + 35001, + 35002 + ], + "firstprize": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + } + ], + "dropshow": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + }, + { + "a": "equi", + "t": "10130", + "n": 1 + }, + { + "a": "equi", + "t": "10131", + "n": 1 + }, + { + "a": "equi", + "t": "10132", + "n": 1 + }, + { + "a": "equi", + "t": "10123", + "n": 1 + } + ], + "drop": 1004, "scene": "", "bossmodel": 11009, "boss_skill": 51004, @@ -3952,237 +3952,12 @@ { "id": 30090, "copytype": 4, - "bossid": 33, + "bossid": 31, "name": { - "key": "viking_boss_1003", - "text": "森林泰坦" + "key": "viking_boss_1001", + "text": "火焰泰坦" }, - "difficulty": 1, - "BattleReadyID": 112, - "captionrecommend": [ - 25001, - 25004, - 34006, - 35001, - 35002 - ], - "firstprize": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "dropshow": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "equi", - "t": "10110", - "n": 1 - }, - { - "a": "equi", - "t": "10111", - "n": 1 - }, - { - "a": "equi", - "t": "10112", - "n": 1 - }, - { - "a": "equi", - "t": "10113", - "n": 1 - } - ], - "drop": 1021, - "scene": "", - "bossmodel": 11009, - "boss_skill": 51004, - "boss": [ - 710001, - 710001, - 710001 - ], - "ps_consume": [ - { - "a": "item", - "t": "100100", - "n": 6 - } - ], - "ps_mg": [ - { - "a": "item", - "t": "100100", - "n": 5 - } - ] - }, - { - "id": 30100, - "copytype": 4, - "bossid": 33, - "name": { - "key": "viking_boss_1003", - "text": "森林泰坦" - }, - "difficulty": 2, - "BattleReadyID": 112, - "captionrecommend": [ - 25001, - 25004, - 34006, - 35001, - 35002 - ], - "firstprize": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "dropshow": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "equi", - "t": "10120", - "n": 1 - }, - { - "a": "equi", - "t": "10121", - "n": 1 - }, - { - "a": "equi", - "t": "10122", - "n": 1 - }, - { - "a": "equi", - "t": "10113", - "n": 1 - } - ], - "drop": 1022, - "scene": "", - "bossmodel": 11009, - "boss_skill": 51004, - "boss": [ - 710001, - 710001, - 710001 - ], - "ps_consume": [ - { - "a": "item", - "t": "100100", - "n": 7 - } - ], - "ps_mg": [ - { - "a": "item", - "t": "100100", - "n": 6 - } - ] - }, - { - "id": 30110, - "copytype": 4, - "bossid": 33, - "name": { - "key": "viking_boss_1003", - "text": "森林泰坦" - }, - "difficulty": 3, - "BattleReadyID": 112, - "captionrecommend": [ - 25001, - 25004, - 34006, - 35001, - 35002 - ], - "firstprize": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - } - ], - "dropshow": [ - { - "a": "attr", - "t": "diamond", - "n": 100 - }, - { - "a": "equi", - "t": "10120", - "n": 1 - }, - { - "a": "equi", - "t": "10121", - "n": 1 - }, - { - "a": "equi", - "t": "10122", - "n": 1 - }, - { - "a": "equi", - "t": "10123", - "n": 1 - } - ], - "drop": 1023, - "scene": "", - "bossmodel": 11009, - "boss_skill": 51004, - "boss": [ - 710001, - 710001, - 710001 - ], - "ps_consume": [ - { - "a": "item", - "t": "100100", - "n": 8 - } - ], - "ps_mg": [ - { - "a": "item", - "t": "100100", - "n": 7 - } - ] - }, - { - "id": 30120, - "copytype": 4, - "bossid": 33, - "name": { - "key": "viking_boss_1003", - "text": "森林泰坦" - }, - "difficulty": 4, + "difficulty": 9, "BattleReadyID": 112, "captionrecommend": [ 25001, @@ -4225,7 +4000,7 @@ "n": 1 } ], - "drop": 1024, + "drop": 1004, "scene": "", "bossmodel": 11009, "boss_skill": 51004, @@ -4250,14 +4025,14 @@ ] }, { - "id": 30130, + "id": 30100, "copytype": 4, - "bossid": 34, + "bossid": 31, "name": { "key": "viking_boss_1001", - "text": "武器BOSS" + "text": "火焰泰坦" }, - "difficulty": 1, + "difficulty": 10, "BattleReadyID": 112, "captionrecommend": [ 25001, @@ -4281,26 +4056,26 @@ }, { "a": "equi", - "t": "20010", + "t": "10130", "n": 1 }, { "a": "equi", - "t": "20011", + "t": "10131", "n": 1 }, { "a": "equi", - "t": "20012", + "t": "10132", "n": 1 }, { "a": "equi", - "t": "20013", + "t": "10123", "n": 1 } ], - "drop": 1001, + "drop": 1004, "scene": "", "bossmodel": 11009, "boss_skill": 51004, @@ -4313,14 +4088,164 @@ { "a": "item", "t": "100100", - "n": 6 + "n": 9 } ], "ps_mg": [ { "a": "item", "t": "100100", - "n": 5 + "n": 8 + } + ] + }, + { + "id": 30110, + "copytype": 4, + "bossid": 31, + "name": { + "key": "viking_boss_1001", + "text": "火焰泰坦" + }, + "difficulty": 11, + "BattleReadyID": 112, + "captionrecommend": [ + 25001, + 25004, + 34006, + 35001, + 35002 + ], + "firstprize": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + } + ], + "dropshow": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + }, + { + "a": "equi", + "t": "10130", + "n": 1 + }, + { + "a": "equi", + "t": "10131", + "n": 1 + }, + { + "a": "equi", + "t": "10132", + "n": 1 + }, + { + "a": "equi", + "t": "10123", + "n": 1 + } + ], + "drop": 1004, + "scene": "", + "bossmodel": 11009, + "boss_skill": 51004, + "boss": [ + 710001, + 710001, + 710001 + ], + "ps_consume": [ + { + "a": "item", + "t": "100100", + "n": 9 + } + ], + "ps_mg": [ + { + "a": "item", + "t": "100100", + "n": 8 + } + ] + }, + { + "id": 30120, + "copytype": 4, + "bossid": 31, + "name": { + "key": "viking_boss_1001", + "text": "火焰泰坦" + }, + "difficulty": 12, + "BattleReadyID": 112, + "captionrecommend": [ + 25001, + 25004, + 34006, + 35001, + 35002 + ], + "firstprize": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + } + ], + "dropshow": [ + { + "a": "attr", + "t": "diamond", + "n": 100 + }, + { + "a": "equi", + "t": "10130", + "n": 1 + }, + { + "a": "equi", + "t": "10131", + "n": 1 + }, + { + "a": "equi", + "t": "10132", + "n": 1 + }, + { + "a": "equi", + "t": "10123", + "n": 1 + } + ], + "drop": 1004, + "scene": "", + "bossmodel": 11009, + "boss_skill": 51004, + "boss": [ + 710001, + 710001, + 710001 + ], + "ps_consume": [ + { + "a": "item", + "t": "100100", + "n": 9 + } + ], + "ps_mg": [ + { + "a": "item", + "t": "100100", + "n": 8 } ] } diff --git a/comm/imodule.go b/comm/imodule.go index f5f151a28..b265b84cf 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -99,7 +99,7 @@ type ( GetAllMaxHero(session IUserSession) (code pb.ErrorCode) // 教习登记 - RegisterInstructor(session IUserSession, heroOid string, registerId int32) (code pb.ErrorCode) + RegisterInstructor(session IUserSession, heroOid []string, registerId int32) (code pb.ErrorCode) } //玩家 diff --git a/modules/hero/module.go b/modules/hero/module.go index 918d90cc0..282920607 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -841,60 +841,72 @@ func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update return } -func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, fulllvenr int32) (code pb.ErrorCode) { +func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string, fulllvenr int32) (code pb.ErrorCode) { var ( - _hero *pb.DBHero + _szHero []*pb.DBHero model *db.DBModel err error _heroMap map[string]interface{} _changeHero []*pb.DBHero // 变化的英雄 ) + if this.IsCross() { - _hero = &pb.DBHero{} + _hero := &pb.DBHero{} if model, err = this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { - if err := model.GetListObj(session.GetUserId(), heroOid, _hero); err != nil { - this.Errorf("err:%v", err) - return + for _, v := range heroOid { + if err := model.GetListObj(session.GetUserId(), v, _hero); err != nil { + this.Errorf("err:%v", err) + return + } } } + _szHero = append(_szHero, _hero) } else { - _hero, code = this.GetHeroByObjID(session.GetUserId(), heroOid) - if code != pb.ErrorCode_Success { - return + for _, v := range heroOid { + _hero, c := this.GetHeroByObjID(session.GetUserId(), v) + if c != pb.ErrorCode_Success { + code = c + return + } + _szHero = append(_szHero, _hero) } } - _heroMap = make(map[string]interface{}) - if fulllvenr == 0 && _hero.Fulllvenr != 0 { - _heroMap["fulllvenr"] = 0 - } else if _hero.Fulllvenr == 0 && fulllvenr != 0 { - // 校验有没有满级 - if _hero.Lv < this.configure.GetHeroMaxLv(_hero.Star) { - code = pb.ErrorCode_HeroLvNoEnough // 必须满级 - return - } - _hero.Fulllvenr = fulllvenr - _heroMap["fulllvenr"] = _hero.Fulllvenr + for _, v := range _szHero { + _heroMap = make(map[string]interface{}) + if fulllvenr == 0 && v.Fulllvenr != 0 { + v.Fulllvenr = 0 + _heroMap["fulllvenr"] = 0 + } else if v.Fulllvenr == 0 && fulllvenr != 0 { + // 校验有没有满级 + if v.Lv < this.configure.GetHeroMaxLv(v.Star) { + code = pb.ErrorCode_HeroLvNoEnough // 必须满级 + return + } + v.Fulllvenr = fulllvenr + _heroMap["fulllvenr"] = v.Fulllvenr - } else { - code = pb.ErrorCode_HeroIsRegister - return - } - if this.IsCross() { - if model != nil { - if err := model.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { + } else { + code = pb.ErrorCode_HeroIsRegister + return + } + if this.IsCross() { + if model != nil { + if err := model.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { + this.Errorf("err:%v", err) + code = pb.ErrorCode_DBError + return + } + } + } else { + if err := this.modelHero.ChangeList(session.GetUserId(), v.Id, _heroMap); err != nil { // 修改英雄信息 this.Errorf("err:%v", err) code = pb.ErrorCode_DBError return } } - } else { - if err := this.modelHero.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { // 修改英雄信息 - this.Errorf("err:%v", err) - code = pb.ErrorCode_DBError - return - } + _changeHero = append(_changeHero, v) } - _changeHero = append(_changeHero, _hero) + session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) return } From 5a369950606b00e6ec9411fdcb773dd225c6fcad Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 16 Mar 2023 13:37:35 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 3 + modules/arena/modelarena.go | 2 +- modules/battle/module.go | 4 +- modules/equipment/modelEquipment.go | 10 +-- modules/hero/model_hero.go | 4 +- modules/hero/module.go | 6 +- modules/horoscope/modelhoroscope.go | 2 +- modules/items/modelitems.go | 12 +-- modules/modulebase.go | 20 ++++- modules/practice/api_unLock.go | 2 +- modules/practice/modelPandata.go | 6 +- modules/practice/module.go | 118 ++++++++++++++++++---------- modules/privilege/module.go | 2 +- modules/user/model_expand.go | 4 +- modules/user/model_user.go | 4 +- pb/practice_msg.pb.go | 20 ++--- 16 files changed, 137 insertions(+), 82 deletions(-) diff --git a/comm/const.go b/comm/const.go index f84bc12e1..99a58bf8e 100644 --- a/comm/const.go +++ b/comm/const.go @@ -290,6 +290,9 @@ const ( //Rpc Rpc_ModuleSociatyTask core.Rpc_Key = "Rpc_ModuleSociatyTask" Rpc_ModuleSociatyGetTask core.Rpc_Key = "Rpc_ModuleSociatyGetTask" + //武馆解锁柱子 + RPC_ModulePracticeUnLockPillar core.Rpc_Key = "RPC_ModulePracticeUnLockPillar" + // RPC 通知来了邮件 Rpc_Mail core.Rpc_Key = "Rpc_Mail" ) diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index dae0b8847..6a0327c0f 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -92,7 +92,7 @@ func (this *modelArena) queryUserHeros(uid string, heroids []string) (results [] var ( model *db.DBModel ) - if model, err = this.module.GetDBModuleByUid(uid, comm.TableHero, time.Hour); err != nil { + if model, err = this.module.GetDBModelByUid(uid, comm.TableHero, time.Hour); err != nil { this.module.Errorln(err) return } diff --git a/modules/battle/module.go b/modules/battle/module.go index 4f8936a3e..1db6464ec 100644 --- a/modules/battle/module.go +++ b/modules/battle/module.go @@ -208,11 +208,11 @@ func (this *Battle) CreateRtPvpBattle(req *pb.BattleRTPVPReq) (code pb.ErrorCode code = pb.ErrorCode_Exception return } - if redmodel, err = this.GetDBModuleByUid(req.RedCompId, comm.TableHero, time.Hour); err != nil { + if redmodel, err = this.GetDBModelByUid(req.RedCompId, comm.TableHero, time.Hour); err != nil { code = pb.ErrorCode_DBError return } - if bluemodel, err = this.GetDBModuleByUid(req.BlueCompId, comm.TableHero, time.Hour); err != nil { + if bluemodel, err = this.GetDBModelByUid(req.BlueCompId, comm.TableHero, time.Hour); err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/equipment/modelEquipment.go b/modules/equipment/modelEquipment.go index c70dcf7b9..c2405e391 100644 --- a/modules/equipment/modelEquipment.go +++ b/modules/equipment/modelEquipment.go @@ -57,7 +57,7 @@ func (this *modelEquipmentComp) QueryUserEquipments(uId string) (equipments []*p ) equipments = make([]*pb.DB_Equipment, 0) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetList(uId, &equipments); err != nil { @@ -143,7 +143,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.AddLists(uId, add); err != nil { @@ -166,7 +166,7 @@ func (this *modelEquipmentComp) addEquipment(equip *pb.DB_Equipment) (err error) model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(equip.UId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(equip.UId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.AddList(equip.UId, equip.Id, equip); err != nil { @@ -190,7 +190,7 @@ func (this *modelEquipmentComp) DelEquipments(uId string, eIds []string) (change ) change = make([]*pb.DB_Equipment, 0) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.DelListlds(uId, eIds); err != nil { @@ -220,7 +220,7 @@ func (this *modelEquipmentComp) UpdateByHeroId(uid string, equipments ...*pb.DB_ model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { for _, v := range equipments { diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 900075ed8..ded2e0639 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -139,7 +139,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int if hero != nil { hero.SameCount = 1 // 新需求 不需要判断叠加 if this.moduleHero.IsCross() { - if model, err = this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.moduleHero.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.moduleHero.Errorln(err) } else { if err = model.AddList(uid, hero.Id, hero); err != nil { @@ -831,7 +831,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c return } if this.moduleHero.IsCross() { - if dbModel, err1 := this.moduleHero.GetDBModuleByUid(uid, this.TableName, this.Expired); err1 == nil { + if dbModel, err1 := this.moduleHero.GetDBModelByUid(uid, this.TableName, this.Expired); err1 == nil { if err = dbModel.GetList(uid, &heros); err != nil { this.moduleHero.Errorf("err:%v", err) return diff --git a/modules/hero/module.go b/modules/hero/module.go index 918d90cc0..b0c0a28fe 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -310,7 +310,7 @@ func (this *Hero) AddHeroExp(session comm.IUserSession, heroObjID string, exp in } if this.IsCross() { _hero = &pb.DBHero{} - if model, err := this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { + if model, err := this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { if err := model.GetListObj(session.GetUserId(), heroObjID, _hero); err != nil { this.Errorf("err:%v", err) return @@ -348,7 +348,7 @@ func (this *Hero) KungFuHero(session comm.IUserSession, heroObjID string, bKongf if this.IsCross() { _hero = &pb.DBHero{} - if model, err = this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { + if model, err = this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { if err := model.GetListObj(session.GetUserId(), heroObjID, _hero); err != nil { this.Errorf("err:%v", err) return @@ -851,7 +851,7 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, ) if this.IsCross() { _hero = &pb.DBHero{} - if model, err = this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { + if model, err = this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { if err := model.GetListObj(session.GetUserId(), heroOid, _hero); err != nil { this.Errorf("err:%v", err) return diff --git a/modules/horoscope/modelhoroscope.go b/modules/horoscope/modelhoroscope.go index f6d8a15dd..c2044d095 100644 --- a/modules/horoscope/modelhoroscope.go +++ b/modules/horoscope/modelhoroscope.go @@ -51,7 +51,7 @@ func (this *modelHoroscope) updateInfo(session comm.IUserSession, info *pb.DBHor "nodes": info.Nodes, "lastrest": info.Lastrest, }) - if model, err = this.module.GetDBModuleByUid(info.Uid, this.TableName, time.Hour); err != nil { + if model, err = this.module.GetDBModelByUid(info.Uid, this.TableName, time.Hour); err != nil { this.module.Errorln(err) return } diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index b63b62892..d7ae75bcc 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -42,7 +42,7 @@ func (this *ModelItemsComp) QueryUserPack(uId string) (itmes []*pb.DB_UserItemDa ) itmes = make([]*pb.DB_UserItemData, 0) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetList(uId, &itmes); err != nil { @@ -66,7 +66,7 @@ func (this *ModelItemsComp) QueryUserPackByGridId(uId string, grid string) (itme itme = &pb.DB_UserItemData{} if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetListObj(uId, grid, itme); err != nil { @@ -90,7 +90,7 @@ func (this *ModelItemsComp) QueryUserPackByGridIds(uId string, grids []string) ( itme = make([]*pb.DB_UserItemData, len(grids)) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.GetListObjs(uId, grids, &itme); err != nil { @@ -116,7 +116,7 @@ func (this *ModelItemsComp) AddUserPack(uId string, itmes ...*pb.DB_UserItemData model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uId, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uId, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.AddLists(uId, data); err != nil { @@ -138,7 +138,7 @@ func (this *ModelItemsComp) UpdateUserPack(uid string, itmes ...*pb.DB_UserItemD model *db.DBModel ) if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { for _, v := range itmes { @@ -172,7 +172,7 @@ func (this *ModelItemsComp) DeleteUserPack(uid string, itmes ...*pb.DB_UserItemD gridIds[i] = v.GridId } if this.module.IsCross() { - if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err = this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.DelListlds(uid, gridIds); err != nil { diff --git a/modules/modulebase.go b/modules/modulebase.go index 97e6bca57..5e5293239 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -477,7 +477,25 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string, } //跨服对象获取数据操作对象 -func (this *ModuleBase) GetDBModuleByUid(uid, tableName string, expired time.Duration) (model *db.DBModel, err error) { +func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration) (model *db.DBModel, err error) { + var ( + conn *db.DBConn + ) + if this.IsCross() { + if conn, err = db.Local(); err != nil { + return + } + } else { + if conn, err = db.Cross(); err != nil { + return + } + } + model = db.NewDBModel(tableName, expired, conn) + return +} + +//跨服对象获取数据操作对象 +func (this *ModuleBase) GetDBModelByUid(uid, tableName string, expired time.Duration) (model *db.DBModel, err error) { var ( stag string conn *db.DBConn diff --git a/modules/practice/api_unLock.go b/modules/practice/api_unLock.go index a8385ddb5..f98f49fa7 100644 --- a/modules/practice/api_unLock.go +++ b/modules/practice/api_unLock.go @@ -56,6 +56,6 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq filed: pillar, "pillarf": room.Pillarf, }) - session.SendMsg(string(this.module.GetType()), "unLock", &pb.PracticeUnLockResp{Info: room}) + session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room}) return } diff --git a/modules/practice/modelPandata.go b/modules/practice/modelPandata.go index 985144a95..0f36e49ac 100644 --- a/modules/practice/modelPandata.go +++ b/modules/practice/modelPandata.go @@ -45,10 +45,10 @@ func (this *modelPandata) queryUserMartialhall(uid string) (result *pb.DBPractic Knapsack: make(map[string]int32), Gymaction: 0, Gymrefresh: 0, - Pillar1: &pb.DBPracticePillar{Index: 1, Isunlock: 2, Lv: 1}, + Pillar1: &pb.DBPracticePillar{Index: 1, Lv: 1}, Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1}, Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1}, - Pillarf: &pb.DBPracticePillar{Index: 4, Isunlock: 2, Lv: 1}, + Pillarf: &pb.DBPracticePillar{Index: 4, Lv: 1}, Statuers: make([]*pb.DBPracticeStatuer, 0), } if err = this.refreshnpc(result); err != nil { @@ -64,6 +64,8 @@ func (this *modelPandata) queryUserMartialhall(uid string) (result *pb.DBPractic return } + + //刷新npc func (this *modelPandata) refreshnpc(room *pb.DBPracticeRoom) (err error) { var ( diff --git a/modules/practice/module.go b/modules/practice/module.go index 1c8bcbf0c..8e19e95a9 100644 --- a/modules/practice/module.go +++ b/modules/practice/module.go @@ -1,6 +1,8 @@ package practice import ( + "context" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" @@ -11,6 +13,7 @@ import ( "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/sys/db" + "strconv" "time" "go.mongodb.org/mongo-driver/bson/primitive" @@ -74,6 +77,7 @@ func (this *Practice) Start() (err error) { return } this.battle = module.(comm.IBattle) + this.service.RegisterFunctionName(string(comm.RPC_ModulePracticeUnLockPillar), this.RPC_ModulePracticeUnLockPillar) return } @@ -156,51 +160,20 @@ func (this *Practice) AddItems(session comm.IUserSession, items map[string]int32 //完成世界任务 func (this *Practice) TaskComplete(session comm.IUserSession, taskid int32) { - var ( - configure []*cfg.GamePandamasJsData - room *pb.DBPracticeRoom - err error + this.Debug("TaskComplete", + log.Field{Key: "session", Value: session.GetUserId()}, + log.Field{Key: "taskid", Value: taskid}, ) - if configure, err = this.configure.getGamePandamasJs(); err != nil { - this.Errorln(err) - return - } - if room, err = this.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { - this.Errorln(err) - return - } - for _, v := range configure { - if v.UnlockCondition == taskid { - switch v.Id { - case 1: - if room.Pillar1.Isunlock == 0 { - room.Pillar1.Isunlock = 1 - } - this.modelPandata.Change(session.GetUserId(), map[string]interface{}{ - "pillar1": room.Pillar1, - }) - this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001") - break - case 2: - if room.Pillar2.Isunlock == 0 { - room.Pillar2.Isunlock = 1 - } - this.modelPandata.Change(session.GetUserId(), map[string]interface{}{ - "pillar2": room.Pillar2, - }) - this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001") - break - case 3: - if room.Pillar3.Isunlock == 0 { - room.Pillar3.Isunlock = 1 - } - this.modelPandata.Change(session.GetUserId(), map[string]interface{}{ - "pillar3": room.Pillar3, - }) - this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), "1001") - break - } + if !this.IsCross() { + err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(), + comm.Service_Worker, string(comm.RPC_ModulePracticeUnLockPillar), + &pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: fmt.Sprintf("%d", taskid)}, &pb.EmptyResp{}) + if err != nil { + this.Errorln(err) + return } + } else { + this.RPC_ModulePracticeUnLockPillar(context.Background(), &pb.RPCGeneralReqA2{Param1: session.GetUserId(), Param2: fmt.Sprintf("%d", taskid)}, &pb.EmptyResp{}) } } @@ -291,3 +264,62 @@ func (this *Practice) ChallengeResults(bid, red, bule string, winSide int32) { "statuers": buleroom.Statuers, }) } + +//解锁武馆柱子 +func (this *Practice) RPC_ModulePracticeUnLockPillar(ctx context.Context, args *pb.RPCGeneralReqA2, reply *pb.EmptyResp) (err error) { + this.Debug("RPC_ModulePracticeUnLockPillar", + log.Field{Key: "uid", Value: args.Param1}, + log.Field{Key: "taskid", Value: args.Param2}, + ) + var ( + configure []*cfg.GamePandamasJsData + room *pb.DBPracticeRoom + taskid int64 + ) + if taskid, err = strconv.ParseInt(args.Param2, 10, 64); err != nil { + this.Errorln(err) + return + } + if configure, err = this.configure.getGamePandamasJs(); err != nil { + this.Errorln(err) + return + } + if room, err = this.modelPandata.queryUserMartialhall(args.Param1); err != nil { + this.Errorln(err) + return + } + for _, v := range configure { + if v.UnlockCondition == int32(taskid) { + switch v.Id { + case 1: + if room.Pillar1.Isunlock == 0 { + room.Pillar1.Isunlock = 1 + } + this.modelPandata.Change(args.Param1, map[string]interface{}{ + "pillar1": room.Pillar1, + }) + this.atlas.CheckActivatePandaAtlasCollect(args.Param1, "1001") + break + case 2: + if room.Pillar2.Isunlock == 0 { + room.Pillar2.Isunlock = 1 + } + this.modelPandata.Change(args.Param1, map[string]interface{}{ + "pillar2": room.Pillar2, + }) + this.atlas.CheckActivatePandaAtlasCollect(args.Param1, "1001") + break + case 3: + if room.Pillar3.Isunlock == 0 { + room.Pillar3.Isunlock = 1 + } + this.modelPandata.Change(args.Param1, map[string]interface{}{ + "pillar3": room.Pillar3, + }) + this.atlas.CheckActivatePandaAtlasCollect(args.Param1, "1001") + break + } + } + } + return +} diff --git a/modules/privilege/module.go b/modules/privilege/module.go index d1332ea84..c6e2a5225 100644 --- a/modules/privilege/module.go +++ b/modules/privilege/module.go @@ -413,7 +413,7 @@ func (this *Privilege) SendDailyPrivilegeMail(session comm.IUserSession, cId []i } func (this *Privilege) GetCountByPrivilegeId(uid string, pType int32) (count int32) { if this.IsCross() { // 跨服情况 - if model, err := this.GetDBModuleByUid(uid, comm.TableVip, time.Hour); err == nil { + if model, err := this.GetDBModelByUid(uid, comm.TableVip, time.Hour); err == nil { vip := &pb.DBVip{} if err = model.Get(uid, vip); err == nil { if v, ok := vip.Privilege[pType]; ok { diff --git a/modules/user/model_expand.go b/modules/user/model_expand.go index edcdcafac..4e156e495 100644 --- a/modules/user/model_expand.go +++ b/modules/user/model_expand.go @@ -33,7 +33,7 @@ func (this *ModelExpand) Init(service core.IService, module core.IModule, comp c func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err error) { result = &pb.DBUserExpand{} if db.IsCross() { - if model, err := this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err := this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.module.Error("Cross GetDBModuleByUid", log.Field{Key: "uid", Value: uid}) return result, err } else { @@ -78,7 +78,7 @@ func (this *ModelExpand) ChangeUserExpand(uid string, value map[string]interface model *db.DBModel ) if db.IsCross() { - if model, err = this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err == nil { + if model, err = this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err == nil { return model.Change(uid, value) } else { this.module.Errorln(err) diff --git a/modules/user/model_user.go b/modules/user/model_user.go index b52d56b5d..d81f9a46f 100644 --- a/modules/user/model_user.go +++ b/modules/user/model_user.go @@ -93,7 +93,7 @@ func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) { // return // } if this.module.IsCross() { - if model, err := this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err := this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.Get(uid, user); err != nil { @@ -111,7 +111,7 @@ func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) { //设置属性 func (this *ModelUser) updateUserAttr(uid string, data map[string]interface{}) error { if this.module.IsCross() { - if model, err := this.module.GetDBModuleByUid(uid, this.TableName, this.Expired); err != nil { + if model, err := this.module.GetDBModelByUid(uid, this.TableName, this.Expired); err != nil { this.module.Errorln(err) } else { if err = model.Change(uid, data); err != nil { diff --git a/pb/practice_msg.pb.go b/pb/practice_msg.pb.go index ca97017a7..67668de4e 100644 --- a/pb/practice_msg.pb.go +++ b/pb/practice_msg.pb.go @@ -858,8 +858,8 @@ type PracticeEnrolledReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group int32 `protobuf:"varint,1,opt,name=group,proto3" json:"group"` - Hero string `protobuf:"bytes,2,opt,name=hero,proto3" json:"hero"` + Group int32 `protobuf:"varint,1,opt,name=group,proto3" json:"group"` + Hero []string `protobuf:"bytes,2,rep,name=hero,proto3" json:"hero"` } func (x *PracticeEnrolledReq) Reset() { @@ -901,11 +901,11 @@ func (x *PracticeEnrolledReq) GetGroup() int32 { return 0 } -func (x *PracticeEnrolledReq) GetHero() string { +func (x *PracticeEnrolledReq) GetHero() []string { if x != nil { return x.Hero } - return "" + return nil } ///登记满级英雄 回应 @@ -914,8 +914,8 @@ type PracticeEnrolledResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Group int32 `protobuf:"varint,1,opt,name=group,proto3" json:"group"` - Hero string `protobuf:"bytes,2,opt,name=hero,proto3" json:"hero"` + Group int32 `protobuf:"varint,1,opt,name=group,proto3" json:"group"` + Hero []string `protobuf:"bytes,2,rep,name=hero,proto3" json:"hero"` } func (x *PracticeEnrolledResp) Reset() { @@ -957,11 +957,11 @@ func (x *PracticeEnrolledResp) GetGroup() int32 { return 0 } -func (x *PracticeEnrolledResp) GetHero() string { +func (x *PracticeEnrolledResp) GetHero() []string { if x != nil { return x.Hero } - return "" + return nil } ///练功道具和教习推送 @@ -2110,11 +2110,11 @@ var file_practice_practice_msg_proto_rawDesc = []byte{ 0x22, 0x3f, 0x0a, 0x13, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, - 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, + 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x40, 0x0a, 0x14, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, - 0x12, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, + 0x12, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x24, 0x0a, 0x12, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x4a, 0x58, 0x49, 0x74, 0x65, 0x6d, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x50, 0x72, 0x61, From 68fc794ee8b01aa9548e305ff92cba7a8e2dc08c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 16 Mar 2023 13:42:12 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 282920607..f02e4de43 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -851,16 +851,17 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string ) if this.IsCross() { - _hero := &pb.DBHero{} + if model, err = this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { for _, v := range heroOid { + _hero := &pb.DBHero{} if err := model.GetListObj(session.GetUserId(), v, _hero); err != nil { this.Errorf("err:%v", err) return } + _szHero = append(_szHero, _hero) } } - _szHero = append(_szHero, _hero) } else { for _, v := range heroOid { _hero, c := this.GetHeroByObjID(session.GetUserId(), v) From 79fb4b27ebbd883f509d3117ccf580562ccb17c1 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 16 Mar 2023 13:52:50 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=8B=B1=E9=9B=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 3 +++ modules/hero/module.go | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/comm/imodule.go b/comm/imodule.go index b265b84cf..7690aeb58 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -100,6 +100,9 @@ type ( // 教习登记 RegisterInstructor(session IUserSession, heroOid []string, registerId int32) (code pb.ErrorCode) + + // 跨服查询英雄详细信息 + QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, err error) } //玩家 diff --git a/modules/hero/module.go b/modules/hero/module.go index cc8970b54..a0ccb82ca 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -935,3 +935,42 @@ func (this *Hero) DrawCardContinuousRestrictionCamp(cardId string, race map[int3 } return card } + +// 只通过唯一id 查询英雄信息 +func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, err error) { + if this.IsCross() { + for _, tag := range db.GetServerTags() { + conn, err1 := db.ServerDBConn(tag) // 遍历连接对象 + if err1 != nil { + continue + } + for _, v := range oid { + sr := conn.Mgo.FindOne(comm.TableHero, bson.M{ + "_id": v, + }) + _hero := &pb.DBHero{} + if err = sr.Decode(hero); err != nil { + this.modelHero.moduleHero.Errorf("find hero error: %v", err) + } + hero = append(hero, _hero) + } + + return + } + } else { // 不是跨服就查本服 注意 这个接口是给跨服玩法调用 理论上这个分支是不会执行的 + for _, v := range oid { + if res := this.modelHero.DB.FindOne(comm.TableHero, bson.M{ + "_id": v, + }); res == nil { + _hero := &pb.DBHero{} + if err = res.Decode(hero); err != nil { + this.modelHero.moduleHero.Errorf("find hero error: %v", err) + return + } + hero = append(hero, _hero) + } + } + } + + return +} From eda81986af40f705e2b7b998dd81ace1e0417641 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 16 Mar 2023 13:55:19 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/practice/api_enrolled.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/practice/api_enrolled.go b/modules/practice/api_enrolled.go index 5e4a96572..380fd247f 100644 --- a/modules/practice/api_enrolled.go +++ b/modules/practice/api_enrolled.go @@ -18,7 +18,7 @@ func (this *apiComp) Enrolled(session comm.IUserSession, req *pb.PracticeEnrolle var ( err error - hero *pb.DBHero + hero []*pb.DBHero room *pb.DBPracticeRoom ) @@ -32,7 +32,7 @@ func (this *apiComp) Enrolled(session comm.IUserSession, req *pb.PracticeEnrolle } room.Full[req.Group]++ } else { - if hero, err = this.module.ModuleHero.QueryCrossHeroinfo(req.Hero); err != nil { + if hero, err = this.module.ModuleHero.QueryCrossMultipleHeroinfo(req.Hero); err != nil { code = pb.ErrorCode_ReqParameterError return } @@ -40,7 +40,10 @@ func (this *apiComp) Enrolled(session comm.IUserSession, req *pb.PracticeEnrolle if code = this.module.ModuleHero.RegisterInstructor(session, req.Hero, req.Group); code != pb.ErrorCode_Success { return } - room.Full[hero.Fulllvenr]-- + for _, v := range hero { + room.Full[v.Fulllvenr]-- + } + } this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{ From d3dbc468af9f1701308108750bfc3b3528bddd2e Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 16 Mar 2023 14:14:57 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index a0ccb82ca..2cb36ce8d 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -949,7 +949,7 @@ func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, e "_id": v, }) _hero := &pb.DBHero{} - if err = sr.Decode(hero); err != nil { + if err = sr.Decode(_hero); err != nil { this.modelHero.moduleHero.Errorf("find hero error: %v", err) } hero = append(hero, _hero) From fd1e70601495debac3d3ccc9e86004529f6005f5 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 16 Mar 2023 14:15:27 +0800 Subject: [PATCH 7/9] update --- modules/hero/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 2cb36ce8d..89a1647eb 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -963,7 +963,7 @@ func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, e "_id": v, }); res == nil { _hero := &pb.DBHero{} - if err = res.Decode(hero); err != nil { + if err = res.Decode(_hero); err != nil { this.modelHero.moduleHero.Errorf("find hero error: %v", err) return } From 260ff1c1777af6b4e8f68ac19c0facfbfe39523b Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 16 Mar 2023 14:44:36 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 2 +- modules/practice/api_enrolled.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index a0ccb82ca..2cb36ce8d 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -949,7 +949,7 @@ func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, e "_id": v, }) _hero := &pb.DBHero{} - if err = sr.Decode(hero); err != nil { + if err = sr.Decode(_hero); err != nil { this.modelHero.moduleHero.Errorf("find hero error: %v", err) } hero = append(hero, _hero) diff --git a/modules/practice/api_enrolled.go b/modules/practice/api_enrolled.go index 380fd247f..90deb4906 100644 --- a/modules/practice/api_enrolled.go +++ b/modules/practice/api_enrolled.go @@ -30,7 +30,10 @@ func (this *apiComp) Enrolled(session comm.IUserSession, req *pb.PracticeEnrolle if code = this.module.ModuleHero.RegisterInstructor(session, req.Hero, req.Group); code != pb.ErrorCode_Success { return } - room.Full[req.Group]++ + for i := 0; i < len(req.Hero); i++ { + room.Full[req.Group]++ + } + } else { if hero, err = this.module.ModuleHero.QueryCrossMultipleHeroinfo(req.Hero); err != nil { code = pb.ErrorCode_ReqParameterError From b1eb026dab7fb63ae1c9fee2154244d9fd5de67a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 16 Mar 2023 15:05:02 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_pandamasjs.json | 6 ++--- bin/json/game_pandamasmryl.json | 48 ++++++++++++++++----------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bin/json/game_pandamasjs.json b/bin/json/game_pandamasjs.json index e5be7e0c6..8786cac6b 100644 --- a/bin/json/game_pandamasjs.json +++ b/bin/json/game_pandamasjs.json @@ -1,14 +1,14 @@ [ { "id": 1, - "unlock_condition": 6000001 + "unlock_condition": 20010 }, { "id": 2, - "unlock_condition": 6000002 + "unlock_condition": 20011 }, { "id": 3, - "unlock_condition": 6000003 + "unlock_condition": 20012 } ] \ No newline at end of file diff --git a/bin/json/game_pandamasmryl.json b/bin/json/game_pandamasmryl.json index 5a4bdb927..1d0ca7eea 100644 --- a/bin/json/game_pandamasmryl.json +++ b/bin/json/game_pandamasmryl.json @@ -5,9 +5,9 @@ "key": "wuguandongzuo_101", "text": "开合跳" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "开合跳" }, "ticks": 3, @@ -20,9 +20,9 @@ "key": "wuguandongzuo_102", "text": "手臂环绕" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "手臂环绕" }, "ticks": 3, @@ -35,9 +35,9 @@ "key": "wuguandongzuo_103", "text": "肩部拉伸" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "肩部拉伸" }, "ticks": 3, @@ -50,9 +50,9 @@ "key": "wuguandongzuo_104", "text": "波比" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "波比" }, "ticks": 3, @@ -65,9 +65,9 @@ "key": "wuguandongzuo_105", "text": "交错俯卧撑" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "交错俯卧撑" }, "ticks": 3, @@ -80,9 +80,9 @@ "key": "wuguandongzuo_106", "text": "钻石俯卧撑" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "钻石俯卧撑" }, "ticks": 3, @@ -95,9 +95,9 @@ "key": "wuguandongzuo_107", "text": "掌上压后转身" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "掌上压后转身" }, "ticks": 3, @@ -110,9 +110,9 @@ "key": "wuguandongzuo_108", "text": "眼镜蛇式拉伸" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "眼镜蛇式拉伸" }, "ticks": 3, @@ -125,9 +125,9 @@ "key": "wuguandongzuo_109", "text": "胸部拉伸" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "胸部拉伸" }, "ticks": 3, @@ -140,9 +140,9 @@ "key": "wuguandongzuo_110", "text": "原地跑" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "原地跑" }, "ticks": 3, @@ -155,9 +155,9 @@ "key": "wuguandongzuo_111", "text": "深蹲" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "深蹲" }, "ticks": 3, @@ -170,9 +170,9 @@ "key": "wuguandongzuo_112", "text": "仰卧起坐" }, - "icon": "", + "icon": "wg_js_dz001", "des": { - "key": "wuguandongzuo_", + "key": "wuguandongzuo_wg_js_dz001", "text": "仰卧起坐" }, "ticks": 3,