diff --git a/common/constant.go b/common/constant.go index ce97408..39e5f71 100644 --- a/common/constant.go +++ b/common/constant.go @@ -611,6 +611,7 @@ const ( ItemIDPhoneScore = 100006 // 手机抽奖积分 ItemIDWeekScore = 100004 // 周活跃积分 ItemIDGiftBox = 50001 // 碎片礼盒 + ItemIDCollectBox = 50002 // 集卡礼盒 ) func ToItemId(id int32) int32 { @@ -702,6 +703,7 @@ const ( TaskTypeActivityScore = 14 // 周活跃积分数量 TaskTypeFirstLogin = 15 // 每日首次登录 TaskTypeInviteNum = 16 // 邀请绑定数量 + TaskTypeTurnplate = 17 // 转盘抽奖次数 ) const ( diff --git a/data/DB_GameItem.dat b/data/DB_GameItem.dat index 000c018..0719886 100644 Binary files a/data/DB_GameItem.dat and b/data/DB_GameItem.dat differ diff --git a/data/DB_GameItem.json b/data/DB_GameItem.json index cbfd726..0f1d7ab 100644 --- a/data/DB_GameItem.json +++ b/data/DB_GameItem.json @@ -393,7 +393,7 @@ 1, 0 ], - "Type": 4, + "Type": 13, "Effect0": [ 1, 0, diff --git a/data/DB_PropExchange.dat b/data/DB_PropExchange.dat index b06b77f..ab684a7 100644 --- a/data/DB_PropExchange.dat +++ b/data/DB_PropExchange.dat @@ -1,5 +1,5 @@ -6ӆԆՆֆ׆"= -.؆نچۆ"= -WӆԆֆچۆՆ׆؆ن"  -]ֆ؆چ܆ӆԆنۆՆ׆" \ No newline at end of file +6ֆ׆ӆԆՆ"= +.ۆ؆نچ"= +WچۆӆԆֆنՆ׆؆"  +]ֆ؆چۆ܆ӆԆՆ׆ن" \ No newline at end of file diff --git a/data/DB_Task.dat b/data/DB_Task.dat index 1328797..39af72e 100644 Binary files a/data/DB_Task.dat and b/data/DB_Task.dat differ diff --git a/data/gameparam.json b/data/gameparam.json index 01c9755..818194c 100644 --- a/data/gameparam.json +++ b/data/gameparam.json @@ -20,7 +20,7 @@ "MatchSeasonRankMaxNum":50, "RobotInviteInitInterval": 1, "RobotInviteIntervalMax": 1, - "ClosePreCreateRoom": false, + "ClosePreCreateRoom": true, "AgoraAddress": "http://47.105.78.29:8081", "InviteUrl": "http://47.105.78.29:8000/" } \ No newline at end of file diff --git a/etcd/keyconf.go b/etcd/keyconf.go index ae44b90..ffa0d23 100644 --- a/etcd/keyconf.go +++ b/etcd/keyconf.go @@ -6,50 +6,50 @@ const ( ETCDKEY_SYS_PLT_DBCFG_PREFIX = "/sys/plt/dbcfg/" //业务配置 - ETCDKEY_ROOT_PREFIX = "/mongo.games.com/game/" - ETCDKEY_PLATFORM_PREFIX = "/mongo.games.com/game/plt/config/" - ETCDKEY_BULLETIN_PREFIX = "/mongo.games.com/game/plt/bulletin/" - ETCDKEY_AGENTCUSTOMER_PREFIX = "/mongo.games.com/game/plt/agent_customer/" - ETCDKEY_GAME_CONFIG_GLOBAL = "/mongo.games.com/game/plt/game_config_global" // 超管平台游戏开关 - ETCDKEY_GAMECONFIG_PREFIX = "/mongo.games.com/game/plt/game_config/" // 平台游戏配置 - ETCDKEY_PACKAGE_PREFIX = "/mongo.games.com/game/plt/package/" - ETCDKEY_GROUPCONFIG_PREFIX = "/mongo.games.com/game/group_config/" - ETCDKEY_BLACKLIST_PREFIX = "/mongo.games.com/game/plt/black_list/" - ETCDKEY_ACT_SIGNIN_PREFIX = "/mongo.games.com/game/activity/signin/" - ETCDKEY_ACT_TASK_PREFIX = "/mongo.games.com/game/activity/task/" - ETCDKEY_ACT_GOLDTASK_PREFIX = "/mongo.games.com/game/activity/goldtask/" - ETCDKEY_ACT_GOLDCOME_PREFIX = "/mongo.games.com/game/activity/goldcome/" - ETCDKEY_ACT_ONLINEREWARD_PREFIX = "/mongo.games.com/game/activity/onlinereward/" - ETCDKEY_ACT_LUCKLYTURNTABLE_PREFIX = "/mongo.games.com/game/activity/lucklyturntable/" - ETCDKEY_ACT_YEB_PREFIX = "/mongo.games.com/game/activity/yeb/" - ETCDKEY_CONFIG_REBATE = "/mongo.games.com/game/plt/game_rebate_config/" - ETCDKEY_PROMOTER_PREFIX = "/mongo.games.com/game/plt/promoter/" - ETCDKEY_ACT_VIP_PREFIX = "/mongo.games.com/game/plt/actvip/" - ETCDKEY_ACT_WEIXIN_SHARE_PREFIX = "/mongo.games.com/game/plt/actshare/" - ETCDKEY_ACT_GIVE_PREFIX = "/mongo.games.com/game/plt/actgive/" - ETCDKEY_ACT_PAY_PREFIX = "/mongo.games.com/game/plt/payact/" - ETCDKEY_ACT_RANDCOIN_PREFIX = "/mongo.games.com/game/plt/randcoin/" - ETCDKEY_ACT_FPAY_PREFIX = "/mongo.games.com/game/plt/fpay/" - ETCDKEY_PLATFORM_PROFITCONTROL = "/mongo.games.com/game/plt/profitcontrol/" - ETCDKEY_MATCH_PROFIX = "/mongo.games.com/game/match/" - ETCDKEY_ACT_TICKET_PROFIX = "/mongo.games.com/game/activity/ticket/" - ETCDKEY_ACT_TICKET_RUNNING = "/mongo.games.com/game/activity/ticket/running" - ETCDKEY_MATCH_GRADESHOP = "/mongo.games.com/game/match/gradeshop/" - ETCDKEY_CONFIG_LOGICLEVEL = "/mongo.games.com/game/logiclevel/" - ETCDKEY_SHOP_EXCHANGE = "/mongo.games.com/game/exchange_shop" - ETCDKEY_GAME_NOTICE = "/mongo.games.com/game/common_notice" - ETCDKEY_SHOP_ITEM = "/mongo.games.com/game/item_shop" - ETCDKEY_GAME_MATCH = "/mongo.games.com/game/game_match" - ETCDKEY_ACT_TURNPLATE = "/mongo.games.com/game/act_turnplate" - ETCDKEY_ACT_7SIGN = "/mongo.games.com/game/act_7sign" - ETCDKEY_ACT_BLINDBOX = "/mongo.games.com/game/act_blindbox" - ETCDKEY_ACT_FIRSTPAY = "/mongo.games.com/game/act_FirstPay" - ETCDKEY_ACT_CONTINUOUSPAY = "/mongo.games.com/game/act_ContinuousPay" - ETCDKEY_VIP_CFG = "/mongo.games.com/game/VIPcfg" - ETCDKEY_WBCtrl_CFG = "/mongo.games.com/game/WBCtrlCfg" - ETCDKEY_PACKAGE_ENTRYSWITCH = "/mongo.games.com/game/plt/entryswitch/" //界面入口开关 - ETCDKEY_CHESSRANK_CFG = "/mongo.games.com/game/plt/chessrank/" // 象棋段位配置 - ETCDKEY_PLAYERPOOL = "/mongo.games.com/game/plt/playerpool/" // 个人水池调控配置 - ETCDKEY_GAME_CONFIG = "/mongo.games.com/game/plt/gameconfig/" // 游戏管理/全局配置 - ETCDKEY_ACT_PHONELOTTERY = "/mongo.games.com/game/act_phoneLottery" + ETCDKEY_ROOT_PREFIX = "/game/" + ETCDKEY_PLATFORM_PREFIX = "/game/plt/config/" + ETCDKEY_BULLETIN_PREFIX = "/game/plt/bulletin/" + ETCDKEY_AGENTCUSTOMER_PREFIX = "/game/plt/agent_customer/" + ETCDKEY_GAME_CONFIG_GLOBAL = "/game/plt/game_config_global" // 超管平台游戏开关 + ETCDKEY_GAMECONFIG_PREFIX = "/game/plt/game_config/" // 平台游戏配置 + ETCDKEY_PACKAGE_PREFIX = "/game/plt/package/" + ETCDKEY_GROUPCONFIG_PREFIX = "/game/group_config/" + ETCDKEY_BLACKLIST_PREFIX = "/game/plt/black_list/" + ETCDKEY_ACT_SIGNIN_PREFIX = "/game/activity/signin/" + ETCDKEY_ACT_TASK_PREFIX = "/game/activity/task/" + ETCDKEY_ACT_GOLDTASK_PREFIX = "/game/activity/goldtask/" + ETCDKEY_ACT_GOLDCOME_PREFIX = "/game/activity/goldcome/" + ETCDKEY_ACT_ONLINEREWARD_PREFIX = "/game/activity/onlinereward/" + ETCDKEY_ACT_LUCKLYTURNTABLE_PREFIX = "/game/activity/lucklyturntable/" + ETCDKEY_ACT_YEB_PREFIX = "/game/activity/yeb/" + ETCDKEY_CONFIG_REBATE = "/game/plt/game_rebate_config/" + ETCDKEY_PROMOTER_PREFIX = "/game/plt/promoter/" + ETCDKEY_ACT_VIP_PREFIX = "/game/plt/actvip/" + ETCDKEY_ACT_WEIXIN_SHARE_PREFIX = "/game/plt/actshare/" + ETCDKEY_ACT_GIVE_PREFIX = "/game/plt/actgive/" + ETCDKEY_ACT_PAY_PREFIX = "/game/plt/payact/" + ETCDKEY_ACT_RANDCOIN_PREFIX = "/game/plt/randcoin/" + ETCDKEY_ACT_FPAY_PREFIX = "/game/plt/fpay/" + ETCDKEY_PLATFORM_PROFITCONTROL = "/game/plt/profitcontrol/" + ETCDKEY_MATCH_PROFIX = "/game/match/" + ETCDKEY_ACT_TICKET_PROFIX = "/game/activity/ticket/" + ETCDKEY_ACT_TICKET_RUNNING = "/game/activity/ticket/running" + ETCDKEY_MATCH_GRADESHOP = "/game/match/gradeshop/" + ETCDKEY_CONFIG_LOGICLEVEL = "/game/logiclevel/" + ETCDKEY_SHOP_EXCHANGE = "/game/exchange_shop" + ETCDKEY_GAME_NOTICE = "/game/common_notice" + ETCDKEY_SHOP_ITEM = "/game/item_shop" + ETCDKEY_GAME_MATCH = "/game/game_match" + ETCDKEY_ACT_TURNPLATE = "/game/act_turnplate" + ETCDKEY_ACT_7SIGN = "/game/act_7sign" + ETCDKEY_ACT_BLINDBOX = "/game/act_blindbox" + ETCDKEY_ACT_FIRSTPAY = "/game/act_FirstPay" + ETCDKEY_ACT_CONTINUOUSPAY = "/game/act_ContinuousPay" + ETCDKEY_VIP_CFG = "/game/VIPcfg" + ETCDKEY_WBCtrl_CFG = "/game/WBCtrlCfg" + ETCDKEY_PACKAGE_ENTRYSWITCH = "/game/plt/entryswitch/" //界面入口开关 + ETCDKEY_CHESSRANK_CFG = "/game/plt/chessrank/" // 象棋段位配置 + ETCDKEY_PLAYERPOOL = "/game/plt/playerpool/" // 个人水池调控配置 + ETCDKEY_GAME_CONFIG = "/game/plt/gameconfig/" // 游戏管理/全局配置 + ETCDKEY_ACT_PHONELOTTERY = "/game/act_phoneLottery" ) diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index 85ef62b..ce5bb1d 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -2319,6 +2319,9 @@ func (this *Scene) TryBillExGameDrop(p *Player) { if p.IsRob { return } + + this.DropCollectBox(p) + baseScore := this.DbGameFree.BaseScore if common.IsLocalGame(this.GameId) { baseScore = this.BaseScore @@ -2371,6 +2374,40 @@ func (this *Scene) TryBillExGameDrop(p *Player) { } } +// DropCollectBox 掉落集卡礼盒 +func (this *Scene) DropCollectBox(p *Player) { + if p == nil || p.IsRob { + return + } + + data := srvdata.PBDB_CollectBoxGainMgr.GetData(this.GetGameFreeId()) + if data == nil { + return + } + + n := this.RandInt(100) + if n < int(data.GetRate()) { + pack := &player.SCGameExDropItems{} + pack.Items = make(map[int32]int32) + itemData := srvdata.PBDB_GameItemMgr.GetData(common.ItemIDCollectBox) + if itemData != nil { + p.Items[itemData.Id] = p.Items[itemData.Id] + 1 + pack.Items = map[int32]int32{itemData.Id: 1} + remark := fmt.Sprintf("游戏掉落%v", itemData.Id) + //logType 0获得 1消耗 + log := model.NewItemLogEx(p.Platform, p.SnId, 0, itemData.Id, itemData.Name, 1, remark) + if log != nil { + logger.Logger.Trace("WriteLog: ", log) + LogChannelSingleton.WriteLog(log) + } + } + if pack != nil && pack.Items != nil && len(pack.Items) != 0 { + p.SendToClient(int(player.PlayerPacketID_PACKET_SCGAMEEXDROPITEMS), pack) + logger.Logger.Trace("SCGAMEEXDROPITEMS", pack) + } + } +} + // 生成名字 func (this *Scene) RandNickName() string { //if rand.Int31n(100) < 60 { diff --git a/protocol/bag/bag.pb.go b/protocol/bag/bag.pb.go index 06e77a4..b3dc67a 100644 --- a/protocol/bag/bag.pb.go +++ b/protocol/bag/bag.pb.go @@ -20,7 +20,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -//操作结果 +// 操作结果 type OpResultCode int32 const ( @@ -91,6 +91,9 @@ const ( SPacketID_PACKET_ALL_BAG_USE SPacketID = 2531 //使用背包道具 SPacketID_PACKET_SC_SYNCBAGDATA SPacketID = 2532 //背包数据更新 SPacketID_PACKET_ALL_BAG_END SPacketID = 2549 //最大消息号 + //3000~3099 + SPacketID_PACKET_PropExchange SPacketID = 3000 // 道具兑换 + SPacketID_PACKET_ExchangeList SPacketID = 3001 // 兑换列表 ) // Enum value maps for SPacketID. @@ -101,6 +104,8 @@ var ( 2531: "PACKET_ALL_BAG_USE", 2532: "PACKET_SC_SYNCBAGDATA", 2549: "PACKET_ALL_BAG_END", + 3000: "PACKET_PropExchange", + 3001: "PACKET_ExchangeList", } SPacketID_value = map[string]int32{ "PACKET_BAG_ZERO": 0, @@ -108,6 +113,8 @@ var ( "PACKET_ALL_BAG_USE": 2531, "PACKET_SC_SYNCBAGDATA": 2532, "PACKET_ALL_BAG_END": 2549, + "PACKET_PropExchange": 3000, + "PACKET_ExchangeList": 3001, } ) @@ -138,7 +145,7 @@ func (SPacketID) EnumDescriptor() ([]byte, []int) { return file_bag_proto_rawDescGZIP(), []int{1} } -//物品信息 后续精简 +// 物品信息 后续精简 type ItemInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -216,13 +223,14 @@ func (x *ItemInfo) GetObtainTime() int64 { return 0 } -//PACKET_ALL_BAG_INFO +// PACKET_ALL_BAG_INFO type CSBagInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields NowLocation int32 `protobuf:"varint,1,opt,name=NowLocation,proto3" json:"NowLocation,omitempty"` //0.通用 1.大厅 2.Tienlen 3.捕鱼 + Tp int32 `protobuf:"varint,2,opt,name=Tp,proto3" json:"Tp,omitempty"` // 道具类型 } func (x *CSBagInfo) Reset() { @@ -264,7 +272,14 @@ func (x *CSBagInfo) GetNowLocation() int32 { return 0 } -//PACKET_ALL_BAG_INFO +func (x *CSBagInfo) GetTp() int32 { + if x != nil { + return x.Tp + } + return 0 +} + +// PACKET_ALL_BAG_INFO type SCBagInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -328,7 +343,7 @@ func (x *SCBagInfo) GetBagNumMax() int32 { return 0 } -//PACKET_ALL_BAG_USE +// PACKET_ALL_BAG_USE type CSUpBagInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -416,7 +431,7 @@ func (x *CSUpBagInfo) GetShowId() int64 { return 0 } -//PACKET_ALL_BAG_USE +// PACKET_ALL_BAG_USE type SCUpBagInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -506,7 +521,7 @@ func (x *SCUpBagInfo) GetInfos() []*ItemInfo { return nil } -//PACKET_SC_SYNCBAGDATA +// PACKET_SC_SYNCBAGDATA type SCSyncBagData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -554,6 +569,338 @@ func (x *SCSyncBagData) GetInfos() []*ItemInfo { return nil } +type PropInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ItemId int32 `protobuf:"varint,1,opt,name=ItemId,proto3" json:"ItemId,omitempty"` //物品ID + ItemNum int64 `protobuf:"varint,2,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"` //物品数量 +} + +func (x *PropInfo) Reset() { + *x = PropInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_bag_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PropInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PropInfo) ProtoMessage() {} + +func (x *PropInfo) ProtoReflect() protoreflect.Message { + mi := &file_bag_proto_msgTypes[6] + 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 PropInfo.ProtoReflect.Descriptor instead. +func (*PropInfo) Descriptor() ([]byte, []int) { + return file_bag_proto_rawDescGZIP(), []int{6} +} + +func (x *PropInfo) GetItemId() int32 { + if x != nil { + return x.ItemId + } + return 0 +} + +func (x *PropInfo) GetItemNum() int64 { + if x != nil { + return x.ItemNum + } + return 0 +} + +// PACKET_PropExchange +type CSPropExchange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 兑换ID +} + +func (x *CSPropExchange) Reset() { + *x = CSPropExchange{} + if protoimpl.UnsafeEnabled { + mi := &file_bag_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CSPropExchange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CSPropExchange) ProtoMessage() {} + +func (x *CSPropExchange) ProtoReflect() protoreflect.Message { + mi := &file_bag_proto_msgTypes[7] + 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 CSPropExchange.ProtoReflect.Descriptor instead. +func (*CSPropExchange) Descriptor() ([]byte, []int) { + return file_bag_proto_rawDescGZIP(), []int{7} +} + +func (x *CSPropExchange) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type SCPropExchange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RetCode OpResultCode `protobuf:"varint,1,opt,name=RetCode,proto3,enum=bag.OpResultCode" json:"RetCode,omitempty"` // 错误码 + Items []*PropInfo `protobuf:"bytes,2,rep,name=Items,proto3" json:"Items,omitempty"` // 获得道具 + RemainItems []*PropInfo `protobuf:"bytes,3,rep,name=RemainItems,proto3" json:"RemainItems,omitempty"` // 被消耗的道具剩余数量 +} + +func (x *SCPropExchange) Reset() { + *x = SCPropExchange{} + if protoimpl.UnsafeEnabled { + mi := &file_bag_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SCPropExchange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SCPropExchange) ProtoMessage() {} + +func (x *SCPropExchange) ProtoReflect() protoreflect.Message { + mi := &file_bag_proto_msgTypes[8] + 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 SCPropExchange.ProtoReflect.Descriptor instead. +func (*SCPropExchange) Descriptor() ([]byte, []int) { + return file_bag_proto_rawDescGZIP(), []int{8} +} + +func (x *SCPropExchange) GetRetCode() OpResultCode { + if x != nil { + return x.RetCode + } + return OpResultCode_OPRC_Sucess +} + +func (x *SCPropExchange) GetItems() []*PropInfo { + if x != nil { + return x.Items + } + return nil +} + +func (x *SCPropExchange) GetRemainItems() []*PropInfo { + if x != nil { + return x.RemainItems + } + return nil +} + +type ExchangeInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 兑换ID + CostItems []*PropInfo `protobuf:"bytes,2,rep,name=CostItems,proto3" json:"CostItems,omitempty"` // 消耗道具 + GainItems []*PropInfo `protobuf:"bytes,3,rep,name=GainItems,proto3" json:"GainItems,omitempty"` // 获得道具 +} + +func (x *ExchangeInfo) Reset() { + *x = ExchangeInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_bag_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExchangeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExchangeInfo) ProtoMessage() {} + +func (x *ExchangeInfo) ProtoReflect() protoreflect.Message { + mi := &file_bag_proto_msgTypes[9] + 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 ExchangeInfo.ProtoReflect.Descriptor instead. +func (*ExchangeInfo) Descriptor() ([]byte, []int) { + return file_bag_proto_rawDescGZIP(), []int{9} +} + +func (x *ExchangeInfo) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ExchangeInfo) GetCostItems() []*PropInfo { + if x != nil { + return x.CostItems + } + return nil +} + +func (x *ExchangeInfo) GetGainItems() []*PropInfo { + if x != nil { + return x.GainItems + } + return nil +} + +// PACKET_ExchangeList +type CSExchangeList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 兑换类型 1集卡活动 +} + +func (x *CSExchangeList) Reset() { + *x = CSExchangeList{} + if protoimpl.UnsafeEnabled { + mi := &file_bag_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CSExchangeList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CSExchangeList) ProtoMessage() {} + +func (x *CSExchangeList) ProtoReflect() protoreflect.Message { + mi := &file_bag_proto_msgTypes[10] + 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 CSExchangeList.ProtoReflect.Descriptor instead. +func (*CSExchangeList) Descriptor() ([]byte, []int) { + return file_bag_proto_rawDescGZIP(), []int{10} +} + +func (x *CSExchangeList) GetTp() int32 { + if x != nil { + return x.Tp + } + return 0 +} + +type SCExchangeList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Infos []*ExchangeInfo `protobuf:"bytes,1,rep,name=Infos,proto3" json:"Infos,omitempty"` // 兑换列表 + Tp int32 `protobuf:"varint,2,opt,name=Tp,proto3" json:"Tp,omitempty"` // 兑换类型 +} + +func (x *SCExchangeList) Reset() { + *x = SCExchangeList{} + if protoimpl.UnsafeEnabled { + mi := &file_bag_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SCExchangeList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SCExchangeList) ProtoMessage() {} + +func (x *SCExchangeList) ProtoReflect() protoreflect.Message { + mi := &file_bag_proto_msgTypes[11] + 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 SCExchangeList.ProtoReflect.Descriptor instead. +func (*SCExchangeList) Descriptor() ([]byte, []int) { + return file_bag_proto_rawDescGZIP(), []int{11} +} + +func (x *SCExchangeList) GetInfos() []*ExchangeInfo { + if x != nil { + return x.Infos + } + return nil +} + +func (x *SCExchangeList) GetTp() int32 { + if x != nil { + return x.Tp + } + return 0 +} + var File_bag_proto protoreflect.FileDescriptor var file_bag_proto_rawDesc = []byte{ @@ -563,10 +910,11 @@ var file_bag_proto_rawDesc = []byte{ 0x65, 0x6d, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x2d, + 0x28, 0x03, 0x52, 0x0a, 0x4f, 0x62, 0x74, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3d, 0x0a, 0x09, 0x43, 0x53, 0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x6f, 0x77, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0b, 0x4e, 0x6f, 0x77, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7b, 0x0a, + 0x52, 0x0b, 0x4e, 0x6f, 0x77, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, + 0x02, 0x54, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x7b, 0x0a, 0x09, 0x53, 0x43, 0x42, 0x61, 0x67, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x0a, 0x07, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x07, @@ -601,25 +949,58 @@ var file_bag_proto_rawDesc = []byte{ 0x6f, 0x73, 0x22, 0x34, 0x0a, 0x0d, 0x53, 0x43, 0x53, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x2a, 0x85, 0x01, 0x0a, 0x0c, 0x4f, 0x70, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, - 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, - 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, - 0x52, 0x43, 0x5f, 0x55, 0x73, 0x65, 0x55, 0x70, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, - 0x52, 0x43, 0x5f, 0x49, 0x64, 0x45, 0x72, 0x72, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, - 0x52, 0x43, 0x5f, 0x44, 0x62, 0x45, 0x72, 0x72, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, - 0x52, 0x43, 0x5f, 0x42, 0x61, 0x67, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, - 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x4e, 0x6f, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x06, - 0x2a, 0x88, 0x01, 0x0a, 0x09, 0x53, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x13, - 0x0a, 0x0f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x5a, 0x45, 0x52, - 0x4f, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, - 0x4c, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe2, 0x13, 0x12, 0x17, 0x0a, - 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x47, 0x5f, - 0x55, 0x53, 0x45, 0x10, 0xe3, 0x13, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x42, 0x41, 0x47, 0x44, 0x41, 0x54, 0x41, 0x10, - 0xe4, 0x13, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, - 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0xf5, 0x13, 0x42, 0x07, 0x5a, 0x05, 0x2e, - 0x3b, 0x62, 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x52, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x22, 0x3c, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x49, + 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x53, 0x50, 0x72, 0x6f, 0x70, + 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x22, 0x93, 0x01, 0x0a, 0x0e, 0x53, 0x43, 0x50, + 0x72, 0x6f, 0x70, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x52, + 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x62, + 0x61, 0x67, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, + 0x07, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x50, 0x72, + 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2f, 0x0a, + 0x0b, 0x52, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x0b, 0x52, 0x65, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x78, + 0x0a, 0x0c, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, + 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x2b, + 0x0a, 0x09, 0x43, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x09, 0x43, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x47, + 0x61, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x62, 0x61, 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x47, + 0x61, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x53, 0x45, 0x78, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x49, 0x0a, 0x0e, 0x53, 0x43, + 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x05, + 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x62, 0x61, + 0x67, 0x2e, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, + 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x02, 0x54, 0x70, 0x2a, 0x85, 0x01, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, + 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x55, 0x73, 0x65, 0x55, 0x70, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x49, 0x64, 0x45, 0x72, 0x72, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x44, 0x62, 0x45, 0x72, 0x72, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x42, 0x61, 0x67, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x50, 0x52, + 0x43, 0x5f, 0x4e, 0x6f, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x06, 0x2a, 0xbc, 0x01, + 0x0a, 0x09, 0x53, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x13, 0x0a, 0x0f, 0x50, + 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, + 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42, + 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe2, 0x13, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, + 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42, 0x41, 0x47, 0x5f, 0x55, 0x53, 0x45, + 0x10, 0xe3, 0x13, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, + 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x42, 0x41, 0x47, 0x44, 0x41, 0x54, 0x41, 0x10, 0xe4, 0x13, 0x12, + 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x41, 0x4c, 0x4c, 0x5f, 0x42, 0x41, + 0x47, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0xf5, 0x13, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x50, 0x72, 0x6f, 0x70, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, + 0xb8, 0x17, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45, 0x78, 0x63, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb9, 0x17, 0x42, 0x07, 0x5a, 0x05, + 0x2e, 0x3b, 0x62, 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -635,28 +1016,40 @@ func file_bag_proto_rawDescGZIP() []byte { } var file_bag_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_bag_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_bag_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_bag_proto_goTypes = []interface{}{ - (OpResultCode)(0), // 0: bag.OpResultCode - (SPacketID)(0), // 1: bag.SPacketID - (*ItemInfo)(nil), // 2: bag.ItemInfo - (*CSBagInfo)(nil), // 3: bag.CSBagInfo - (*SCBagInfo)(nil), // 4: bag.SCBagInfo - (*CSUpBagInfo)(nil), // 5: bag.CSUpBagInfo - (*SCUpBagInfo)(nil), // 6: bag.SCUpBagInfo - (*SCSyncBagData)(nil), // 7: bag.SCSyncBagData + (OpResultCode)(0), // 0: bag.OpResultCode + (SPacketID)(0), // 1: bag.SPacketID + (*ItemInfo)(nil), // 2: bag.ItemInfo + (*CSBagInfo)(nil), // 3: bag.CSBagInfo + (*SCBagInfo)(nil), // 4: bag.SCBagInfo + (*CSUpBagInfo)(nil), // 5: bag.CSUpBagInfo + (*SCUpBagInfo)(nil), // 6: bag.SCUpBagInfo + (*SCSyncBagData)(nil), // 7: bag.SCSyncBagData + (*PropInfo)(nil), // 8: bag.PropInfo + (*CSPropExchange)(nil), // 9: bag.CSPropExchange + (*SCPropExchange)(nil), // 10: bag.SCPropExchange + (*ExchangeInfo)(nil), // 11: bag.ExchangeInfo + (*CSExchangeList)(nil), // 12: bag.CSExchangeList + (*SCExchangeList)(nil), // 13: bag.SCExchangeList } var file_bag_proto_depIdxs = []int32{ - 0, // 0: bag.SCBagInfo.RetCode:type_name -> bag.OpResultCode - 2, // 1: bag.SCBagInfo.Infos:type_name -> bag.ItemInfo - 0, // 2: bag.SCUpBagInfo.RetCode:type_name -> bag.OpResultCode - 2, // 3: bag.SCUpBagInfo.Infos:type_name -> bag.ItemInfo - 2, // 4: bag.SCSyncBagData.Infos:type_name -> bag.ItemInfo - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 0, // 0: bag.SCBagInfo.RetCode:type_name -> bag.OpResultCode + 2, // 1: bag.SCBagInfo.Infos:type_name -> bag.ItemInfo + 0, // 2: bag.SCUpBagInfo.RetCode:type_name -> bag.OpResultCode + 2, // 3: bag.SCUpBagInfo.Infos:type_name -> bag.ItemInfo + 2, // 4: bag.SCSyncBagData.Infos:type_name -> bag.ItemInfo + 0, // 5: bag.SCPropExchange.RetCode:type_name -> bag.OpResultCode + 8, // 6: bag.SCPropExchange.Items:type_name -> bag.PropInfo + 8, // 7: bag.SCPropExchange.RemainItems:type_name -> bag.PropInfo + 8, // 8: bag.ExchangeInfo.CostItems:type_name -> bag.PropInfo + 8, // 9: bag.ExchangeInfo.GainItems:type_name -> bag.PropInfo + 11, // 10: bag.SCExchangeList.Infos:type_name -> bag.ExchangeInfo + 11, // [11:11] is the sub-list for method output_type + 11, // [11:11] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_bag_proto_init() } @@ -737,6 +1130,78 @@ func file_bag_proto_init() { return nil } } + file_bag_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PropInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bag_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CSPropExchange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bag_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SCPropExchange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bag_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExchangeInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bag_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CSExchangeList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bag_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SCExchangeList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -744,7 +1209,7 @@ func file_bag_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_bag_proto_rawDesc, NumEnums: 2, - NumMessages: 6, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/bag/bag.proto b/protocol/bag/bag.proto index bf5243a..ee6ba1a 100644 --- a/protocol/bag/bag.proto +++ b/protocol/bag/bag.proto @@ -18,6 +18,9 @@ enum SPacketID { PACKET_ALL_BAG_USE = 2531; //使用背包道具 PACKET_SC_SYNCBAGDATA = 2532;//背包数据更新 PACKET_ALL_BAG_END = 2549; //最大消息号 + //3000~3099 + PACKET_PropExchange = 3000; // 道具兑换 + PACKET_ExchangeList = 3001; // 兑换列表 } //物品信息 后续精简 message ItemInfo{ @@ -43,6 +46,7 @@ message ItemInfo{ //PACKET_ALL_BAG_INFO message CSBagInfo { int32 NowLocation = 1;//0.通用 1.大厅 2.Tienlen 3.捕鱼 + int32 Tp = 2;// 道具类型 } //PACKET_ALL_BAG_INFO message SCBagInfo { @@ -74,4 +78,34 @@ message SCUpBagInfo { //PACKET_SC_SYNCBAGDATA message SCSyncBagData{ repeated ItemInfo Infos = 1;// 物品信息 +} + +message PropInfo{ + int32 ItemId = 1;//物品ID + int64 ItemNum = 2;//物品数量 +} + +// PACKET_PropExchange +message CSPropExchange{ + int32 Id = 1; // 兑换ID +} +message SCPropExchange{ + OpResultCode RetCode = 1; // 错误码 + repeated PropInfo Items = 2; // 获得道具 + repeated PropInfo RemainItems = 3; // 被消耗的道具剩余数量 +} + +message ExchangeInfo{ + int32 Id = 1; // 兑换ID + repeated PropInfo CostItems = 2; // 消耗道具 + repeated PropInfo GainItems = 3; // 获得道具 +} + +// PACKET_ExchangeList +message CSExchangeList{ + int32 Tp = 1; // 兑换类型 1集卡活动 +} +message SCExchangeList{ + repeated ExchangeInfo Infos = 1; // 兑换列表 + int32 Tp = 2; // 兑换类型 } \ No newline at end of file diff --git a/protocol/doc.md b/protocol/doc.md index 4ffacf5..01bc184 100644 --- a/protocol/doc.md +++ b/protocol/doc.md @@ -47,6 +47,7 @@ #### bag(背包) - 2530~2549 +- 3000~3099 #### Pets(人物宠物) - 2550~2579 diff --git a/protocol/shop/shop.proto_bak b/protocol/shop/shop.proto_bak deleted file mode 100644 index 5c62ff3..0000000 --- a/protocol/shop/shop.proto_bak +++ /dev/null @@ -1,141 +0,0 @@ -syntax = "proto3"; -package shop; -option go_package = ".;shop"; -//操作结果 -enum OpResultCode { - OPRC_Sucess = 0; //成功 - OPRC_Error = 1; //失败 -} -//世界杯 -enum SPacketID { - PACKET_SHOP_ZERO = 0; // 弃用消息号 - SHOP_CS_PAYLIST = 2550; //支付方式 - SHOP_SC_PAYLIST = 2551; //支付方式 - SHOP_CS_PAYORDER = 2552; //创建订单 - SHOP_SC_PAYORDER = 2553; //创建订单 - SHOP_CS_EXCHANGE = 2554; //兑换订单 - SHOP_SC_EXCHANGE = 2555; //兑换订单 - SHOP_CS_EXCHANGELIST = 2556; //兑换订单 - SHOP_SC_EXCHANGELIST = 2557; //兑换订单 - SHOP_CS_FLOWLIST = 2558; //请求获取流水列表 - SHOP_SC_FLOWLIST = 2559; //返回流水列表 - SHOP_CS_GET_EXCHANGEINFO = 2560; //请求兑换信息 - SHOP_SC_GET_EXCHANGEINFO = 2561; //返回兑换信息 - SHOP_CS_GET_PAYFLOWLIST = 2562; //请求兑换支付赠送信息 - SHOP_SC_GET_PAYFLOWLIST = 2563; //返回兑换支付赠送信息 - SHOP_SC_GIVECOIN_INFO = 2564; //通知赠送信息,先临时放到这个地方,其他协议需要合并 - -} - -//支付方式列表 -message CSShopPayList { - int32 OS = 1; //OS 操作系统 0 全部 1 android 2 ios -} -message SCShopPayList { - OpResultCode OpCode = 1; //请求结果 - string Data = 2; //平台数据 -} -//创建订单 -message CSShopOrder { - int32 OrderId = 1; //充值平台ID,上面platforms中的id字段 - int32 Count = 2; //充值数量 - string BankerCode = 3; //支付方式 - string ExtCode = 4; - string Ip = 5; //IP地址 -} -message SCShopOrder{ - string PayStr = 1; //支付路径 - string Error = 2; - OpResultCode OpCode = 3; -} -//创建兑换订单 -message CSShopExchange { - int32 ExchangeType = 1; //兑换类型1:支付宝,2:银行卡 - string Account = 2; //兑换账号 - int32 Count = 3; //兑换金额 - string AccountName = 4; //账号名称 - int32 BankID = 5; //银行编号 -} -message SCShopExchange { - OpResultCode OpCode = 1; //请求结果 -} -//兑换订单列表 -message CSShopExchangeList { - int32 PageNo = 1; // 当前页 -} -message SCShopExchangeList { - OpResultCode OpCode = 1; // 请求结果 - string Data = 2; // 列表 - int32 PageNo = 3; // 当前页 - int32 PageSum = 4; // 总页数 -} - -//获取玩家流水列表 -message FlowListLog{ - int32 GameId = 1; //游戏id - int32 GameMode = 2; //游戏模式 - int32 Ts = 3; //记录时间 - int32 GameTiming = 4; //本局游戏用时(mm) - int64 ConvertibilityFlow = 5;//当局玩家流水 -} -message CSFlowList { - int32 PageNo = 1; // 当前页 -} -message SCFlowList { - OpResultCode OpCode = 1; // 请求结果 - repeated FlowListLog Data = 2; // 列表 - int32 PageNo = 3; // 当前页 - int32 PageSum = 4; // 总页数 -} - -//获得玩家的流水信息 -message CSGetExchangeInfo { - -} - -message SCGetExchangeInfo { - OpResultCode OpCode = 1; // 请求结果 - int64 TotalFlow = 2; //玩家流水 - int64 NeedFlow = 3; //自由兑换需要多少流水 - int32 Tax = 4; //兑换税率 - int64 ForceTax = 5; //强制兑换需要扣除税费 - int64 GiveGold = 6; //强制兑换扣除赠送金币数量 -} - -//获取玩家流水兑换打码信息 -message PlayerPayFlowLog{ - int32 PayType = 1; //记录类型 0 充值 1系统赠送 - int64 PayCoin = 2; //充值金额 - int64 GiveCoin = 3; //赠送金额 - int64 PayNeedFlow = 4; //充值需要流水 - int64 GiveNeedFlow = 5; //赠送需要流水 - int64 ForceTax = 6; //强制扣除费用金额 - int64 ForceGiveCoin = 7; //赠送扣除金额 - int32 IsPass = 8; //是否通过审核 1 通过 0 未通过 - int64 Ts = 9; //记录时间 - int64 FinishFlow = 10; //记录之间完成流水 - string OrderID = 11; //订单id - -} - -message CSGetPlayerPayFlowList { - int32 PageNo = 1; // 当前页 -} - -message SCGetPlayerPayFlowList { - OpResultCode OpCode = 1; // 请求结果 - repeated PlayerPayFlowLog Data = 2; // 列表 - int32 PageNo = 3; // 当前页 - int32 PageSum = 4; // 总页数 - int32 PageSize = 5; // 每页记录数 - int32 TotalNum = 6; // 总记录数 -} - -message SCNotifyGiveCoinInfo { - int64 GiveCoin = 1; //赠送金币 - int32 GiveTag = 2; //赠送类型,需要对应关系 -} - - - - diff --git a/protocol/welfare/welfare.pb.go b/protocol/welfare/welfare.pb.go index 0153d93..b8e659b 100644 --- a/protocol/welfare/welfare.pb.go +++ b/protocol/welfare/welfare.pb.go @@ -20,7 +20,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -//操作结果 +// 操作结果 type OpResultCode int32 const ( @@ -116,6 +116,7 @@ const ( // 2900~2999 SPacketID_PACKET_CSWelfRelief SPacketID = 2900 //救济金信息 SPacketID_PACKET_SCWelfRelief SPacketID = 2901 //救济金信息 + // 邀请活动 SPacketID_PACKET_CSInviteInfo SPacketID = 2902 //邀请信息 SPacketID_PACKET_SCInviteInfo SPacketID = 2903 //邀请信息 SPacketID_PACKET_CSBindInvite SPacketID = 2904 //绑定邀请人 @@ -211,8 +212,8 @@ func (SPacketID) EnumDescriptor() ([]byte, []int) { return file_welfare_proto_rawDescGZIP(), []int{1} } -//救济金领取 -//PACKET_CS_WELF_GETRELIEFFUND +// 救济金领取 +// PACKET_CS_WELF_GETRELIEFFUND type CSGetReliefFund struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -260,7 +261,7 @@ func (x *CSGetReliefFund) GetIsVideo() bool { return false } -//PACKET_SC_WELF_GETRELIEFFUND +// PACKET_SC_WELF_GETRELIEFFUND type SCGetReliefFund struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -395,8 +396,8 @@ func (x *WelfareDate) GetItem_Id() int32 { return 0 } -//转动转盘 -//PACKET_CS_WELF_GETTURNPLATE +// 转动转盘 +// PACKET_CS_WELF_GETTURNPLATE type CSGetTurnplate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -444,7 +445,7 @@ func (x *CSGetTurnplate) GetIsVideo() bool { return false } -//PACKET_SC_WELF_GETTURNPLATE +// PACKET_SC_WELF_GETTURNPLATE type SCGetTurnplate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -579,8 +580,8 @@ func (x *AddUpWelfareDate) GetAddUpDate() []*WelfareDate { return nil } -//累计签到 -//PACKET_CS_WELF_GETADDUPSIGN +// 累计签到 +// PACKET_CS_WELF_GETADDUPSIGN type CSGetAddupSign struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -628,7 +629,7 @@ func (x *CSGetAddupSign) GetAddUpDay() int32 { return 0 } -//PACKET_SC_WELF_GETADDUPSIGN +// PACKET_SC_WELF_GETADDUPSIGN type SCGetAddupSign struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -692,8 +693,8 @@ func (x *SCGetAddupSign) GetAddUpSignDay() []int32 { return nil } -//福利信息 -//PACKET_CS_WELF_WELFAREINFO +// 福利信息 +// PACKET_CS_WELF_WELFAREINFO type CSWelfaredInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -850,7 +851,7 @@ func (x *Welfare7SignDate) GetAddUpDate() []*AddUpWelfareDate { return nil } -//PACKET_SC_WELF_WELFAREINFO +// PACKET_SC_WELF_WELFAREINFO type SCWelfaredInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1057,8 +1058,8 @@ func (x *BlindBoxData) GetItem_Id() int32 { return 0 } -//查看盲盒 -//PACKET_CS_WELF_BLINBOXINFO +// 查看盲盒 +// PACKET_CS_WELF_BLINBOXINFO type CSBlindBoxInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1106,7 +1107,7 @@ func (x *CSBlindBoxInfo) GetId() int32 { return 0 } -//PACKET_SC_WELF_BLINBOXINFO +// PACKET_SC_WELF_BLINBOXINFO type SCBlindBoxInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1186,8 +1187,8 @@ func (x *SCBlindBoxInfo) GetCycle() int32 { return 0 } -//领取盲盒 -//PACKET_CS_WELF_GETBLINBOX +// 领取盲盒 +// PACKET_CS_WELF_GETBLINBOX type CSGetBlindBox struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1235,7 +1236,7 @@ func (x *CSGetBlindBox) GetId() int32 { return 0 } -//PACKET_SC_WELF_GETBLINBOX +// PACKET_SC_WELF_GETBLINBOX type SCGetBlindBox struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1378,7 +1379,7 @@ func (x *WelfareSpree) GetDiscount() float64 { return 0 } -//PACKET_CS_WELF_FIRSTPAYINFO +// PACKET_CS_WELF_FIRSTPAYINFO type CSWelfareFirstPayData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1417,7 +1418,7 @@ func (*CSWelfareFirstPayData) Descriptor() ([]byte, []int) { return file_welfare_proto_rawDescGZIP(), []int{18} } -//PACKET_SC_WELF_FIRSTPAYINFO +// PACKET_SC_WELF_FIRSTPAYINFO type SCWelfareFirstPayData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1497,7 +1498,7 @@ func (x *SCWelfareFirstPayData) GetDraw() int32 { return 0 } -//PACKET_CS_WELF_FIRSTPAY +// PACKET_CS_WELF_FIRSTPAY type CSWelfareFirstPay struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1536,7 +1537,7 @@ func (*CSWelfareFirstPay) Descriptor() ([]byte, []int) { return file_welfare_proto_rawDescGZIP(), []int{20} } -//PACKET_SC_WELF_FIRSTPAY +// PACKET_SC_WELF_FIRSTPAY type SCWelfareFirstPay struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1584,7 +1585,7 @@ func (x *SCWelfareFirstPay) GetOpRetCode() OpResultCode { return OpResultCode_OPRC_Sucess } -//PACKET_CS_WELF_CONTINPAYINFO +// PACKET_CS_WELF_CONTINPAYINFO type CSWelfareContinuousPayData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1623,7 +1624,7 @@ func (*CSWelfareContinuousPayData) Descriptor() ([]byte, []int) { return file_welfare_proto_rawDescGZIP(), []int{22} } -//PACKET_SC_WELF_CONTINPAYINFO +// PACKET_SC_WELF_CONTINPAYINFO type SCWelfareContinuousPayData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1711,7 +1712,7 @@ func (x *SCWelfareContinuousPayData) GetDay() int32 { return 0 } -//PACKET_CS_WELF_CONTINPAY +// PACKET_CS_WELF_CONTINPAY type CSWelfareContinuousPay struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1750,7 +1751,7 @@ func (*CSWelfareContinuousPay) Descriptor() ([]byte, []int) { return file_welfare_proto_rawDescGZIP(), []int{24} } -//PACKET_SC_WELF_CONTINPAY +// PACKET_SC_WELF_CONTINPAY type SCWelfareContinuousPay struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/protocol/welfare/welfare.proto b/protocol/welfare/welfare.proto index d44f407..fa3b7d7 100644 --- a/protocol/welfare/welfare.proto +++ b/protocol/welfare/welfare.proto @@ -36,9 +36,11 @@ enum SPacketID { PACKET_SC_WELF_CONTINPAYINFO = 2597;//连续充值信息 PACKET_CS_WELF_CONTINPAY = 2598;//领取(购买)连续充值 后期走充值回调 PACKET_SC_WELF_CONTINPAY = 2599;//领取连续充值 + // 2900~2999 PACKET_CSWelfRelief = 2900;//救济金信息 PACKET_SCWelfRelief = 2901;//救济金信息 + // 邀请活动 PACKET_CSInviteInfo = 2902;//邀请信息 PACKET_SCInviteInfo = 2903;//邀请信息 PACKET_CSBindInvite = 2904;//绑定邀请人 diff --git a/public b/public index f317779..bf19adf 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit f317779a9675bcfd4741c351b69f532fa930cec8 +Subproject commit bf19adf1d5cf74a3ec3d180730404492658dd6d7 diff --git a/worldsrv/action_bag.go b/worldsrv/action_bag.go index b53a797..daaa88e 100644 --- a/worldsrv/action_bag.go +++ b/worldsrv/action_bag.go @@ -30,7 +30,7 @@ func (this *CSBagInfoPacketFactory) CreatePacket() interface{} { func (this *CSBagInfoHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error { logger.Logger.Trace("CSBagInfoHandler Process recv ", data) - if _, ok := data.(*bag.CSBagInfo); ok { + if msg, ok := data.(*bag.CSBagInfo); ok { p := PlayerMgrSington.GetPlayer(sid) if p == nil { logger.Logger.Warn("CSBagInfoHandler p == nil") @@ -41,28 +41,16 @@ func (this *CSBagInfoHandler) Process(s *netlib.Session, packetid int, data inte return nil } //nowLocation := int(msg.NowLocation - 1) - playbag := BagMgrSingleton.GetBagInfo(p.SnId) + tp := msg.GetTp() // 道具类型 + bagInfo := BagMgrSingleton.GetBagInfo(p.SnId) pack := &bag.SCBagInfo{RetCode: bag.OpResultCode_OPRC_Sucess, BagNumMax: BagItemMax} - if playbag != nil { - for _, v := range playbag.BagItem { + if bagInfo != nil { + for _, v := range bagInfo.BagItem { item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) - if item != nil && v.ItemNum > 0 /*&& (nowLocation == -1 || (nowLocation < len(item.ShowLocation) && item.ShowLocation[nowLocation] == 1))*/ { + if item != nil && v.ItemNum > 0 && (tp <= 0 || item.GetType() == tp) /*&& (nowLocation == -1 || (nowLocation < len(item.ShowLocation) && item.ShowLocation[nowLocation] == 1))*/ { pack.Infos = append(pack.Infos, &bag.ItemInfo{ - ItemId: v.ItemId, - ItemNum: v.ItemNum, - //Name: item.Name, - //ShowLocation: item.ShowLocation, - //Classify: item.Classify, - //Type: item.Type, - //Effect0: item.Effect0, - //Effect: item.Effect, - //SaleType: item.SaleType, - //SaleGold: item.SaleGold, - //Composition: item.Composition, - //CompositionMax: item.CompositionMax, - //Time: item.Time, - //Location: item.Location, - //Describe: item.Describe, + ItemId: v.ItemId, + ItemNum: v.ItemNum, ObtainTime: v.ObtainTime, }) } @@ -192,6 +180,53 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in useFunc() } + case common.ItemIDCollectBox: + f() + useFunc := func() { + sum := 0 + for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() { + sum += int(v.GetRate()) + } + if sum > 0 { + n := 0 + i := rand.Intn(sum) + for _, v := range srvdata.PBDB_CollectBoxMgr.Datas.GetArr() { + n += int(v.GetRate()) + if i < n { + var items []*Item + for k, vv := range v.ItemID { + if vv > 0 { + items = append(items, &Item{ + ItemId: int32(k), + ItemNum: vv, + ObtainTime: ts, + }) + } + } + if len(items) > 0 { + BagMgrSingleton.AddJybBagInfo(p, items, 0, common.GainWay_ItemUse, "player", "道具使用") + for _, v := range items { + data := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) + if data != nil { + // 背包变更记录 + BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemObtain, v.ItemId, data.Name, v.ItemNum, "集卡礼盒获得") + } + pack.Infos = append(pack.Infos, &bag.ItemInfo{ + ItemId: v.ItemId, + ItemNum: v.ItemNum, + ObtainTime: v.ObtainTime, + }) + } + } + break + } + } + } + } + for i := 0; i < int(msg.ItemNum); i++ { + useFunc() + } + default: logger.Logger.Warnf("道具使用未定义", msg.ItemId) } @@ -259,12 +294,132 @@ func (this *CSUpBagInfoHandler) Process(s *netlib.Session, packetid int, data in return nil } +func CSExchangeList(s *netlib.Session, packetid int, data interface{}, sid int64) error { + logger.Logger.Trace("CSExchangeList", data) + msg, ok := data.(*bag.CSExchangeList) + if !ok { + return nil + } + + p := PlayerMgrSington.GetPlayer(sid) + if p == nil { + return nil + } + + pack := &bag.SCExchangeList{ + Tp: msg.Tp, + } + + for _, v := range srvdata.PBDB_PropExchangeMgr.Datas.GetArr() { + if v.GetGroup() != msg.Tp { + continue + } + var costItems, gainItems []*bag.PropInfo + for k, v := range v.GetCost() { + costItems = append(costItems, &bag.PropInfo{ + ItemId: int32(k), + ItemNum: v, + }) + } + for k, v := range v.GetGain() { + gainItems = append(gainItems, &bag.PropInfo{ + ItemId: int32(k), + ItemNum: v, + }) + } + pack.Infos = append(pack.Infos, &bag.ExchangeInfo{ + CostItems: costItems, + GainItems: gainItems, + }) + } + + p.SendToClient(packetid, pack) + logger.Logger.Tracef("SCExchangeList:%v", pack) + return nil +} + +func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64) error { + logger.Logger.Trace("CSPropExchange", data) + msg, ok := data.(*bag.CSPropExchange) + if !ok { + return nil + } + + p := PlayerMgrSington.GetPlayer(sid) + if p == nil { + return nil + } + + pack := &bag.SCPropExchange{ + RetCode: bag.OpResultCode_OPRC_Error, + } + send := func(code bag.OpResultCode) { + pack.RetCode = code + p.SendToClient(packetid, pack) + logger.Logger.Tracef("SCPropExchange:%v", pack) + } + + info := srvdata.PBDB_PropExchangeMgr.GetData(msg.Id) + if info == nil { + send(bag.OpResultCode_OPRC_IdErr) + return nil + } + // 检查背包是否足够 + var items []*Item + var costItems []*Item + for k, v := range info.GetCost() { + item := BagMgrSingleton.GetItem(p.SnId, int32(k)) + if item == nil || item.ItemNum < v { + send(bag.OpResultCode_OPRC_UseUp) + return nil + } + info := srvdata.PBDB_GameItemMgr.GetData(int32(k)) + if info != nil { + costItems = append(costItems, &Item{ + ItemId: int32(k), + ItemNum: v, + Name: info.Name, + }) + } + } + for k, v := range info.GetGain() { + info := srvdata.PBDB_GameItemMgr.GetData(int32(k)) + if info != nil { + items = append(items, &Item{ + ItemId: int32(k), + ItemNum: v, + Name: info.Name, + }) + } + } + // 扣除背包物品 + for _, item := range costItems { + BagMgrSingleton.SaleItemV2(p, item.ItemId, item.ItemNum, common.GainWay_Collect, "system", "集卡活动兑换") + BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemConsume, item.ItemId, item.Name, item.ItemNum, "集卡活动兑换使用") + } + // 增加背包物品 + BagMgrSingleton.AddJybBagInfo(p, items, 0, common.GainWay_Collect, "player", "集卡活动兑换") + for _, v := range items { + BagMgrSingleton.RecordItemLog(p.Platform, p.SnId, ItemObtain, v.ItemId, v.Name, v.ItemNum, "集卡活动兑换获得") + pack.Items = append(pack.Items, &bag.PropInfo{ + ItemId: v.ItemId, + ItemNum: v.ItemNum, + }) + } + + send(bag.OpResultCode_OPRC_Sucess) + return nil +} + func init() { // 查看背包 common.RegisterHandler(int(bag.SPacketID_PACKET_ALL_BAG_INFO), &CSBagInfoHandler{}) netlib.RegisterFactory(int(bag.SPacketID_PACKET_ALL_BAG_INFO), &CSBagInfoPacketFactory{}) - // 道具操作(赠送,出售...) common.RegisterHandler(int(bag.SPacketID_PACKET_ALL_BAG_USE), &CSUpBagInfoHandler{}) netlib.RegisterFactory(int(bag.SPacketID_PACKET_ALL_BAG_USE), &CSUpBagInfoPacketFactory{}) + // 兑换列表 + common.Register(int(bag.SPacketID_PACKET_ExchangeList), &bag.CSExchangeList{}, CSExchangeList) + // 道具兑换 + common.Register(int(bag.SPacketID_PACKET_PropExchange), &bag.CSPropExchange{}, CSPropExchange) } diff --git a/worldsrv/bagmgr.go b/worldsrv/bagmgr.go index ac5f851..6790f98 100644 --- a/worldsrv/bagmgr.go +++ b/worldsrv/bagmgr.go @@ -84,31 +84,53 @@ func (this *BagMgr) GetBagInfo(snid int32) *BagInfo { // GetItem 获取个人的指定道具信息 func (this *BagMgr) GetItem(snid, itemId int32) *Item { - if bagItem, ok := this.PlayerBag[snid]; ok { - if bagItem != nil { - item := bagItem.BagItem[itemId] - if item != nil { - itemX := srvdata.PBDB_GameItemMgr.GetData(item.ItemId) - if itemX != nil { - item.Name = itemX.Name - //item.ShowLocation = itemX.ShowLocation - //item.Classify = itemX.Classify - //item.Type = itemX.Type - item.Effect0 = itemX.Effect - item.Effect = itemX.Effect - item.SaleType = itemX.SaleType - item.SaleGold = itemX.SaleGold - //item.Composition = itemX.Composition - //item.CompositionMax = itemX.CompositionMax - //item.Time = itemX.Time - //item.Location = itemX.Location - //item.Describe = itemX.Describe + p := PlayerMgrSington.GetPlayerBySnId(snid) + if p == nil { + return nil + } + + item := &Item{ + ItemId: itemId, + } + f := func() { + itemX := srvdata.PBDB_GameItemMgr.GetData(itemId) + if itemX != nil { + item.Name = itemX.Name + //item.ShowLocation = itemX.ShowLocation + //item.Classify = itemX.Classify + //item.Type = itemX.Type + item.Effect0 = itemX.Effect + item.Effect = itemX.Effect + item.SaleType = itemX.SaleType + item.SaleGold = itemX.SaleGold + //item.Composition = itemX.Composition + //item.CompositionMax = itemX.CompositionMax + //item.Time = itemX.Time + //item.Location = itemX.Location + //item.Describe = itemX.Describe + } + } + + switch itemId { + case common.ItemIDCoin: + item.ItemNum = p.Coin + f() + case common.ItemIDDiamond: + item.ItemNum = p.Diamond + f() + default: + if bagItem, ok := this.PlayerBag[snid]; ok { + if bagItem != nil { + item = bagItem.BagItem[itemId] + if item != nil { + f() + return item } - return item } } } - return nil + + return item } // AddJybBagInfo 给玩家背包添加道具 @@ -215,13 +237,9 @@ func (this *BagMgr) AddJybBagInfo(p *Player, addItems []*Item, add int64, gainWa // SaleItem 出售道具,减少玩家道具数量 func (this *BagMgr) SaleItem(p *Player, itemId int32, num int64) bool { - if bagInfo, ok := this.PlayerBag[p.SnId]; ok { - if item, ok1 := bagInfo.BagItem[itemId]; ok1 { - if item.ItemNum >= num { - //可以出售 - return this.SalePlayerItem(p, item, num) - } - } + item := this.GetItem(p.SnId, itemId) + if item != nil && item.ItemNum >= num { + return this.SalePlayerItem(p, item, num) } return false } @@ -234,9 +252,30 @@ func (this *BagMgr) SalePlayerItem(p *Player, item *Item, num int64) bool { return true } +func (this *BagMgr) SaleItemV2(p *Player, itemId int32, num int64, gain int32, oper string, remark string) bool { + item := this.GetItem(p.SnId, itemId) + if item != nil && item.ItemNum >= num { + switch item.ItemId { + case common.ItemIDCoin: + p.AddCoin(-num, 0, gain, oper, remark) + return true + case common.ItemIDDiamond: + p.AddDiamond(-num, 0, gain, oper, remark) + return true + default: + return this.SalePlayerItem(p, item, num) + } + } + return false +} + // RecordItemLog 道具操作记录(获得,消耗) func (this *BagMgr) RecordItemLog(platform string, snid, logType, itemId int32, itemName string, count int64, remark string) { //logger.Logger.Trace("RecordItemLog:", platform, snid, logType, itemId, itemName, count, remark) + switch itemId { + case common.ItemIDCoin, common.ItemIDDiamond: + return + } log := model.NewItemLogEx(platform, snid, logType, itemId, itemName, count, remark) if log != nil { LogChannelSingleton.WriteLog(log) diff --git a/worldsrv/player.go b/worldsrv/player.go index 0d7afe1..325abad 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -4600,3 +4600,20 @@ func (this *Player) ResetTask(tp int32) { this.WelfData.Task[v.GetId()] = &model.TaskData{} } } + +func (this *Player) CollectTask(taskId int32, num int64) { + // 每日登录游戏赠送一个 + // 每日转盘抽奖赠送一个 + switch taskId { + case common.TaskTypeTurnplate, common.TaskTypeFirstLogin: + oper := fmt.Sprintf("集卡活动%v", taskId) + var items []*Item + items = append(items, &Item{ + ItemId: common.ItemIDCollectBox, + ItemNum: num, + ObtainTime: time.Now().Unix(), + }) + BagMgrSingleton.AddJybBagInfo(this, items, 0, common.GainWay_Collect, "system", oper) + default: + } +} diff --git a/worldsrv/taskmgr.go b/worldsrv/taskmgr.go index 97543de..0138fa0 100644 --- a/worldsrv/taskmgr.go +++ b/worldsrv/taskmgr.go @@ -123,9 +123,13 @@ func (t *TaskHandle) TaskUpdate(id int, data any) { //抽奖次数增加 p.PhoneLotteryTask(common.TaskTypeFirstLogin, 0) p.InviteTask(common.InviteScoreTypeLogin, int32(info.GameID), num) + p.CollectTask(common.TaskTypeFirstLogin, num) case common.TaskTypeInviteNum: + case common.TaskTypeTurnplate: + p.CollectTask(common.TaskTypeTurnplate, num) + default: return } diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index f8e17bf..f9b7a53 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -367,6 +367,7 @@ func (this *WelfareMgr) GetTurnplate(p *Player) { hadSign = int32(len(turnplate.RateList)) } pack.SignDay = hadSign // 已签到天数 + TaskSubjectSingleton.Touch(common.TaskTypeTurnplate, &TaskData{SnId: p.SnId, Num: 1}) break } } diff --git a/xlsx/DB_GameItem.xlsx b/xlsx/DB_GameItem.xlsx index 36a467c..7f504b8 100644 Binary files a/xlsx/DB_GameItem.xlsx and b/xlsx/DB_GameItem.xlsx differ