From aa47570de95484a3d2fbff60d2d8f8500cb79a7a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 7 Jun 2022 19:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=B5=8B=E8=AF=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_extservers.json | 10 + bin/json/game_hero.json | 552 +++++++++++++++++++ bin/json/game_item.json | 1 + bin/json/game_language.json | 366 ++++++++++++ bin/json/game_plot.json | 8 + bin/json/game_skill.json | 482 ++++++++++++++++ bin/json/game_ui.json | 422 ++++++++++++++ go_dreamfactory.rar | Bin 0 -> 10925 bytes modules/pack/api_comp.go | 19 +- modules/pack/configure_comp.go | 56 +- pb/mail.pb.go | 2 +- pb/pack_db.pb.go | 143 ++--- pb/pack_msg.pb.go | 235 +++----- pb/proto/pack_db.proto | 18 +- pb/proto/pack_msg.proto | 21 +- pb/user_db.pb.go | 8 +- sys/cache/pack.go | 57 +- sys/configure/structs/game.extservers.go | 42 ++ sys/configure/structs/game.extserversData.go | 27 + sys/configure/structs/game.hero.go | 42 ++ sys/configure/structs/game.heroData.go | 69 +++ sys/configure/structs/game.item.go | 42 ++ sys/configure/structs/game.itemData.go | 63 +++ sys/configure/structs/game.language.go | 42 ++ sys/configure/structs/game.languageData.go | 43 ++ sys/configure/structs/game.plot.go | 42 ++ sys/configure/structs/game.plotData.go | 31 ++ sys/configure/structs/game.skill.go | 42 ++ sys/configure/structs/game.skillData.go | 43 ++ sys/configure/structs/game.ui.go | 42 ++ sys/configure/structs/game.uiData.go | 43 ++ sys/db/pack.go | 57 +- sys/db/pack_test.go | 58 ++ 33 files changed, 2837 insertions(+), 291 deletions(-) create mode 100644 bin/json/game_extservers.json create mode 100644 bin/json/game_hero.json create mode 100644 bin/json/game_item.json create mode 100644 bin/json/game_language.json create mode 100644 bin/json/game_plot.json create mode 100644 bin/json/game_skill.json create mode 100644 bin/json/game_ui.json create mode 100644 go_dreamfactory.rar create mode 100644 sys/configure/structs/game.extservers.go create mode 100644 sys/configure/structs/game.extserversData.go create mode 100644 sys/configure/structs/game.hero.go create mode 100644 sys/configure/structs/game.heroData.go create mode 100644 sys/configure/structs/game.item.go create mode 100644 sys/configure/structs/game.itemData.go create mode 100644 sys/configure/structs/game.language.go create mode 100644 sys/configure/structs/game.languageData.go create mode 100644 sys/configure/structs/game.plot.go create mode 100644 sys/configure/structs/game.plotData.go create mode 100644 sys/configure/structs/game.skill.go create mode 100644 sys/configure/structs/game.skillData.go create mode 100644 sys/configure/structs/game.ui.go create mode 100644 sys/configure/structs/game.uiData.go create mode 100644 sys/db/pack_test.go diff --git a/bin/json/game_extservers.json b/bin/json/game_extservers.json new file mode 100644 index 000000000..dd804adc8 --- /dev/null +++ b/bin/json/game_extservers.json @@ -0,0 +1,10 @@ +[ + { + "name": "本地测试服1", + "ips": "10.0.1.11:9999" + }, + { + "name": "本地测试服2", + "ips": "homm20.legu.cc:6352" + } +] \ No newline at end of file diff --git a/bin/json/game_hero.json b/bin/json/game_hero.json new file mode 100644 index 000000000..177d56de6 --- /dev/null +++ b/bin/json/game_hero.json @@ -0,0 +1,552 @@ +[ + { + "id": "11001", + "name": "阿宝", + "star": 4, + "color": 3, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "Person/11001.prefab", + "icon": "11001", + "sound": "121323", + "tujing": "[1]", + "hpgrow": "57.4", + "atkgrow": "7.2", + "defgrow": "5.6", + "speedgrow": "2", + "hp": "576", + "atk": "73", + "def": "57", + "speed": "174", + "intr": "", + "events": "EventDataSet/Hero_11001.asset", + "cite": "" + }, + { + "id": "11002", + "name": "原始人", + "star": 5, + "color": 4, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "Person/11002.prefab", + "icon": "11002", + "sound": "11002", + "tujing": "[1]", + "hpgrow": "82.9", + "atkgrow": "9.4", + "defgrow": "5.8", + "speedgrow": "2", + "hp": "830", + "atk": "95", + "def": "59", + "speed": "193", + "intr": "", + "events": "EventDataSet/Hero_11002.asset", + "cite": "" + }, + { + "id": "11003", + "name": "波比", + "star": 5, + "color": 4, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "Person/11003.prefab", + "icon": "11003", + "sound": "11003", + "tujing": "[1]", + "hpgrow": "82.9", + "atkgrow": "9.4", + "defgrow": "5.8", + "speedgrow": "2", + "hp": "830", + "atk": "95", + "def": "59", + "speed": "193", + "intr": "", + "events": "EventDataSet/Hero_11003.asset", + "cite": "" + }, + { + "id": "11004", + "name": "布兰", + "star": 5, + "color": 4, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "11004", + "icon": "11004", + "sound": "11004", + "tujing": "[1]", + "hpgrow": "82.9", + "atkgrow": "9.4", + "defgrow": "5.8", + "speedgrow": "2", + "hp": "830", + "atk": "95", + "def": "59", + "speed": "193", + "intr": "", + "events": "hero_2011", + "cite": "" + }, + { + "id": "11005", + "name": "无牙仔", + "star": 4, + "color": 3, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "Person/11001.prefab", + "icon": "11005", + "sound": "121323", + "tujing": "[1]", + "hpgrow": "57.4", + "atkgrow": "7.2", + "defgrow": "5.6", + "speedgrow": "2", + "hp": "576", + "atk": "73", + "def": "57", + "speed": "174", + "intr": "", + "events": "EventDataSet/Hero_11001.asset", + "cite": "" + }, + { + "id": "11006", + "name": "亚丝翠", + "star": 5, + "color": 4, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "11006", + "icon": "11006", + "sound": "11006", + "tujing": "[1]", + "hpgrow": "82.9", + "atkgrow": "9.4", + "defgrow": "5.8", + "speedgrow": "2", + "hp": "830", + "atk": "95", + "def": "59", + "speed": "193", + "intr": "", + "events": "hero_2011", + "cite": "" + }, + { + "id": "11009", + "name": "希卡普", + "star": 4, + "color": 3, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11009", + "icon": "11009", + "sound": "11009", + "tujing": "[1]", + "hpgrow": "38.6", + "atkgrow": "10.5", + "defgrow": "5.7", + "speedgrow": "2", + "hp": "389", + "atk": "106", + "def": "58", + "speed": "165", + "intr": "", + "events": "EventDataSet/Hero_11009.asset", + "cite": "" + }, + { + "id": "22002", + "name": "沈王爷青春版", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "22002", + "icon": "22002", + "sound": "22002", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "hero_2011", + "cite": "" + }, + { + "id": "90001", + "name": "邪恶阿宝", + "star": 4, + "color": 3, + "chengwei": 3, + "zhongzu": 1, + "job": 1, + "type": 1, + "prefab": "Person/90001.prefab", + "icon": "90001", + "sound": "90001", + "tujing": "[1]", + "hpgrow": "57.4", + "atkgrow": "7.2", + "defgrow": "5.6", + "speedgrow": "2", + "hp": "576", + "atk": "73", + "def": "57", + "speed": "174", + "intr": "", + "events": "hero_90001", + "cite": "11001" + }, + { + "id": "11011", + "name": "浣熊", + "star": 4, + "color": 3, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11011", + "icon": "11011", + "sound": "11011", + "tujing": "[1]", + "hpgrow": "38.6", + "atkgrow": "10.5", + "defgrow": "5.7", + "speedgrow": "2", + "hp": "389", + "atk": "106", + "def": "58", + "speed": "165", + "intr": "", + "events": "EventDataSet/Hero_11011.asset", + "cite": "" + }, + { + "id": "11008", + "name": "悍娇虎", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11008", + "icon": "11008", + "sound": "11008", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "hero_2011", + "cite": "" + }, + { + "id": "11017", + "name": "冰霜杰克", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11017", + "icon": "11017", + "sound": "11017", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11017.asset", + "cite": "" + }, + { + "id": "11018", + "name": "睡神", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11018", + "icon": "11018", + "sound": "11018", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11018.asset", + "cite": "" + }, + { + "id": "11019", + "name": "莫甘娜", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11019", + "icon": "11019", + "sound": "11019", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11019.asset", + "cite": "" + }, + { + "id": "11020", + "name": "莫甘娜二阶段", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11020", + "icon": "11020", + "sound": "11020", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11020.asset", + "cite": "" + }, + { + "id": "11021", + "name": "莫甘娜巨怪", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11021", + "icon": "11021", + "sound": "11021", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11021.asset", + "cite": "" + }, + { + "id": "11099", + "name": "触手", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "11099", + "icon": "11099", + "sound": "11099", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11099.asset", + "cite": "" + }, + { + "id": "12001", + "name": "黑化阿宝", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "Person/12001.prefab", + "icon": "12001", + "sound": "121323", + "tujing": "[1]", + "hpgrow": "57.4", + "atkgrow": "7.2", + "defgrow": "5.6", + "speedgrow": "2", + "hp": "576", + "atk": "73", + "def": "57", + "speed": "174", + "intr": "", + "events": "EventDataSet/Hero_12001.asset", + "cite": "" + }, + { + "id": "12003", + "name": "黑化包比", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "Person/11003.prefab", + "icon": "12003", + "sound": "12003", + "tujing": "[1]", + "hpgrow": "82.9", + "atkgrow": "9.4", + "defgrow": "5.8", + "speedgrow": "2", + "hp": "830", + "atk": "95", + "def": "59", + "speed": "193", + "intr": "", + "events": "EventDataSet/Hero_11003.asset", + "cite": "11003" + }, + { + "id": "12009", + "name": "黑化希卡普", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "12009", + "icon": "11009", + "sound": "11009", + "tujing": "[1]", + "hpgrow": "38.6", + "atkgrow": "10.5", + "defgrow": "5.7", + "speedgrow": "2", + "hp": "389", + "atk": "106", + "def": "58", + "speed": "165", + "intr": "", + "events": "EventDataSet/Hero_11009.asset", + "cite": "" + }, + { + "id": "12017", + "name": "黑化杰克", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "12017", + "icon": "12017", + "sound": "12017", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11017.asset", + "cite": "" + }, + { + "id": "12018", + "name": "黑化睡神", + "star": 5, + "color": 4, + "chengwei": 4, + "zhongzu": 2, + "job": 2, + "type": 1, + "prefab": "12018", + "icon": "12018", + "sound": "12018", + "tujing": "[1]", + "hpgrow": "55.6", + "atkgrow": "13.6", + "defgrow": "5.9", + "speedgrow": "2", + "hp": "561", + "atk": "137", + "def": "60", + "speed": "183", + "intr": "", + "events": "EventDataSet/Hero_11018.asset", + "cite": "11018" + } +] \ No newline at end of file diff --git a/bin/json/game_item.json b/bin/json/game_item.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/bin/json/game_item.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/bin/json/game_language.json b/bin/json/game_language.json new file mode 100644 index 000000000..d82389253 --- /dev/null +++ b/bin/json/game_language.json @@ -0,0 +1,366 @@ +[ + { + "id": "ChineseSimplified", + "maps": [ + [ + "ChineseSimplified", + "简体中文" + ], + [ + "ChineseTraditional", + "簡體中文" + ] + ] + }, + { + "id": "ChineseTraditional", + "maps": [ + [ + "ChineseSimplified", + "繁体中文" + ], + [ + "ChineseTraditional", + "繁體中文" + ] + ] + }, + { + "id": "English", + "maps": [ + [ + "ChineseSimplified", + "英文" + ], + [ + "ChineseTraditional", + "英文" + ] + ] + }, + { + "id": "1", + "maps": [ + [ + "ChineseSimplified", + "一" + ], + [ + "ChineseTraditional", + "一" + ], + [ + "English", + "one" + ] + ] + }, + { + "id": "2", + "maps": [ + [ + "ChineseSimplified", + "二" + ], + [ + "ChineseTraditional", + "二" + ], + [ + "English", + "two" + ] + ] + }, + { + "id": "3", + "maps": [ + [ + "ChineseSimplified", + "三" + ], + [ + "ChineseTraditional", + "三" + ], + [ + "English", + "three" + ] + ] + }, + { + "id": "4", + "maps": [ + [ + "ChineseSimplified", + "四" + ], + [ + "ChineseTraditional", + "四" + ], + [ + "English", + "four" + ] + ] + }, + { + "id": "5", + "maps": [ + [ + "ChineseSimplified", + "五" + ], + [ + "ChineseTraditional", + "五" + ], + [ + "English", + "five" + ] + ] + }, + { + "id": "6", + "maps": [ + [ + "ChineseSimplified", + "六" + ], + [ + "ChineseTraditional", + "六" + ], + [ + "English", + "six" + ] + ] + }, + { + "id": "7", + "maps": [ + [ + "ChineseSimplified", + "七" + ], + [ + "ChineseTraditional", + "七" + ], + [ + "English", + "seven" + ] + ] + }, + { + "id": "8", + "maps": [ + [ + "ChineseSimplified", + "八" + ], + [ + "ChineseTraditional", + "八" + ], + [ + "English", + "eight" + ] + ] + }, + { + "id": "9", + "maps": [ + [ + "ChineseSimplified", + "九" + ], + [ + "ChineseTraditional", + "九" + ], + [ + "English", + "nine" + ] + ] + }, + { + "id": "10", + "maps": [ + [ + "ChineseSimplified", + "十" + ], + [ + "ChineseTraditional", + "十" + ], + [ + "English", + "ten" + ] + ] + }, + { + "id": "Login", + "maps": [ + [ + "ChineseSimplified", + "登录" + ], + [ + "ChineseTraditional", + "登錄" + ], + [ + "English", + "Login" + ] + ] + }, + { + "id": "MomentDay1", + "maps": [ + [ + "ChineseSimplified", + "{0}天前" + ], + [ + "ChineseTraditional", + "{0}天前" + ] + ] + }, + { + "id": "MomentDay2", + "maps": [ + [ + "ChineseSimplified", + "还有{0}天" + ], + [ + "ChineseTraditional", + "還有{0}天" + ] + ] + }, + { + "id": "MomentHour1", + "maps": [ + [ + "ChineseSimplified", + "{0}小时前" + ], + [ + "ChineseTraditional", + "{0}小時前" + ] + ] + }, + { + "id": "MomentHour2", + "maps": [ + [ + "ChineseSimplified", + "还有{0}小时" + ], + [ + "ChineseTraditional", + "還有{0}小時" + ] + ] + }, + { + "id": "MomentMinutes1", + "maps": [ + [ + "ChineseSimplified", + "{0}分钟前" + ], + [ + "ChineseTraditional", + "{0}分鐘前" + ] + ] + }, + { + "id": "MomentMinutes2", + "maps": [ + [ + "ChineseSimplified", + "还有{0}分钟" + ], + [ + "ChineseTraditional", + "還有{0}分鐘" + ] + ] + }, + { + "id": "MomentSeconds1", + "maps": [ + [ + "ChineseSimplified", + "刚刚" + ], + [ + "ChineseTraditional", + "剛剛" + ] + ] + }, + { + "id": "MomentSeconds2", + "maps": [ + [ + "ChineseSimplified", + "1分以内" + ], + [ + "ChineseTraditional", + "1分以內" + ] + ] + }, + { + "id": "Tuijian", + "maps": [ + [ + "ChineseSimplified", + "推荐" + ], + [ + "ChineseTraditional", + "推薦" + ], + [ + "English", + "Hot" + ] + ] + }, + { + "id": "Juese", + "maps": [ + [ + "ChineseSimplified", + "角色" + ], + [ + "ChineseTraditional", + "角色" + ], + [ + "English", + "Role" + ] + ] + } +] \ No newline at end of file diff --git a/bin/json/game_plot.json b/bin/json/game_plot.json new file mode 100644 index 000000000..0b821fca3 --- /dev/null +++ b/bin/json/game_plot.json @@ -0,0 +1,8 @@ +[ + { + "sameid": 1, + "skip": true, + "name": "Cutscene_Fight", + "describe": "一段垃圾的剧情,臭" + } +] \ No newline at end of file diff --git a/bin/json/game_skill.json b/bin/json/game_skill.json new file mode 100644 index 000000000..146902b7e --- /dev/null +++ b/bin/json/game_skill.json @@ -0,0 +1,482 @@ +[ + { + "sameid": 110001, + "heroid": 11001, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 110002, + "heroid": 11001, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "110002_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 110003, + "heroid": 11001, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "110003_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 110004, + "heroid": 11001, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "Skill3", + "skill": "[]", + "tubiao": "110004_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 110005, + "heroid": 11001, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110005_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + }, + { + "sameid": 110031, + "heroid": 11003, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 110032, + "heroid": 11003, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "110032_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 110033, + "heroid": 11003, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "110033_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 110034, + "heroid": 11003, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110034_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 110035, + "heroid": 11003, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110035_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + }, + { + "sameid": 110041, + "heroid": 11004, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 110042, + "heroid": 11004, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "110042_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 110043, + "heroid": 11004, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "110043_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 110044, + "heroid": 11004, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110044_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 110045, + "heroid": 11004, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110045_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + }, + { + "sameid": 220001, + "heroid": 22001, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 220002, + "heroid": 22001, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "220002_1", + "name": "寒冬将至", + "describe": "白雪公主飘到敌方上空,甩动头发蓄力降下冰雪,对敌方全体造成57%攻击伤害并有15%概率使目标冰冻2回合" + }, + { + "sameid": 220003, + "heroid": 22001, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "220003_2", + "name": "寒冰血脉", + "describe": "白雪公主天生自带寒冰之力,攻击增加25%,生命增加20%" + }, + { + "sameid": 220004, + "heroid": 22001, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "220004_3", + "name": "美丽冻人", + "describe": "暴雪公主天生丽质,美丽冻人,普攻有15%概率使目标冰冻,持续1回合" + }, + { + "sameid": 220005, + "heroid": 22001, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "220005_4", + "name": "风雪归途", + "describe": "白雪公主败退之时,体内寒冰血脉爆发,有11.1%概率使所有敌人冰冻,持续2回合" + }, + { + "sameid": 900001, + "heroid": 90001, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 900002, + "heroid": 90001, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "900002_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 900003, + "heroid": 90001, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "900003_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 900004, + "heroid": 90001, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "900004_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 900005, + "heroid": 90001, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "900005_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + }, + { + "sameid": 110081, + "heroid": 11008, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 110082, + "heroid": 11008, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "110082_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 110083, + "heroid": 11008, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "110083_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 110084, + "heroid": 11008, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110084_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 110085, + "heroid": 11008, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110085_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + }, + { + "sameid": 110171, + "heroid": 11017, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 110172, + "heroid": 11017, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "110172_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 110173, + "heroid": 11017, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "110173_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 110174, + "heroid": 11017, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110174_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 110175, + "heroid": 11017, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110175_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + }, + { + "sameid": 110181, + "heroid": 11018, + "lv": 0, + "type": 0, + "skilllv": 1, + "act": "Atk", + "skill": "[]", + "tubiao": "", + "name": "", + "describe": "" + }, + { + "sameid": 110182, + "heroid": 11018, + "lv": 1, + "type": 1, + "skilllv": 1, + "act": "Skill1", + "skill": "[]", + "tubiao": "110182_1", + "name": "伤心欲绝", + "describe": "对敌方后排随机3名敌人造成125%攻击伤害,并使自己暴击提升10%,持续2回合" + }, + { + "sameid": 110183, + "heroid": 11018, + "lv": 31, + "type": 2, + "skilllv": 1, + "act": "Skill2", + "skill": "[]", + "tubiao": "110183_2", + "name": "铁皮", + "describe": "铁皮人血量提升20%,攻击提升15%" + }, + { + "sameid": 110184, + "heroid": 11018, + "lv": 51, + "type": 3, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110184_3", + "name": "刃甲", + "describe": "受到伤害时有25%概率反击,造成50%攻击伤害" + }, + { + "sameid": 110185, + "heroid": 11018, + "lv": 81, + "type": 4, + "skilllv": 1, + "act": "hit", + "skill": "[]", + "tubiao": "110185_4", + "name": "生生不息", + "describe": "每次普攻回复自己生命24%攻击伤害" + } +] \ No newline at end of file diff --git a/bin/json/game_ui.json b/bin/json/game_ui.json new file mode 100644 index 000000000..2984972e6 --- /dev/null +++ b/bin/json/game_ui.json @@ -0,0 +1,422 @@ +[ + { + "id": "loading", + "file": "LoadingWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "loading/loading", + "packagename": "loading", + "comname": "main", + "des": "加载界面" + }, + { + "id": "login", + "file": "LoginWindow", + "unloadpkg": 1, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "login/login", + "packagename": "login", + "comname": "main", + "des": "登录界面" + }, + { + "id": "useragreement", + "file": "LoginUseragreementWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 0, + "blur": 1, + "package": "login/login", + "packagename": "login", + "comname": "useragreement", + "des": "登录界面用户隐私协议" + }, + { + "id": "notice", + "file": "LoginNoticeWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 0, + "blur": 1, + "package": "login/login", + "packagename": "login", + "comname": "notice", + "des": "登录界面公告" + }, + { + "id": "serverlist", + "file": "ServerListWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 0, + "blur": 1, + "package": "login/login", + "packagename": "login", + "comname": "serverlist", + "des": "服务器列表" + }, + { + "id": "tanxian", + "file": "TanXianWindow", + "unloadpkg": 1, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "tanxian/tanxian", + "packagename": "tanxian", + "comname": "main", + "des": "探险界面" + }, + { + "id": "bigmap", + "file": "BigmapWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 0, + "blur": 0, + "package": "bigmap/bigmap", + "packagename": "bigmap", + "comname": "main", + "des": "大地图界面" + }, + { + "id": "starup_hero", + "file": "HeroStarUpWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "hero/hero", + "packagename": "hero", + "comname": "heroCultivatePanel", + "des": "英雄升星界面(临时)" + }, + { + "id": "heropanel", + "file": "HeroPanelWindow", + "unloadpkg": 1, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "hero/hero", + "packagename": "hero", + "comname": "heroPanel", + "des": "英雄界面" + }, + { + "id": "exhibition2", + "file": "Exhibition2Window", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "exhibition/exhibition", + "packagename": "exhibition", + "comname": "main2", + "des": "临时展示界面" + }, + { + "id": "exhibition3", + "file": "Exhibition3Window", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "exhibition/exhibition", + "packagename": "exhibition", + "comname": "main1", + "des": "临时展示界面" + }, + { + "id": "exhibition_back1", + "file": "ExhibitionBack1Window", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "exhibition/exhibition", + "packagename": "exhibition", + "comname": "back", + "des": "临时展示界面-屏幕滑动" + }, + { + "id": "exhibition_back2", + "file": "ExhibitionBack2Window", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "exhibition/exhibition", + "packagename": "exhibition", + "comname": "back", + "des": "临时展示界面-左下按钮返回" + }, + { + "id": "exhibition_back3", + "file": "ExhibitionBack3Window", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "exhibition/exhibition", + "packagename": "exhibition", + "comname": "back", + "des": "临时展示界面-模型旋转" + }, + { + "id": "exhibition_back4", + "file": "ExhibitionBack4Window", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "exhibition/exhibition", + "packagename": "exhibition", + "comname": "back_up", + "des": "临时展示界面-左上按钮返回" + }, + { + "id": "methodandway_equip", + "file": "EquipMethodAndWayWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "tips/tips", + "packagename": "tips", + "comname": "equipMethodAndWayTips", + "des": "装备获取途径界面(临时)" + }, + { + "id": "skillinfo", + "file": "SkillInfoWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "tips/tips", + "packagename": "tips", + "comname": "skillInfoTips", + "des": "技能信息界面(临时)" + }, + { + "id": "generaltips", + "file": "GeneralTipsWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "tips/tips", + "packagename": "tips", + "comname": "GeneralTips", + "des": "跑马灯" + }, + { + "id": "noticetips", + "file": "NoticeTipsWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "tips/tips", + "packagename": "tips", + "comname": "NoticeTips", + "des": "通用提示" + }, + { + "id": "zhandou", + "file": "FightWindow", + "unloadpkg": 1, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "main2", + "des": "战斗界面" + }, + { + "id": "koshow", + "file": "KOPanel", + "unloadpkg": 0, + "loadtype": 0, + "full": 1, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "KOInterface", + "des": "KO界面" + }, + { + "id": "settlement", + "file": "SettlementWindow", + "unloadpkg": 1, + "loadtype": 0, + "full": 0, + "blur": 1, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "main_account", + "des": "战斗结算界面" + }, + { + "id": "pausebattle", + "file": "PauseBattleWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 1, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "pausewindow", + "des": "战斗暂停界面" + }, + { + "id": "campties", + "file": "CampTiesWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "campties", + "des": "阵营加成" + }, + { + "id": "battleopen", + "file": "BattleOpenWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 1, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "battleopenwindow", + "des": "战斗开始界面" + }, + { + "id": "embattle", + "file": "EmbattleWindow", + "unloadpkg": 1, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "Embattle", + "des": "布阵界面" + }, + { + "id": "battlestatistics", + "file": "BattleStatisticsWindow", + "unloadpkg": 0, + "loadtype": 0, + "full": 0, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "battlestatisticswindow", + "des": "战斗统计界面" + }, + { + "id": "maincity", + "file": "MainCityWindow", + "unloadpkg": 1, + "loadtype": 0, + "full": 1, + "blur": 0, + "package": "maincity/maincity", + "packagename": "maincity", + "comname": "main", + "des": "主城界面" + }, + { + "id": "flagstonefunc", + "file": "FlagstoneFuncWindow", + "unloadpkg": 1, + "loadtype": 0, + "full": 1, + "blur": 0, + "package": "maincity/maincity", + "packagename": "maincity", + "comname": "flagstonewindow", + "des": "交互场景石板功能界面" + }, + { + "id": "interactionui", + "file": "InteractionEventWindow", + "unloadpkg": 1, + "loadtype": 0, + "full": 1, + "blur": 0, + "package": "maincity/maincity", + "packagename": "maincity", + "comname": "interactioneventwindow", + "des": "交互UI" + }, + { + "id": "messagebox", + "file": "MessageBoxWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 0, + "blur": 1, + "package": "public/public", + "packagename": "public", + "comname": "messagebox", + "des": "默认弹出框" + }, + { + "id": "heronewlist", + "file": "HeroNewListWindow", + "unloadpkg": 1, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "heronew/heronew", + "packagename": "heronew", + "comname": "heriopanel", + "des": "英雄列表" + }, + { + "id": "heronewinfo", + "file": "HeroNewInfoWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "heronew/heronew", + "packagename": "heronew", + "comname": "heroinfo", + "des": "英雄详情" + }, + { + "id": "heronewstart", + "file": "HeroNewStartWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 0, + "blur": 1, + "package": "heronew/heronew", + "packagename": "heronew", + "comname": "herostarup", + "des": "升星-选择材料" + }, + { + "id": "battleready", + "file": "BattleReadyWindow", + "unloadpkg": 0, + "loadtype": 1, + "full": 1, + "blur": 0, + "package": "zhandou/zhandou", + "packagename": "zhandou", + "comname": "battlereadywindow", + "des": "战斗布阵界面" + } +] \ No newline at end of file diff --git a/go_dreamfactory.rar b/go_dreamfactory.rar new file mode 100644 index 0000000000000000000000000000000000000000..7b1212ae4d955bcc4024b934cb5a81ebb32d49e3 GIT binary patch literal 10925 zcmZvibyOVNvhb0C!QI_LaMuKvV8Ma~2r|In3^usCgy0e+AwX~o?hxFaU^t%MqMqK>a>~{D}x0~jmyVe`P0*zHeWWSH(hUA?ud@3ElGN| z#;(|$_={bQ&XjED1DECX_F0q+HwH6S z#7@;dZ~nRxC?<^2e@jMPTsJ9p!J-+5}k*a~**Z|ccqWL#OTM){& zDecc*-&{gI>4J?GDAp}!-PL@s_7DFRj z($;?X#~-b;!N0|gVvkaLLQ|p0%WJmpx?6%`gQGr$Im&g#McuJ1Xuve)tk0n*)1Q}= zI?6PVLb~?8WJhx2@x&s{I!<=!6FU)i$_HPEW71_>u8&}_v!k}4g>3L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K{ zIZmjG_3^t%)|Bj99U1UGA}+JC6pWoXH!-p^R}#`swXYayQ`VE(tV*BbqSeyxkWt?q zQNDot?s`Gx)%Uh_yCw$s=SM(6z(aul;0+wKKe6`D=oK7YZ%be+e?}(;-u<-uzr_B8 z54hMr@gkuvV;0^S{GZx@f3*E=J@p@?Q5T`}h=`mjRsUP+UvqG9UAlg=CZ*2vh#AIc dU#b6F7cyKITw;+v!}^aEQhVrXBBKBh{vRvlYPtXb literal 0 HcmV?d00001 diff --git a/modules/pack/api_comp.go b/modules/pack/api_comp.go index 744ea6efa..92e17a0aa 100644 --- a/modules/pack/api_comp.go +++ b/modules/pack/api_comp.go @@ -36,26 +36,21 @@ func (this *Api_Comp) QueryUserPackReq(ctx context.Context, session comm.IUserSe var ( code pb.ErrorCode pack *pb.DB_UserPackData - items []*pb.ItemAmount + grids []*pb.DB_GridData ) defer func() { - session.SendMsg("pack", "queryuserpackresp", code, &pb.QueryUserPackResp{Items: items}) + session.SendMsg(string(this.module.GetType()), "queryuserpackresp", code, &pb.QueryUserPackResp{Grids: grids}) }() - if session.GetUserId() == "" { + if !session.IsLogin() { code = pb.ErrorCode_NoLogin return } - if pack, err = cache.Defsys.QueryUserPack(session.GetUserId()); err != nil { + if pack, err = cache.Defsys.Pack_QueryUserPack(session.GetUserId()); err != nil { log.Errorf("QueryUserPackReq err:%v", err) code = pb.ErrorCode_CacheReadError return } else { - items = make([]*pb.ItemAmount, 0, len(pack.Pack)) - // for _, v := range pack.Pack { - // if v.Itype == req.IType { - // items = append(items, &pb.ItemAmount{IsNew: v.IsNew, ItemId: v.ItemId, Amount: v.Amount}) - // } - // } + grids = this.module.configure_comp.GetPackItemByType(pack, req.IType) } return } @@ -68,7 +63,7 @@ func (this *Api_Comp) UseItemReq(ctx context.Context, session comm.IUserSession, defer func() { session.SendMsg(string(this.module.GetType()), UseItemResp, code, &pb.UseItemResp{}) }() - if session.GetUserId() == "" { + if !session.IsLogin() { code = pb.ErrorCode_NoLogin return } @@ -84,7 +79,7 @@ func (this *Api_Comp) SellItemReq(ctx context.Context, session comm.IUserSession defer func() { session.SendMsg(string(this.module.GetType()), SellItemResp, code, &pb.SellItemResp{}) }() - if session.GetUserId() == "" { + if !session.IsLogin() { code = pb.ErrorCode_NoLogin return } diff --git a/modules/pack/configure_comp.go b/modules/pack/configure_comp.go index 8317bb466..aacc0e6cb 100644 --- a/modules/pack/configure_comp.go +++ b/modules/pack/configure_comp.go @@ -1,8 +1,18 @@ package pack import ( + "fmt" + "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" + cfg "go_dreamfactory/sys/configure/structs" + "github.com/liwei1dao/lego/core" "github.com/liwei1dao/lego/core/cbase" + "github.com/liwei1dao/lego/sys/log" +) + +const ( + game_item = "game_item.json" ) ///背包配置管理组件 @@ -12,9 +22,51 @@ type Configure_Comp struct { func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.ModuleCompBase.Init(service, module, comp, options) + configure.RegisterConfigure(game_item, cfg.NewGame_item) return } -func (this *Configure_Comp) GetItemConfigureData(id uint32) { - +//读取物品配置 +func (this *Configure_Comp) GetItemConfigure(id int32) (item *cfg.Game_itemData, err error) { + var ( + v interface{} + ok bool + ) + if v, err = configure.GetConfigure(game_item); err != nil { + return + } else { + if item, ok = v.(*cfg.Game_item).GetDataMap()[id]; !ok { + err = fmt.Errorf("no found item:%d configure", id) + return + } + } + return +} + +//获取指定类型的物品列表 +func (this *Configure_Comp) GetPackItemByType(pack *pb.DB_UserPackData, usetype int32) (result []*pb.DB_GridData) { + result = make([]*pb.DB_GridData, 0, len(pack.Pack)) + var ( + v interface{} + table *cfg.Game_item + item *cfg.Game_itemData + id int32 + ok bool + err error + ) + if v, err = configure.GetConfigure(game_item); err != nil { + return + } else { + table = v.(*cfg.Game_item) + for _, v := range pack.Pack { + if item, ok = table.GetDataMap()[id]; ok { + if item.Usetype == usetype { + result = append(result, v) + } + } else { + log.Errorf("no found itemConfigure:%d", id) + } + } + } + return } diff --git a/pb/mail.pb.go b/pb/mail.pb.go index e5e2522b9..5f8e0a3a3 100644 --- a/pb/mail.pb.go +++ b/pb/mail.pb.go @@ -167,7 +167,7 @@ type DB_UserMailData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `bson:"_id" json:"UserId,omitempty" protobuf:"bytes,1,opt,name=UserId,proto3"` //tags:{bson:"_id"}用户Id + UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty" bson:"_id"` //tags:{bson:"_id"}用户Id Mails []*MailData `protobuf:"bytes,2,rep,name=mails,proto3" json:"mails,omitempty"` // 邮件列表 } diff --git a/pb/pack_db.pb.go b/pb/pack_db.pb.go index 0dc1074bd..bea236e19 100644 --- a/pb/pack_db.pb.go +++ b/pb/pack_db.pb.go @@ -20,68 +20,21 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type ItemType int32 - -const ( - ItemType_Props ItemType = 0 //道具 - ItemType_Equip ItemType = 2 //装备 - ItemType_Fragment ItemType = 12 //碎片 -) - -// Enum value maps for ItemType. -var ( - ItemType_name = map[int32]string{ - 0: "Props", - 2: "Equip", - 12: "Fragment", - } - ItemType_value = map[string]int32{ - "Props": 0, - "Equip": 2, - "Fragment": 12, - } -) - -func (x ItemType) Enum() *ItemType { - p := new(ItemType) - *p = x - return p -} - -func (x ItemType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ItemType) Descriptor() protoreflect.EnumDescriptor { - return file_pack_db_proto_enumTypes[0].Descriptor() -} - -func (ItemType) Type() protoreflect.EnumType { - return &file_pack_db_proto_enumTypes[0] -} - -func (x ItemType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ItemType.Descriptor instead. -func (ItemType) EnumDescriptor() ([]byte, []int) { - return file_pack_db_proto_rawDescGZIP(), []int{0} -} - //背包格子 -type GridData struct { +type DB_GridData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - IsNew bool `protobuf:"varint,1,opt,name=IsNew,proto3" json:"IsNew,omitempty"` //是否是新的 - ItemId uint32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId,omitempty"` //存放物品的Id - Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"` //存放物品的数量 + GridId int32 `protobuf:"varint,1,opt,name=GridId,proto3" json:"GridId,omitempty"` //背包格子Id 所在背包数组的下表 + IsEmpty bool `protobuf:"varint,2,opt,name=IsEmpty,proto3" json:"IsEmpty,omitempty"` //是否是空格子 + ItemId int32 `protobuf:"varint,3,opt,name=ItemId,proto3" json:"ItemId,omitempty"` //存放物品的Id + Amount uint32 `protobuf:"varint,4,opt,name=Amount,proto3" json:"Amount,omitempty"` //存放物品的数量 + IsNewItem bool `protobuf:"varint,5,opt,name=IsNewItem,proto3" json:"IsNewItem,omitempty"` //是否是新的 } -func (x *GridData) Reset() { - *x = GridData{} +func (x *DB_GridData) Reset() { + *x = DB_GridData{} if protoimpl.UnsafeEnabled { mi := &file_pack_db_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -89,13 +42,13 @@ func (x *GridData) Reset() { } } -func (x *GridData) String() string { +func (x *DB_GridData) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GridData) ProtoMessage() {} +func (*DB_GridData) ProtoMessage() {} -func (x *GridData) ProtoReflect() protoreflect.Message { +func (x *DB_GridData) ProtoReflect() protoreflect.Message { mi := &file_pack_db_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -107,40 +60,54 @@ func (x *GridData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GridData.ProtoReflect.Descriptor instead. -func (*GridData) Descriptor() ([]byte, []int) { +// Deprecated: Use DB_GridData.ProtoReflect.Descriptor instead. +func (*DB_GridData) Descriptor() ([]byte, []int) { return file_pack_db_proto_rawDescGZIP(), []int{0} } -func (x *GridData) GetIsNew() bool { +func (x *DB_GridData) GetGridId() int32 { if x != nil { - return x.IsNew + return x.GridId + } + return 0 +} + +func (x *DB_GridData) GetIsEmpty() bool { + if x != nil { + return x.IsEmpty } return false } -func (x *GridData) GetItemId() uint32 { +func (x *DB_GridData) GetItemId() int32 { if x != nil { return x.ItemId } return 0 } -func (x *GridData) GetAmount() uint32 { +func (x *DB_GridData) GetAmount() uint32 { if x != nil { return x.Amount } return 0 } +func (x *DB_GridData) GetIsNewItem() bool { + if x != nil { + return x.IsNewItem + } + return false +} + //用户背包 type DB_UserPackData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `bson:"_id" json:"UserId,omitempty" protobuf:"bytes,1,opt,name=UserId,proto3"` //tags:{bson:"_id"}用户Id - Pack []*GridData `protobuf:"bytes,2,rep,name=Pack,proto3" json:"Pack,omitempty"` //背包列表 + UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty" bson:"_id"` //tags:{bson:"_id"}用户Id + Pack []*DB_GridData `protobuf:"bytes,2,rep,name=Pack,proto3" json:"Pack,omitempty"` //背包列表 } func (x *DB_UserPackData) Reset() { @@ -182,7 +149,7 @@ func (x *DB_UserPackData) GetUserId() string { return "" } -func (x *DB_UserPackData) GetPack() []*GridData { +func (x *DB_UserPackData) GetPack() []*DB_GridData { if x != nil { return x.Pack } @@ -193,20 +160,21 @@ var File_pack_db_proto protoreflect.FileDescriptor var file_pack_db_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x70, 0x61, 0x63, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x50, 0x0a, 0x08, 0x47, 0x72, 0x69, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x49, - 0x73, 0x4e, 0x65, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x73, 0x4e, 0x65, - 0x77, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x48, 0x0a, 0x0f, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, - 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x04, - 0x50, 0x61, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x47, 0x72, 0x69, - 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x50, 0x61, 0x63, 0x6b, 0x2a, 0x2e, 0x0a, 0x08, 0x49, - 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x70, 0x73, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x71, 0x75, 0x69, 0x70, 0x10, 0x02, 0x12, 0x0c, 0x0a, - 0x08, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x8d, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x47, 0x72, 0x69, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x73, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x49, 0x73, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x73, 0x4e, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x73, 0x4e, 0x65, 0x77, 0x49, 0x74, 0x65, 0x6d, 0x22, + 0x4b, 0x0a, 0x0f, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x04, 0x50, 0x61, + 0x63, 0x6b, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x5f, 0x47, 0x72, + 0x69, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x50, 0x61, 0x63, 0x6b, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -221,15 +189,13 @@ func file_pack_db_proto_rawDescGZIP() []byte { return file_pack_db_proto_rawDescData } -var file_pack_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_pack_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_pack_db_proto_goTypes = []interface{}{ - (ItemType)(0), // 0: ItemType - (*GridData)(nil), // 1: GridData - (*DB_UserPackData)(nil), // 2: DB_UserPackData + (*DB_GridData)(nil), // 0: DB_GridData + (*DB_UserPackData)(nil), // 1: DB_UserPackData } var file_pack_db_proto_depIdxs = []int32{ - 1, // 0: DB_UserPackData.Pack:type_name -> GridData + 0, // 0: DB_UserPackData.Pack:type_name -> DB_GridData 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -244,7 +210,7 @@ func file_pack_db_proto_init() { } if !protoimpl.UnsafeEnabled { file_pack_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GridData); i { + switch v := v.(*DB_GridData); i { case 0: return &v.state case 1: @@ -273,14 +239,13 @@ func file_pack_db_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pack_db_proto_rawDesc, - NumEnums: 1, + NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 0, }, GoTypes: file_pack_db_proto_goTypes, DependencyIndexes: file_pack_db_proto_depIdxs, - EnumInfos: file_pack_db_proto_enumTypes, MessageInfos: file_pack_db_proto_msgTypes, }.Build() File_pack_db_proto = out.File diff --git a/pb/pack_msg.pb.go b/pb/pack_msg.pb.go index c84a69c20..b8cb25588 100644 --- a/pb/pack_msg.pb.go +++ b/pb/pack_msg.pb.go @@ -20,83 +20,19 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -//物品数量 -type ItemAmount struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IsNew bool `protobuf:"varint,1,opt,name=IsNew,proto3" json:"IsNew,omitempty"` //是否是新的 - ItemId uint32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId,omitempty"` - Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"` -} - -func (x *ItemAmount) Reset() { - *x = ItemAmount{} - if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ItemAmount) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ItemAmount) ProtoMessage() {} - -func (x *ItemAmount) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ItemAmount.ProtoReflect.Descriptor instead. -func (*ItemAmount) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{0} -} - -func (x *ItemAmount) GetIsNew() bool { - if x != nil { - return x.IsNew - } - return false -} - -func (x *ItemAmount) GetItemId() uint32 { - if x != nil { - return x.ItemId - } - return 0 -} - -func (x *ItemAmount) GetAmount() uint32 { - if x != nil { - return x.Amount - } - return 0 -} - //查询用户背包请求 type QueryUserPackReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - IType ItemType `protobuf:"varint,1,opt,name=IType,proto3,enum=ItemType" json:"IType,omitempty"` + IType int32 `protobuf:"varint,1,opt,name=IType,proto3" json:"IType,omitempty"` } func (x *QueryUserPackReq) Reset() { *x = QueryUserPackReq{} if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[1] + mi := &file_pack_msg_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109,7 +45,7 @@ func (x *QueryUserPackReq) String() string { func (*QueryUserPackReq) ProtoMessage() {} func (x *QueryUserPackReq) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[1] + mi := &file_pack_msg_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122,14 +58,14 @@ func (x *QueryUserPackReq) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryUserPackReq.ProtoReflect.Descriptor instead. func (*QueryUserPackReq) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{1} + return file_pack_msg_proto_rawDescGZIP(), []int{0} } -func (x *QueryUserPackReq) GetIType() ItemType { +func (x *QueryUserPackReq) GetIType() int32 { if x != nil { return x.IType } - return ItemType_Props + return 0 } //查询用户背包请求 回应 @@ -138,13 +74,13 @@ type QueryUserPackResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Items []*ItemAmount `protobuf:"bytes,1,rep,name=Items,proto3" json:"Items,omitempty"` + Grids []*DB_GridData `protobuf:"bytes,1,rep,name=Grids,proto3" json:"Grids,omitempty"` } func (x *QueryUserPackResp) Reset() { *x = QueryUserPackResp{} if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[2] + mi := &file_pack_msg_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -157,7 +93,7 @@ func (x *QueryUserPackResp) String() string { func (*QueryUserPackResp) ProtoMessage() {} func (x *QueryUserPackResp) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[2] + mi := &file_pack_msg_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -170,12 +106,12 @@ func (x *QueryUserPackResp) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryUserPackResp.ProtoReflect.Descriptor instead. func (*QueryUserPackResp) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{2} + return file_pack_msg_proto_rawDescGZIP(), []int{1} } -func (x *QueryUserPackResp) GetItems() []*ItemAmount { +func (x *QueryUserPackResp) GetGrids() []*DB_GridData { if x != nil { - return x.Items + return x.Grids } return nil } @@ -186,14 +122,15 @@ type UseItemReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ItemId uint32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId,omitempty"` - Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"` + GridId int32 `protobuf:"varint,1,opt,name=GridId,proto3" json:"GridId,omitempty"` //格子Id + ItemId int32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId,omitempty"` //物品Id + Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"` //使用数量 } func (x *UseItemReq) Reset() { *x = UseItemReq{} if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[3] + mi := &file_pack_msg_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -206,7 +143,7 @@ func (x *UseItemReq) String() string { func (*UseItemReq) ProtoMessage() {} func (x *UseItemReq) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[3] + mi := &file_pack_msg_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -219,10 +156,17 @@ func (x *UseItemReq) ProtoReflect() protoreflect.Message { // Deprecated: Use UseItemReq.ProtoReflect.Descriptor instead. func (*UseItemReq) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{3} + return file_pack_msg_proto_rawDescGZIP(), []int{2} } -func (x *UseItemReq) GetItemId() uint32 { +func (x *UseItemReq) GetGridId() int32 { + if x != nil { + return x.GridId + } + return 0 +} + +func (x *UseItemReq) GetItemId() int32 { if x != nil { return x.ItemId } @@ -246,7 +190,7 @@ type UseItemResp struct { func (x *UseItemResp) Reset() { *x = UseItemResp{} if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[4] + mi := &file_pack_msg_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -259,7 +203,7 @@ func (x *UseItemResp) String() string { func (*UseItemResp) ProtoMessage() {} func (x *UseItemResp) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[4] + mi := &file_pack_msg_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -272,7 +216,7 @@ func (x *UseItemResp) ProtoReflect() protoreflect.Message { // Deprecated: Use UseItemResp.ProtoReflect.Descriptor instead. func (*UseItemResp) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{4} + return file_pack_msg_proto_rawDescGZIP(), []int{3} } //出售道具请求 @@ -281,14 +225,15 @@ type SellItemReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ItemId uint32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId,omitempty"` - Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"` + GridId int32 `protobuf:"varint,1,opt,name=GridId,proto3" json:"GridId,omitempty"` //格子Id + ItemId int32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId,omitempty"` //物品Id + Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"` //使用数量 } func (x *SellItemReq) Reset() { *x = SellItemReq{} if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[5] + mi := &file_pack_msg_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -301,7 +246,7 @@ func (x *SellItemReq) String() string { func (*SellItemReq) ProtoMessage() {} func (x *SellItemReq) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[5] + mi := &file_pack_msg_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -314,10 +259,17 @@ func (x *SellItemReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SellItemReq.ProtoReflect.Descriptor instead. func (*SellItemReq) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{5} + return file_pack_msg_proto_rawDescGZIP(), []int{4} } -func (x *SellItemReq) GetItemId() uint32 { +func (x *SellItemReq) GetGridId() int32 { + if x != nil { + return x.GridId + } + return 0 +} + +func (x *SellItemReq) GetItemId() int32 { if x != nil { return x.ItemId } @@ -341,7 +293,7 @@ type SellItemResp struct { func (x *SellItemResp) Reset() { *x = SellItemResp{} if protoimpl.UnsafeEnabled { - mi := &file_pack_msg_proto_msgTypes[6] + mi := &file_pack_msg_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -354,7 +306,7 @@ func (x *SellItemResp) String() string { func (*SellItemResp) ProtoMessage() {} func (x *SellItemResp) ProtoReflect() protoreflect.Message { - mi := &file_pack_msg_proto_msgTypes[6] + mi := &file_pack_msg_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -367,7 +319,7 @@ func (x *SellItemResp) ProtoReflect() protoreflect.Message { // Deprecated: Use SellItemResp.ProtoReflect.Descriptor instead. func (*SellItemResp) Descriptor() ([]byte, []int) { - return file_pack_msg_proto_rawDescGZIP(), []int{6} + return file_pack_msg_proto_rawDescGZIP(), []int{5} } var File_pack_msg_proto protoreflect.FileDescriptor @@ -375,29 +327,26 @@ var File_pack_msg_proto protoreflect.FileDescriptor var file_pack_msg_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x70, 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0d, 0x70, 0x61, 0x63, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x52, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x49, 0x73, 0x4e, 0x65, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x73, - 0x4e, 0x65, 0x77, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x33, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, - 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x05, 0x49, 0x54, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x05, 0x49, 0x54, 0x79, 0x70, 0x65, 0x22, 0x36, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, - 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x49, - 0x74, 0x65, 0x6d, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, - 0x22, 0x3c, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, - 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x28, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x49, 0x54, 0x79, 0x70, 0x65, 0x22, 0x37, 0x0a, 0x11, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, + 0x0a, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x44, 0x42, 0x5f, 0x47, 0x72, 0x69, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x47, 0x72, 0x69, + 0x64, 0x73, 0x22, 0x54, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, + 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x0d, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x49, + 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x22, 0x55, 0x0a, 0x0b, 0x53, 0x65, 0x6c, 0x6c, 0x49, + 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x0d, - 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x22, 0x3d, 0x0a, - 0x0b, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, - 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x49, 0x74, - 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x0e, 0x0a, 0x0c, - 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x0e, + 0x0a, 0x0c, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -412,25 +361,23 @@ func file_pack_msg_proto_rawDescGZIP() []byte { return file_pack_msg_proto_rawDescData } -var file_pack_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_pack_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_pack_msg_proto_goTypes = []interface{}{ - (*ItemAmount)(nil), // 0: ItemAmount - (*QueryUserPackReq)(nil), // 1: QueryUserPackReq - (*QueryUserPackResp)(nil), // 2: QueryUserPackResp - (*UseItemReq)(nil), // 3: UseItemReq - (*UseItemResp)(nil), // 4: UseItemResp - (*SellItemReq)(nil), // 5: SellItemReq - (*SellItemResp)(nil), // 6: SellItemResp - (ItemType)(0), // 7: ItemType + (*QueryUserPackReq)(nil), // 0: QueryUserPackReq + (*QueryUserPackResp)(nil), // 1: QueryUserPackResp + (*UseItemReq)(nil), // 2: UseItemReq + (*UseItemResp)(nil), // 3: UseItemResp + (*SellItemReq)(nil), // 4: SellItemReq + (*SellItemResp)(nil), // 5: SellItemResp + (*DB_GridData)(nil), // 6: DB_GridData } var file_pack_msg_proto_depIdxs = []int32{ - 7, // 0: QueryUserPackReq.IType:type_name -> ItemType - 0, // 1: QueryUserPackResp.Items:type_name -> ItemAmount - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 6, // 0: QueryUserPackResp.Grids:type_name -> DB_GridData + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_pack_msg_proto_init() } @@ -441,18 +388,6 @@ func file_pack_msg_proto_init() { file_pack_db_proto_init() if !protoimpl.UnsafeEnabled { file_pack_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ItemAmount); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pack_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryUserPackReq); i { case 0: return &v.state @@ -464,7 +399,7 @@ func file_pack_msg_proto_init() { return nil } } - file_pack_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_pack_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryUserPackResp); i { case 0: return &v.state @@ -476,7 +411,7 @@ func file_pack_msg_proto_init() { return nil } } - file_pack_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_pack_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UseItemReq); i { case 0: return &v.state @@ -488,7 +423,7 @@ func file_pack_msg_proto_init() { return nil } } - file_pack_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_pack_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UseItemResp); i { case 0: return &v.state @@ -500,7 +435,7 @@ func file_pack_msg_proto_init() { return nil } } - file_pack_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_pack_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SellItemReq); i { case 0: return &v.state @@ -512,7 +447,7 @@ func file_pack_msg_proto_init() { return nil } } - file_pack_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_pack_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SellItemResp); i { case 0: return &v.state @@ -531,7 +466,7 @@ func file_pack_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pack_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/proto/pack_db.proto b/pb/proto/pack_db.proto index 1f144c70e..7ac9d4d92 100644 --- a/pb/proto/pack_db.proto +++ b/pb/proto/pack_db.proto @@ -1,21 +1,17 @@ syntax = "proto3"; option go_package = ".;pb"; -enum ItemType { - Props = 0; //道具 - Equip = 2; //装备 - Fragment = 12; //碎片 -} - //背包格子 -message GridData { - bool IsNew = 1; //是否是新的 - uint32 ItemId = 2; //存放物品的Id - uint32 Amount = 3; //存放物品的数量 +message DB_GridData { + int32 GridId = 1; //背包格子Id 所在背包数组的下表 + bool IsEmpty = 2; //是否是空格子 + int32 ItemId = 3; //存放物品的Id + uint32 Amount = 4; //存放物品的数量 + bool IsNewItem = 5; //是否是新的 } //用户背包 message DB_UserPackData { string UserId = 1; //tags:{bson:"_id"}用户Id - repeated GridData Pack = 2; //背包列表 + repeated DB_GridData Pack = 2; //背包列表 } \ No newline at end of file diff --git a/pb/proto/pack_msg.proto b/pb/proto/pack_msg.proto index cf7b4661e..995560832 100644 --- a/pb/proto/pack_msg.proto +++ b/pb/proto/pack_msg.proto @@ -2,27 +2,21 @@ syntax = "proto3"; option go_package = ".;pb"; import "pack_db.proto"; -//物品数量 -message ItemAmount { - bool IsNew = 1; //是否是新的 - uint32 ItemId = 2; - uint32 Amount = 3; -} - //查询用户背包请求 message QueryUserPackReq { - ItemType IType = 1; + int32 IType = 1; } //查询用户背包请求 回应 message QueryUserPackResp { - repeated ItemAmount Items = 1; + repeated DB_GridData Grids = 1; } //使用物品请求 message UseItemReq { - uint32 ItemId = 2; - uint32 Amount = 3; + int32 GridId = 1; //格子Id + int32 ItemId = 2; //物品Id + uint32 Amount = 3; //使用数量 } //使用物品请求 回应 @@ -32,8 +26,9 @@ message UseItemResp { //出售道具请求 message SellItemReq { - uint32 ItemId = 2; - uint32 Amount = 3; + int32 GridId = 1; //格子Id + int32 ItemId = 2; //物品Id + uint32 Amount = 3; //使用数量 } //出售道具请求 回应 diff --git a/pb/user_db.pb.go b/pb/user_db.pb.go index 2c4b65c99..06f7a4715 100644 --- a/pb/user_db.pb.go +++ b/pb/user_db.pb.go @@ -88,8 +88,8 @@ type DB_UserData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `bson:"_id" json:"UserId,omitempty" protobuf:"bytes,1,opt,name=UserId,proto3"` //tags:{bson:"_id"}动态Id - Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account,omitempty"` + UserId string `protobuf:"bytes,1,opt,name=UserId,proto3" json:"UserId,omitempty" bson:"_id"` //tags:{bson:"_id"}动态Id + Account string `protobuf:"bytes,2,opt,name=Account,proto3" json:"Account,omitempty"` NiceName string `protobuf:"bytes,3,opt,name=NiceName,proto3" json:"NiceName,omitempty"` Email string `protobuf:"bytes,4,opt,name=Email,proto3" json:"Email,omitempty"` Password string `protobuf:"bytes,5,opt,name=Password,proto3" json:"Password,omitempty"` @@ -177,8 +177,8 @@ var file_user_db_proto_rawDesc = []byte{ 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0x8d, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65, + 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, diff --git a/sys/cache/pack.go b/sys/cache/pack.go index 8465fa099..47a7ac56f 100644 --- a/sys/cache/pack.go +++ b/sys/cache/pack.go @@ -13,21 +13,23 @@ const ( //Redis Redis_PackCache string = "pack:%s" ) -const () +const ( + GridCapMaxNum = 90 //单个格子的最大容量 +) type IPack interface { - QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) + Pack_QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) } ///查询用户背包数据 -func (this *Cache) QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) { +func (this *Cache) Pack_QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) { pack = &pb.DB_UserPackData{ UserId: uId, } if err = this.redis.Get(fmt.Sprintf(Redis_PackCache, uId), pack); err == nil { return } else if err == redis.RedisNil { - if pack, err = db.Defsys.QueryUserPack(uId); err == nil { + if pack, err = db.Defsys.Pack_QueryUserPack(uId); err == nil { this.redis.Set(fmt.Sprintf(Redis_PackCache, uId), pack, -1) } else if err == mgo.MongodbNil { err = nil @@ -36,8 +38,49 @@ func (this *Cache) QueryUserPack(uId string) (pack *pb.DB_UserPackData, err erro return } -///查询用户背包数据 -func (this *Cache) UpdateUserPack(pack *pb.DB_UserPackData) (err error) { - err = this.redis.Set(fmt.Sprintf(Redis_PackCache, pack.UserId), pack, -1) +///添加或则减少物品到用户背包 +func (this *Cache) Pack_AddItemToUserPack(uId string, itemId int32, addnum int32) (err error) { + var ( + pack *pb.DB_UserPackData + modifys []*pb.DB_GridData + leftnum int64 + num int64 + ) + if addnum == 0 { + return + } + if pack, err = this.Pack_QueryUserPack(uId); err != nil { + return + } + leftnum = int64(addnum) + modifys = make([]*pb.DB_GridData, 0) + for _, v := range pack.Pack { + if !v.IsEmpty && v.ItemId == itemId { + num = int64(v.Amount) + int64(leftnum) + if num < 0 { + leftnum += int64(v.Amount) + v.Amount = 0 + modifys = append(modifys, v) + } else if num > 0 && num < int64(v.Amount) { + leftnum = 0 + v.Amount = uint32(num) + modifys = append(modifys, v) + break + } else if num > 0 && num > int64(v.Amount) { + if num <= GridCapMaxNum { + leftnum = 0 + v.Amount = uint32(num) + modifys = append(modifys, v) + break + } else { + if v.Amount < GridCapMaxNum { + leftnum = int64(num - int64(v.Amount)) + v.Amount = uint32(num) + modifys = append(modifys, v) + } + } + } + } + } return } diff --git a/sys/configure/structs/game.extservers.go b/sys/configure/structs/game.extservers.go new file mode 100644 index 000000000..fad235100 --- /dev/null +++ b/sys/configure/structs/game.extservers.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 Game_extservers struct { + _dataMap map[string]*Game_extserversData + _dataList []*Game_extserversData +} + +func NewGame_extservers(_buf []map[string]interface{}) (*Game_extservers, error) { + _dataList := make([]*Game_extserversData, 0, len(_buf)) + dataMap := make(map[string]*Game_extserversData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_extserversData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Name] = _v + } + } + return &Game_extservers{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_extservers) GetDataMap() map[string]*Game_extserversData { + return table._dataMap +} + +func (table *Game_extservers) GetDataList() []*Game_extserversData { + return table._dataList +} + +func (table *Game_extservers) Get(key string) *Game_extserversData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.extserversData.go b/sys/configure/structs/game.extserversData.go new file mode 100644 index 000000000..d5eea37bd --- /dev/null +++ b/sys/configure/structs/game.extserversData.go @@ -0,0 +1,27 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_extserversData struct { + Name string + Ips string +} + +func (Game_extserversData) GetTypeId() int { + return -245856747 +} + +func NewGame_extserversData(_buf map[string]interface{}) (_v *Game_extserversData, err error) { + _v = &Game_extserversData{} + { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } + { var _ok_ bool; if _v.Ips, _ok_ = _buf["ips"].(string); !_ok_ { err = errors.New("ips error"); return } } + return +} diff --git a/sys/configure/structs/game.hero.go b/sys/configure/structs/game.hero.go new file mode 100644 index 000000000..c324154bb --- /dev/null +++ b/sys/configure/structs/game.hero.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 Game_hero struct { + _dataMap map[string]*Game_heroData + _dataList []*Game_heroData +} + +func NewGame_hero(_buf []map[string]interface{}) (*Game_hero, error) { + _dataList := make([]*Game_heroData, 0, len(_buf)) + dataMap := make(map[string]*Game_heroData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_heroData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &Game_hero{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_hero) GetDataMap() map[string]*Game_heroData { + return table._dataMap +} + +func (table *Game_hero) GetDataList() []*Game_heroData { + return table._dataList +} + +func (table *Game_hero) Get(key string) *Game_heroData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.heroData.go b/sys/configure/structs/game.heroData.go new file mode 100644 index 000000000..4a6d26849 --- /dev/null +++ b/sys/configure/structs/game.heroData.go @@ -0,0 +1,69 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_heroData struct { + Id string + Name string + Star int32 + Color int32 + Chengwei int32 + Zhongzu int32 + Job int32 + Type int32 + Prefab string + Icon string + Sound string + Tujing string + Hpgrow string + Atkgrow string + Defgrow string + Speedgrow string + Hp string + Atk string + Def string + Speed string + Intr string + Events string + Cite string +} + +func (Game_heroData) GetTypeId() int { + return 650222912 +} + +func NewGame_heroData(_buf map[string]interface{}) (_v *Game_heroData, err error) { + _v = &Game_heroData{} + { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } + { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["chengwei"].(float64); !_ok_ { err = errors.New("chengwei error"); return }; _v.Chengwei = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["zhongzu"].(float64); !_ok_ { err = errors.New("zhongzu error"); return }; _v.Zhongzu = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["job"].(float64); !_ok_ { err = errors.New("job error"); return }; _v.Job = int32(_tempNum_) } + { 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; if _v.Prefab, _ok_ = _buf["prefab"].(string); !_ok_ { err = errors.New("prefab error"); return } } + { var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } } + { var _ok_ bool; if _v.Sound, _ok_ = _buf["sound"].(string); !_ok_ { err = errors.New("sound error"); return } } + { var _ok_ bool; if _v.Tujing, _ok_ = _buf["tujing"].(string); !_ok_ { err = errors.New("tujing error"); return } } + { var _ok_ bool; if _v.Hpgrow, _ok_ = _buf["hpgrow"].(string); !_ok_ { err = errors.New("hpgrow error"); return } } + { var _ok_ bool; if _v.Atkgrow, _ok_ = _buf["atkgrow"].(string); !_ok_ { err = errors.New("atkgrow error"); return } } + { var _ok_ bool; if _v.Defgrow, _ok_ = _buf["defgrow"].(string); !_ok_ { err = errors.New("defgrow error"); return } } + { var _ok_ bool; if _v.Speedgrow, _ok_ = _buf["speedgrow"].(string); !_ok_ { err = errors.New("speedgrow error"); return } } + { var _ok_ bool; if _v.Hp, _ok_ = _buf["hp"].(string); !_ok_ { err = errors.New("hp error"); return } } + { var _ok_ bool; if _v.Atk, _ok_ = _buf["atk"].(string); !_ok_ { err = errors.New("atk error"); return } } + { var _ok_ bool; if _v.Def, _ok_ = _buf["def"].(string); !_ok_ { err = errors.New("def error"); return } } + { var _ok_ bool; if _v.Speed, _ok_ = _buf["speed"].(string); !_ok_ { err = errors.New("speed error"); return } } + { var _ok_ bool; if _v.Intr, _ok_ = _buf["intr"].(string); !_ok_ { err = errors.New("intr error"); return } } + { var _ok_ bool; if _v.Events, _ok_ = _buf["events"].(string); !_ok_ { err = errors.New("events error"); return } } + { var _ok_ bool; if _v.Cite, _ok_ = _buf["cite"].(string); !_ok_ { err = errors.New("cite error"); return } } + return +} diff --git a/sys/configure/structs/game.item.go b/sys/configure/structs/game.item.go new file mode 100644 index 000000000..98a567268 --- /dev/null +++ b/sys/configure/structs/game.item.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 Game_item struct { + _dataMap map[int32]*Game_itemData + _dataList []*Game_itemData +} + +func NewGame_item(_buf []map[string]interface{}) (*Game_item, error) { + _dataList := make([]*Game_itemData, 0, len(_buf)) + dataMap := make(map[int32]*Game_itemData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_itemData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Itemid] = _v + } + } + return &Game_item{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_item) GetDataMap() map[int32]*Game_itemData { + return table._dataMap +} + +func (table *Game_item) GetDataList() []*Game_itemData { + return table._dataList +} + +func (table *Game_item) Get(key int32) *Game_itemData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.itemData.go b/sys/configure/structs/game.itemData.go new file mode 100644 index 000000000..2c5b2ee64 --- /dev/null +++ b/sys/configure/structs/game.itemData.go @@ -0,0 +1,63 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_itemData struct { + Itemid int32 + Name string + Usetype int32 + Color int32 + Bagtype string + Index int32 + Texiao string + Dlp int32 + Hcnum int32 + Htype int32 + Tujing int32 + Usetz int32 + Shuliangshangxian int32 + Uselv int32 + Ismutil int32 + Type int32 + Img string + Ico string + Intr string + Sale string +} + +func (Game_itemData) GetTypeId() int { + return -1848306727 +} + +func NewGame_itemData(_buf map[string]interface{}) (_v *Game_itemData, err error) { + _v = &Game_itemData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["itemid"].(float64); !_ok_ { err = errors.New("itemid error"); return }; _v.Itemid = int32(_tempNum_) } + { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["usetype"].(float64); !_ok_ { err = errors.New("usetype error"); return }; _v.Usetype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) } + { var _ok_ bool; if _v.Bagtype, _ok_ = _buf["bagtype"].(string); !_ok_ { err = errors.New("bagtype error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["index"].(float64); !_ok_ { err = errors.New("index error"); return }; _v.Index = int32(_tempNum_) } + { var _ok_ bool; if _v.Texiao, _ok_ = _buf["texiao"].(string); !_ok_ { err = errors.New("texiao error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dlp"].(float64); !_ok_ { err = errors.New("dlp error"); return }; _v.Dlp = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hcnum"].(float64); !_ok_ { err = errors.New("hcnum error"); return }; _v.Hcnum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["htype"].(float64); !_ok_ { err = errors.New("htype error"); return }; _v.Htype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tujing"].(float64); !_ok_ { err = errors.New("tujing error"); return }; _v.Tujing = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["usetz"].(float64); !_ok_ { err = errors.New("usetz error"); return }; _v.Usetz = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["shuliangshangxian"].(float64); !_ok_ { err = errors.New("shuliangshangxian error"); return }; _v.Shuliangshangxian = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["uselv"].(float64); !_ok_ { err = errors.New("uselv error"); return }; _v.Uselv = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ismutil"].(float64); !_ok_ { err = errors.New("ismutil error"); return }; _v.Ismutil = int32(_tempNum_) } + { 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; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } } + { var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } } + { var _ok_ bool; if _v.Intr, _ok_ = _buf["intr"].(string); !_ok_ { err = errors.New("intr error"); return } } + { var _ok_ bool; if _v.Sale, _ok_ = _buf["sale"].(string); !_ok_ { err = errors.New("sale error"); return } } + return +} diff --git a/sys/configure/structs/game.language.go b/sys/configure/structs/game.language.go new file mode 100644 index 000000000..0c4024d2e --- /dev/null +++ b/sys/configure/structs/game.language.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 Game_language struct { + _dataMap map[string]*Game_languageData + _dataList []*Game_languageData +} + +func NewGame_language(_buf []map[string]interface{}) (*Game_language, error) { + _dataList := make([]*Game_languageData, 0, len(_buf)) + dataMap := make(map[string]*Game_languageData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_languageData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &Game_language{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_language) GetDataMap() map[string]*Game_languageData { + return table._dataMap +} + +func (table *Game_language) GetDataList() []*Game_languageData { + return table._dataList +} + +func (table *Game_language) Get(key string) *Game_languageData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.languageData.go b/sys/configure/structs/game.languageData.go new file mode 100644 index 000000000..fd0a408e2 --- /dev/null +++ b/sys/configure/structs/game.languageData.go @@ -0,0 +1,43 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_languageData struct { + Id string + Maps map[string]string +} + +func (Game_languageData) GetTypeId() int { + return -1436621922 +} + +func NewGame_languageData(_buf map[string]interface{}) (_v *Game_languageData, err error) { + _v = &Game_languageData{} + { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["maps"].([]interface{}); !_ok_ { err = errors.New("maps error"); return } + + _v.Maps = make(map[string]string) + + for _, _e_ := range _arr_ { + var _kv_ []interface{} + if _kv_, _ok_ = _e_.([]interface{}); !_ok_ || len(_kv_) != 2 { err = errors.New("maps error"); return } + var _key_ string + { if _key_, _ok_ = _kv_[0].(string); !_ok_ { err = errors.New("_key_ error"); return } } + var _value_ string + { if _value_, _ok_ = _kv_[1].(string); !_ok_ { err = errors.New("_value_ error"); return } } + _v.Maps[_key_] = _value_ + } + } + return +} diff --git a/sys/configure/structs/game.plot.go b/sys/configure/structs/game.plot.go new file mode 100644 index 000000000..dc383d4cf --- /dev/null +++ b/sys/configure/structs/game.plot.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 Game_plot struct { + _dataMap map[int32]*Game_plotData + _dataList []*Game_plotData +} + +func NewGame_plot(_buf []map[string]interface{}) (*Game_plot, error) { + _dataList := make([]*Game_plotData, 0, len(_buf)) + dataMap := make(map[int32]*Game_plotData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_plotData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Sameid] = _v + } + } + return &Game_plot{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_plot) GetDataMap() map[int32]*Game_plotData { + return table._dataMap +} + +func (table *Game_plot) GetDataList() []*Game_plotData { + return table._dataList +} + +func (table *Game_plot) Get(key int32) *Game_plotData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.plotData.go b/sys/configure/structs/game.plotData.go new file mode 100644 index 000000000..de75b0825 --- /dev/null +++ b/sys/configure/structs/game.plotData.go @@ -0,0 +1,31 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_plotData struct { + Sameid int32 + Skip bool + Name string + Describe string +} + +func (Game_plotData) GetTypeId() int { + return -750874969 +} + +func NewGame_plotData(_buf map[string]interface{}) (_v *Game_plotData, err error) { + _v = &Game_plotData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sameid"].(float64); !_ok_ { err = errors.New("sameid error"); return }; _v.Sameid = int32(_tempNum_) } + { var _ok_ bool; if _v.Skip, _ok_ = _buf["skip"].(bool); !_ok_ { err = errors.New("skip error"); return } } + { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } + { var _ok_ bool; if _v.Describe, _ok_ = _buf["describe"].(string); !_ok_ { err = errors.New("describe error"); return } } + return +} diff --git a/sys/configure/structs/game.skill.go b/sys/configure/structs/game.skill.go new file mode 100644 index 000000000..fdda767b1 --- /dev/null +++ b/sys/configure/structs/game.skill.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 Game_skill struct { + _dataMap map[int32]*Game_skillData + _dataList []*Game_skillData +} + +func NewGame_skill(_buf []map[string]interface{}) (*Game_skill, error) { + _dataList := make([]*Game_skillData, 0, len(_buf)) + dataMap := make(map[int32]*Game_skillData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_skillData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Sameid] = _v + } + } + return &Game_skill{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_skill) GetDataMap() map[int32]*Game_skillData { + return table._dataMap +} + +func (table *Game_skill) GetDataList() []*Game_skillData { + return table._dataList +} + +func (table *Game_skill) Get(key int32) *Game_skillData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.skillData.go b/sys/configure/structs/game.skillData.go new file mode 100644 index 000000000..e7a12f314 --- /dev/null +++ b/sys/configure/structs/game.skillData.go @@ -0,0 +1,43 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_skillData struct { + Sameid int32 + Heroid int32 + Lv int32 + Type int32 + Skilllv int32 + Act string + Skill string + Tubiao string + Name string + Describe string +} + +func (Game_skillData) GetTypeId() int { + return -1600555361 +} + +func NewGame_skillData(_buf map[string]interface{}) (_v *Game_skillData, err error) { + _v = &Game_skillData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sameid"].(float64); !_ok_ { err = errors.New("sameid error"); return }; _v.Sameid = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["heroid"].(float64); !_ok_ { err = errors.New("heroid error"); return }; _v.Heroid = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) } + { 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["skilllv"].(float64); !_ok_ { err = errors.New("skilllv error"); return }; _v.Skilllv = int32(_tempNum_) } + { var _ok_ bool; if _v.Act, _ok_ = _buf["act"].(string); !_ok_ { err = errors.New("act error"); return } } + { var _ok_ bool; if _v.Skill, _ok_ = _buf["skill"].(string); !_ok_ { err = errors.New("skill error"); return } } + { var _ok_ bool; if _v.Tubiao, _ok_ = _buf["tubiao"].(string); !_ok_ { err = errors.New("tubiao error"); return } } + { var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } } + { var _ok_ bool; if _v.Describe, _ok_ = _buf["describe"].(string); !_ok_ { err = errors.New("describe error"); return } } + return +} diff --git a/sys/configure/structs/game.ui.go b/sys/configure/structs/game.ui.go new file mode 100644 index 000000000..b10aa45ea --- /dev/null +++ b/sys/configure/structs/game.ui.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 Game_ui struct { + _dataMap map[string]*Game_uiData + _dataList []*Game_uiData +} + +func NewGame_ui(_buf []map[string]interface{}) (*Game_ui, error) { + _dataList := make([]*Game_uiData, 0, len(_buf)) + dataMap := make(map[string]*Game_uiData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_uiData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &Game_ui{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_ui) GetDataMap() map[string]*Game_uiData { + return table._dataMap +} + +func (table *Game_ui) GetDataList() []*Game_uiData { + return table._dataList +} + +func (table *Game_ui) Get(key string) *Game_uiData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.uiData.go b/sys/configure/structs/game.uiData.go new file mode 100644 index 000000000..38b81fb85 --- /dev/null +++ b/sys/configure/structs/game.uiData.go @@ -0,0 +1,43 @@ + +//------------------------------------------------------------------------------ +// +// 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 Game_uiData struct { + Id string + File string + Unloadpkg int32 + Loadtype int32 + Full int32 + Blur int32 + Package string + Packagename string + Comname string + Des string +} + +func (Game_uiData) GetTypeId() int { + return -473993766 +} + +func NewGame_uiData(_buf map[string]interface{}) (_v *Game_uiData, err error) { + _v = &Game_uiData{} + { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } + { var _ok_ bool; if _v.File, _ok_ = _buf["file"].(string); !_ok_ { err = errors.New("file error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["unloadpkg"].(float64); !_ok_ { err = errors.New("unloadpkg error"); return }; _v.Unloadpkg = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["loadtype"].(float64); !_ok_ { err = errors.New("loadtype error"); return }; _v.Loadtype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["full"].(float64); !_ok_ { err = errors.New("full error"); return }; _v.Full = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["blur"].(float64); !_ok_ { err = errors.New("blur error"); return }; _v.Blur = int32(_tempNum_) } + { var _ok_ bool; if _v.Package, _ok_ = _buf["package"].(string); !_ok_ { err = errors.New("package error"); return } } + { var _ok_ bool; if _v.Packagename, _ok_ = _buf["packagename"].(string); !_ok_ { err = errors.New("packagename error"); return } } + { var _ok_ bool; if _v.Comname, _ok_ = _buf["comname"].(string); !_ok_ { err = errors.New("comname error"); return } } + { var _ok_ bool; if _v.Des, _ok_ = _buf["des"].(string); !_ok_ { err = errors.New("des error"); return } } + return +} diff --git a/sys/db/pack.go b/sys/db/pack.go index b50b51f62..b159c3caf 100644 --- a/sys/db/pack.go +++ b/sys/db/pack.go @@ -1,10 +1,12 @@ package db import ( + "fmt" "go_dreamfactory/pb" "github.com/liwei1dao/lego/core" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo/options" ) const ( //Redis @@ -12,12 +14,63 @@ const ( //Redis ) type IPack interface { - QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) + Pack_InitUserPack(uId string) (pack *pb.DB_UserPackData, err error) + Pack_QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) + Pack_UpdateGridToUserPack(uId string, grids ...*pb.DB_GridData) (pack *pb.DB_UserPackData, err error) +} + +func (this *DB) Pack_InitUserPack(uId string) (pack *pb.DB_UserPackData, err error) { + pack = &pb.DB_UserPackData{UserId: uId, Pack: make([]*pb.DB_GridData, 0)} + _, err = this.mgo.InsertOne(DB_PackTable, pack) + return } ///查询用户背包数据 -func (this *DB) QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) { +func (this *DB) Pack_QueryUserPack(uId string) (pack *pb.DB_UserPackData, err error) { pack = &pb.DB_UserPackData{} err = this.mgo.FindOne(DB_PackTable, bson.M{"_id": uId}).Decode(pack) return } + +//更新背包格子数据 +func (this *DB) Pack_UpdateGridToUserPack(uId string, grids ...*pb.DB_GridData) (pack *pb.DB_UserPackData, err error) { + pack = &pb.DB_UserPackData{} + update := bson.M{} + for _, v := range grids { + update[fmt.Sprintf("pack.%d.gridid", v.GridId)] = v.GridId + update[fmt.Sprintf("pack.%d.isempty", v.GridId)] = v.IsEmpty + update[fmt.Sprintf("pack.%d.itemid", v.GridId)] = v.ItemId + update[fmt.Sprintf("pack.%d.amount", v.GridId)] = v.Amount + update[fmt.Sprintf("pack.%d.isnewitem", v.GridId)] = v.IsNewItem + } + + err = this.mgo.FindOneAndUpdate(DB_PackTable, + bson.M{"_id": uId}, + bson.M{"$set": update}, + options.FindOneAndUpdate().SetUpsert(true).SetReturnDocument(options.After)).Decode(pack) + return +} + +//更新背包格子物品的数据 +func (this *DB) Pack_AddGridAmountToUserPack(uId string, grid int32, amount int32) (pack *pb.DB_UserPackData, err error) { + pack = &pb.DB_UserPackData{} + err = this.mgo.FindOneAndUpdate(DB_PackTable, + bson.M{"_id": uId}, + bson.M{"$inc": bson.M{ + fmt.Sprintf("pack.%d.amount", grid): amount, + }}, + options.FindOneAndUpdate().SetUpsert(true).SetReturnDocument(options.After)).Decode(pack) + return +} + +//修改背包格子IsNew标识 +func (this *DB) Pack_ModifyPackGridIsNewItem(uId string, grids []int32) (pack *pb.DB_UserPackData, err error) { + pack = &pb.DB_UserPackData{} + identifier := []interface{}{bson.M{"item.gridid": bson.M{"$in": grids}}} + err = this.mgo.FindOneAndUpdate(DB_PackTable, + bson.M{"_id": uId}, + bson.M{"$set": bson.M{ + "pack.$[item].isNewitem": false, + }}, options.FindOneAndUpdate().SetArrayFilters(options.ArrayFilters{Filters: identifier}).SetReturnDocument(options.After)).Decode(pack) + return +} diff --git a/sys/db/pack_test.go b/sys/db/pack_test.go new file mode 100644 index 000000000..8123bb5a9 --- /dev/null +++ b/sys/db/pack_test.go @@ -0,0 +1,58 @@ +package db + +import ( + "go_dreamfactory/pb" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Pack_InitUserPack(t *testing.T) { + _, err := db.Pack_InitUserPack("liwei1dao") + require.Nil(t, err) +} + +func Test_Pack_UpdateGridToUserPack(t *testing.T) { + data, err := db.Pack_UpdateGridToUserPack("liwei1dao", + &pb.DB_GridData{ + + GridId: 0, + IsEmpty: false, + ItemId: 1001, + Amount: 202, + IsNewItem: true, + }, + &pb.DB_GridData{ + GridId: 1, + IsEmpty: false, + ItemId: 1002, + Amount: 202, + IsNewItem: true, + }, + &pb.DB_GridData{ + GridId: 2, + IsEmpty: false, + ItemId: 1003, + Amount: 202, + IsNewItem: true, + }, + ) + require.Nil(t, err) + require.Nil(t, data) +} +func Test_Pack_QueryUserPack(t *testing.T) { + data, err := db.Pack_QueryUserPack("liwei1dao") + require.Nil(t, err) + require.Nil(t, data) +} + +func Test_Pack_UpdateGridAmountToUserPack(t *testing.T) { + data, err := db.Pack_AddGridAmountToUserPack("liwei1dao", 0, 102) + require.Nil(t, err) + require.Nil(t, data) +} +func Test_Pack_ModifyPackGridIsNewItem(t *testing.T) { + data, err := db.Pack_ModifyPackGridIsNewItem("liwei1dao", []int32{0, 1}) + require.Nil(t, err) + require.Nil(t, data) +}