钻石抽奖实现

This commit is contained in:
by 2024-07-09 17:35:55 +08:00
parent cdd855bfb2
commit 0484f1f47b
12 changed files with 1934 additions and 748 deletions

View File

@ -292,6 +292,7 @@ const (
GainWayPermitExchangeCost = 96 // 赛季通行证兑换消耗
GainWayPermitExchangeGain = 97 // 赛季通行证兑换获得
GainWayItemTaskPermit = 98 // 赛季通行证任务
GainWayDiamondLottery = 99 //钻石抽奖
)
// 后台选择 金币变化类型 的充值 类型id号起始
@ -786,6 +787,7 @@ var PetIDs = []int32{PetIDChicken}
const (
ChannelSwitchExchange = 1
ChannelSwitchDropItem = 2
DiamondLottery = 4
)
// 特殊商品id

View File

@ -30,7 +30,8 @@ const (
ETCDKEY_PLAYERPOOL = "/game/plt/playerpool/" // 个人水池调控配置
ETCDKEY_GAME_CONFIG = "/game/plt/gameconfig/" // 游戏管理/全局配置
ETCDKEY_ACT_PHONELOTTERY = "/game/act_phoneLottery"
ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
ETCDKEY_DIAMOND_LOTTERY = "/game/diamond_lottery" // 钻石抽奖配置
)

View File

