From ef8176943b5b167c689a6f60edd31c1282b43501 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 11 Aug 2023 23:19:06 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/stonehenge/api_event.go | 29 ++++++++++++++++----------- modules/stonehenge/api_gotoroom.go | 19 ++++++++++++++++++ modules/stonehenge/api_shop.go | 14 ++++++------- modules/stonehenge/api_story.go | 10 +++++++++ modules/stonehenge/modelStonehenge.go | 19 +++++++++++++++++- 5 files changed, 71 insertions(+), 20 deletions(-) diff --git a/modules/stonehenge/api_event.go b/modules/stonehenge/api_event.go index 3b7a8b5b3..9401ed0cc 100644 --- a/modules/stonehenge/api_event.go +++ b/modules/stonehenge/api_event.go @@ -45,14 +45,26 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } return } - if v, ok := stone.Rooms.Eventid[req.Eventid]; !ok || v == true { // 不存在该事件 + if eventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil { errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ReqParameterError, - Title: pb.ErrorCode_ReqParameterError.ToString(), - Message: fmt.Sprintf("req.Eventid err :%d", req.Eventid), + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), } return } + // EventType29 特殊事件 + if eventConf.EventType != EventType29 { + if v, ok := stone.Rooms.Eventid[req.Eventid]; !ok || v == true { // 不存在该事件 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + Message: fmt.Sprintf("req.Eventid err :%d", req.Eventid), + } + return + } + } + _, bBox := stone.Rooms.Box[req.Eventid] if stone.Rooms.Eventid[req.Eventid] || bBox { // 重复完成 errdata = &pb.ErrorData{ @@ -71,14 +83,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } return } - if eventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Title: pb.ErrorCode_ConfigNoFound.ToString(), - Message: err.Error(), - } - return - } + if len(eventConf.CostItem) > 0 { if errdata = this.module.CheckRes(session, eventConf.CostItem); errdata != nil { return diff --git a/modules/stonehenge/api_gotoroom.go b/modules/stonehenge/api_gotoroom.go index 24f5827b7..05cc64bf8 100644 --- a/modules/stonehenge/api_gotoroom.go +++ b/modules/stonehenge/api_gotoroom.go @@ -134,6 +134,25 @@ func (this *apiComp) GotoRoom(session comm.IUserSession, req *pb.StonehengeGotoR stone.Rooms.Portal = []int32{c.PortalGroup} } } + // 判断传送门是否开启 + stone.Rooms.Complete = true + + for _, v := range curRoomConf.Condition { + for k, ok := range stone.Rooms.Eventid { + if !ok { + if eventConf, err := this.module.configure.GetStoneEventDataById(k); err == nil { + if eventConf.EventType == v { + stone.Rooms.Complete = false + break + } + } + } + } + if !stone.Rooms.Complete { + break + } + } + update["rooms"] = stone.Rooms this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update) session.SendMsg(string(this.module.GetType()), "gotoroom", &pb.StonehengeGotoRoomResp{ diff --git a/modules/stonehenge/api_shop.go b/modules/stonehenge/api_shop.go index 19c382d3d..147220c99 100644 --- a/modules/stonehenge/api_shop.go +++ b/modules/stonehenge/api_shop.go @@ -57,13 +57,13 @@ func (this *apiComp) Store(session comm.IUserSession, req *pb.StonehengeStoreReq return } // 校验 是否有这个事件 - if _, ok := stone.Rooms.Eventid[storeConf.EventId]; ok { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_StonehengeCantBuy, - Title: pb.ErrorCode_StonehengeCantBuy.String(), - } - return - } + // if _, ok := stone.Rooms.Eventid[storeConf.EventId]; ok { + // errdata = &pb.ErrorData{ + // Code: pb.ErrorCode_StonehengeCantBuy, + // Title: pb.ErrorCode_StonehengeCantBuy.String(), + // } + // return + // } stone.Rooms.Shop[storeConf.EventId] += 1 stone.Rooms.Eventid[storeConf.EventId] = false diff --git a/modules/stonehenge/api_story.go b/modules/stonehenge/api_story.go index 54438e2f2..b0c6dd36a 100644 --- a/modules/stonehenge/api_story.go +++ b/modules/stonehenge/api_story.go @@ -52,6 +52,16 @@ func (this *apiComp) Story(session comm.IUserSession, req *pb.StonehengeStoryReq if req.Cid == -1 { stone.Rooms.Story = 0 stone.Rooms.Eventid[req.Eventid] = true + + this.module.modelStonehenge.EventOpenRoom(req.Eventid, stone) + update["rooms"] = stone.Rooms + this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update) + session.SendMsg(string(this.module.GetType()), "story", &pb.StonehengeStoryResp{ + Story: stone.Rooms.Story, + NewEvent: newEvent, + Room: stone.Rooms, + }) + return } else { if conf, err = this.module.configure.GetStoneStoryConf(req.Cid); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/stonehenge/modelStonehenge.go b/modules/stonehenge/modelStonehenge.go index d1367f5cd..0b98cb552 100644 --- a/modules/stonehenge/modelStonehenge.go +++ b/modules/stonehenge/modelStonehenge.go @@ -132,5 +132,22 @@ func (this *MStonehenge) AddNewEvent(event []int32, stone *pb.DBStonehenge) { } } } - +} + +// 完成事件 开启传送门 +func (this *MStonehenge) EventOpenRoom(event int32, stone *pb.DBStonehenge) { + stone.Rooms.Complete = true + if curRoomConf, err := this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err == nil { + for _, v := range curRoomConf.Condition { + if eventConf, err := this.module.configure.GetStoneEventDataById(event); err == nil { + if eventConf.EventType == v { + stone.Rooms.Complete = false + break + } + } + if !stone.Rooms.Complete { + break + } + } + } } From e8bc7f69d4aad78c17ba0f218d748905091bc5ee Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 11 Aug 2023 23:26:32 +0800 Subject: [PATCH 2/8] =?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_buriedcondi.json | 24 ++--- bin/json/game_heroupstorychapter.json | 18 ++-- bin/json/game_item.json | 147 ++++++++++++++++++++++++-- bin/json/game_mainstage.json | 42 ++++---- bin/json/game_monsterformat.json | 12 +-- bin/json/game_opencond.json | 16 --- bin/json/game_worldtask.json | 60 +++++------ 7 files changed, 219 insertions(+), 100 deletions(-) diff --git a/bin/json/game_buriedcondi.json b/bin/json/game_buriedcondi.json index 3e2db50ac..59e97e2af 100644 --- a/bin/json/game_buriedcondi.json +++ b/bin/json/game_buriedcondi.json @@ -20528,7 +20528,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_723", - "text": "击退豺狼小怪" + "text": "击退恐惧灵小怪" }, "type": 70, "valid": 0, @@ -20615,7 +20615,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_726", - "text": "击败豺狼小怪" + "text": "击败恐惧灵小怪" }, "type": 70, "valid": 0, @@ -21101,7 +21101,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_743", - "text": "击退豺狼小怪" + "text": "击退恐惧灵小怪" }, "type": 70, "valid": 0, @@ -21825,7 +21825,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_768", - "text": "击退豺狼小怪" + "text": "击退恐惧灵小怪" }, "type": 70, "valid": 0, @@ -21883,7 +21883,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_770", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22175,7 +22175,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_780", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22204,7 +22204,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_781", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22233,7 +22233,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_782", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22348,7 +22348,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_786", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22377,7 +22377,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_787", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22608,7 +22608,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_795", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, @@ -22637,7 +22637,7 @@ "type_sp": 1, "tasktxt": { "key": "buried_buried_condi_tasktxt_796", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "type": 70, "valid": 0, diff --git a/bin/json/game_heroupstorychapter.json b/bin/json/game_heroupstorychapter.json index d9dbb5e1a..76c7abeb5 100644 --- a/bin/json/game_heroupstorychapter.json +++ b/bin/json/game_heroupstorychapter.json @@ -12,7 +12,7 @@ "level": 101, "levellink": [], "leveltype": 1, - "startstory": 10254, + "startstory": 20325, "battle": 0, "reward": [ { @@ -45,7 +45,7 @@ 1 ], "leveltype": 2, - "startstory": 10254, + "startstory": 20325, "battle": 101, "reward": [ { @@ -139,7 +139,7 @@ 4 ], "leveltype": 5, - "startstory": 10254, + "startstory": 20325, "battle": 101, "reward": [ { @@ -170,7 +170,7 @@ "level": 101, "levellink": [], "leveltype": 1, - "startstory": 10254, + "startstory": 20325, "battle": 0, "reward": [ { @@ -203,7 +203,7 @@ 1 ], "leveltype": 2, - "startstory": 10254, + "startstory": 20325, "battle": 101, "reward": [ { @@ -297,7 +297,7 @@ 4 ], "leveltype": 5, - "startstory": 10254, + "startstory": 20325, "battle": 0, "reward": [ { @@ -328,7 +328,7 @@ "level": 101, "levellink": [], "leveltype": 1, - "startstory": 10254, + "startstory": 20325, "battle": 0, "reward": [ { @@ -361,7 +361,7 @@ 1 ], "leveltype": 2, - "startstory": 10254, + "startstory": 20325, "battle": 101, "reward": [ { @@ -455,7 +455,7 @@ 4 ], "leveltype": 5, - "startstory": 10254, + "startstory": 20325, "battle": 0, "reward": [ { diff --git a/bin/json/game_item.json b/bin/json/game_item.json index 0f132f0e4..22eda1ba1 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -18397,7 +18397,7 @@ "text": "可用于拼图游戏中完成拼图游戏" }, "describe": { - "key": "", + "key": "item_item_describe_395", "text": "" }, "dialogue": { @@ -18442,7 +18442,7 @@ "text": "可用于云上行走游戏中" }, "describe": { - "key": "", + "key": "item_item_describe_396", "text": "" }, "dialogue": { @@ -18487,7 +18487,7 @@ "text": "可用于黄金矿工游戏中" }, "describe": { - "key": "", + "key": "item_item_describe_397", "text": "" }, "dialogue": { @@ -18532,7 +18532,7 @@ "text": "鹦鹉螺较为罕见,又因其外形精巧美丽,因此成为稀缺货币的代名词。人们即使历经磨难也只能得到很少的鹦鹉螺,收到它作为奖励是一件非常自豪骄傲的事。" }, "describe": { - "key": "item_item_describe_395", + "key": "item_item_describe_398", "text": "" }, "dialogue": { @@ -18577,7 +18577,7 @@ "text": "可以从中自由选择3种属性招募卷的宝箱" }, "describe": { - "key": "item_item_describe_396", + "key": "item_item_describe_399", "text": "" }, "dialogue": { @@ -18624,7 +18624,7 @@ "text": "开启后,可以获得一套4星装备。" }, "describe": { - "key": "item_item_describe_397", + "key": "item_item_describe_400", "text": "" }, "dialogue": { @@ -18638,5 +18638,140 @@ "n": 1000 } ] + }, + { + "id": "24010001", + "name": { + "key": "item_item_name_392", + "text": "鳄犬的尾巴" + }, + "usetype": 1, + "color": 2, + "bagtype": 1, + "index": 1, + "special_type": 0, + "time": 0, + "reddottype": 0, + "effects": "", + "modelName": "", + "box_id": 0, + "synthetize_num": 0, + "synthetize_deplete": [], + "synthetize_get": [], + "decompose_deplete": [], + "decompose_get": [], + "access": [], + "use_skip": 0, + "upper_limit": 0, + "img": "item_24010001", + "intr": { + "key": "item_item_intr_401", + "text": "" + }, + "describe": { + "key": "item_item_describe_401", + "text": "" + }, + "dialogue": { + "key": "item_item_dialogue_399", + "text": "" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "24010002", + "name": { + "key": "item_item_name_393", + "text": "猫头熊的皮毛" + }, + "usetype": 1, + "color": 2, + "bagtype": 1, + "index": 1, + "special_type": 0, + "time": 0, + "reddottype": 0, + "effects": "", + "modelName": "", + "box_id": 0, + "synthetize_num": 0, + "synthetize_deplete": [], + "synthetize_get": [], + "decompose_deplete": [], + "decompose_get": [], + "access": [], + "use_skip": 0, + "upper_limit": 0, + "img": "item_24010002", + "intr": { + "key": "item_item_intr_402", + "text": "" + }, + "describe": { + "key": "item_item_describe_402", + "text": "" + }, + "dialogue": { + "key": "item_item_dialogue_400", + "text": "" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] + }, + { + "id": "24010003", + "name": { + "key": "item_item_name_394", + "text": "猛犸象牙" + }, + "usetype": 1, + "color": 2, + "bagtype": 1, + "index": 1, + "special_type": 0, + "time": 0, + "reddottype": 0, + "effects": "", + "modelName": "", + "box_id": 0, + "synthetize_num": 0, + "synthetize_deplete": [], + "synthetize_get": [], + "decompose_deplete": [], + "decompose_get": [], + "access": [], + "use_skip": 0, + "upper_limit": 0, + "img": "item_24010003", + "intr": { + "key": "item_item_intr_403", + "text": "" + }, + "describe": { + "key": "item_item_describe_403", + "text": "" + }, + "dialogue": { + "key": "item_item_dialogue_401", + "text": "" + }, + "sale": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] } ] \ No newline at end of file diff --git a/bin/json/game_mainstage.json b/bin/json/game_mainstage.json index 0c0374926..694554428 100644 --- a/bin/json/game_mainstage.json +++ b/bin/json/game_mainstage.json @@ -735,9 +735,9 @@ "ps_mg": [], "firstaward": [ { - "a": "attr", - "t": "gold", - "n": 6000 + "a": "item", + "t": "24010001", + "n": 1 } ], "lotteryward": 0, @@ -799,9 +799,9 @@ "ps_mg": [], "firstaward": [ { - "a": "attr", - "t": "gold", - "n": 6001 + "a": "item", + "t": "24010002", + "n": 1 } ], "lotteryward": 0, @@ -863,9 +863,9 @@ "ps_mg": [], "firstaward": [ { - "a": "attr", - "t": "gold", - "n": 6002 + "a": "item", + "t": "24010003", + "n": 1 } ], "lotteryward": 0, @@ -6855,7 +6855,7 @@ "hide": 0, "destroy": 1, "progress": 0, - "frontstoryid": 0, + "frontstoryid": 20100, "afterstoryid": 0, "maingroupName": { "key": "", @@ -7021,7 +7021,7 @@ "hide": 0, "destroy": 1, "progress": 1, - "frontstoryid": 20106, + "frontstoryid": 20105, "afterstoryid": 20107, "maingroupName": { "key": "", @@ -7657,8 +7657,8 @@ "hide": 0, "destroy": 1, "progress": 1, - "frontstoryid": 20122, - "afterstoryid": 20125, + "frontstoryid": 20115, + "afterstoryid": 20117, "maingroupName": { "key": "", "text": "" @@ -7763,8 +7763,8 @@ "hide": 0, "destroy": 1, "progress": 1, - "frontstoryid": 20200, - "afterstoryid": 20201, + "frontstoryid": 20218, + "afterstoryid": 20219, "maingroupName": { "key": "", "text": "" @@ -7869,8 +7869,8 @@ "hide": 0, "destroy": 1, "progress": 1, - "frontstoryid": 20204, - "afterstoryid": 20206, + "frontstoryid": 0, + "afterstoryid": 20222, "maingroupName": { "key": "", "text": "" @@ -7975,8 +7975,8 @@ "hide": 0, "destroy": 1, "progress": 1, - "frontstoryid": 20207, - "afterstoryid": 20209, + "frontstoryid": 20225, + "afterstoryid": 0, "maingroupName": { "key": "", "text": "" @@ -8081,8 +8081,8 @@ "hide": 0, "destroy": 1, "progress": 1, - "frontstoryid": 20210, - "afterstoryid": 20211, + "frontstoryid": 20226, + "afterstoryid": 0, "maingroupName": { "key": "", "text": "" diff --git a/bin/json/game_monsterformat.json b/bin/json/game_monsterformat.json index 774f5b891..2ffc60bfb 100644 --- a/bin/json/game_monsterformat.json +++ b/bin/json/game_monsterformat.json @@ -325,7 +325,7 @@ "captainId": 0, "IsBoss": 0, "bossHpCnt": 0, - "heroid": 51004, + "heroid": 51012, "star": 3, "equip": [], "newskill": [], @@ -345,7 +345,7 @@ "captainId": 0, "IsBoss": 0, "bossHpCnt": 0, - "heroid": 51004, + "heroid": 51012, "star": 3, "equip": [], "newskill": [], @@ -625,7 +625,7 @@ "captainId": 0, "IsBoss": 0, "bossHpCnt": 0, - "heroid": 51004, + "heroid": 51012, "star": 3, "equip": [], "newskill": [], @@ -645,7 +645,7 @@ "captainId": 0, "IsBoss": 0, "bossHpCnt": 0, - "heroid": 51004, + "heroid": 51012, "star": 3, "equip": [], "newskill": [], @@ -665,7 +665,7 @@ "captainId": 1, "IsBoss": 0, "bossHpCnt": 0, - "heroid": 51004, + "heroid": 51012, "star": 3, "equip": [], "newskill": [], @@ -685,7 +685,7 @@ "captainId": 0, "IsBoss": 0, "bossHpCnt": 0, - "heroid": 51004, + "heroid": 51012, "star": 3, "equip": [], "newskill": [], diff --git a/bin/json/game_opencond.json b/bin/json/game_opencond.json index 64898fecd..5f885673a 100644 --- a/bin/json/game_opencond.json +++ b/bin/json/game_opencond.json @@ -96,10 +96,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100101 } ], "wkqbx": 2, @@ -246,10 +242,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100101 } ], "wkqbx": 0, @@ -273,10 +265,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100101 } ], "wkqbx": 2, @@ -323,10 +311,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100101 } ], "wkqbx": 0, diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json index a20b5fed5..4ccaddc24 100644 --- a/bin/json/game_worldtask.json +++ b/bin/json/game_worldtask.json @@ -147,11 +147,11 @@ }, "task_details": { "key": "worldtask_world_task_task_details_4", - "text": "刚踏出飞船就遇到了潜入船舱甲板的豺狼小怪,尝试击败他们!" + "text": "刚踏出飞船就遇到了潜入船舱甲板的恐惧灵小怪,尝试击败他们!" }, "npctxt": { "key": "worldtask_world_task_npctxt_4", - "text": "击退豺狼小怪" + "text": "击退恐惧灵小怪" }, "get_item": [], "trigger": 0, @@ -279,11 +279,11 @@ }, "task_details": { "key": "worldtask_world_task_task_details_7", - "text": "正当阿宝和邦尼兔斗嘴时,圣桃树旁出现一团黑气,随后豺狼小怪再次出现。" + "text": "正当阿宝和邦尼兔斗嘴时,圣桃树旁出现一团黑气,随后恐惧灵小怪再次出现。" }, "npctxt": { "key": "worldtask_world_task_npctxt_7", - "text": "击败豺狼小怪" + "text": "击败恐惧灵小怪" }, "get_item": [], "trigger": 0, @@ -370,7 +370,7 @@ }, "task_details": { "key": "worldtask_world_task_task_details_9", - "text": "跟着豺狼小怪消失的方向,你们一行人追踪到熊猫武馆。武馆是中轴城守护者提高战斗力、习武比试的地方。" + "text": "跟着恐惧灵小怪消失的方向,你们一行人追踪到熊猫武馆。武馆是中轴城守护者提高战斗力、习武比试的地方。" }, "npctxt": { "key": "worldtask_world_task_npctxt_9", @@ -992,7 +992,7 @@ }, "task_details": { "key": "worldtask_world_task_task_details_22", - "text": "刚召唤结束,一股黑气围绕在圣桃树旁久久不散,众人惊愕下,大量豺狼小怪出现,不断袭击中轴城的防护网。" + "text": "刚召唤结束,一股黑气围绕在圣桃树旁久久不散,众人惊愕下,大量恐惧灵小怪出现,不断袭击中轴城的防护网。" }, "npctxt": { "key": "worldtask_world_task_npctxt_22", @@ -2086,15 +2086,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_46", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_46", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_46", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -2520,15 +2520,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_56", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_56", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_56", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -2563,15 +2563,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_57", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_57", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_57", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -2606,15 +2606,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_58", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_58", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_58", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -2778,15 +2778,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_62", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_62", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_62", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -2821,15 +2821,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_63", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_63", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_63", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -3178,15 +3178,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_71", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_71", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_71", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, @@ -3221,15 +3221,15 @@ "icon": "25001", "task_name": { "key": "worldtask_world_task_task_name_72", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "task_details": { "key": "worldtask_world_task_task_details_72", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "npctxt": { "key": "worldtask_world_task_npctxt_72", - "text": "击退豺狼人" + "text": "击退恐惧灵" }, "get_item": [], "trigger": 0, From 1d2cda271a90ea1ad9b4347bafdc28daa02ea1c9 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 11 Aug 2023 23:51:05 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E4=BC=A0=E9=80=81=E9=97=A8=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/stonehenge/modelStonehenge.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/stonehenge/modelStonehenge.go b/modules/stonehenge/modelStonehenge.go index 0b98cb552..126d2ea33 100644 --- a/modules/stonehenge/modelStonehenge.go +++ b/modules/stonehenge/modelStonehenge.go @@ -137,12 +137,16 @@ func (this *MStonehenge) AddNewEvent(event []int32, stone *pb.DBStonehenge) { // 完成事件 开启传送门 func (this *MStonehenge) EventOpenRoom(event int32, stone *pb.DBStonehenge) { stone.Rooms.Complete = true - if curRoomConf, err := this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err == nil { - for _, v := range curRoomConf.Condition { - if eventConf, err := this.module.configure.GetStoneEventDataById(event); err == nil { - if eventConf.EventType == v { - stone.Rooms.Complete = false - break + if roomConf, err := this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err == nil { + for _, v := range roomConf.Condition { + for k, ok := range stone.Rooms.Eventid { + if !ok { + if eventConf, err := this.module.configure.GetStoneEventDataById(k); err == nil { + if eventConf.EventType == v { + stone.Rooms.Complete = false + break + } + } } } if !stone.Rooms.Complete { @@ -150,4 +154,5 @@ func (this *MStonehenge) EventOpenRoom(event int32, stone *pb.DBStonehenge) { } } } + } From ae91a6e10e229670e0511b288cfe7505f2746c3a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sat, 12 Aug 2023 00:00:49 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_opencond.json | 55 +------------------------------------ 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/bin/json/game_opencond.json b/bin/json/game_opencond.json index 5f885673a..84be0d3e7 100644 --- a/bin/json/game_opencond.json +++ b/bin/json/game_opencond.json @@ -380,10 +380,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100404 } ], "wkqbx": 0, @@ -636,10 +632,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100608 } ], "wkqbx": 2, @@ -686,10 +678,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100404 } ], "wkqbx": 0, @@ -873,10 +861,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100304 } ], "wkqbx": 0, @@ -900,10 +884,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100508 } ], "wkqbx": 0, @@ -1272,10 +1252,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100408 } ], "wkqbx": 0, @@ -1520,12 +1496,7 @@ "key": "opencond_opencond_name_66", "text": "炼金塔" }, - "main": [ - { - "key": 2, - "param": 1100308 - } - ], + "main": [], "wkqbx": 1, "kqbx": 0, "img": "", @@ -1722,10 +1693,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100808 } ], "wkqbx": 0, @@ -1772,10 +1739,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100604 } ], "wkqbx": 0, @@ -1826,10 +1789,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100504 } ], "wkqbx": 0, @@ -1925,10 +1884,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1101208 } ], "wkqbx": 0, @@ -1970,10 +1925,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1101008 } ], "wkqbx": 2, @@ -1997,10 +1948,6 @@ { "key": 1, "param": 1 - }, - { - "key": 2, - "param": 1100408 } ], "wkqbx": 2, From 64ef4708bbe8bee119fae1e7728d2ee4c933c17a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sat, 12 Aug 2023 00:19:06 +0800 Subject: [PATCH 5/8] update --- modules/stonehenge/api_event.go | 2 +- modules/user/module.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/stonehenge/api_event.go b/modules/stonehenge/api_event.go index 9401ed0cc..0422f5e3c 100644 --- a/modules/stonehenge/api_event.go +++ b/modules/stonehenge/api_event.go @@ -66,7 +66,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } _, bBox := stone.Rooms.Box[req.Eventid] - if stone.Rooms.Eventid[req.Eventid] || bBox { // 重复完成 + if stone.Rooms.Eventid[req.Eventid] || !bBox { // 重复完成 errdata = &pb.ErrorData{ Code: pb.ErrorCode_StonehengeRepeatedReward, Title: pb.ErrorCode_StonehengeRepeatedReward.ToString(), diff --git a/modules/user/module.go b/modules/user/module.go index 0660b99ce..529f005bd 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -546,6 +546,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha } change.Ps += add userEx.ConsumPs += -add + this.ModuleUiGame.HDPSTodayConsum(session.GetUserId(), change.Ps) } else { if change.Ps+add > ggd.PsUl { change.Ps = ggd.PsUl From d0d557ac23d7a750c0b9a6034651ee8728294140 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sat, 12 Aug 2023 00:42:14 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_stoneevent.json | 80 ++++++++++++++++++++++++++++----- bin/json/game_stoneroom.json | 6 +-- modules/stonehenge/api_event.go | 2 +- 3 files changed, 74 insertions(+), 14 deletions(-) diff --git a/bin/json/game_stoneevent.json b/bin/json/game_stoneevent.json index c14155a04..3b4d8b921 100644 --- a/bin/json/game_stoneevent.json +++ b/bin/json/game_stoneevent.json @@ -11,7 +11,13 @@ "Value2": 0, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -27,7 +33,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -43,7 +55,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -59,7 +77,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -75,7 +99,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -91,7 +121,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -107,7 +143,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -123,7 +165,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -139,7 +187,13 @@ "Value2": 2, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, @@ -155,7 +209,13 @@ "Value2": 1, "Value3": 0, "Value4": 0, - "CostItem": [], + "CostItem": [ + { + "a": "item", + "t": "10000039", + "n": 1 + } + ], "PostEvent": 0, "probability": 0 }, diff --git a/bin/json/game_stoneroom.json b/bin/json/game_stoneroom.json index ae346d807..b9f0d424c 100644 --- a/bin/json/game_stoneroom.json +++ b/bin/json/game_stoneroom.json @@ -32,7 +32,7 @@ "EventStoreGroup": 0, "BossEvent": 0, "Condition": [ - 16 + 14 ] }, { @@ -50,7 +50,7 @@ "EventStoreGroup": 0, "BossEvent": 0, "Condition": [ - 16 + 14 ] }, { @@ -86,7 +86,7 @@ "EventStoreGroup": 0, "BossEvent": 0, "Condition": [ - 16 + 14 ] }, { diff --git a/modules/stonehenge/api_event.go b/modules/stonehenge/api_event.go index 0422f5e3c..b62526272 100644 --- a/modules/stonehenge/api_event.go +++ b/modules/stonehenge/api_event.go @@ -66,7 +66,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } _, bBox := stone.Rooms.Box[req.Eventid] - if stone.Rooms.Eventid[req.Eventid] || !bBox { // 重复完成 + if stone.Rooms.Eventid[req.Eventid] { // 重复完成 errdata = &pb.ErrorData{ Code: pb.ErrorCode_StonehengeRepeatedReward, Title: pb.ErrorCode_StonehengeRepeatedReward.ToString(), From 5abb015088dce42f8c2f6a93b12e5cb116807755 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sat, 12 Aug 2023 00:53:28 +0800 Subject: [PATCH 7/8] update --- modules/stonehenge/api_event.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/modules/stonehenge/api_event.go b/modules/stonehenge/api_event.go index b62526272..47243cffb 100644 --- a/modules/stonehenge/api_event.go +++ b/modules/stonehenge/api_event.go @@ -53,27 +53,19 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq } return } + // EventType29 特殊事件 - if eventConf.EventType != EventType29 { - if v, ok := stone.Rooms.Eventid[req.Eventid]; !ok || v == true { // 不存在该事件 + if eventConf.EventType != EventType29 && eventConf.EventType != EventType10 { + if stone.Rooms.Eventid[req.Eventid] { // 重复完成 errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ReqParameterError, - Title: pb.ErrorCode_ReqParameterError.ToString(), + Code: pb.ErrorCode_StonehengeRepeatedReward, + Title: pb.ErrorCode_StonehengeRepeatedReward.ToString(), Message: fmt.Sprintf("req.Eventid err :%d", req.Eventid), } return } } - _, bBox := stone.Rooms.Box[req.Eventid] - if stone.Rooms.Eventid[req.Eventid] { // 重复完成 - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_StonehengeRepeatedReward, - Title: pb.ErrorCode_StonehengeRepeatedReward.ToString(), - Message: fmt.Sprintf("req.Eventid err :%d", req.Eventid), - } - return - } update["stageID"] = stone.StageID if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil { errdata = &pb.ErrorData{ @@ -174,7 +166,7 @@ func (this *apiComp) Event(session comm.IUserSession, req *pb.StonehengeEventReq return } // 次数校验 - if bBox && stone.Rooms.Box[req.Eventid] < eventConf.Value2 { + if stone.Rooms.Box[req.Eventid] < eventConf.Value2 { user := this.module.ModuleUser.GetUser(session.GetUserId()) // 校验消耗是否 // if len(eventConf.CostItem) > 0 { From 5bfa66a65dc66061d0345863907b74009a6c0ed2 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 14 Aug 2023 11:12:40 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E6=8E=89=E8=90=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/tools/comp_configure.go | 253 +++++++++++++++----------------- 1 file changed, 120 insertions(+), 133 deletions(-) diff --git a/modules/tools/comp_configure.go b/modules/tools/comp_configure.go index a2710ed8a..1cebb6369 100644 --- a/modules/tools/comp_configure.go +++ b/modules/tools/comp_configure.go @@ -51,9 +51,9 @@ type MCompConfigure struct { _groupType1 map[int64][]int32 //value cid // 小组类型为2 _groupType2 map[int64][]int32 //value cid - Btype map[int32]int32 - Stype map[int64]int32 // subtype - SNum map[int64]int32 // 小组产出数量 + //Btype map[int32]int32 + Stype map[int64]int32 // subtype + SNum map[int64]int32 // 小组产出数量 _price map[int32][]*cfg.GamePricegroupData } @@ -84,7 +84,7 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com this._lotteryType2 = make(map[int32][]int32, 0) this._groupType1 = make(map[int64][]int32, 0) this._groupType2 = make(map[int64][]int32, 0) - this.Btype = make(map[int32]int32, 0) + //this.Btype = make(map[int32]int32, 0) this.Stype = make(map[int64]int32, 0) this.SNum = make(map[int64]int32, 0) configure.RegisterConfigure(game_lottery, cfg.NewGameLottery, this.LoadGroupData) @@ -102,13 +102,21 @@ func (this *MCompConfigure) LoadGroupData() { this._lotteryType2 = make(map[int32][]int32, 0) this._groupType1 = make(map[int64][]int32, 0) this._groupType2 = make(map[int64][]int32, 0) - this.Btype = make(map[int32]int32, 0) + //this.Btype = make(map[int32]int32, 0) this.Stype = make(map[int64]int32, 0) this.SNum = make(map[int64]int32, 0) + var tmp1 int64 + var tmp2 int64 + var itype int32 for _, value := range configure.GetDataList() { key := int64(value.Lotteryid)<<31 + int64(value.Groupid) + // key2 := int64(value.Lotteryid)<<31 + int64(value.Type) this._group[key] = append(this._group[key], value.Id) - + if value.Type == 0 { + value.Type = itype + } else { + itype = value.Type + } // 数据安全校验 if value.Min > value.Max { log.Errorf("value.Min:%d > value.Max :%d ", value.Min, value.Max) @@ -123,20 +131,25 @@ func (this *MCompConfigure) LoadGroupData() { 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 - } - if _, ok := this.Stype[key]; !ok { this.Stype[key] = value.Subtype } if _, ok := this.SNum[key]; !ok { this.SNum[key] = value.Groupnum } - if this.Btype[value.Lotteryid] == 1 { - this._lotteryType1[value.Lotteryid] = append(this._lotteryType1[value.Lotteryid], value.Id) - } else if this.Btype[value.Lotteryid] == 2 { - this._lotteryType2[value.Lotteryid] = append(this._lotteryType2[value.Lotteryid], value.Id) + + if value.Type == 1 || value.Type == 0 { + if tmp1 != key { + this._lotteryType1[value.Lotteryid] = append(this._lotteryType1[value.Lotteryid], value.Id) + tmp1 = key + } + + } + if value.Type == 2 || value.Type == 0 { + if tmp2 != key { + this._lotteryType2[value.Lotteryid] = append(this._lotteryType2[value.Lotteryid], value.Id) + tmp2 = key + } } if this.Stype[key] == 1 { // 小组ID为1 @@ -163,138 +176,112 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32, } } // 优先校验大组ID 的类型 - if this.Btype[lotteryId] == 1 { // 该大组中的小组为权重掉落,必定从N个小组中随机出1个小组 - var ( - szW []int32 // 权重数组 - szID []int32 // 小组ID 数组 - groupID int32 - gourp map[int32]int32 // key 小组ID value 权重 - ) + var ( + szW []int32 // 权重数组 + szID []int32 // 小组ID 数组 + groupID int32 + ) - gourp = make(map[int32]int32, 0) - // 随机小组id - for _, v := range this._lotteryType1[lotteryId] { - if _data := this.GetLotterConfById(v); _data != nil { - if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件 - if _, ok := gourp[_data.Groupid]; !ok { - gourp[_data.Groupid] = _data.Groupwt // 小组ID 权重赋值 - szW = append(szW, _data.Groupwt) - szID = append(szID, _data.Groupid) - } - } + // 随机小组id + for _, v := range this._lotteryType1[lotteryId] { + if _data := this.GetLotterConfById(v); _data != nil { + if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件 + szW = append(szW, _data.Groupwt) + szID = append(szID, _data.Groupid) } } + } - groupID = szID[comm.GetRandW(szW)] // 获得小组ID - //fmt.Printf("大组类型为1的,获得小组ID :%d,dropID:%d", groupID, lotteryId) - key := int64(lotteryId)<<31 + int64(groupID) - // 小组ID 类型判断 - if this.Stype[key] == 1 { // 该小组的道具为权重掉落,必定从N个道具中随机出1个道具 - for i := 0; i < int(this.SNum[key]); i++ { - szW = make([]int32, 0) - szID = make([]int32, 0) - gourp = make(map[int32]int32, 0) - for _, v := range this._groupType1[key] { - if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 - if _, ok := gourp[_data.Groupid]; !ok { - szW = append(szW, _data.Itemwt) - szID = append(szID, _data.Id) - } - } - } - index := comm.GetRandW(szW) - _data := this.GetLotterConfById(szID[index]) - //fmt.Printf("获得最终的道具 :%d", _data.Id) - count := comm.GetRandNum(_data.Min, _data.Max) - // 随机获得的数量 - items = append(items, &cfg.Gameatn{ - A: _data.Itemid.A, - T: _data.Itemid.T, - N: _data.Itemid.N * count, - }) - } - return - } else if this.Stype[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比) - var wt int32 - for _, v := range this._groupType2[key] { + groupID = szID[comm.GetRandW(szW)] // 获得小组ID + //fmt.Printf("大组类型为1的,获得小组ID :%d,dropID:%d", groupID, lotteryId) + key := int64(lotteryId)<<31 + int64(groupID) + // 小组ID 类型判断 + if this.Stype[key] == 1 { // 该小组的道具为权重掉落,必定从N个道具中随机出1个道具 + for i := 0; i < int(this.SNum[key]); i++ { + sztW := make([]int32, 0) + sztID := make([]int32, 0) + for _, v := range this._groupType1[key] { if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 - if _data.Itemwt != 0 { - wt = _data.Itemwt - } - if wt >= comm.GetRandNum(0, 1000) { // 命中 - count := comm.GetRandNum(_data.Min, _data.Max) - items = append(items, &cfg.Gameatn{ - A: _data.Itemid.A, - T: _data.Itemid.T, - N: _data.Itemid.N * count, // 小组产出数量 - }) - } + sztW = append(sztW, _data.Itemwt) + sztID = append(sztID, _data.Id) } } - return + index := comm.GetRandW(sztW) + _data := this.GetLotterConfById(sztID[index]) + count := comm.GetRandNum(_data.Min, _data.Max) + // 随机获得的数量 + items = append(items, &cfg.Gameatn{ + A: _data.Itemid.A, + T: _data.Itemid.T, + N: _data.Itemid.N * count, + }) } - } else if this.Btype[lotteryId] == 2 { // 该大组中的小组为概率掉落,每个小组都会随机一次是否会掉落(单位为千分比) - // 每个小组id 都随机取一次 - var szGroupID []int32 // 获得的权重数组 - gourp := make([]*cfg.GameLotteryData, 0) // key 小组ID value 权重 - for _, v := range this._lotteryType2[lotteryId] { - if _data := this.GetLotterConfById(v); _data != nil { - if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件 - gourp = append(gourp, _data) + + } else if this.Stype[key] == 2 { // 该小组中的道具为概率掉落,每个道具都会随机一次是否会掉落(单位为千分比) + for _, v := range this._groupType2[key] { + if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 + + if _data.Itemwt >= comm.GetRandNum(0, 1000) { // 命中 + count := comm.GetRandNum(_data.Min, _data.Max) + items = append(items, &cfg.Gameatn{ + A: _data.Itemid.A, + T: _data.Itemid.T, + N: _data.Itemid.N * count, // 小组产出数量 + }) } } } - // 过滤 group - var wt int32 - // 类型为2 可能会同时获得多个组id - for _, v := range gourp { - k := v.Groupid - if v.Groupwt != 0 { - wt = v.Groupwt + + } + // 每个小组id 都随机取一次 + szW = make([]int32, 0) + szID = make([]int32, 0) + for _, v := range this._lotteryType2[lotteryId] { + if _data := this.GetLotterConfById(v); _data != nil { + if (_data.Playerlvmax == 0 || (_data.Playerlvmin <= lv && lv <= _data.Playerlvmax)) && (_data.VIPmax == 0 || (_data.VIPmin <= vipLv && vipLv <= _data.VIPmax)) { // 过滤等级等条件 + szW = append(szW, _data.Groupwt) + szID = append(szID, _data.Groupid) } - //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) - if wt >= comm.GetRandNum(0, 1000) { // 命中 - szGroupID = append(szGroupID, k) - key := int64(lotteryId)<<31 + int64(k) - if this.Stype[key] == 1 { // 随机一组数据 - for i := 0; i < int(this.SNum[key]); i++ { - szW := make([]int32, 0) - szID := make([]int32, 0) - gourp := make(map[int32]int32, 0) - for _, v := range this._groupType1[key] { - if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 - if _, ok := gourp[_data.Groupid]; !ok { - szW = append(szW, _data.Itemwt) - szID = append(szID, _data.Id) - } - } - } - index := comm.GetRandW(szW) - _data := this.GetLotterConfById(szID[index]) - //fmt.Printf("获得最终的道具 :%d", _data.Id) - count := comm.GetRandNum(_data.Min, _data.Max) - // 随机获得的数量 - items = append(items, &cfg.Gameatn{ - A: _data.Itemid.A, - T: _data.Itemid.T, - N: _data.Itemid.N * count, - }) - } - } else if this.Stype[key] == 2 { - var wt int32 - for _, v := range this._groupType2[key] { + } + } + + // 类型为2 可能会同时获得多个组id + for pos, v := range szW { + key := int64(lotteryId)<<31 + int64(szID[pos]) + //fmt.Printf("大组类型为2的,获得小组ID :%d,dropID:%d", k, v.Id) + if v >= comm.GetRandNum(0, 1000) { // 命中 + if this.Stype[key] == 1 { // 随机一组数据 + for i := 0; i < int(this.SNum[key]); i++ { + sztW := make([]int32, 0) + sztID := make([]int32, 0) + for _, v := range this._groupType1[key] { if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 - if _data.Itemwt != 0 { - wt = _data.Itemwt - } - if wt >= comm.GetRandNum(1, 1000) { // 命中 - count := comm.GetRandNum(_data.Min, _data.Max) - items = append(items, &cfg.Gameatn{ - A: _data.Itemid.A, - T: _data.Itemid.T, - N: _data.Itemid.N * count, // 小组产出数量 - }) - } + sztW = append(sztW, _data.Itemwt) + sztID = append(sztID, _data.Id) + } + } + index := comm.GetRandW(sztW) + _data := this.GetLotterConfById(sztID[index]) + //fmt.Printf("获得最终的道具 :%d", _data.Id) + count := comm.GetRandNum(_data.Min, _data.Max) + // 随机获得的数量 + items = append(items, &cfg.Gameatn{ + A: _data.Itemid.A, + T: _data.Itemid.T, + N: _data.Itemid.N * count, + }) + } + } else if this.Stype[key] == 2 { + for _, v := range this._groupType2[key] { + if _data := this.GetLotterConfById(v); _data != nil { // 权重赋值 + + if _data.Itemwt >= comm.GetRandNum(1, 1000) { // 命中 + count := comm.GetRandNum(_data.Min, _data.Max) + items = append(items, &cfg.Gameatn{ + A: _data.Itemid.A, + T: _data.Itemid.T, + N: _data.Itemid.N * count, // 小组产出数量 + }) } } }