From 231cff3c4a3fd9e1254e117bbd6ce64ebc5e664c Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Thu, 2 Jan 2025 17:57:47 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E7=B4=AF=E8=AE=A1=E6=B6=88=E8=80=97?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/constant.go | 19 +-- etcd/keyconf.go | 4 +- model/config.go | 2 + protocol/task/task.pb.go | 142 ++++++++++++--------- protocol/task/task.proto | 13 +- protocol/webapi/common.pb.go | 155 ++++++++++++++++++----- protocol/webapi/common.proto | 8 ++ worldsrv/action_task.go | 156 +++-------------------- worldsrv/etcd.go | 7 +- worldsrv/internal/playerlistener.go | 49 +++++--- worldsrv/player.go | 26 +--- worldsrv/taskmgr.go | 184 +++++++++++++++++++++++++++- worldsrv/welfmgr.go | 4 + 13 files changed, 484 insertions(+), 285 deletions(-) diff --git a/common/constant.go b/common/constant.go index 77c53f7..6f68feb 100644 --- a/common/constant.go +++ b/common/constant.go @@ -710,15 +710,16 @@ const ( ) const ( - TaskActivityTypeEveryDay = 1 // 每日任务 - TaskActivityTypeWeek = 2 // 每周任务 - TaskActivityTypeNovice = 3 // 新手任务 - TaskActivityTypeInvite = 4 // 邀请任务 - TaskActivityTypeAchieve = 5 // 成就任务 - TaskActivityTypePermitEveryDay = 6 // 赛季通行证每日任务 - TaskActivityTypePermit = 7 // 赛季通行证任务 - TaskActivityTypeNianEveryDay = 8 // 年兽每日任务 - TaskActivityTypeNian = 9 // 活动期间年兽任务 + TaskActivityTypeEveryDay = 1 // 每日任务 + TaskActivityTypeWeek = 2 // 每周任务 + TaskActivityTypeNovice = 3 // 新手任务 + TaskActivityTypeInvite = 4 // 邀请任务 + TaskActivityTypeAchieve = 5 // 成就任务 + TaskActivityTypePermitEveryDay = 6 // 赛季通行证每日任务 + TaskActivityTypePermit = 7 // 赛季通行证任务 + TaskActivityTypeNianEveryDay = 8 // 年兽每日任务 + TaskActivityTypeNian = 9 // 活动期间年兽任务 + TaskActivityTypeConsume = 10 // 累计消耗活动任务 ) const HeadRange = 3 // 机器人头像id范围 diff --git a/etcd/keyconf.go b/etcd/keyconf.go index 4561a9e..64856b9 100644 --- a/etcd/keyconf.go +++ b/etcd/keyconf.go @@ -52,6 +52,6 @@ const ( ETCDKEY_PigBankDiamond = "/game/pigbank_diamond" //存钱罐消耗获得 ETCDKEY_PigBankProp = "/game/pigbank_prop" //存钱罐属性 ETCDKEY_NianConfig = "/game/activity_nian" //年兽活动配置 - ETCDKEY_REDPACKET = "/game/act_redpacket" //红包配置 - + KeyRedPacket = "/game/act_redpacket" //红包配置 + KeyActConsume = "/game/act_consume" //累计消耗活动配置 ) diff --git a/model/config.go b/model/config.go index ac5c00d..2127f91 100644 --- a/model/config.go +++ b/model/config.go @@ -172,6 +172,8 @@ type AllConfig struct { *webapi.ActivityNianConfig // 红包配置 *webapi.RedPacketConfig + // 累计消耗活动配置 + *webapi.ConsumeConfig } type GlobalConfig struct { diff --git a/protocol/task/task.pb.go b/protocol/task/task.pb.go index 8cd279d..c0b3d90 100644 --- a/protocol/task/task.pb.go +++ b/protocol/task/task.pb.go @@ -227,7 +227,7 @@ type CSTaskList struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 6:赛季通行证任务 8:年兽每日任务 9:年兽活动任务 10:累计消耗任务 } func (x *CSTaskList) Reset() { @@ -275,8 +275,11 @@ type SCTaskList struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 - List []*TaskData `protobuf:"bytes,2,rep,name=List,proto3" json:"List,omitempty"` // 任务列表 + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 + List []*TaskData `protobuf:"bytes,2,rep,name=List,proto3" json:"List,omitempty"` // 任务列表 + StartTs int64 `protobuf:"varint,3,opt,name=StartTs,proto3" json:"StartTs,omitempty"` // 开始时间 + EndTs int64 `protobuf:"varint,4,opt,name=EndTs,proto3" json:"EndTs,omitempty"` // 结束时间 + On bool `protobuf:"varint,5,opt,name=On,proto3" json:"On,omitempty"` // 活动开关 } func (x *SCTaskList) Reset() { @@ -325,6 +328,27 @@ func (x *SCTaskList) GetList() []*TaskData { return nil } +func (x *SCTaskList) GetStartTs() int64 { + if x != nil { + return x.StartTs + } + return 0 +} + +func (x *SCTaskList) GetEndTs() int64 { + if x != nil { + return x.EndTs + } + return 0 +} + +func (x *SCTaskList) GetOn() bool { + if x != nil { + return x.On + } + return false +} + // 领取任务奖励 // PACKET_CSTaskReward type CSTaskReward struct { @@ -332,7 +356,7 @@ type CSTaskReward struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 6:赛季通行证任务 8: 年兽每日任务 9:年兽活动任务 + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` // 任务id; 0 表示一键领取 } @@ -461,7 +485,7 @@ type SCTaskChange struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 List []*TaskData `protobuf:"bytes,2,rep,name=List,proto3" json:"List,omitempty"` // 任务列表 } @@ -516,7 +540,7 @@ type CSTaskDebugInc struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 任务类型 Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` // 任务id AddNum int32 `protobuf:"varint,3,opt,name=AddNum,proto3" json:"AddNum,omitempty"` // 直接增加次数 } @@ -642,59 +666,63 @@ var file_protocol_task_task_proto_rawDesc = []byte{ 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x1c, 0x0a, 0x0a, 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x40, 0x0a, 0x0a, 0x53, 0x43, 0x54, 0x61, 0x73, 0x6b, - 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x54, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x2e, 0x0a, 0x0c, 0x43, 0x53, 0x54, 0x61, - 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x22, 0xcd, 0x01, 0x0a, 0x0c, 0x53, 0x43, 0x54, - 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x4f, 0x70, 0x43, + 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x80, 0x01, 0x0a, 0x0a, 0x53, 0x43, 0x54, 0x61, 0x73, + 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x74, 0x61, + 0x72, 0x74, 0x54, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x53, 0x74, 0x61, 0x72, + 0x74, 0x54, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6e, 0x64, 0x54, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x45, 0x6e, 0x64, 0x54, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x4f, 0x6e, 0x22, 0x2e, 0x0a, 0x0c, 0x43, 0x53, 0x54, + 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x22, 0xcd, 0x01, 0x0a, 0x0c, 0x53, 0x43, + 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x4f, 0x70, + 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x74, 0x61, 0x73, + 0x6b, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, + 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x53, 0x43, + 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, + 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x39, + 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x42, 0x0a, 0x0c, 0x53, 0x43, 0x54, + 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x4c, 0x69, 0x73, + 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x54, + 0x61, 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x48, 0x0a, + 0x0e, 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, 0x12, + 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, + 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x41, 0x64, 0x64, 0x4e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x41, 0x64, 0x64, 0x4e, 0x75, 0x6d, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x43, 0x54, 0x61, 0x73, + 0x6b, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, 0x12, 0x2a, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x4f, - 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x53, 0x43, 0x54, - 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x39, 0x0a, - 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x42, 0x0a, 0x0c, 0x53, 0x43, 0x54, 0x61, - 0x73, 0x6b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x54, 0x61, - 0x73, 0x6b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x0e, - 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, 0x12, 0x0e, - 0x0a, 0x02, 0x54, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x12, 0x0e, - 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x41, 0x64, 0x64, 0x4e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x41, 0x64, 0x64, 0x4e, 0x75, 0x6d, 0x22, 0x3c, 0x0a, 0x0e, 0x53, 0x43, 0x54, 0x61, 0x73, 0x6b, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, 0x12, 0x2a, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x74, 0x61, 0x73, 0x6b, 0x2e, - 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x4f, 0x70, - 0x43, 0x6f, 0x64, 0x65, 0x2a, 0x30, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x2a, 0xd2, 0x01, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x50, - 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x54, 0x61, 0x73, 0x6b, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x16, 0x0a, - 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x69, - 0x73, 0x74, 0x10, 0xe0, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, - 0x53, 0x43, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xe1, 0x12, 0x12, 0x18, 0x0a, - 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x10, 0xe2, 0x12, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, - 0x54, 0x5f, 0x53, 0x43, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe3, - 0x12, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x54, 0x61, - 0x73, 0x6b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0xe4, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, - 0x10, 0xe5, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, - 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, 0x10, 0xe6, 0x12, 0x42, 0x24, 0x5a, 0x22, 0x6d, - 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, - 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x74, 0x61, 0x73, - 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x43, 0x6f, 0x64, 0x65, 0x2a, 0x30, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x2a, 0xd2, 0x01, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, + 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x54, 0x61, 0x73, 0x6b, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x16, + 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x4c, + 0x69, 0x73, 0x74, 0x10, 0xe0, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, + 0x5f, 0x53, 0x43, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xe1, 0x12, 0x12, 0x18, + 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x54, 0x61, 0x73, 0x6b, 0x52, + 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xe2, 0x12, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, + 0x45, 0x54, 0x5f, 0x53, 0x43, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, + 0xe3, 0x12, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x54, + 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10, 0xe4, 0x12, 0x12, 0x16, 0x0a, 0x11, + 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, + 0x63, 0x10, 0xe5, 0x12, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, + 0x43, 0x44, 0x65, 0x62, 0x75, 0x67, 0x49, 0x6e, 0x63, 0x10, 0xe6, 0x12, 0x42, 0x24, 0x5a, 0x22, + 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x74, 0x61, + 0x73, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/task/task.proto b/protocol/task/task.proto index 88b4474..cd0f26e 100644 --- a/protocol/task/task.proto +++ b/protocol/task/task.proto @@ -33,18 +33,21 @@ message TaskData{ // 任务列表 // PACKET_CSTaskList message CSTaskList{ - int32 Tp = 1; // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + int32 Tp = 1; // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 6:赛季通行证任务 8:年兽每日任务 9:年兽活动任务 10:累计消耗任务 } // PACKET_SCTaskList message SCTaskList{ - int32 Tp = 1; // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + int32 Tp = 1; // 任务类型 repeated TaskData List = 2; // 任务列表 + int64 StartTs = 3; // 开始时间 + int64 EndTs = 4; // 结束时间 + bool On = 5; // 活动开关 } // 领取任务奖励 // PACKET_CSTaskReward message CSTaskReward{ - int32 Tp = 1; // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 6:赛季通行证任务 8: 年兽每日任务 9:年兽活动任务 + int32 Tp = 1; // 任务类型 int32 Id = 2; // 任务id; 0 表示一键领取 } // PACKET_SCTaskReward @@ -58,12 +61,12 @@ message SCTaskReward{ // 任务变更通知 // PACKET_SCTaskChange message SCTaskChange{ - int32 Tp = 1; // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + int32 Tp = 1; // 任务类型 repeated TaskData List = 2; // 任务列表 } message CSTaskDebugInc{ - int32 Tp = 1; // 任务类型 1:日常任务 2:周活跃任务 3:新手任务 4:邀请任务 5:成就系统 + int32 Tp = 1; // 任务类型 int32 Id = 2; // 任务id int32 AddNum = 3; // 直接增加次数 } diff --git a/protocol/webapi/common.pb.go b/protocol/webapi/common.pb.go index 3800625..4ce75d8 100644 --- a/protocol/webapi/common.pb.go +++ b/protocol/webapi/common.pb.go @@ -10336,6 +10336,78 @@ func (x *RedInfo) GetRate() int64 { return 0 } +// etcd /game/act_consume +type ConsumeConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台 + On int32 `protobuf:"varint,2,opt,name=On,proto3" json:"On,omitempty"` // 活动开关 1.开启 2.关闭 + StartTime string `protobuf:"bytes,3,opt,name=StartTime,proto3" json:"StartTime,omitempty"` // 活动开始时间 + EndTime string `protobuf:"bytes,4,opt,name=EndTime,proto3" json:"EndTime,omitempty"` // 活动结束时间 +} + +func (x *ConsumeConfig) Reset() { + *x = ConsumeConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_protocol_webapi_common_proto_msgTypes[110] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConsumeConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsumeConfig) ProtoMessage() {} + +func (x *ConsumeConfig) ProtoReflect() protoreflect.Message { + mi := &file_protocol_webapi_common_proto_msgTypes[110] + 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 ConsumeConfig.ProtoReflect.Descriptor instead. +func (*ConsumeConfig) Descriptor() ([]byte, []int) { + return file_protocol_webapi_common_proto_rawDescGZIP(), []int{110} +} + +func (x *ConsumeConfig) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *ConsumeConfig) GetOn() int32 { + if x != nil { + return x.On + } + return 0 +} + +func (x *ConsumeConfig) GetStartTime() string { + if x != nil { + return x.StartTime + } + return "" +} + +func (x *ConsumeConfig) GetEndTime() string { + if x != nil { + return x.EndTime + } + return "" +} + var File_protocol_webapi_common_proto protoreflect.FileDescriptor var file_protocol_webapi_common_proto_rawDesc = []byte{ @@ -11927,10 +11999,18 @@ var file_protocol_webapi_common_proto_rawDesc = []byte{ 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x07, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x52, - 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, 0x42, - 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, 0x22, + 0x73, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, + 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x53, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e, + 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x45, 0x6e, 0x64, + 0x54, 0x69, 0x6d, 0x65, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, + 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -11945,7 +12025,7 @@ func file_protocol_webapi_common_proto_rawDescGZIP() []byte { return file_protocol_webapi_common_proto_rawDescData } -var file_protocol_webapi_common_proto_msgTypes = make([]protoimpl.MessageInfo, 120) +var file_protocol_webapi_common_proto_msgTypes = make([]protoimpl.MessageInfo, 121) var file_protocol_webapi_common_proto_goTypes = []interface{}{ (*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting (*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting @@ -12057,32 +12137,33 @@ var file_protocol_webapi_common_proto_goTypes = []interface{}{ (*RedPacketConfig)(nil), // 107: webapi.RedPacketConfig (*RedPacketInfo)(nil), // 108: webapi.RedPacketInfo (*RedInfo)(nil), // 109: webapi.RedInfo - nil, // 110: webapi.Platform.BindTelRewardEntry - nil, // 111: webapi.PlayerData.RankScoreEntry - nil, // 112: webapi.ItemShop.AwardEntry - nil, // 113: webapi.VIPcfg.AwardEntry - nil, // 114: webapi.VIPcfg.Privilege1Entry - nil, // 115: webapi.VIPcfg.Privilege7Entry - nil, // 116: webapi.VIPcfg.Privilege9Entry - nil, // 117: webapi.ActInviteConfig.PayScoreEntry - nil, // 118: webapi.SkinLevel.UpItemEntry - nil, // 119: webapi.SkinItem.UnlockParamEntry - (*server.DB_GameFree)(nil), // 120: server.DB_GameFree - (*server.DB_GameItem)(nil), // 121: server.DB_GameItem + (*ConsumeConfig)(nil), // 110: webapi.ConsumeConfig + nil, // 111: webapi.Platform.BindTelRewardEntry + nil, // 112: webapi.PlayerData.RankScoreEntry + nil, // 113: webapi.ItemShop.AwardEntry + nil, // 114: webapi.VIPcfg.AwardEntry + nil, // 115: webapi.VIPcfg.Privilege1Entry + nil, // 116: webapi.VIPcfg.Privilege7Entry + nil, // 117: webapi.VIPcfg.Privilege9Entry + nil, // 118: webapi.ActInviteConfig.PayScoreEntry + nil, // 119: webapi.SkinLevel.UpItemEntry + nil, // 120: webapi.SkinItem.UnlockParamEntry + (*server.DB_GameFree)(nil), // 121: server.DB_GameFree + (*server.DB_GameItem)(nil), // 122: server.DB_GameItem } var file_protocol_webapi_common_proto_depIdxs = []int32{ 2, // 0: webapi.Platform.Leaderboard:type_name -> webapi.RankSwitch 3, // 1: webapi.Platform.ClubConfig:type_name -> webapi.ClubConfig 4, // 2: webapi.Platform.ThirdGameMerchant:type_name -> webapi.ThirdGame - 110, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry + 111, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry 6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus - 120, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree + 121, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree 8, // 6: webapi.PlatformGameConfig.DbGameFrees:type_name -> webapi.GameFree 0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting 1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting 1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting - 120, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree - 111, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry + 121, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree + 112, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry 32, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo 14, // 13: webapi.PlayerData.RoleUnlockList:type_name -> webapi.ModInfo 14, // 14: webapi.PlayerData.PetUnlockList:type_name -> webapi.ModInfo @@ -12095,7 +12176,7 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{ 32, // 21: webapi.ExchangeShop.Items:type_name -> webapi.ItemInfo 25, // 22: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop 29, // 23: webapi.ExchangeShopList.Weight:type_name -> webapi.ShopWeight - 112, // 24: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry + 113, // 24: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry 30, // 25: webapi.ItemShopList.List:type_name -> webapi.ItemShop 32, // 26: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo 33, // 27: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward @@ -12116,14 +12197,14 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{ 38, // 42: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate 48, // 43: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree 48, // 44: webapi.WelfareContinuousPayDataList.List:type_name -> webapi.WelfareSpree - 113, // 45: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry - 114, // 46: webapi.VIPcfg.Privilege1:type_name -> webapi.VIPcfg.Privilege1Entry - 115, // 47: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry - 116, // 48: webapi.VIPcfg.Privilege9:type_name -> webapi.VIPcfg.Privilege9Entry + 114, // 45: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry + 115, // 46: webapi.VIPcfg.Privilege1:type_name -> webapi.VIPcfg.Privilege1Entry + 116, // 47: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry + 117, // 48: webapi.VIPcfg.Privilege9:type_name -> webapi.VIPcfg.Privilege9Entry 51, // 49: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg 38, // 50: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate 55, // 51: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig - 117, // 52: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry + 118, // 52: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry 62, // 53: webapi.ActInviteConfig.Awards1:type_name -> webapi.RankAward 62, // 54: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward 62, // 55: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward @@ -12140,12 +12221,12 @@ var file_protocol_webapi_common_proto_depIdxs = []int32{ 69, // 66: webapi.DiamondLotteryData.Info:type_name -> webapi.DiamondLotteryInfo 70, // 67: webapi.DiamondLotteryData.Players:type_name -> webapi.DiamondLotteryPlayers 72, // 68: webapi.DiamondLotteryConfig.LotteryData:type_name -> webapi.DiamondLotteryData - 121, // 69: webapi.ItemConfig.Items:type_name -> server.DB_GameItem + 122, // 69: webapi.ItemConfig.Items:type_name -> server.DB_GameItem 32, // 70: webapi.RankAwardInfo.Item:type_name -> webapi.ItemInfo 75, // 71: webapi.RankTypeInfo.Award:type_name -> webapi.RankAwardInfo 76, // 72: webapi.RankTypeConfig.Info:type_name -> webapi.RankTypeInfo - 118, // 73: webapi.SkinLevel.UpItem:type_name -> webapi.SkinLevel.UpItemEntry - 119, // 74: webapi.SkinItem.UnlockParam:type_name -> webapi.SkinItem.UnlockParamEntry + 119, // 73: webapi.SkinLevel.UpItem:type_name -> webapi.SkinLevel.UpItemEntry + 120, // 74: webapi.SkinItem.UnlockParam:type_name -> webapi.SkinItem.UnlockParamEntry 78, // 75: webapi.SkinItem.Levels:type_name -> webapi.SkinLevel 79, // 76: webapi.SkinConfig.Items:type_name -> webapi.SkinItem 82, // 77: webapi.AwardLogConfig.AwardLog:type_name -> webapi.AwardLogData @@ -13503,6 +13584,18 @@ func file_protocol_webapi_common_proto_init() { return nil } } + file_protocol_webapi_common_proto_msgTypes[110].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ConsumeConfig); 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{ @@ -13510,7 +13603,7 @@ func file_protocol_webapi_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_protocol_webapi_common_proto_rawDesc, NumEnums: 0, - NumMessages: 120, + NumMessages: 121, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/webapi/common.proto b/protocol/webapi/common.proto index 0347298..113ae71 100644 --- a/protocol/webapi/common.proto +++ b/protocol/webapi/common.proto @@ -1144,4 +1144,12 @@ message RedPacketInfo{ message RedInfo{ int64 Num = 1; // 数量 int64 Rate = 2; // 概率,百分比 +} + +// etcd /game/act_consume +message ConsumeConfig{ + string Platform = 1; // 平台 + int32 On = 2; // 活动开关 1.开启 2.关闭 + string StartTime = 3; // 活动开始时间 + string EndTime = 4; // 活动结束时间 } \ No newline at end of file diff --git a/worldsrv/action_task.go b/worldsrv/action_task.go index 877bea5..fe0795f 100644 --- a/worldsrv/action_task.go +++ b/worldsrv/action_task.go @@ -27,143 +27,6 @@ func init() { common.Register(int(taskproto.TaskPacketID_PACKET_CSDebugInc), taskproto.CSTaskDebugInc{}, CSTaskDebugInc) } -// GetTaskTimes 获取任务完成进度 -func GetTaskTimes(p *Player, id int32) int64 { - if p.WelfData != nil && p.WelfData.Task[id] != nil { - return p.WelfData.Task[id].N - } - return 0 -} - -// IsTaskFinish 是否任务完成 -func IsTaskFinish(p *Player, id int32) bool { - data := srvdata.PBDB_TaskMgr.GetData(id) - if data == nil { - return false - } - if p.WelfData != nil && p.WelfData.Task[id] != nil { - return p.WelfData.Task[id].N >= data.GetTargetTimes() - } - return false -} - -// IsTaskReward 是否任务奖励已领取 -func IsTaskReward(p *Player, id int32) bool { - if p.WelfData != nil && p.WelfData.Task != nil { - if data := p.WelfData.Task[id]; data != nil && data.Ts > 0 { - t := srvdata.PBDB_TaskMgr.GetData(id) - switch t.ActivityType { - case common.TaskActivityTypeEveryDay, common.TaskActivityTypePermitEveryDay, common.TaskActivityTypeNianEveryDay: - if common.TsInSameDay(time.Now().Unix(), data.Ts) { - return true - } - - case common.TaskActivityTypeWeek: - if common.TsInSameWeek(time.Now().Unix(), data.Ts) { - return true - } - - case common.TaskActivityTypeNovice, common.TaskActivityTypeInvite, common.TaskActivityTypeAchieve: - if data.Ts > 0 { - return true - } - case common.TaskActivityTypePermit: - startTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitStartTs - endTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitEndTs - if startTs > 0 { - return data.Ts >= startTs && data.Ts < endTs - } - return true - case common.TaskActivityTypeNian: - pool := PlatformMgrSingleton.GetConfig(p.Platform).ActivityNianConfig - if pool == nil || pool.List == nil { - return false - } - if pool.Switch == model.WelfareClose { - return false - } - startTime := pool.List[0].ActivityStart - endTime := pool.List[0].ActivityEnd - start, _ := time.Parse(time.DateTime, startTime) - timestamp := start.Unix() - end, _ := time.Parse(time.DateTime, endTime) - endTimestamp := end.Unix() - if timestamp > 0 { - return data.Ts >= timestamp && data.Ts < endTimestamp - } - return true - } - } - } - return false -} - -func SendReward(p *Player, m map[int64]int64, tp int32) { - isPermit := p.GetIsPermit() - add := p.GetSkillAdd(common.SkillIdTask) - var items []*model.Item - for k, v := range m { - if k == common.ItemIDPermit && isPermit { - v += int64(float64(v) * common.PermitAdd) - } - // 皮肤技能每日任务金币加成 - if tp == common.TaskActivityTypeEveryDay && add > 0 && k == common.ItemIDCoin { - v += int64((float64(v) * float64(add)) / 100.0) - } - items = append(items, &model.Item{ - ItemId: int32(k), - ItemNum: v, - }) - } - gain := int32(0) - giveType := int32(-1) - switch tp { - case 1: - gain = common.GainWayItemTaskEveryDay - giveType = model.SystemFreeGive_GiveType_TaskEveryDay - case 2: - gain = common.GainWayItemWeekActive - giveType = model.SystemFreeGive_GiveType_TaskWeekActive - case 3: - gain = common.GainWayItemTaskNewPlayer - giveType = model.SystemFreeGive_GiveType_TaskNewPlayer - case 4: - gain = common.GainWayItemTaskInvite - giveType = model.SystemFreeGive_GiveType_TaskInvite - case 5: - gain = common.GainWayItemTaskAchievement - giveType = model.SystemFreeGive_GiveType_TaskAchievement - case 6: - gain = common.GainWayItemTaskPermit - giveType = model.SystemFreeGive_GiveType_TaskPermit - } - BagMgrSingleton.AddItems(&model.AddItemParam{ - Platform: p.Platform, - SnId: p.SnId, - Change: items, - Add: 0, - GainWay: gain, - Operator: "system", - Remark: "任务奖励", - GameId: 0, - GameFreeId: 0, - }) - for _, v := range items { - tp := int32(-1) - if v.ItemId == common.ItemIDCoin { - tp = model.SystemFreeGive_CoinType_Coin - } else if v.ItemId == common.ItemIDDiamond { - tp = model.SystemFreeGive_CoinType_Diamond - } - if !p.IsRob && tp >= 0 && giveType >= 0 { - mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, giveType, tp, v.ItemNum)) - } - } - if giveType == model.SystemFreeGive_GiveType_TaskPermit { - mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_Permit, 1)) - } -} - func CSTaskList(s *netlib.Session, packetId int, data interface{}, sid int64) error { logger.Logger.Tracef("CSTaskList %v", data) msg, ok := data.(*taskproto.CSTaskList) @@ -179,6 +42,14 @@ func CSTaskList(s *netlib.Session, packetId int, data interface{}, sid int64) er ret := &taskproto.SCTaskList{ Tp: msg.GetTp(), } + if msg.GetTp() == common.TaskActivityTypeConsume { + conf := WelfareMgrSington.GetConfig(p.Platform).ConsumeConfig + if conf != nil { + ret.StartTs = common.StrTimeToTs(conf.StartTime) + ret.EndTs = common.StrTimeToTs(conf.EndTime) + ret.On = conf.GetOn() == common.On + } + } for _, v := range srvdata.TaskMgr.GetActivityType(msg.GetTp()) { item := &taskproto.TaskData{ @@ -245,7 +116,7 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) } data := srvdata.PBDB_TaskMgr.GetData(id) if data != nil { - SendReward(p, data.Award, msg.Tp) + SendTaskReward(p, data.Award, msg.Tp) for k, vv := range data.GetAward() { if k == common.ItemIDPermit && isPermit { vv += int64(float64(vv) * common.PermitAdd) @@ -271,6 +142,15 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) } } + if msg.GetTp() == common.TaskActivityTypeConsume { + conf := WelfareMgrSington.GetConfig(p.Platform).ConsumeConfig + if conf == nil || conf.GetOn() != common.On || now.Unix() < common.StrTimeToTs(conf.StartTime) || now.Unix() >= common.StrTimeToTs(conf.EndTime) { + p.SendToClient(int(taskproto.TaskPacketID_PACKET_SCTaskReward), ret) + logger.Logger.Tracef("SCTaskReward %v", ret) + return nil + } + } + if msg.Tp > 0 && msg.Id == 0 { // 一键领取 for _, v := range srvdata.TaskMgr.GetActivityType(msg.GetTp()) { diff --git a/worldsrv/etcd.go b/worldsrv/etcd.go index d1870aa..a9bcd29 100644 --- a/worldsrv/etcd.go +++ b/worldsrv/etcd.go @@ -113,7 +113,9 @@ func init() { //年兽配置 etcd.Register(etcd.ETCDKEY_NianConfig, webapi.ActivityNianConfig{}, platformConfigEvent) // 红包配置 - etcd.Register(etcd.ETCDKEY_REDPACKET, webapi.RedPacketConfig{}, platformConfigEvent) + etcd.Register(etcd.KeyRedPacket, webapi.RedPacketConfig{}, platformConfigEvent) + // 累计消耗活动配置 + etcd.Register(etcd.KeyActConsume, webapi.ConsumeConfig{}, platformConfigEvent) WelfareMgrSington.UpdateRedPacket(&webapi.RedPacketConfig{ Platform: "1", @@ -514,6 +516,9 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e WelfareMgrSington.UpdateActivityNianStatus(config) case *webapi.RedPacketConfig: WelfareMgrSington.UpdateRedPacket(config, isInit) + case *webapi.ConsumeConfig: + WelfareMgrSington.UpdateConsumeConfig(config) + default: logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey) } diff --git a/worldsrv/internal/playerlistener.go b/worldsrv/internal/playerlistener.go index 19e99c6..e2d1c51 100644 --- a/worldsrv/internal/playerlistener.go +++ b/worldsrv/internal/playerlistener.go @@ -16,11 +16,12 @@ func RegisterPlayerListener[Player, Scene any](l PlayerListener[Player, Scene]) type PlayerListener[Player, Scene any] interface { common.ClockSinker // 登出相关 - OnPlayerLogined(p Player) // 玩家登录时触发 - OnPlayerLogouted(p Player) // 玩家登出时触发 - OnPlayerDropLine(p Player) // 玩家掉线时触发 - OnPlayerRehold(p Player) // 玩家重新连接时触发 - OnPlayerDayChanged(p Player, isLogin, isContinue bool) // 玩家跨天时触发 + OnPlayerLogined(p Player) // 玩家登录时触发 + OnPlayerLogouted(p Player) // 玩家登出时触发 + OnPlayerDropLine(p Player) // 玩家掉线时触发 + OnPlayerRehold(p Player) // 玩家重新连接时触发 + OnPlayerDayChanged(p Player, isLogin, isContinue bool) // 玩家跨天时触发 + OnPlayerWeekChanged(p Player, isLogin, isContinue bool) // 玩家跨周时触发 // 业务相关 OnPlayerEnterSceneBefore(p Player, s Scene) // 玩家进入场景前触发 OnPlayerEnterSceneAfter(p Player, s Scene) // 玩家进入场景后触发 @@ -70,6 +71,14 @@ func FirePlayerDayChanged[Player, Scene any](p Player, isLogin, isContinue bool) } } +func FirePlayerWeekChanged[Player, Scene any](p Player, isLogin, isContinue bool) { + for _, l := range _playerListeners { + if l != nil { + l.(PlayerListener[Player, Scene]).OnPlayerWeekChanged(p, isLogin, isContinue) + } + } +} + func FirePlayerEnterSceneBefore[Player, Scene any](p Player, s Scene) { for _, l := range _playerListeners { if l != nil { @@ -122,17 +131,18 @@ type BasePlayerListener[Player, Scene any] struct { common.ClockFunc } -func (l *BasePlayerListener[Player, Scene]) OnPlayerLogined(p Player) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerLogouted(p Player) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerDropLine(p Player) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerRehold(p Player) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerDayChanged(p Player, isLogin, isContinue bool) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneAfter(p Player, s Scene) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneBefore(p Player, s Scene) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneAfter(p Player, s Scene) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneBefore(p Player, s Scene) {} -func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneAfter(p Player, s Scene) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerLogined(p Player) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerLogouted(p Player) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerDropLine(p Player) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerRehold(p Player) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerDayChanged(p Player, isLogin, isContinue bool) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerWeekChanged(p Player, isLogin, isContinue bool) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerEnterSceneAfter(p Player, s Scene) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneBefore(p Player, s Scene) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerLeaveSceneAfter(p Player, s Scene) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneBefore(p Player, s Scene) {} +func (l *BasePlayerListener[Player, Scene]) OnPlayerReturnSceneAfter(p Player, s Scene) {} type PlayerListenerFunc[Player, Scene any] struct { common.ClockFunc @@ -141,6 +151,7 @@ type PlayerListenerFunc[Player, Scene any] struct { OnPlayerDropLineFunc func(p Player) OnPlayerReholdFunc func(p Player) OnPlayerDayChangedFunc func(p Player, isLogin, isContinue bool) + OnPlayerWeekChangedFunc func(p Player, isLogin, isContinue bool) OnPlayerEnterSceneBeforeFunc func(p Player, s Scene) OnPlayerEnterSceneAfterFunc func(p Player, s Scene) OnPlayerLeaveSceneBeforeFunc func(p Player, s Scene) @@ -179,6 +190,12 @@ func (l *PlayerListenerFunc[Player, Scene]) OnPlayerDayChanged(p Player, isLogin } } +func (l *PlayerListenerFunc[Player, Scene]) OnPlayerWeekChanged(p Player, isLogin, isContinue bool) { + if l.OnPlayerWeekChangedFunc != nil { + l.OnPlayerWeekChangedFunc(p, isLogin, isContinue) + } +} + func (l *PlayerListenerFunc[Player, Scene]) OnPlayerEnterSceneBefore(p Player, s Scene) { if l.OnPlayerEnterSceneBeforeFunc != nil { l.OnPlayerEnterSceneBeforeFunc(p, s) diff --git a/worldsrv/player.go b/worldsrv/player.go index 6cc5cc6..28e3644 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -1666,20 +1666,6 @@ func (this *Player) OnDayTimer(login, continuous bool, t int) { this.VipMatchTimes = 0 //VIP商城数据更新 this.UpdateVipShopData() - // 重置每日任务 - if this.WelfData != nil { - if this.WelfData.Task != nil { - for _, v := range srvdata.TaskMgr.GetActivityType(common.TaskActivityTypeEveryDay) { - this.WelfData.Task[v.GetId()] = &model.TaskData{} - } - for _, v := range srvdata.TaskMgr.GetActivityType(common.TaskActivityTypePermitEveryDay) { - this.WelfData.Task[v.GetId()] = &model.TaskData{} - } - for _, v := range srvdata.TaskMgr.GetActivityType(common.TaskActivityTypeNianEveryDay) { - this.WelfData.Task[v.GetId()] = &model.TaskData{} - } - } - } //周卡数据更新 this.WeekCardAward = make(map[int32]bool) //周卡领取奖励 @@ -1793,13 +1779,15 @@ func (this *Player) OnMonthTimer() { } func (this *Player) OnWeekTimer() { - logger.Logger.Tracef("OnWeekTimer %v", time.Now()) //判断是否一天即可过滤0点多次切换 if common.InSameDayNoZero(time.Now().Local(), this.lastOnWeekChange) { return } this.lastOnWeekChange = time.Now().Local() + logger.Logger.Tracef("OnWeekTimer %v", time.Now()) + internal.FirePlayerWeekChanged[*Player, *Scene](this, false, false) + //清理比赛券 ticket := this.Ticket if ticket > 0 { @@ -1824,14 +1812,6 @@ func (this *Player) OnWeekTimer() { } } - // 重置周任务 - if this.WelfData != nil { - if this.WelfData.Task != nil { - for _, v := range srvdata.TaskMgr.GetActivityType(common.TaskActivityTypeWeek) { - this.WelfData.Task[v.GetId()] = &model.TaskData{} - } - } - } // 重置周任务 // 重置邀请积分 CheckNewWeek(this.Platform, this.SnId) diff --git a/worldsrv/taskmgr.go b/worldsrv/taskmgr.go index 356aac8..c66e450 100644 --- a/worldsrv/taskmgr.go +++ b/worldsrv/taskmgr.go @@ -3,13 +3,16 @@ package main import ( "container/list" "math" - "mongo.games.com/goserver/core/logger" "time" + "mongo.games.com/goserver/core/logger" + "mongo.games.com/game/common" "mongo.games.com/game/model" + "mongo.games.com/game/mq" taskproto "mongo.games.com/game/protocol/task" "mongo.games.com/game/srvdata" + "mongo.games.com/game/worldsrv/internal" ) /* @@ -160,6 +163,7 @@ func (t *TaskHandle) AllTask(id int, data any) { logger.Logger.Tracef("AllTask taskID:%v %v", id, p.WelfData.Task[int32(id)]) + now := time.Now() change := map[int32][]*taskproto.TaskData{} for _, v := range srvdata.TaskMgr.GetTaskType(int32(id)) { if !info.Debug { @@ -192,7 +196,9 @@ func (t *TaskHandle) AllTask(id int, data any) { } } } - if v.ActivityType == common.TaskActivityTypeNianEveryDay || v.ActivityType == common.TaskActivityTypeNian { + + switch v.GetActivityType() { + case common.TaskActivityTypeNianEveryDay, common.TaskActivityTypeNian: //判断是否在开启时间段内 pool := PlatformMgrSingleton.GetConfig(p.Platform).ActivityNianConfig if pool == nil || pool.List == nil { @@ -207,7 +213,13 @@ func (t *TaskHandle) AllTask(id int, data any) { timestamp := start.Unix() end, _ := time.Parse(time.DateTime, endTime) endTimestamp := end.Unix() - if time.Now().Unix() < timestamp || time.Now().Unix() > endTimestamp { + if now.Unix() < timestamp || now.Unix() > endTimestamp { + continue + } + + case common.TaskActivityTypeConsume: + cfg := WelfareMgrSington.GetConfig(p.Platform).ConsumeConfig + if cfg == nil || cfg.GetOn() != common.On || now.Unix() < common.StrTimeToTs(cfg.StartTime) || now.Unix() >= common.StrTimeToTs(cfg.EndTime) { continue } } @@ -280,6 +292,144 @@ func OnNotifyChange(p *Player, activityType int32) { logger.Logger.Tracef("SCTaskChange %v", pack) } +// GetTaskTimes 获取任务完成进度 +func GetTaskTimes(p *Player, id int32) int64 { + if p.WelfData != nil && p.WelfData.Task[id] != nil { + return p.WelfData.Task[id].N + } + return 0 +} + +// IsTaskFinish 是否任务完成 +func IsTaskFinish(p *Player, id int32) bool { + data := srvdata.PBDB_TaskMgr.GetData(id) + if data == nil { + return false + } + if p.WelfData != nil && p.WelfData.Task[id] != nil { + return p.WelfData.Task[id].N >= data.GetTargetTimes() + } + return false +} + +// IsTaskReward 是否任务奖励已领取 +func IsTaskReward(p *Player, id int32) bool { + if p.WelfData != nil && p.WelfData.Task != nil { + if data := p.WelfData.Task[id]; data != nil && data.Ts > 0 { + t := srvdata.PBDB_TaskMgr.GetData(id) + switch t.ActivityType { + case common.TaskActivityTypeEveryDay, common.TaskActivityTypePermitEveryDay, common.TaskActivityTypeNianEveryDay, common.TaskActivityTypeConsume: + if common.TsInSameDay(time.Now().Unix(), data.Ts) { + return true + } + + case common.TaskActivityTypeWeek: + if common.TsInSameWeek(time.Now().Unix(), data.Ts) { + return true + } + + case common.TaskActivityTypeNovice, common.TaskActivityTypeInvite, common.TaskActivityTypeAchieve: + if data.Ts > 0 { + return true + } + case common.TaskActivityTypePermit: + startTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitStartTs + endTs := PlatformMgrSingleton.GetConfig(p.Platform).PermitEndTs + if startTs > 0 { + return data.Ts >= startTs && data.Ts < endTs + } + return true + case common.TaskActivityTypeNian: + pool := PlatformMgrSingleton.GetConfig(p.Platform).ActivityNianConfig + if pool == nil || pool.List == nil { + return false + } + if pool.Switch == model.WelfareClose { + return false + } + startTime := pool.List[0].ActivityStart + endTime := pool.List[0].ActivityEnd + start, _ := time.Parse(time.DateTime, startTime) + timestamp := start.Unix() + end, _ := time.Parse(time.DateTime, endTime) + endTimestamp := end.Unix() + if timestamp > 0 { + return data.Ts >= timestamp && data.Ts < endTimestamp + } + return true + } + } + } + return false +} + +// SendTaskReward 发送任务奖励 +func SendTaskReward(p *Player, m map[int64]int64, tp int32) { + isPermit := p.GetIsPermit() + add := p.GetSkillAdd(common.SkillIdTask) + var items []*model.Item + for k, v := range m { + if k == common.ItemIDPermit && isPermit { + v += int64(float64(v) * common.PermitAdd) + } + // 皮肤技能每日任务金币加成 + if tp == common.TaskActivityTypeEveryDay && add > 0 && k == common.ItemIDCoin { + v += int64((float64(v) * float64(add)) / 100.0) + } + items = append(items, &model.Item{ + ItemId: int32(k), + ItemNum: v, + }) + } + gain := int32(0) + giveType := int32(-1) + switch tp { + case 1: + gain = common.GainWayItemTaskEveryDay + giveType = model.SystemFreeGive_GiveType_TaskEveryDay + case 2: + gain = common.GainWayItemWeekActive + giveType = model.SystemFreeGive_GiveType_TaskWeekActive + case 3: + gain = common.GainWayItemTaskNewPlayer + giveType = model.SystemFreeGive_GiveType_TaskNewPlayer + case 4: + gain = common.GainWayItemTaskInvite + giveType = model.SystemFreeGive_GiveType_TaskInvite + case 5: + gain = common.GainWayItemTaskAchievement + giveType = model.SystemFreeGive_GiveType_TaskAchievement + case 6: + gain = common.GainWayItemTaskPermit + giveType = model.SystemFreeGive_GiveType_TaskPermit + } + BagMgrSingleton.AddItems(&model.AddItemParam{ + Platform: p.Platform, + SnId: p.SnId, + Change: items, + Add: 0, + GainWay: gain, + Operator: "system", + Remark: "任务奖励", + GameId: 0, + GameFreeId: 0, + }) + for _, v := range items { + tp := int32(-1) + if v.ItemId == common.ItemIDCoin { + tp = model.SystemFreeGive_CoinType_Coin + } else if v.ItemId == common.ItemIDDiamond { + tp = model.SystemFreeGive_CoinType_Diamond + } + if !p.IsRob && tp >= 0 && giveType >= 0 { + mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, giveType, tp, v.ItemNum)) + } + } + if giveType == model.SystemFreeGive_GiveType_TaskPermit { + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_Permit, 1)) + } +} + func init() { taskHandle := new(TaskHandle) TaskSubjectSingleton.Attach(common.TaskTypeAdv, taskHandle) @@ -313,4 +463,32 @@ func init() { TaskSubjectSingleton.Attach(common.TaskTypeRankMatchWinTimes, taskHandle) TaskSubjectSingleton.Attach(common.TaskTypeBuyPermit, taskHandle) TaskSubjectSingleton.Attach(common.TaskTypeBuyRedBag, taskHandle) + + internal.RegisterPlayerListenerFunc(&internal.PlayerListenerFunc[*Player, *Scene]{ + OnPlayerDayChangedFunc: func(p *Player, isLogin, isContinue bool) { + if p.WelfData != nil && p.WelfData.Task != nil { + for _, v := range []int32{ + // todo 每日重置的任务列表 + common.TaskActivityTypeEveryDay, + common.TaskActivityTypePermitEveryDay, + common.TaskActivityTypeNianEveryDay, + common.TaskActivityTypeConsume} { + for _, vv := range srvdata.TaskMgr.GetActivityType(v) { + p.WelfData.Task[vv.GetId()] = &model.TaskData{} + } + } + } + }, + OnPlayerWeekChangedFunc: func(p *Player, isLogin, isContinue bool) { + if p.WelfData != nil && p.WelfData.Task != nil { + for _, v := range []int32{ + // todo 每周重置的任务列表 + common.TaskActivityTypeWeek} { + for _, vv := range srvdata.TaskMgr.GetActivityType(v) { + p.WelfData.Task[vv.GetId()] = &model.TaskData{} + } + } + } + }, + }) } diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index 91961c1..198d2c3 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -2441,6 +2441,10 @@ func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDr return pack } +func (this *WelfareMgr) UpdateConsumeConfig(conf *webapi_proto.ConsumeConfig) { + this.GetConfig(conf.Platform).ConsumeConfig = conf +} + func (this *WelfareMgr) Update() { }