@ -149,9 +149,9 @@
"SlowMS": 500
},
"etcd": {
"Url": ["127.0.0.1:2379"],
"UserName": "",
"Password": "",
"Url": ["47.105.78.29:2379"],
"UserName": "root",
"Password": "win88",
"DialTimeout": 60
},
"costum": {

View File

@ -12,13 +12,14 @@ import (
*/
const (
OpAll = 0
OpTurnplate = 1
OpBlindBox = 2
OpFirstPay = 3
OpContinuousPay = 4
OpPhoneLottery = 5
OpCollect = 6
OpAll = 0
OpTurnplate = 1
OpBlindBox = 2
OpFirstPay = 3
OpContinuousPay = 4
OpPhoneLottery = 5
OpCollect = 6
OpDiamondLottery = 7
)
const (
@ -123,6 +124,7 @@ type AllConfig struct {
*webapi.ActPermitConfig
PermitStartTs int64 // 开始时间戳
PermitEndTs int64 // 结束时间戳
*webapi.DiamondLotteryConfig
}
type GlobalConfig struct {

View File

@ -474,6 +474,7 @@ type PlayerData struct {
IScoreTs time.Time // 邀请积分更新时间
Permit time.Time // 赛季通行证领取时间
PermitStartTs int64 // 赛季通行证开始时间戳
DiamondLotteryScore int64 //钻石抽奖幸运值
}
// 七日签到数据

File diff suppressed because it is too large Load Diff

View File

@ -209,6 +209,13 @@ enum PlayerPacketID {
PACKET_SCExchangeChannel = 2826; //
PACKET_CSSMSConfig = 2827; //
PACKET_SCSMSConfig = 2828; //
PACKET_CS_DiamondLotteryInfo = 2829; //
PACKET_SC_DiamondLotteryInfo = 2830; //
PACKET_CS_DiamondLottery = 2831; //
PACKET_SC_DiamondLottery = 2832; //
PACKET_CSDiamondLotteryLuckyAward = 2833; //
PACKET_SCDiamondLotteryLuckyAward = 2834; //
}
//
@ -1150,6 +1157,7 @@ message LotteryItem{
int32 Id = 1;
int32 ItemId = 2;
int64 ItemNum =3;
int32 TypeId = 4;
}
//
@ -1191,7 +1199,7 @@ message CSExchangeChannel{
message ChannelSwitch {
repeated string OnChannelName = 1; //
int32 Tp = 2; // 1 2v卡掉落 3:
int32 Tp = 2; // 1 2v卡掉落 3: 4:
}
// PACKET_SCExchangeChannel
@ -1210,4 +1218,38 @@ message SCSMSConfig{
message SMSInfo{
int32 Id = 1;
string SmsName = 2;
}
//
//PACKET_CS_DiamondLotteryInfo
message CSDiamondLotteryInfo{
}
//
//PACKET_SC_DiamondLotteryInfo
message SCDiamondLotteryInfo{
int64 LuckyScore = 1; //
repeated LotteryItem Item = 2;//
int32 MaxScore = 3;//
int32 DiamondNum = 4; //
}
//
//PACKET_CS_DiamondLottery
message CSDiamondLottery{
int32 LotteryType = 1; //1- 2-
}
//
//PACKET_SC_DiamondLottery
message SCDiamondLottery{
int64 LuckyScore = 1; //
repeated LotteryItem Item = 2; //
}
//
//PACKET_CSDiamondLotteryLuckyAward
message CSDiamondLotteryLuckyAward{
}
////PACKET_SCDiamondLotteryLuckyAward
message SCDiamondLotteryLuckyAward{
int64 LuckyScore = 1; //
repeated LotteryItem Item = 2; //
}

View File

@ -6028,7 +6028,7 @@ type ChannelSwitchConfig struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 开关类型 1.兑换 2.道具掉落 3.邀请活动开关
Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 开关类型 1.兑换 2.道具掉落 3.邀请活动开关 4.钻石抽奖
Platform string `protobuf:"bytes,2,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台id
OnChannelName []string `protobuf:"bytes,3,rep,name=OnChannelName,proto3" json:"OnChannelName,omitempty"` // 开启渠道
}
@ -6636,6 +6636,293 @@ func (x *ActPermitConfig) GetConfigs() []*PermitChannelConfig {
return nil
}
//钻石抽奖
type DiamondLotteryInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
Type int32 `protobuf:"varint,2,opt,name=Type,proto3" json:"Type,omitempty"`
Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"`
ItemId int32 `protobuf:"varint,4,opt,name=ItemId,proto3" json:"ItemId,omitempty"`
Grade int32 `protobuf:"varint,5,opt,name=Grade,proto3" json:"Grade,omitempty"`
Oddrate int32 `protobuf:"varint,6,opt,name=Oddrate,proto3" json:"Oddrate,omitempty"`
}
func (x *DiamondLotteryInfo) Reset() {
*x = DiamondLotteryInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[66]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DiamondLotteryInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DiamondLotteryInfo) ProtoMessage() {}
func (x *DiamondLotteryInfo) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[66]
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 DiamondLotteryInfo.ProtoReflect.Descriptor instead.
func (*DiamondLotteryInfo) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{66}
}
func (x *DiamondLotteryInfo) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *DiamondLotteryInfo) GetType() int32 {
if x != nil {
return x.Type
}
return 0
}
func (x *DiamondLotteryInfo) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DiamondLotteryInfo) GetItemId() int32 {
if x != nil {
return x.ItemId
}
return 0
}
func (x *DiamondLotteryInfo) GetGrade() int32 {
if x != nil {
return x.Grade
}
return 0
}
func (x *DiamondLotteryInfo) GetOddrate() int32 {
if x != nil {
return x.Oddrate
}
return 0
}
//钻石抽奖白名单
type DiamondLotteryPlayers struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid int32 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"`
Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` //抽奖次数
AwatdId []int32 `protobuf:"varint,3,rep,packed,name=AwatdId,proto3" json:"AwatdId,omitempty"` //配置表里的奖励ID
}
func (x *DiamondLotteryPlayers) Reset() {
*x = DiamondLotteryPlayers{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[67]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DiamondLotteryPlayers) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DiamondLotteryPlayers) ProtoMessage() {}
func (x *DiamondLotteryPlayers) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[67]
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 DiamondLotteryPlayers.ProtoReflect.Descriptor instead.
func (*DiamondLotteryPlayers) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{67}
}
func (x *DiamondLotteryPlayers) GetUid() int32 {
if x != nil {
return x.Uid
}
return 0
}
func (x *DiamondLotteryPlayers) GetCount() int32 {
if x != nil {
return x.Count
}
return 0
}
func (x *DiamondLotteryPlayers) GetAwatdId() []int32 {
if x != nil {
return x.AwatdId
}
return nil
}
type DiamondLotteryData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Channel string `protobuf:"bytes,1,opt,name=Channel,proto3" json:"Channel,omitempty"` //渠道
Info []*DiamondLotteryInfo `protobuf:"bytes,2,rep,name=Info,proto3" json:"Info,omitempty"`
MaxScore int32 `protobuf:"varint,3,opt,name=MaxScore,proto3" json:"MaxScore,omitempty"` //保底奖励最大值
DiamondNum int32 `protobuf:"varint,4,opt,name=DiamondNum,proto3" json:"DiamondNum,omitempty"` //单次抽奖消耗钻石数量
Players []*DiamondLotteryPlayers `protobuf:"bytes,5,rep,name=Players,proto3" json:"Players,omitempty"` //白名单
}
func (x *DiamondLotteryData) Reset() {
*x = DiamondLotteryData{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[68]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DiamondLotteryData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DiamondLotteryData) ProtoMessage() {}
func (x *DiamondLotteryData) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[68]
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 DiamondLotteryData.ProtoReflect.Descriptor instead.
func (*DiamondLotteryData) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{68}
}
func (x *DiamondLotteryData) GetChannel() string {
if x != nil {
return x.Channel
}
return ""
}
func (x *DiamondLotteryData) GetInfo() []*DiamondLotteryInfo {
if x != nil {
return x.Info
}
return nil
}
func (x *DiamondLotteryData) GetMaxScore() int32 {
if x != nil {
return x.MaxScore
}
return 0
}
func (x *DiamondLotteryData) GetDiamondNum() int32 {
if x != nil {
return x.DiamondNum
}
return 0
}
func (x *DiamondLotteryData) GetPlayers() []*DiamondLotteryPlayers {
if x != nil {
return x.Players
}
return nil
}
// etcd /game/diamond_lottery
type DiamondLotteryConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台
LotteryData []*DiamondLotteryData `protobuf:"bytes,2,rep,name=LotteryData,proto3" json:"LotteryData,omitempty"`
}
func (x *DiamondLotteryConfig) Reset() {
*x = DiamondLotteryConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[69]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DiamondLotteryConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DiamondLotteryConfig) ProtoMessage() {}
func (x *DiamondLotteryConfig) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[69]
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 DiamondLotteryConfig.ProtoReflect.Descriptor instead.
func (*DiamondLotteryConfig) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{69}
}
func (x *DiamondLotteryConfig) GetPlatform() string {
if x != nil {
return x.Platform
}
return ""
}
func (x *DiamondLotteryConfig) GetLotteryData() []*DiamondLotteryData {
if x != nil {
return x.LotteryData
}
return nil
}
var File_common_proto protoreflect.FileDescriptor
var file_common_proto_rawDesc = []byte{
@ -7709,10 +7996,45 @@ var file_common_proto_rawDesc = []byte{
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61,
0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x73, 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,
0x69, 0x67, 0x73, 0x22, 0x94, 0x01, 0x0a, 0x12, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4c,
0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79,
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12,
0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x47, 0x72,
0x61, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x47, 0x72, 0x61, 0x64, 0x65,
0x12, 0x18, 0x0a, 0x07, 0x4f, 0x64, 0x64, 0x72, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28,
0x05, 0x52, 0x07, 0x4f, 0x64, 0x64, 0x72, 0x61, 0x74, 0x65, 0x22, 0x59, 0x0a, 0x15, 0x44, 0x69,
0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x41,
0x77, 0x61, 0x74, 0x64, 0x49, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x41, 0x77,
0x61, 0x74, 0x64, 0x49, 0x64, 0x22, 0xd3, 0x01, 0x0a, 0x12, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e,
0x64, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07,
0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43,
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x2e, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x69,
0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x78, 0x53, 0x63, 0x6f,
0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x4d, 0x61, 0x78, 0x53, 0x63, 0x6f,
0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e, 0x75, 0x6d,
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e,
0x75, 0x6d, 0x12, 0x37, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x69, 0x61,
0x6d, 0x6f, 0x6e, 0x64, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x72, 0x73, 0x52, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x22, 0x70, 0x0a, 0x14, 0x44,
0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 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,
0x3c, 0x0a, 0x0b, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x69,
0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61,
0x52, 0x0b, 0x4c, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 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 (
@ -7727,7 +8049,7 @@ func file_common_proto_rawDescGZIP() []byte {
return file_common_proto_rawDescData
}
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 72)
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 76)
var file_common_proto_goTypes = []interface{}{
(*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting
(*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting
@ -7795,33 +8117,37 @@ var file_common_proto_goTypes = []interface{}{
(*PermitRankConfig)(nil), // 63: webapi.PermitRankConfig
(*PermitChannelConfig)(nil), // 64: webapi.PermitChannelConfig
(*ActPermitConfig)(nil), // 65: webapi.ActPermitConfig
nil, // 66: webapi.Platform.BindTelRewardEntry
nil, // 67: webapi.PlayerData.RankScoreEntry
nil, // 68: webapi.ItemShop.AwardEntry
nil, // 69: webapi.VIPcfg.AwardEntry
nil, // 70: webapi.VIPcfg.Privilege7Entry
nil, // 71: webapi.ActInviteConfig.PayScoreEntry
(*server.DB_GameFree)(nil), // 72: server.DB_GameFree
(*DiamondLotteryInfo)(nil), // 66: webapi.DiamondLotteryInfo
(*DiamondLotteryPlayers)(nil), // 67: webapi.DiamondLotteryPlayers
(*DiamondLotteryData)(nil), // 68: webapi.DiamondLotteryData
(*DiamondLotteryConfig)(nil), // 69: webapi.DiamondLotteryConfig
nil, // 70: webapi.Platform.BindTelRewardEntry
nil, // 71: webapi.PlayerData.RankScoreEntry
nil, // 72: webapi.ItemShop.AwardEntry
nil, // 73: webapi.VIPcfg.AwardEntry
nil, // 74: webapi.VIPcfg.Privilege7Entry
nil, // 75: webapi.ActInviteConfig.PayScoreEntry
(*server.DB_GameFree)(nil), // 76: server.DB_GameFree
}
var file_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
66, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry
70, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry
6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus
72, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree
76, // 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
72, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
67, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
76, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
71, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
29, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo
20, // 13: webapi.OnlineReport.GameCount:type_name -> webapi.OnlineGameCnt
22, // 14: webapi.CommonNoticeList.List:type_name -> webapi.CommonNotice
25, // 15: webapi.ExchangeShop.ExType:type_name -> webapi.ExchangeType
24, // 16: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop
68, // 17: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry
72, // 17: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry
27, // 18: webapi.ItemShopList.List:type_name -> webapi.ItemShop
29, // 19: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo
30, // 20: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward
@ -7842,12 +8168,12 @@ var file_common_proto_depIdxs = []int32{
35, // 35: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate
45, // 36: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree
45, // 37: webapi.WelfareContinuousPayDataList.List:type_name -> webapi.WelfareSpree
69, // 38: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
70, // 39: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
73, // 38: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
74, // 39: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
48, // 40: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg
35, // 41: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate
52, // 42: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig
71, // 43: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry
75, // 43: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry
59, // 44: webapi.ActInviteConfig.Awards1:type_name -> webapi.RankAward
59, // 45: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward
59, // 46: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward
@ -7860,11 +8186,14 @@ var file_common_proto_depIdxs = []int32{
62, // 53: webapi.PermitChannelConfig.ExchangeConfig:type_name -> webapi.PermitExchangeConfig
63, // 54: webapi.PermitChannelConfig.RankConfig:type_name -> webapi.PermitRankConfig
64, // 55: webapi.ActPermitConfig.Configs:type_name -> webapi.PermitChannelConfig
56, // [56:56] is the sub-list for method output_type
56, // [56:56] is the sub-list for method input_type
56, // [56:56] is the sub-list for extension type_name
56, // [56:56] is the sub-list for extension extendee
0, // [0:56] is the sub-list for field type_name
66, // 56: webapi.DiamondLotteryData.Info:type_name -> webapi.DiamondLotteryInfo
67, // 57: webapi.DiamondLotteryData.Players:type_name -> webapi.DiamondLotteryPlayers
68, // 58: webapi.DiamondLotteryConfig.LotteryData:type_name -> webapi.DiamondLotteryData
59, // [59:59] is the sub-list for method output_type
59, // [59:59] is the sub-list for method input_type
59, // [59:59] is the sub-list for extension type_name
59, // [59:59] is the sub-list for extension extendee
0, // [0:59] is the sub-list for field type_name
}
func init() { file_common_proto_init() }
@ -8665,6 +8994,54 @@ func file_common_proto_init() {
return nil
}
}
file_common_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DiamondLotteryInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DiamondLotteryPlayers); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DiamondLotteryData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DiamondLotteryConfig); 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{
@ -8672,7 +9049,7 @@ func file_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 72,
NumMessages: 76,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -672,7 +672,7 @@ message WelfareCollectConfig{
// etcd /game/channel/switch
message ChannelSwitchConfig{
int32 Tp = 1; // 1. 2. 3.
int32 Tp = 1; // 1. 2. 3. 4.
string Platform = 2; // id
repeated string OnChannelName = 3; //
}
@ -735,4 +735,33 @@ message ActPermitConfig{
int64 StartTs = 2; //
int32 Days = 3; //
repeated PermitChannelConfig Configs = 4; //
}
}
//
message DiamondLotteryInfo{
int32 Id = 1;
int32 Type = 2;
string Name = 3;
int32 ItemId = 4;
int32 Grade = 5;
int32 Oddrate =6;
}
//
message DiamondLotteryPlayers{
int32 uid = 1;
int32 Count = 2; //
repeated int32 AwatdId = 3; //ID
}
message DiamondLotteryData{
string Channel = 1; //
repeated DiamondLotteryInfo Info = 2;
int32 MaxScore = 3; //
int32 DiamondNum = 4; //
repeated DiamondLotteryPlayers Players = 5;//
}
// etcd /game/diamond_lottery
message DiamondLotteryConfig{
string Platform = 1; //
repeated DiamondLotteryData LotteryData = 2;
}

View File

@ -6,6 +6,7 @@ import (
"mongo.games.com/game/common"
"mongo.games.com/game/model"
player_proto "mongo.games.com/game/protocol/player"
"mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
@ -24,7 +25,6 @@ func (this *CSPhoneLotteryInfoPacketFactory) CreatePacket() interface{} {
// 获取抽奖信息
func (this *CSPhoneLotteryInfoHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
if _, ok := data.(*player_proto.CSPhoneLotteryInfo); ok {
p := PlayerMgrSington.GetPlayer(sid)
logger.Logger.Trace("客户端请求抽奖信息snid = ", p.SnId)
@ -80,7 +80,8 @@ func (this *CSPhoneLotteryHandler) Process(s *netlib.Session, packetid int, data
logger.Logger.Warn("CSPhoneLottery p == nil")
return nil
}
if WelfareMgrSington.GetPhoneLotteryStatus(p.Platform) == model.WelfareClose {
conf := PlatformMgrSingleton.GetConfig(p.Platform).ChannelSwitch[common.DiamondLottery]
if !model.GameParamData.CloseChannelSwitch && (conf == nil || !common.InSliceString(conf.OnChannelName, p.LastChannel)) {
return nil
}
countType := msg.GetLotteryType()
@ -91,10 +92,6 @@ func (this *CSPhoneLotteryHandler) Process(s *netlib.Session, packetid int, data
count = 10
}
logger.Logger.Tracef("玩家请求抽奖snid =%d,count = %d ", p.SnId, count)
if p == nil {
logger.Logger.Warn("CSPhoneLottery p == nil")
return nil
}
if p.LotteryCount < count {
logger.Logger.Trace("剩余抽奖次数不足,无法抽奖 count = ", count)
return nil
@ -197,6 +194,257 @@ func (this *CSPhoneLotteryHandler) Process(s *netlib.Session, packetid int, data
return nil
}
type CSDiamondLotteryInfoPacketFactory struct {
}
type CSDiamondLotteryInfoHandler struct {
}
func (this *CSDiamondLotteryInfoPacketFactory) CreatePacket() interface{} {
pack := &player_proto.CSDiamondLotteryInfo{}
return pack
}
// 获取钻石抽奖信息
func (this *CSDiamondLotteryInfoHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
if _, ok := data.(*player_proto.CSPhoneLotteryInfo); ok {
p := PlayerMgrSington.GetPlayer(sid)
logger.Logger.Trace("客户端请求钻石抽奖信息snid = ", p.SnId)
if p == nil {
logger.Logger.Warn("CSPhoneLotteryInfo p == nil")
return nil
}
// 渠道开关
conf := PlatformMgrSingleton.GetConfig(p.Platform).ChannelSwitch[common.DiamondLottery]
if !model.GameParamData.CloseChannelSwitch && (conf == nil || !common.InSliceString(conf.OnChannelName, p.LastChannel)) {
return nil
}
pack := &player_proto.SCDiamondLotteryInfo{}
pack.LuckyScore = p.DiamondLotteryScore
info := WelfareMgrSington.GetConfig(p.Platform)
if info != nil && info.DiamondLotteryConfig != nil {
for _, data := range info.DiamondLotteryConfig.LotteryData {
if data.Channel == p.Channel {
pack.MaxScore = data.MaxScore
pack.DiamondNum = data.DiamondNum
for _, lotteryInfo := range data.Info {
item := &player_proto.LotteryItem{
Id: lotteryInfo.Id,
ItemId: lotteryInfo.ItemId,
ItemNum: int64(lotteryInfo.Grade),
TypeId: lotteryInfo.Type,
}
pack.Item = append(pack.Item, item)
}
}
}
}
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DiamondLotteryInfo), pack)
logger.Logger.Trace("返回钻石抽奖信息:", pack.String())
}
return nil
}
type CSDiamondLotteryPacketFactory struct {
}
type CSDiamondLotteryHandler struct {
}
func (this *CSDiamondLotteryPacketFactory) CreatePacket() interface{} {
pack := &player_proto.CSDiamondLottery{}
return pack
}
// 玩家钻石抽奖
func (this *CSDiamondLotteryHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
if msg, ok := data.(*player_proto.CSDiamondLottery); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSDiamondLottery p == nil")
return nil
}
// 渠道开关
conf := PlatformMgrSingleton.GetConfig(p.Platform).ChannelSwitch[common.DiamondLottery]
if !model.GameParamData.CloseChannelSwitch && (conf == nil || !common.InSliceString(conf.OnChannelName, p.LastChannel)) {
return nil
}
countType := msg.GetLotteryType()
count := int32(0)
if countType == 1 {
count = 1
} else {
count = 10
}
logger.Logger.Tracef("玩家请求钻石抽奖snid =%d,count = %d ", p.SnId, count)
info := WelfareMgrSington.GetConfig(p.Platform)
var config *webapi.DiamondLotteryData
if info == nil && info.DiamondLotteryConfig != nil {
for _, data := range info.LotteryData {
if data.Channel == p.Channel {
config = data
break
}
}
if config == nil {
logger.Logger.Error("钻石抽奖未找到配置p.Channel = ", p.Channel)
return nil
}
//判断钻石数量
diamondNum := int64(config.DiamondNum * count)
if p.Diamond < diamondNum {
logger.Logger.Trace("钻石抽奖 ,钻石数量不足!")
return nil
}
p.AddDiamond(-diamondNum, 0, common.GainWayDiamondLottery, "sys", "钻石抽奖")
pack := &player_proto.SCDiamondLottery{}
weight := 0
for _, lotteryInfo := range config.Info {
if lotteryInfo.Type == 1 {
weight += int(lotteryInfo.Oddrate)
}
}
var items []*Item
for i := 1; i <= int(count); i++ {
random := rand.Intn(weight) + 1
value := 0
p.DiamondLotteryScore += 1
//判断是否白名单用户
whiteList := config.Players
status := false
var playerData *webapi.DiamondLotteryPlayers
for _, players := range whiteList {
if players.Uid == p.SnId {
playerData = players
break
}
}
if playerData != nil && p.DiamondLotteryScore%int64(playerData.Count) == 0 {
status = true
}
if status {
//白名单从列表里获取奖励
id := rand.Intn(len(playerData.AwatdId)) + 1
awardId := playerData.AwatdId[id]
for _, lotteryInfo := range config.Info {
if lotteryInfo.Id == awardId {
items = append(items, &Item{
ItemId: lotteryInfo.ItemId, // 物品id
ItemNum: int64(lotteryInfo.Grade), // 数量
})
itemData := &player_proto.LotteryItem{
Id: lotteryInfo.Id,
ItemId: lotteryInfo.ItemId,
ItemNum: int64(lotteryInfo.Grade),
}
pack.Item = append(pack.Item, itemData)
break
}
}
} else {
for _, lotteryInfo := range config.Info {
value += int(lotteryInfo.Oddrate)
if lotteryInfo.Type == 1 {
if random <= value {
items = append(items, &Item{
ItemId: lotteryInfo.ItemId, // 物品id
ItemNum: int64(lotteryInfo.Grade), // 数量
})
itemData := &player_proto.LotteryItem{
Id: lotteryInfo.Id,
ItemId: lotteryInfo.ItemId,
ItemNum: int64(lotteryInfo.Grade),
}
pack.Item = append(pack.Item, itemData)
break
}
}
}
}
}
BagMgrSingleton.AddItems(p, items, 0, common.GainWayDiamondLottery, "system", "钻石抽奖", 0, 0, false)
pack.LuckyScore = p.DiamondLotteryScore
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DiamondLottery), pack)
logger.Logger.Trace("返回钻石抽奖信息:", pack.String())
}
}
return nil
}
// 领取保底奖励
type CSDiamondLotteryLuckyAwardPacketFactory struct {
}
type CSDiamondLotteryLuckyAwardHandler struct {
}
func (this *CSDiamondLotteryLuckyAwardPacketFactory) CreatePacket() interface{} {
pack := &player_proto.CSDiamondLotteryLuckyAward{}
return pack
}
// 玩家钻石抽奖保底奖励
func (this *CSDiamondLotteryLuckyAwardHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
if _, ok := data.(*player_proto.CSDiamondLotteryLuckyAward); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSDiamondLotteryLuckyAward p == nil")
return nil
}
// 渠道开关
conf := PlatformMgrSingleton.GetConfig(p.Platform).ChannelSwitch[common.DiamondLottery]
if !model.GameParamData.CloseChannelSwitch && (conf == nil || !common.InSliceString(conf.OnChannelName, p.LastChannel)) {
return nil
}
info := WelfareMgrSington.GetConfig(p.Platform)
var config *webapi.DiamondLotteryData
if info == nil && info.DiamondLotteryConfig != nil {
for _, data := range info.LotteryData {
if data.Channel == p.Channel {
config = data
break
}
}
if config == nil {
logger.Logger.Error("钻石抽奖未找到配置p.Channel = ", p.Channel)
return nil
}
if p.DiamondLotteryScore < int64(config.MaxScore) {
return nil
}
p.DiamondLotteryScore -= int64(config.MaxScore)
pack := &player_proto.SCDiamondLotteryLuckyAward{}
pack.LuckyScore = p.DiamondLotteryScore
//获取奖励
for _, lotteryInfo := range config.Info {
if lotteryInfo.Type == 2 {
var items []*Item
items = append(items, &Item{
ItemId: lotteryInfo.ItemId, // 物品id
ItemNum: int64(lotteryInfo.Grade), // 数量
})
itemData := &player_proto.LotteryItem{
Id: lotteryInfo.Id,
ItemId: lotteryInfo.ItemId,
ItemNum: int64(lotteryInfo.Grade),
}
BagMgrSingleton.AddItems(p, items, 0, common.GainWayDiamondLottery, "system", "钻石抽奖", 0, 0, false)
pack.Item = append(pack.Item, itemData)
break
}
}
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCDiamondLotteryLuckyAward), pack)
logger.Logger.Trace("返回钻石抽奖领取保底奖励信息:", pack.String())
}
}
return nil
}
func init() {
// 抽奖信息
common.RegisterHandler(int(player_proto.PlayerPacketID_PACKET_CS_PhoneLotteryInfo), &CSPhoneLotteryInfoHandler{})
@ -204,4 +452,13 @@ func init() {
// 抽奖
common.RegisterHandler(int(player_proto.PlayerPacketID_PACKET_CS_PhoneLottery), &CSPhoneLotteryHandler{})
netlib.RegisterFactory(int(player_proto.PlayerPacketID_PACKET_CS_PhoneLottery), &CSPhoneLotteryPacketFactory{})
//钻石抽奖信息
common.RegisterHandler(int(player_proto.PlayerPacketID_PACKET_CS_DiamondLotteryInfo), &CSDiamondLotteryInfoHandler{})
netlib.RegisterFactory(int(player_proto.PlayerPacketID_PACKET_SC_DiamondLotteryInfo), &CSDiamondLotteryInfoPacketFactory{})
// 钻石抽奖
common.RegisterHandler(int(player_proto.PlayerPacketID_PACKET_CS_DiamondLottery), &CSDiamondLotteryHandler{})
netlib.RegisterFactory(int(player_proto.PlayerPacketID_PACKET_CS_DiamondLottery), &CSDiamondLotteryPacketFactory{})
//钻石抽奖保底奖励
common.RegisterHandler(int(player_proto.PlayerPacketID_PACKET_CSDiamondLotteryLuckyAward), &CSDiamondLotteryLuckyAwardHandler{})
netlib.RegisterFactory(int(player_proto.PlayerPacketID_PACKET_CSDiamondLotteryLuckyAward), &CSDiamondLotteryLuckyAwardPacketFactory{})
}

View File

@ -76,6 +76,8 @@ func init() {
etcd.Register(etcd.ETCDKEY_ACT_Invite, webapi.ActInviteConfig{}, platformConfigEvent)
// 赛季通行证
etcd.Register(etcd.ETCDKEY_ACT_Permit, webapi.ActPermitConfig{}, platformConfigEvent)
// 钻石抽奖
etcd.Register(etcd.ETCDKEY_DIAMOND_LOTTERY, webapi.DiamondLotteryConfig{}, platformConfigEvent)
}
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
@ -205,6 +207,8 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
ChessRankMgrSington.UpdateChessRankConfig(config)
case *webapi.WelfarePhoneLotteryStatus:
WelfareMgrSington.UpdatePhoneLotteryStatus(config)
case *webapi.DiamondLotteryConfig:
WelfareMgrSington.UpdateDiamondLotteryConfig(config)
case *webapi.ActInviteConfig:
PlatformMgrSingleton.GetConfig(config.Platform).ActInviteConfig = config
case *webapi.ActPermitConfig:

View File

@ -215,6 +215,12 @@ func (this *WelfareMgr) UpdatePhoneLotteryStatus(cfg *webapi_proto.WelfarePhoneL
}
}
// 更新钻石抽奖配置
func (this *WelfareMgr) UpdateDiamondLotteryConfig(cfg *webapi_proto.DiamondLotteryConfig) {
info := this.GetConfig(cfg.Platform)
info.DiamondLotteryConfig = cfg
}
func (this *WelfareMgr) GetPhoneLotteryStatus(platform string) int32 {
info := this.GetConfig(platform)
if info.WelfarePhoneLotteryStatus != nil {