From eaf2c07678d7225ca6791a1c5068baa77ff21d7f Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 2 Jun 2023 22:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_heroconvertdata.json | 8 +- bin/json/game_item.json | 98 ++++-- bin/json/game_navigation.json | 298 +++++++++++-------- bin/json/game_worldtask.json | 4 +- comm/core.go | 18 +- modules/tools/comp_configure.go | 19 +- sys/configure/structs/Game.NavigationData.go | 2 + 7 files changed, 279 insertions(+), 168 deletions(-) diff --git a/bin/json/game_heroconvertdata.json b/bin/json/game_heroconvertdata.json index e59075f0f..dc3b5b670 100644 --- a/bin/json/game_heroconvertdata.json +++ b/bin/json/game_heroconvertdata.json @@ -1,18 +1,18 @@ [ { "race": 1, - "id": "14010111" + "id": "15000101" }, { "race": 2, - "id": "14010212" + "id": "15000102" }, { "race": 3, - "id": "14010313" + "id": "15000103" }, { "race": 4, - "id": "14010414" + "id": "15000104" } ] \ No newline at end of file diff --git a/bin/json/game_item.json b/bin/json/game_item.json index fc0177d46..904883b2d 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -4270,7 +4270,7 @@ "box_id": 0, "synthetize_num": 0, "access": [ - 10005 + 123 ], "use_skip": 155, "upper_limit": 999, @@ -7751,8 +7751,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000201, + "synthetize_num": 3, "access": [ 168 ], @@ -7788,8 +7788,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000202, + "synthetize_num": 3, "access": [ 168 ], @@ -7825,8 +7825,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000203, + "synthetize_num": 3, "access": [ 168 ], @@ -7862,8 +7862,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000204, + "synthetize_num": 3, "access": [ 168 ], @@ -7899,8 +7899,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000301, + "synthetize_num": 3, "access": [ 168 ], @@ -7919,7 +7919,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000201", + "n": 4 + } + ] }, { "id": "15000202", @@ -7936,8 +7942,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000302, + "synthetize_num": 3, "access": [ 168 ], @@ -7956,7 +7962,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000202", + "n": 4 + } + ] }, { "id": "15000203", @@ -7973,8 +7985,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000303, + "synthetize_num": 3, "access": [ 168 ], @@ -7993,7 +8005,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000203", + "n": 4 + } + ] }, { "id": "15000204", @@ -8010,8 +8028,8 @@ "reddottype": 0, "effects": "", "modelName": "", - "box_id": 0, - "synthetize_num": 0, + "box_id": 15000304, + "synthetize_num": 3, "access": [ 168 ], @@ -8030,7 +8048,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000204", + "n": 4 + } + ] }, { "id": "15000301", @@ -8067,7 +8091,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000301", + "n": 4 + } + ] }, { "id": "15000302", @@ -8104,7 +8134,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000302", + "n": 4 + } + ] }, { "id": "15000303", @@ -8141,7 +8177,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000303", + "n": 4 + } + ] }, { "id": "15000304", @@ -8178,7 +8220,13 @@ } ], "synthetize_deplete": [], - "decompose_deplete": [] + "decompose_deplete": [ + { + "a": "item", + "t": "15000304", + "n": 4 + } + ] }, { "id": "10000007", diff --git a/bin/json/game_navigation.json b/bin/json/game_navigation.json index 1da94d079..633108a78 100644 --- a/bin/json/game_navigation.json +++ b/bin/json/game_navigation.json @@ -14,7 +14,8 @@ "npcName": [ "功能入口-商人" ], - "functionicon": "icon_sd" + "functionicon": "icon_sd", + "mainscreen": "" }, { "Id": 2, @@ -31,7 +32,8 @@ "npcName": [ "功能入口-公告" ], - "functionicon": "icon_gg" + "functionicon": "icon_gg", + "mainscreen": "" }, { "Id": 3, @@ -48,7 +50,8 @@ "npcName": [ "功能入口-邮件" ], - "functionicon": "icon_yj" + "functionicon": "icon_yj", + "mainscreen": "" }, { "Id": 4, @@ -65,211 +68,260 @@ "npcName": [ "功能入口-捕羊大赛" ], - "functionicon": "ty_qp_by" + "functionicon": "ty_qp_by", + "mainscreen": "" }, { "Id": 6, "scene": "GameMain", + "scenename": { + "key": "navigation_Sheet1_scenename_5", + "text": "中轴城" + }, + "sceneicon": "ty_qp_my01", + "functionname": { + "key": "navigation_Sheet1_functionname_5", + "text": "烹饪" + }, + "npcName": [ + "功能入口-烹饪" + ], + "functionicon": "ty_qp_pr", + "mainscreen": "" + }, + { + "Id": 7, + "scene": "GameMain", + "scenename": { + "key": "navigation_Sheet1_scenename_6", + "text": "中轴城" + }, + "sceneicon": "ty_qp_my01", + "functionname": { + "key": "navigation_Sheet1_functionname_6", + "text": "指挥部" + }, + "npcName": [ + "传送点-指挥部" + ], + "functionicon": "ty_qp_zhb", + "mainscreen": "" + }, + { + "Id": 8, + "scene": "GameMain", "scenename": { "key": "navigation_Sheet1_scenename_7", "text": "中轴城" }, "sceneicon": "ty_qp_my01", "functionname": { - "key": "navigation_Sheet1_functionname_6", - "text": "烹饪" + "key": "navigation_Sheet1_functionname_7", + "text": "竞技场" }, "npcName": [ - "功能入口-烹饪" + "功能入口-竞技场" ], - "functionicon": "ty_qp_pr" + "functionicon": "ty_qp_jjc", + "mainscreen": "" }, { - "Id": 7, + "Id": 9, "scene": "GameMain", "scenename": { "key": "navigation_Sheet1_scenename_8", "text": "中轴城" }, "sceneicon": "ty_qp_my01", - "functionname": { - "key": "navigation_Sheet1_functionname_7", - "text": "指挥部" - }, - "npcName": [ - "传送点-指挥部" - ], - "functionicon": "ty_qp_zhb" - }, - { - "Id": 8, - "scene": "GameMain", - "scenename": { - "key": "navigation_Sheet1_scenename_9", - "text": "中轴城" - }, - "sceneicon": "ty_qp_my01", "functionname": { "key": "navigation_Sheet1_functionname_8", - "text": "竞技场" - }, - "npcName": [ - "功能入口-竞技场" - ], - "functionicon": "ty_qp_jjc" - }, - { - "Id": 9, - "scene": "GameMain", - "scenename": { - "key": "navigation_Sheet1_scenename_10", - "text": "中轴城" - }, - "sceneicon": "ty_qp_my01", - "functionname": { - "key": "navigation_Sheet1_functionname_9", "text": "工会" }, "npcName": [ "功能入口-工会申请", "传送点-公会" ], - "functionicon": "ty_qp_gh" + "functionicon": "ty_qp_gh", + "mainscreen": "" }, { "Id": 10, "scene": "SmithyScene", + "scenename": { + "key": "navigation_Sheet1_scenename_9", + "text": "铁匠铺" + }, + "sceneicon": "ty_qp_tjp", + "functionname": { + "key": "navigation_Sheet1_functionname_9", + "text": "打造" + }, + "npcName": [ + "打造" + ], + "functionicon": "ty_qp_zm", + "mainscreen": "传送点-铁匠铺" + }, + { + "Id": 11, + "scene": "SmithyScene", + "scenename": { + "key": "navigation_Sheet1_scenename_10", + "text": "铁匠铺" + }, + "sceneicon": "ty_qp_tjp", + "functionname": { + "key": "navigation_Sheet1_functionname_10", + "text": "锻造炉" + }, + "npcName": [ + "锻造炉" + ], + "functionicon": "ty_qp_wdj", + "mainscreen": "传送点-铁匠铺" + }, + { + "Id": 12, + "scene": "SmithyScene", "scenename": { "key": "navigation_Sheet1_scenename_11", "text": "铁匠铺" }, "sceneicon": "ty_qp_tjp", - "functionname": { - "key": "navigation_Sheet1_functionname_10", - "text": "打造" - }, - "npcName": [ - "打造" - ], - "functionicon": "ty_qp_zm" - }, - { - "Id": 11, - "scene": "SmithyScene", - "scenename": { - "key": "navigation_Sheet1_scenename_12", - "text": "铁匠铺" - }, - "sceneicon": "ty_qp_tjp", "functionname": { "key": "navigation_Sheet1_functionname_11", - "text": "锻造炉" - }, - "npcName": [ - "锻造炉" - ], - "functionicon": "ty_qp_wdj" - }, - { - "Id": 12, - "scene": "SmithyScene", - "scenename": { - "key": "navigation_Sheet1_scenename_13", - "text": "铁匠铺" - }, - "sceneicon": "ty_qp_tjp", - "functionname": { - "key": "navigation_Sheet1_functionname_12", "text": "手册台" }, "npcName": [ "手册台" ], - "functionicon": "ty_qp_sj" + "functionicon": "ty_qp_sj", + "mainscreen": "传送点-铁匠铺" }, { "Id": 13, "scene": "WuGuanScene", + "scenename": { + "key": "navigation_Sheet1_scenename_12", + "text": "熊猫武馆" + }, + "sceneicon": "ty_qp_xmwg", + "functionname": { + "key": "navigation_Sheet1_functionname_12", + "text": "总教习" + }, + "npcName": [ + "总教习" + ], + "functionicon": "ty_qp_jx", + "mainscreen": "" + }, + { + "Id": 14, + "scene": "WuGuanScene", + "scenename": { + "key": "navigation_Sheet1_scenename_13", + "text": "熊猫武馆" + }, + "sceneicon": "ty_qp_xmwg", + "functionname": { + "key": "navigation_Sheet1_functionname_13", + "text": "阿宝" + }, + "npcName": [ + "阿宝" + ], + "functionicon": "ty_qp_mryj", + "mainscreen": "" + }, + { + "Id": 15, + "scene": "WuGuanScene", "scenename": { "key": "navigation_Sheet1_scenename_14", "text": "熊猫武馆" }, "sceneicon": "ty_qp_xmwg", "functionname": { - "key": "navigation_Sheet1_functionname_13", - "text": "总教习" + "key": "navigation_Sheet1_functionname_14", + "text": "告示板" }, "npcName": [ - "总教习" + "告示板" ], - "functionicon": "ty_qp_jx" + "functionicon": "ty_qp_gsb", + "mainscreen": "" }, { - "Id": 14, + "Id": 16, "scene": "WuGuanScene", "scenename": { "key": "navigation_Sheet1_scenename_15", "text": "熊猫武馆" }, "sceneicon": "ty_qp_xmwg", - "functionname": { - "key": "navigation_Sheet1_functionname_14", - "text": "阿宝" - }, - "npcName": [ - "阿宝" - ], - "functionicon": "ty_qp_mryj" - }, - { - "Id": 15, - "scene": "WuGuanScene", - "scenename": { - "key": "navigation_Sheet1_scenename_16", - "text": "熊猫武馆" - }, - "sceneicon": "ty_qp_xmwg", "functionname": { "key": "navigation_Sheet1_functionname_15", - "text": "告示板" - }, - "npcName": [ - "告示板" - ], - "functionicon": "ty_qp_gsb" - }, - { - "Id": 16, - "scene": "WuGuanScene", - "scenename": { - "key": "navigation_Sheet1_scenename_17", - "text": "熊猫武馆" - }, - "sceneicon": "ty_qp_xmwg", - "functionname": { - "key": "navigation_Sheet1_functionname_16", - "text": "木桩1" + "text": "木桩" }, "npcName": [ "木桩" ], - "functionicon": "ty_qp_mz" + "functionicon": "ty_qp_mz", + "mainscreen": "" }, { "Id": 17, "scene": "GameMain", "scenename": { - "key": "navigation_Sheet1_scenename_4", + "key": "navigation_Sheet1_scenename_16", "text": "中轴城" }, "sceneicon": "ty_qp_my01", "functionname": { - "key": "navigation_Sheet1_functionname_17", + "key": "navigation_Sheet1_functionname_16", "text": "羁绊" }, "npcName": [ "功能入口-藏书馆" ], - "functionicon": "ty_qp_hgd" + "functionicon": "ty_qp_hgd", + "mainscreen": "" + }, + { + "Id": 18, + "scene": "CommandScene", + "scenename": { + "key": "navigation_Sheet1_scenename_17", + "text": "指挥部" + }, + "sceneicon": "ty_qp_zhb", + "functionname": { + "key": "navigation_Sheet1_functionname_17", + "text": "旧时光" + }, + "npcName": [ + "功能入口_旧时光" + ], + "functionicon": "ty_qp_jsg", + "mainscreen": "" + }, + { + "Id": 19, + "scene": "CommandScene", + "scenename": { + "key": "navigation_Sheet1_scenename_18", + "text": "指挥部" + }, + "sceneicon": "ty_qp_zhb", + "functionname": { + "key": "navigation_Sheet1_functionname_18", + "text": "星座图" + }, + "npcName": [ + "功能入口_主角星座图" + ], + "functionicon": "ty_qp_tf", + "mainscreen": "" } ] \ No newline at end of file diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json index 42a4b363a..2e109135f 100644 --- a/bin/json/game_worldtask.json +++ b/bin/json/game_worldtask.json @@ -17,7 +17,7 @@ "text": "初来乍到" }, "npctxt": { - "key": "worldtask_world_task_npctxt_1", + "key": "taskcond_rdtask_condi_npctxt_1", "text": "和阿宝聊聊" }, "npc": 10010, @@ -380,7 +380,7 @@ }, "npctxt": { "key": "taskcond_rdtask_condi_npctxt_9", - "text": "这就是维京人的工艺技术吗,我现在感觉自己的实力确实增长不少。" + "text": "和骇客蛛聊聊" }, "npc": 10090, "completetasktxt": { diff --git a/comm/core.go b/comm/core.go index 53f909092..c5fe6c7f1 100644 --- a/comm/core.go +++ b/comm/core.go @@ -2,10 +2,10 @@ package comm import ( "context" - "crypto/rand" + "math/rand" + "fmt" "go_dreamfactory/pb" - "math/big" "reflect" "strings" @@ -93,16 +93,15 @@ func ProtoMarshal(rsp proto.Message, msg *pb.UserMessage) (ok bool) { /// 参数 权重数组 返回值 数组下标 func GetRandW(sz []int32) int32 { if len(sz) > 0 { - var _totalW int64 // 总权重 - var _tmpW int64 // 临时权重 + var _totalW int32 // 总权重 + var _tmpW int32 // 临时权重 for _, v := range sz { - _totalW += int64(v) + _totalW += v } // 随机权重 - n, _ := rand.Int(rand.Reader, big.NewInt(_totalW)) for i, v := range sz { - _tmpW += int64(v) - if n.Int64() < _tmpW { + _tmpW += v + if rand.Int31n(_totalW) < _tmpW { return int32(i) } } @@ -118,8 +117,7 @@ func GetRandNum(min, max int32) int32 { return min } - n, _ := rand.Int(rand.Reader, big.NewInt(int64(max-min+1))) //+1 是因为 rand方法范围是[0, max) - return int32(n.Int64()) + min + return rand.Int31n(int32(max-min+1)) + min } ///通过uid获取用户所在区服 diff --git a/modules/tools/comp_configure.go b/modules/tools/comp_configure.go index 669952d9b..459da3633 100644 --- a/modules/tools/comp_configure.go +++ b/modules/tools/comp_configure.go @@ -37,9 +37,8 @@ type MCompConfigure struct { hlock sync.RWMutex _dropMap map[int32][]*cfg.GameDropData // 掉落表 key 是DiropId _sign map[int32]*cfg.GameSignData - + // 新掉落表 _group map[int64][]int32 // key 小组ID value cid - // 类型为1 的数据 该大组中的小组为权重掉落,必定从N个小组中随机出1个小组 _lotteryType1 map[int32][]int32 // key 大组ID value cid // 类型为2 的数据 有多个小组ID @@ -60,13 +59,11 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com err = this.ModuleCompBase.Init(service, module, comp, options) err = this.LoadConfigure(game_global, cfg.NewGameGlobal) err = this.LoadConfigure(game_initial, cfg.NewGameInitial) - //err = this.LoadConfigure(game_gamecolor, cfg.NewGameGameColor) err = this.LoadConfigure(new_hero, cfg.NewGameHero) err = this.LoadConfigure(game_playerlv, cfg.NewGamePlayerlv) err = this.LoadConfigure(game_signreset, cfg.NewGameSignReset) err = this.LoadConfigure(game_equip, cfg.NewGameEquip) - //err = this.LoadConfigure(game_sign, cfg.NewGameSign) err = this.LoadConfigure(game_item, cfg.NewGameItem) err = this.LoadConfigure(game_vip, cfg.NewGameVip) err = this.LoadConfigure(game_lottery, cfg.NewGameLottery) @@ -105,6 +102,20 @@ func (this *MCompConfigure) LoadGroupData() { key := int64(value.Lotteryid)<<31 + int64(value.Groupid) this._group[key] = append(this._group[key], value.Id) + // 数据安全校验 + if value.Min > value.Max { + log.Errorf("value.Min:%d > value.Max :%d ", value.Min, value.Max) + return + } + if value.VIPmin > value.VIPmax { + log.Errorf("value.VIPmin:%d > value.VIPmax :%d ", value.VIPmin, value.VIPmax) + return + } + + if value.Playerlvmin > value.Playerlvmax { + log.Errorf("value.Playerlvmin:%d > value.Playerlvmax :%d ", value.Playerlvmin, value.Playerlvmax) + return + } if _, ok := this.Btype[value.Lotteryid]; !ok { this.Btype[value.Lotteryid] = value.Type } diff --git a/sys/configure/structs/Game.NavigationData.go b/sys/configure/structs/Game.NavigationData.go index 2f068df07..40b40449c 100644 --- a/sys/configure/structs/Game.NavigationData.go +++ b/sys/configure/structs/Game.NavigationData.go @@ -18,6 +18,7 @@ type GameNavigationData struct { Functionname string NpcName []string Functionicon string + Mainscreen string } const TypeId_GameNavigationData = -800652966 @@ -47,6 +48,7 @@ func (_v *GameNavigationData)Deserialize(_buf map[string]interface{}) (err error } { var _ok_ bool; if _v.Functionicon, _ok_ = _buf["functionicon"].(string); !_ok_ { err = errors.New("functionicon error"); return } } + { var _ok_ bool; if _v.Mainscreen, _ok_ = _buf["mainscreen"].(string); !_ok_ { err = errors.New("mainscreen error"); return } } return }