diff --git a/src/server/game/Player.go b/src/server/game/Player.go index 16f4de98..8080ba23 100644 --- a/src/server/game/Player.go +++ b/src/server/game/Player.go @@ -47,7 +47,7 @@ type Player struct { agent gate.Agent lock sync.Mutex stopSignal chan bool - Msg map[string]PlayerMsg + Msg []PlayerMsg Trigger []*quest.Trigger MDispatr *timer.Dispatcher McronSave *cron.Cron @@ -113,16 +113,16 @@ func (p *Player) SendClientRes() { for _, v := range p.Msg { G_GameLogicPtr.PackResInfo(p.GetAgent(), v.F, v.B) } - p.Msg = make(map[string]PlayerMsg) + p.Msg = make([]PlayerMsg, 0) } func (p *Player) PushClientRes(m proto.Message) { key := GetStructName(m) buff, _ := proto.Marshal(m) - p.Msg[key] = PlayerMsg{ + p.Msg = append(p.Msg, PlayerMsg{ F: key, B: buff, - } + }) } func (p *Player) PushAndSendClienRes(m proto.Message) { @@ -173,14 +173,14 @@ func (p *Player) BackUp() *PlayerBackUp { func (p *Player) Recover(backUp *PlayerBackUp) { // p.GetPlayerBaseMod().Data = backUp.Data p.PlayMod.Recover(backUp) - p.Msg = make(map[string]PlayerMsg) + p.Msg = make([]PlayerMsg, 0) } func (p *Player) InitPlayer(UserName string) error { p.lock.Lock() defer p.lock.Unlock() p.msgChan = make(chan *MsgMod.Msg, 100) - p.Msg = make(map[string]PlayerMsg) + p.Msg = make([]PlayerMsg, 0) p.args = make(map[string]interface{}) p.timerList = make(map[string]*timer.Timer) p.MDispatr = timer.NewDispatcher(100) @@ -660,7 +660,7 @@ func (p *Player) LoginBackData() { func (p *Player) InitPlayerOnly() { p.lock.Lock() defer p.lock.Unlock() - p.Msg = make(map[string]PlayerMsg) + p.Msg = make([]PlayerMsg, 0) p.args = make(map[string]interface{}) p.timerList = make(map[string]*timer.Timer) p.MDispatr = timer.NewDispatcher(10) diff --git a/src/server/game/RegisterNetworkFunc.go b/src/server/game/RegisterNetworkFunc.go index 5de10248..86e0252a 100644 --- a/src/server/game/RegisterNetworkFunc.go +++ b/src/server/game/RegisterNetworkFunc.go @@ -186,6 +186,15 @@ func ReqRewardOrder(args []interface{}) error { Item1 := PlayroomMod.GetReward() Item = item.Merge(Item, Item1) } + + if !OrderMod.CheckSuperOrder() { + if LimitedTimeEventMod.RemoveSuperOrder() { + player.PushClientRes(&msg.LimitEventNotify{ + Id: limitedTimeEvent.EVENT_TYPE_SUPER_ORDER, + Type: limitedTimeEvent.EVENT_NOTIFY_TYPE_DEL, + }) + } + } if LimitedTimeEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_METEOR_SHOW) { //流星雨活动 AddItem := LimitedTimeEventMod.GetMeteorReward(mergeList) if len(AddItem) > 0 { @@ -196,48 +205,6 @@ func ReqRewardOrder(args []interface{}) error { } Item = item.Merge(Item, AddItem) } - if LimitedTimeEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_CHEST_RAIN) { //宝箱雨活动 - AddItem, CardLv, ProductLv, Jackpot := LimitedTimeEventMod.GetChestReward(mergeList) - ChestRainItems := make([]*item.Item, 0) - if len(AddItem) > 0 { - ChestRainItems = AddItem - } - JackpotId := 0 - if CardLv > 0 { - CardId := CardMod.RandCard(CardLv) - ItemId := cardCfg.GetItemIdByCardId(CardId) - ChestRainItems = []*item.Item{{Id: ItemId, Num: 1}} - } - if ProductLv > 0 { - Color := order.RandChessColor(ChessMod.GetOrderEmit()) - ChessId := mergeDataCfg.GetChessIdByLvAndColor(ProductLv, Color) - ChestRainItems = append(ChestRainItems, &item.Item{Id: ChessId, Num: 1}) - } - if Jackpot > 0 { - ProbList := limitedTimeEventCfg.GetSenceJackpotProb() - JackpotId = GoUtil.RandMap(ProbList) - ChestRainItems = limitedTimeEventCfg.GetSenceJackpotReward(JackpotId) - } - Item = item.Merge(Item, ChestRainItems) - if len(ChestRainItems) > 0 { - player.PushClientRes(&msg.ResChessRainReward{ - Items: item.ItemToMsg(ChestRainItems), - Id: int32(JackpotId), - }) - player.TeLog("time_limited_event_action", map[string]interface{}{ - "event_type": "chest_rain", - "item_list": ChestRainItems, - }) - } - } - if !OrderMod.CheckSuperOrder() { - if LimitedTimeEventMod.RemoveSuperOrder() { - player.PushClientRes(&msg.LimitEventNotify{ - Id: limitedTimeEvent.EVENT_TYPE_SUPER_ORDER, - Type: limitedTimeEvent.EVENT_NOTIFY_TYPE_DEL, - }) - } - } if err != nil { player.SendErrClienRes(&msg.ResRewardOrder{ Code: msg.RES_CODE_FAIL, @@ -263,6 +230,50 @@ func ReqRewardOrder(args []interface{}) error { }) return err } + + if LimitedTimeEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_CHEST_RAIN) { //宝箱雨活动 + AddItem, CardLv, ProductLv, Jackpot := LimitedTimeEventMod.GetChestReward(mergeList) + ChestRainItems := make([]*item.Item, 0) + if len(AddItem) > 0 { + ChestRainItems = AddItem + } + JackpotId := 0 + if CardLv > 0 { + CardId := CardMod.RandCard(CardLv) + ItemId := cardCfg.GetItemIdByCardId(CardId) + ChestRainItems = []*item.Item{{Id: ItemId, Num: 1}} + } + if ProductLv > 0 { + Color := order.RandChessColor(ChessMod.GetOrderEmit()) + ChessId := mergeDataCfg.GetChessIdByLvAndColor(ProductLv, Color) + ChestRainItems = append(ChestRainItems, &item.Item{Id: ChessId, Num: 1}) + } + if Jackpot > 0 { + ProbList := limitedTimeEventCfg.GetSenceJackpotProb() + JackpotId = GoUtil.RandMap(ProbList) + ChestRainItems = limitedTimeEventCfg.GetSenceJackpotReward(JackpotId) + } + player.args["ResItemPopId"] = JackpotId + err = player.HandleItem(ChestRainItems, msg.ITEM_POP_LABEL_LimitEventChestRain.String()) + if err != nil { + player.SendErrClienRes(&msg.ResRewardOrder{ + Code: msg.RES_CODE_FAIL, + Msg: err.Error(), + }) + return err + } + + if len(ChestRainItems) > 0 { + player.PushClientRes(&msg.ResChessRainReward{ + Items: item.ItemToMsg(ChestRainItems), + Id: int32(JackpotId), + }) + player.TeLog("time_limited_event_action", map[string]interface{}{ + "event_type": "chest_rain", + "item_list": ChestRainItems, + }) + } + } data := &PlayerChessData{} err = data.UpdateChessData(player, req.MChessData) if err != nil { diff --git a/src/server/msg/Gameapi.pb.go b/src/server/msg/Gameapi.pb.go index 248a44b6..48cf0e54 100644 --- a/src/server/msg/Gameapi.pb.go +++ b/src/server/msg/Gameapi.pb.go @@ -71,6 +71,7 @@ const ( ITEM_POP_LABEL_GM ITEM_POP_LABEL = 45 ITEM_POP_LABEL_Friendtreasure ITEM_POP_LABEL = 46 ITEM_POP_LABEL_CardHandbookReward ITEM_POP_LABEL = 47 // 卡牌图鉴奖励 + ITEM_POP_LABEL_LimitEventChestRain ITEM_POP_LABEL = 48 // 限时事件宝箱雨 ) // Enum value maps for ITEM_POP_LABEL. @@ -124,6 +125,7 @@ var ( 45: "GM", 46: "Friendtreasure", 47: "CardHandbookReward", + 48: "LimitEventChestRain", } ITEM_POP_LABEL_value = map[string]int32{ "Playroom": 0, @@ -174,6 +176,7 @@ var ( "GM": 45, "Friendtreasure": 46, "CardHandbookReward": 47, + "LimitEventChestRain": 48, } ) @@ -20037,7 +20040,7 @@ var file_Gameapi_proto_rawDesc = []byte{ 0x55, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x69, 0x64, 0x22, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x6e, - 0x66, 0x6f, 0x2a, 0x8d, 0x07, 0x0a, 0x0e, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x50, 0x4f, 0x50, 0x5f, + 0x66, 0x6f, 0x2a, 0xa6, 0x07, 0x0a, 0x0e, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x50, 0x4f, 0x50, 0x5f, 0x4c, 0x41, 0x42, 0x45, 0x4c, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x72, 0x6f, 0x6f, 0x6d, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x69, 0x67, 0x67, 0x79, 0x42, 0x61, 0x6e, 0x6b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x68, 0x61, 0x72, 0x67, 0x65, 0x10, 0x02, 0x12, 0x0b, @@ -20094,17 +20097,19 @@ var file_Gameapi_proto_rawDesc = []byte{ 0x0a, 0x02, 0x47, 0x4d, 0x10, 0x2d, 0x12, 0x12, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x10, 0x2e, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x61, 0x72, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x62, 0x6f, 0x6f, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x10, 0x2f, 0x2a, 0x42, 0x0a, 0x0b, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, - 0x45, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x44, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, - 0x4d, 0x50, 0x4f, 0x53, 0x45, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x42, 0x55, 0x59, 0x10, 0x02, - 0x12, 0x08, 0x0a, 0x04, 0x53, 0x45, 0x4c, 0x4c, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, - 0x4d, 0x4f, 0x56, 0x45, 0x10, 0x04, 0x2a, 0x21, 0x0a, 0x08, 0x52, 0x45, 0x53, 0x5f, 0x43, 0x4f, - 0x44, 0x45, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, - 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x2a, 0x2e, 0x0a, 0x09, 0x49, 0x54, 0x45, - 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x4e, 0x45, 0x52, 0x47, 0x59, - 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x54, 0x41, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, - 0x44, 0x49, 0x41, 0x4d, 0x4f, 0x4e, 0x44, 0x10, 0x02, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2e, 0x2f, - 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x10, 0x2f, 0x12, 0x17, 0x0a, 0x13, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x43, 0x68, 0x65, 0x73, 0x74, 0x52, 0x61, 0x69, 0x6e, 0x10, 0x30, 0x2a, 0x42, 0x0a, 0x0b, 0x48, + 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x44, + 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4d, 0x50, 0x4f, 0x53, 0x45, 0x10, 0x01, + 0x12, 0x07, 0x0a, 0x03, 0x42, 0x55, 0x59, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x45, 0x4c, + 0x4c, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x10, 0x04, 0x2a, + 0x21, 0x0a, 0x08, 0x52, 0x45, 0x53, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x12, 0x08, 0x0a, 0x04, 0x46, + 0x41, 0x49, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, + 0x10, 0x01, 0x2a, 0x2e, 0x0a, 0x09, 0x49, 0x54, 0x45, 0x4d, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x12, + 0x0a, 0x0a, 0x06, 0x45, 0x4e, 0x45, 0x52, 0x47, 0x59, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x53, + 0x54, 0x41, 0x52, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x49, 0x41, 0x4d, 0x4f, 0x4e, 0x44, + 0x10, 0x02, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2e, 0x2f, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var (