From d07b80f454d4cfe8b504e3c7629e3451d37ea4c7 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 25 Oct 2022 19:27:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E8=B5=8B=E5=B1=9E=E6=80=A7=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=20=E9=85=8D=E7=BD=AE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_comatn.json | 10 + bin/json/game_herotalent.json | 175 ++++++++---------- bin/json/game_item.json | 129 +++++++++++++ bin/json/game_itembox.json | 14 ++ bin/json/game_talentskill.json | 96 +++++----- modules/hero/api_talentlearn.go | 18 +- modules/hero/configure_comp.go | 1 + modules/hero/model_hero.go | 37 +++- modules/hero/model_talent.go | 8 +- sys/configure/structs/Game.HeroTalentData.go | 19 +- sys/configure/structs/Game.ItemBox.go | 42 +++++ sys/configure/structs/Game.ItemBoxData.go | 37 ++++ sys/configure/structs/Game.TalentSkillData.go | 4 +- sys/configure/structs/Tables.go | 8 + 14 files changed, 415 insertions(+), 183 deletions(-) create mode 100644 bin/json/game_itembox.json create mode 100644 sys/configure/structs/Game.ItemBox.go create mode 100644 sys/configure/structs/Game.ItemBoxData.go diff --git a/bin/json/game_comatn.json b/bin/json/game_comatn.json index 2a2633bda..74ddb5d36 100644 --- a/bin/json/game_comatn.json +++ b/bin/json/game_comatn.json @@ -38,5 +38,15 @@ "n": 20000 } ] + }, + { + "index": "talent_reset", + "var": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ] } ] \ No newline at end of file diff --git a/bin/json/game_herotalent.json b/bin/json/game_herotalent.json index b790e0dca..2ff759bc2 100644 --- a/bin/json/game_herotalent.json +++ b/bin/json/game_herotalent.json @@ -1,9 +1,7 @@ [ { "id": 1, - "type": [ - 0 - ], + "type": 0, "talentid": 40101, "before": [ 0 @@ -11,7 +9,7 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 20000 }, { @@ -20,6 +18,7 @@ "n": 5000 } ], + "point": 20, "position": [ 1, 1 @@ -27,9 +26,7 @@ }, { "id": 2, - "type": [ - 0 - ], + "type": 0, "talentid": 40102, "before": [ 0 @@ -37,7 +34,7 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 20000 }, { @@ -46,6 +43,7 @@ "n": 5000 } ], + "point": 20, "position": [ 1, 3 @@ -53,9 +51,7 @@ }, { "id": 3, - "type": [ - 0 - ], + "type": 0, "talentid": 40103, "before": [ 0 @@ -63,7 +59,7 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 20000 }, { @@ -72,6 +68,7 @@ "n": 5000 } ], + "point": 20, "position": [ 1, 5 @@ -79,9 +76,7 @@ }, { "id": 4, - "type": [ - 1 - ], + "type": 1, "talentid": 10101, "before": [ 1 @@ -89,10 +84,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 3, 1 @@ -100,9 +96,7 @@ }, { "id": 5, - "type": [ - 1 - ], + "type": 1, "talentid": 10102, "before": [ 4 @@ -110,10 +104,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 5, 1 @@ -121,9 +116,7 @@ }, { "id": 6, - "type": [ - 1 - ], + "type": 1, "talentid": 10103, "before": [ 5 @@ -131,10 +124,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 7, 1 @@ -142,9 +136,7 @@ }, { "id": 7, - "type": [ - 1 - ], + "type": 1, "talentid": 10104, "before": [ 6, @@ -153,10 +145,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 9, 1 @@ -164,9 +157,7 @@ }, { "id": 8, - "type": [ - 1 - ], + "type": 1, "talentid": 10105, "before": [ 7 @@ -174,10 +165,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 11, 1 @@ -185,9 +177,7 @@ }, { "id": 9, - "type": [ - 1 - ], + "type": 1, "talentid": 10106, "before": [ 8 @@ -195,10 +185,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 13, 1 @@ -206,9 +197,7 @@ }, { "id": 10, - "type": [ - 2 - ], + "type": 2, "talentid": 20101, "before": [ 2 @@ -216,10 +205,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 3, 3 @@ -227,9 +217,7 @@ }, { "id": 11, - "type": [ - 2 - ], + "type": 2, "talentid": 20102, "before": [ 10 @@ -237,10 +225,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 5, 3 @@ -248,9 +237,7 @@ }, { "id": 12, - "type": [ - 2 - ], + "type": 2, "talentid": 20103, "before": [ 11, @@ -260,10 +247,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 7, 3 @@ -271,9 +259,7 @@ }, { "id": 13, - "type": [ - 2 - ], + "type": 2, "talentid": 20104, "before": [ 23, @@ -282,10 +268,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 9, 3 @@ -293,9 +280,7 @@ }, { "id": 14, - "type": [ - 2 - ], + "type": 2, "talentid": 20105, "before": [ 7, @@ -305,10 +290,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 11, 3 @@ -316,9 +302,7 @@ }, { "id": 15, - "type": [ - 2 - ], + "type": 2, "talentid": 20106, "before": [ 14 @@ -326,10 +310,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 13, 3 @@ -337,9 +322,7 @@ }, { "id": 16, - "type": [ - 2 - ], + "type": 2, "talentid": 20107, "before": [ 10 @@ -347,10 +330,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 4, 2 @@ -358,9 +342,7 @@ }, { "id": 17, - "type": [ - 3 - ], + "type": 3, "talentid": 30101, "before": [ 3 @@ -368,10 +350,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 3, 5 @@ -379,9 +362,7 @@ }, { "id": 18, - "type": [ - 3 - ], + "type": 3, "talentid": 30102, "before": [ 17 @@ -389,10 +370,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 5, 5 @@ -400,9 +382,7 @@ }, { "id": 19, - "type": [ - 3 - ], + "type": 3, "talentid": 30103, "before": [ 18 @@ -410,10 +390,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 7, 5 @@ -421,9 +402,7 @@ }, { "id": 20, - "type": [ - 3 - ], + "type": 3, "talentid": 30104, "before": [ 24 @@ -431,10 +410,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 9, 5 @@ -442,9 +422,7 @@ }, { "id": 21, - "type": [ - 3 - ], + "type": 3, "talentid": 30105, "before": [ 20 @@ -452,10 +430,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 11, 5 @@ -463,9 +442,7 @@ }, { "id": 22, - "type": [ - 3 - ], + "type": 3, "talentid": 30106, "before": [ 21 @@ -473,10 +450,11 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 15000 } ], + "point": 10, "position": [ 13, 5 @@ -484,9 +462,7 @@ }, { "id": 23, - "type": [ - 999 - ], + "type": 999, "talentid": 99101, "before": [ 6, @@ -495,7 +471,7 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 40000 }, { @@ -504,6 +480,7 @@ "n": 5000 } ], + "point": 15, "position": [ 8, 2 @@ -511,9 +488,7 @@ }, { "id": 24, - "type": [ - 999 - ], + "type": 999, "talentid": 99102, "before": [ 12, @@ -522,7 +497,7 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 40000 }, { @@ -531,6 +506,7 @@ "n": 5000 } ], + "point": 15, "position": [ 8, 4 @@ -538,9 +514,7 @@ }, { "id": 25, - "type": [ - 999 - ], + "type": 999, "talentid": 99103, "before": [ 9, @@ -550,7 +524,7 @@ "thing": [ { "a": "attr", - "t": "glod", + "t": "gold", "n": 40000 }, { @@ -559,6 +533,7 @@ "n": 5000 } ], + "point": 15, "position": [ 15, 3 diff --git a/bin/json/game_item.json b/bin/json/game_item.json index 695d5e01c..e1577d71f 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -1632,5 +1632,134 @@ "key": "itemtipstxt_60003", "text": "5星套装宝箱不足" } + }, + { + "id": "90001", + "name": { + "key": "itemname_90001", + "text": "阿宝天赋点" + }, + "usetype": 3, + "color": 5, + "bagtype": 1, + "index": 99, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": [ + 122 + ], + "use_skip": 109, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "action_11001", + "ico": "action_11001", + "intr": { + "key": "itemdesc_90001", + "text": "阿宝天赋点" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "synthetize_deplete": [], + "tipstxt": { + "key": "itemtipstxt_90001", + "text": "阿宝的天赋点不足" + } + }, + { + "id": "90002", + "name": { + "key": "itemname_90002", + "text": "波比天赋点" + }, + "usetype": 3, + "color": 5, + "bagtype": 1, + "index": 99, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": [ + 122 + ], + "use_skip": 109, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "action_11003", + "ico": "action_11003", + "intr": { + "key": "itemdesc_90002", + "text": "波比天赋点" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "synthetize_deplete": [], + "tipstxt": { + "key": "itemtipstxt_90002", + "text": "波比的天赋点不足" + } + }, + { + "id": "90003", + "name": { + "key": "itemname_90003", + "text": "小伊天赋点" + }, + "usetype": 3, + "color": 5, + "bagtype": 1, + "index": 99, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": [ + 122 + ], + "use_skip": 109, + "upper_limit": 999, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "action_44005", + "ico": "action_44005", + "intr": { + "key": "itemdesc_90003", + "text": "小伊天赋点" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "synthetize_deplete": [], + "tipstxt": { + "key": "itemtipstxt_90003", + "text": "小伊的天赋点不足" + } } ] \ No newline at end of file diff --git a/bin/json/game_itembox.json b/bin/json/game_itembox.json new file mode 100644 index 000000000..97cbf30b8 --- /dev/null +++ b/bin/json/game_itembox.json @@ -0,0 +1,14 @@ +[ + { + "heroid": "25001", + "itemid": "90001" + }, + { + "heroid": "25004", + "itemid": "90002" + }, + { + "heroid": "44005", + "itemid": "90003" + } +] \ No newline at end of file diff --git a/bin/json/game_talentskill.json b/bin/json/game_talentskill.json index d9d8e4a10..6897c457f 100644 --- a/bin/json/game_talentskill.json +++ b/bin/json/game_talentskill.json @@ -8,7 +8,7 @@ "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -20,7 +20,7 @@ "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -32,7 +32,7 @@ "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -44,7 +44,7 @@ "hp": 1800, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -56,7 +56,7 @@ "hp": 1800, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -68,7 +68,7 @@ "hp": 1800, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -80,7 +80,7 @@ "hp": 1800, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -92,7 +92,7 @@ "hp": 1800, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -104,7 +104,7 @@ "hp": 1800, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -113,10 +113,10 @@ "skillname": "生命天赋", "skilltxt": "这是生命天赋的描述tips", "skillicon": "jn_dzj_0001", - "hp": 1800, + "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -125,10 +125,10 @@ "skillname": "生命天赋", "skilltxt": "这是生命天赋的描述tips", "skillicon": "jn_dzj_0001", - "hp": 1800, + "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -137,10 +137,10 @@ "skillname": "生命天赋", "skilltxt": "这是生命天赋的描述tips", "skillicon": "jn_dzj_0001", - "hp": 1800, + "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -149,10 +149,10 @@ "skillname": "生命天赋", "skilltxt": "这是生命天赋的描述tips", "skillicon": "jn_dzj_0001", - "hp": 1800, + "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -164,7 +164,7 @@ "hp": -1, "atk": -1, "def": 1500, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -176,7 +176,7 @@ "hp": -1, "atk": -1, "def": 1500, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -188,7 +188,7 @@ "hp": -1, "atk": -1, "def": 1500, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -200,7 +200,7 @@ "hp": -1, "atk": -1, "def": 1500, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -212,7 +212,7 @@ "hp": -1, "atk": -1, "def": 1500, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -224,7 +224,7 @@ "hp": -1, "atk": -1, "def": 1500, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -235,8 +235,8 @@ "skillicon": "jn_dzj_0008", "hp": -1, "atk": -1, - "def": 1500, - "crt": -1, + "def": -1, + "cri": -1, "speed": -1 }, { @@ -247,8 +247,8 @@ "skillicon": "jn_dzj_0009", "hp": -1, "atk": -1, - "def": 1500, - "crt": -1, + "def": -1, + "cri": -1, "speed": -1 }, { @@ -259,8 +259,8 @@ "skillicon": "jn_dzj_0010", "hp": -1, "atk": -1, - "def": 1500, - "crt": -1, + "def": -1, + "cri": -1, "speed": -1 }, { @@ -271,8 +271,8 @@ "skillicon": "jn_dzj_0011", "hp": -1, "atk": -1, - "def": 1500, - "crt": -1, + "def": -1, + "cri": -1, "speed": -1 }, { @@ -284,7 +284,7 @@ "hp": -1, "atk": 1500, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -296,7 +296,7 @@ "hp": -1, "atk": 1500, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -308,7 +308,7 @@ "hp": -1, "atk": 1500, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -320,7 +320,7 @@ "hp": -1, "atk": 1500, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -332,7 +332,7 @@ "hp": -1, "atk": 1500, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -344,7 +344,7 @@ "hp": -1, "atk": 1500, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -354,9 +354,9 @@ "skilltxt": "这是防御天赋的描述tips", "skillicon": "jn_dzj_0018", "hp": -1, - "atk": 1500, + "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -366,9 +366,9 @@ "skilltxt": "这是防御天赋的描述tips", "skillicon": "jn_dzj_0019", "hp": -1, - "atk": 1500, + "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -378,9 +378,9 @@ "skilltxt": "这是防御天赋的描述tips", "skillicon": "jn_dzj_0020", "hp": -1, - "atk": 1500, + "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -390,9 +390,9 @@ "skilltxt": "这是防御天赋的描述tips", "skillicon": "jn_dzj_0021", "hp": -1, - "atk": 1500, + "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": -1 }, { @@ -404,7 +404,7 @@ "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": 3000 }, { @@ -416,7 +416,7 @@ "hp": -1, "atk": -1, "def": -1, - "crt": -1, + "cri": -1, "speed": 4000 }, { @@ -428,7 +428,7 @@ "hp": -1, "atk": -1, "def": -1, - "crt": 10000, + "cri": 10000, "speed": -1 } ] \ No newline at end of file diff --git a/modules/hero/api_talentlearn.go b/modules/hero/api_talentlearn.go index a0f8423bd..d05678c62 100644 --- a/modules/hero/api_talentlearn.go +++ b/modules/hero/api_talentlearn.go @@ -40,16 +40,15 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe } // 数据校验 list, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) - if err != nil { - code = pb.ErrorCode_DBError - return - } - for _, v := range list { - if v.HeroId == req.Heroid { - talent = v - break + if err == nil { + for _, v := range list { + if v.HeroId == req.Heroid { + talent = v + break + } } } + if talent == nil { // 创建一条数据 talent, err = this.module.modelTalent.CreateHeroTalent(session.GetUserId(), req.Heroid) @@ -66,6 +65,9 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe } // 校验 if len(talentConf.Before) == 1 && talentConf.Before[0] == 0 { // 前置解锁技能为0 + if talent.Talent == nil { + talent.Talent = make(map[int32]int32) + } if _, ok := talent.Talent[req.TalentID]; ok { code = pb.ErrorCode_TalentRepeatLearn // 重复激活 return diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index 2deeb366a..96596e120 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -29,6 +29,7 @@ const ( hero_starupsp = "game_herostarupsp.json" // 精灵升星 hero_talentskill = "game_talentskill.json" // 天赋 hero_talent = "game_herotalent.json" // 天赋详细数据 + hero_itembox = "game_itembox.json" // 天赋详细数据 ) ///配置管理组件 diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 952a92545..bb2c56c50 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -61,6 +61,7 @@ func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero { Property: make(map[string]int32), EnergyProperty: make(map[string]int32), JuexProperty: make(map[string]int32), + TalentProperty: make(map[string]int32), } this.PropertyCompute(newHero) this.initHeroSkill(newHero) @@ -700,20 +701,44 @@ func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameTalentSk if conf == nil || hero == nil { return } + if hero.TalentProperty == nil { + hero.TalentProperty = make(map[string]int32) + } if conf.Hp != -1 { - hero.TalentProperty[comm.Hp] += int32(math.Floor((float64(conf.Hp) / 1000) * float64(hero.Property[comm.Hp]))) + 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 { - hero.TalentProperty[comm.Atk] += int32(math.Floor((float64(conf.Atk) / 1000) * float64(hero.Property[comm.Atk]))) + 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 { - hero.TalentProperty[comm.Def] += int32(math.Floor((float64(conf.Def) / 1000) * float64(hero.Property[comm.Def]))) + 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.Crt != -1 { - hero.TalentProperty[comm.Cri] += int32(math.Floor((float64(conf.Crt) / 1000) * float64(hero.Property[comm.Cri]))) + 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 { - hero.TalentProperty[comm.Speed] += int32(math.Floor((float64(conf.Speed) / 1000) * float64(hero.Property[comm.Speed]))) + 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]))) + } } _heroMap := make(map[string]interface{}, 0) diff --git a/modules/hero/model_talent.go b/modules/hero/model_talent.go index 50c05e8e1..9a4793dab 100644 --- a/modules/hero/model_talent.go +++ b/modules/hero/model_talent.go @@ -27,7 +27,7 @@ func (this *ModelTalent) Init(service core.IService, module core.IModule, comp c //获取用户天赋数据 func (this *ModelTalent) GetHerotalent(uid string) (result []*pb.DBHeroTalent, err error) { result = make([]*pb.DBHeroTalent, 0) - if err = this.GetList(uid, result); err != nil && err != redis.RedisNil { + if err = this.GetList(uid, &result); err != nil && err != redis.RedisNil { return } err = nil @@ -47,8 +47,8 @@ func (this *ModelTalent) ChangeHeroTalent(talent *pb.DBHeroTalent, update map[st // 通过objId 查询天赋数据 func (this *ModelTalent) GetHerotalentByObjId(uid string, oid string) (talent *pb.DBHeroTalent, err error) { - result := &pb.DBHeroTalent{} - err = this.GetListObj(uid, oid, result) + talent = &pb.DBHeroTalent{} + err = this.GetListObj(uid, oid, talent) return } @@ -56,7 +56,7 @@ func (this *ModelTalent) GetHerotalentByObjId(uid string, oid string) (talent *p func (this *ModelTalent) CreateHeroTalent(uid, heroId string) (talent *pb.DBHeroTalent, err error) { talent = &pb.DBHeroTalent{ Id: primitive.NewObjectID().Hex(), - Uid: "", + Uid: uid, HeroId: heroId, Talent: map[int32]int32{}, } diff --git a/sys/configure/structs/Game.HeroTalentData.go b/sys/configure/structs/Game.HeroTalentData.go index 281e341a2..68dd03d53 100644 --- a/sys/configure/structs/Game.HeroTalentData.go +++ b/sys/configure/structs/Game.HeroTalentData.go @@ -12,10 +12,11 @@ import "errors" type GameHeroTalentData struct { Id int32 - Type []int32 + Type int32 Talentid int32 Before []int32 Thing []*Gameatn + Point int32 Position []int32 } @@ -27,20 +28,7 @@ func (*GameHeroTalentData) GetTypeId() int32 { func (_v *GameHeroTalentData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["type"].([]interface{}); !_ok_ { err = errors.New("type error"); return } - - _v.Type = make([]int32, 0, len(_arr_)) - - for _, _e_ := range _arr_ { - var _list_v_ int32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } - _v.Type = append(_v.Type, _list_v_) - } - } - + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["talentid"].(float64); !_ok_ { err = errors.New("talentid error"); return }; _v.Talentid = int32(_tempNum_) } { var _arr_ []interface{} @@ -70,6 +58,7 @@ func (_v *GameHeroTalentData)Deserialize(_buf map[string]interface{}) (err error } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["point"].(float64); !_ok_ { err = errors.New("point error"); return }; _v.Point = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool diff --git a/sys/configure/structs/Game.ItemBox.go b/sys/configure/structs/Game.ItemBox.go new file mode 100644 index 000000000..4064d2bbb --- /dev/null +++ b/sys/configure/structs/Game.ItemBox.go @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +type GameItemBox struct { + _dataMap map[string]*GameItemBoxData + _dataList []*GameItemBoxData +} + +func NewGameItemBox(_buf []map[string]interface{}) (*GameItemBox, error) { + _dataList := make([]*GameItemBoxData, 0, len(_buf)) + dataMap := make(map[string]*GameItemBoxData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameItemBoxData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Heroid] = _v + } + } + return &GameItemBox{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameItemBox) GetDataMap() map[string]*GameItemBoxData { + return table._dataMap +} + +func (table *GameItemBox) GetDataList() []*GameItemBoxData { + return table._dataList +} + +func (table *GameItemBox) Get(key string) *GameItemBoxData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.ItemBoxData.go b/sys/configure/structs/Game.ItemBoxData.go new file mode 100644 index 000000000..2a9660d73 --- /dev/null +++ b/sys/configure/structs/Game.ItemBoxData.go @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +import "errors" + +type GameItemBoxData struct { + Heroid string + Itemid string +} + +const TypeId_GameItemBoxData = -1971148410 + +func (*GameItemBoxData) GetTypeId() int32 { + return -1971148410 +} + +func (_v *GameItemBoxData)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; if _v.Heroid, _ok_ = _buf["heroid"].(string); !_ok_ { err = errors.New("heroid error"); return } } + { var _ok_ bool; if _v.Itemid, _ok_ = _buf["itemid"].(string); !_ok_ { err = errors.New("itemid error"); return } } + return +} + +func DeserializeGameItemBoxData(_buf map[string]interface{}) (*GameItemBoxData, error) { + v := &GameItemBoxData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.TalentSkillData.go b/sys/configure/structs/Game.TalentSkillData.go index 697f6ec35..fc32cc0e3 100644 --- a/sys/configure/structs/Game.TalentSkillData.go +++ b/sys/configure/structs/Game.TalentSkillData.go @@ -19,7 +19,7 @@ type GameTalentSkillData struct { Hp int32 Atk int32 Def int32 - Crt int32 + Cri int32 Speed int32 } @@ -38,7 +38,7 @@ func (_v *GameTalentSkillData)Deserialize(_buf map[string]interface{}) (err erro { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hp"].(float64); !_ok_ { err = errors.New("hp error"); return }; _v.Hp = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["atk"].(float64); !_ok_ { err = errors.New("atk error"); return }; _v.Atk = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["def"].(float64); !_ok_ { err = errors.New("def error"); return }; _v.Def = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["crt"].(float64); !_ok_ { err = errors.New("crt error"); return }; _v.Crt = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cri"].(float64); !_ok_ { err = errors.New("cri error"); return }; _v.Cri = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["speed"].(float64); !_ok_ { err = errors.New("speed error"); return }; _v.Speed = int32(_tempNum_) } return } diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go index 392c1dc59..d6ed1c66b 100644 --- a/sys/configure/structs/Tables.go +++ b/sys/configure/structs/Tables.go @@ -114,6 +114,7 @@ type Tables struct { PlayerInfor *GamePlayerInfor HeroTalent *GameHeroTalent TalentSkill *GameTalentSkill + ItemBox *GameItemBox } func NewTables(loader JsonLoader) (*Tables, error) { @@ -739,5 +740,12 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.TalentSkill, err = NewGameTalentSkill(buf); err != nil { return nil, err } + if buf, err = loader("game_itembox"); err != nil { + return nil, err + } + if tables.ItemBox, err = NewGameItemBox(buf); err != nil { + return nil, err + } + return tables, nil }