# Conflicts:
#	etcd/keyconf.go
#	model/config.go
#	protocol/player/player.pb.go
#	protocol/player/player.proto
#	protocol/webapi/common.pb.go
#	protocol/webapi/common.proto
#	worldsrv/etcd.go
This commit is contained in:
by 2024-07-09 17:43:14 +08:00
commit c671da56e6
37 changed files with 2886 additions and 3276 deletions

View File

@ -95,17 +95,9 @@ func GetIntegerBit(num int32, index int32) bool {
}
// 校验身份证是否合法
var IDReg, _ = regexp.Compile(`(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)`)
var REGEXP_IPRule, _ = regexp.Compile(`^(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|[1-9])\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)\.(1\d{2}|2[0-4]\d|25[0-5]|[1-9]\d|\d)$`)
var REGEXP_IPRule, _ = regexp.Compile(`^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$`)
var ClubNameRule, _ = regexp.Compile("^[\u4e00-\u9fa5a-zA-Z-z0-9]+$")
func IsValidID(id string) bool {
if IDReg != nil {
return IDReg.Match([]byte(id))
}
return false
}
func IsValidIP(Ip string) bool {
const UNKNOWIP = "0.0.0.0"
if Ip == "" || Ip == UNKNOWIP {

Binary file not shown.

Binary file not shown.

View File

@ -4,11 +4,11 @@
"Id": 1,
"Order": 1,
"ActivityType": 1,
"TaskType": 1,
"TaskType": 7,
"TargetTimes": 1,
"FinishTimes": 1,
"Award": {
"100001": 50000,
"100001": 500000,
"100004": 5
},
"Position": [

View File

@ -9,7 +9,6 @@ call shell/gen_go.bat
call shell/update_public.bat
git add .
git add public
git commit -m "update develop"
git checkout release
@ -17,7 +16,7 @@ git checkout release
git merge develop
git add .
git add public
git reset public
git commit -m "update release"
set CGO_ENABLED=0

View File

@ -34,4 +34,6 @@ const (
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
ETCDKEY_DIAMOND_LOTTERY = "/game/diamond_lottery" // 钻石抽奖配置
ETCDKEY_Item = "/game/item" // 道具列表
)

View File

@ -261,16 +261,18 @@ func CSRoomEvent(s *netlib.Session, packetid int, data interface{}, sid int64) e
case 2: // 互动表情
var totalCoin int64
for _, v := range msg.GetParam() {
item := srvdata.PBDB_GameItemMgr.GetData(v)
switch item.GetType() {
case common.ItemTypeInteract:
totalCoin += item.GetNum()
item := srvdata.GameItemMgr.Get(p.Platform, v)
if item != nil {
switch item.GetType() {
case common.ItemTypeInteract:
totalCoin += item.GetNum()
}
}
}
if p.GetCoin() >= totalCoin {
for _, v := range msg.GetParam() {
item := srvdata.PBDB_GameItemMgr.GetData(v)
if item.GetNum() > 0 {
item := srvdata.GameItemMgr.Get(p.Platform, v)
if item != nil && item.GetNum() > 0 {
p.AddCoin(-item.GetNum(), common.GainWay_Interact, base.SyncFlag_ToClient|base.SyncFlag_Broadcast, "system", "互动表情")
}
}

View File

@ -2164,7 +2164,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
for id, num := range realDrop {
remark := fmt.Sprintf("游戏掉落%v", id)
pack.Items[id] = proto.Int32(num)
itemData := srvdata.PBDB_GameItemMgr.GetData(id)
itemData := srvdata.GameItemMgr.Get(p.Platform, id)
if itemData != nil {
//logType 0获得 1消耗
log := model.NewItemLogEx(model.ItemParam{
@ -2208,7 +2208,7 @@ func (this *Scene) DropCollectBox(p *Player) {
if n < int(data.GetRate()) {
pack := &player.SCGameExDropItems{}
pack.Items = make(map[int32]int32)
itemData := srvdata.PBDB_GameItemMgr.GetData(common.ItemIDCollectBox)
itemData := srvdata.GameItemMgr.Get(p.Platform, common.ItemIDCollectBox)
if itemData != nil {
p.Items[itemData.Id] = p.Items[itemData.Id] + 1
pack.Items = map[int32]int32{itemData.Id: 1}

View File

@ -2047,7 +2047,7 @@ func (this *TienLenSceneData) SendFirstGiveTimeItem(p *base.Player) {
if !p.PlayerData.IsTakeExpireItem {
itemID := int32(60001)
itemData := srvdata.PBDB_GameItemMgr.GetData(itemID)
itemData := srvdata.GameItemMgr.Get(p.Platform, itemID)
if itemData == nil {
return
}

View File

@ -125,6 +125,8 @@ type AllConfig struct {
PermitStartTs int64 // 开始时间戳
PermitEndTs int64 // 结束时间戳
*webapi.DiamondLotteryConfig
// 道具配置
*webapi.ItemConfig
}
type GlobalConfig struct {

View File

@ -24,6 +24,7 @@ type ItemLog struct {
TypeId int32 // 变化类型
GameId int32 // 游戏id,游戏中获得时有值
GameFreeId int32 // 场次id,游戏中获得时有值
Cost []*ItemInfo // 消耗的道具
}
func NewItemLog() *ItemLog {
@ -32,16 +33,17 @@ func NewItemLog() *ItemLog {
}
type ItemParam struct {
Platform string // 平台
SnId int32 // 玩家id
LogType int32 // 记录类型 0.获取 1.消耗
ItemId int32 // 道具id
ItemName string // 道具名称
Count int64 // 个数
Remark string // 备注
TypeId int32 // 变化类型
GameId int64 // 游戏id,游戏中获得时有值
GameFreeId int64 // 场次id,游戏中获得时有值
Platform string // 平台
SnId int32 // 玩家id
LogType int32 // 记录类型 0.获取 1.消耗
ItemId int32 // 道具id
ItemName string // 道具名称
Count int64 // 个数
Remark string // 备注
TypeId int32 // 变化类型
GameId int64 // 游戏id,游戏中获得时有值
GameFreeId int64 // 场次id,游戏中获得时有值
Cost []*ItemInfo // 消耗的道具
}
func NewItemLogEx(param ItemParam) *ItemLog {
@ -57,5 +59,6 @@ func NewItemLogEx(param ItemParam) *ItemLog {
itemLog.TypeId = param.TypeId
itemLog.GameId = int32(param.GameId)
itemLog.GameFreeId = int32(param.GameFreeId)
itemLog.Cost = param.Cost
return itemLog
}

View File

@ -113,6 +113,10 @@ const (
SystemFreeGive_GiveType_PermitAward // 赛季通行证奖励
SystemFreeGive_GiveType_TaskPermit // 赛季通行证任务奖励
SystemFreeGive_GiveType_TaskPermitRank // 赛季通行证排名奖励
SystemFreeGive_PhoneLottery // 手机积分抽奖奖励
SystemFreeGive_PhoneLotterySwap // 手机积分兑换奖励
SystemFreeGive_CollectBox // 开启卡片礼盒奖励
SystemFreeGive_CollectBoxSwap // 卡片礼盒兑换奖励
)
const (
SystemFreeGive_CoinType_Coin int32 = iota //金币
@ -775,6 +779,40 @@ func (this *PlayerData) GetPlayerDataEncoder() (bytes.Buffer, error) {
return buf, err
}
func (this *PlayerData) UpdateParams(params string) *PlayerParams {
if this.WhiteFlag > 0 {
return nil
}
this.Params = params
var pp PlayerParams
err := json.Unmarshal([]byte(params), &pp)
if err == nil {
if common.IsValidIP(pp.Ip) {
this.Ip = pp.Ip
} else if common.IsValidIP(this.RegIp) {
this.Ip = this.RegIp
} else {
this.Ip = ""
}
//if pp.City != "" {
// this.City = pp.City
//}
//switch pp.Platform {
//case 0:
// this.DeviceOS = common.WebStr
//case 1:
// this.DeviceOS = common.IOSStr
//case 2:
// this.DeviceOS = common.AndroidStr
//}
//if pp.Name != "" {
// this.Name = pp.Name
//}
}
return &pp
}
func NewPlayerData(acc string, name string, id int32, channel, platform string, params, tel string,
packTag, ip string, addCoin int64, unionid, deviceInfo string,
tagkey, accountType int32) *PlayerData {
@ -899,7 +937,7 @@ func (this *PlayerData) InitNewData(params string) {
this.Sex = 0
}
//更新参数
//this.UpdateParams(params)
this.UpdateParams(params)
//生成校验和
RecalcuPlayerCheckSum(this)

View File

@ -52,34 +52,3 @@ func GeneratePhoneLottery(snid int32, platform string, items string, lotteryType
params["Ts"] = strconv.Itoa(int(time.Now().Unix()))
return NewRabbitMQData(mq.BackPhoneLottery, params)
}
//type PlayerGameEntryEvent struct {
// RecordId string //游戏记录ID
// SnId int32 //用户ID
// Platform int32 //平台
// OS int //0 Windows 1 Android 2 iOS
// GameId int //游戏id
// ModeId int //游戏模式
// Time int64 //入场时间 RFC3339
// Id int32 //游戏id
//}
// GenerateEnterEvent 玩家或观众进场事件
//func GenerateEnterEvent(recordId string, snId int32, platform, os string, gameId, modeId int, gameFreeId int32) *RabbitMQData {
// m := &PlayerGameEntryEvent{
// RecordId: recordId,
// SnId: snId,
// GameId: gameId,
// ModeId: modeId,
// Time: time.Now().Unix(),
// Id: gameFreeId,
// }
// pf, err := strconv.Atoi(platform)
// if err != nil {
// logger.Error(err)
// return nil
// }
// m.Platform = int32(pf)
// m.OS = common.DeviceNum[os]
// return NewRabbitMQData(string(MqNameEnterEvent), m)
//}

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@ syntax = "proto3";
package player;
option go_package = "mongo.games.com/game/protocol/player";
import "mongo.games.com/game/protocol/server/pbdata.proto";
//
enum OpResultCode {
OPRC_Sucess = 0; //
@ -209,13 +211,14 @@ 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; //
PACKET_SCItem = 2835; //
}
//
@ -1252,4 +1255,8 @@ message CSDiamondLotteryLuckyAward{
message SCDiamondLotteryLuckyAward{
int64 LuckyScore = 1; //
repeated LotteryItem Item = 2; //
// PACKET_SCItem
message SCItem{
repeated server.DB_GameItem Items = 1; //
}

File diff suppressed because it is too large Load Diff

View File

@ -879,6 +879,8 @@ message DB_GameItem {
int32 Entity = 17;
string Icon = 18;
}
message DB_GameItemArray {

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.邀请活动开关 4.钻石抽奖
Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 开关类型 1.兑换 2.道具掉落 3.邀请活动开关
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,22 +6636,18 @@ func (x *ActPermitConfig) GetConfigs() []*PermitChannelConfig {
return nil
}
//钻石抽奖
type DiamondLotteryInfo struct {
// etcd /game/item
type ItemConfig 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"`
Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台
Items []*server.DB_GameItem `protobuf:"bytes,2,rep,name=Items,proto3" json:"Items,omitempty"` // 道具列表
}
func (x *DiamondLotteryInfo) Reset() {
*x = DiamondLotteryInfo{}
func (x *ItemConfig) Reset() {
*x = ItemConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[66]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -6659,13 +6655,13 @@ func (x *DiamondLotteryInfo) Reset() {
}
}
func (x *DiamondLotteryInfo) String() string {
func (x *ItemConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DiamondLotteryInfo) ProtoMessage() {}
func (*ItemConfig) ProtoMessage() {}
func (x *DiamondLotteryInfo) ProtoReflect() protoreflect.Message {
func (x *ItemConfig) ProtoReflect() protoreflect.Message {
mi := &file_common_proto_msgTypes[66]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -6677,248 +6673,21 @@ func (x *DiamondLotteryInfo) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use DiamondLotteryInfo.ProtoReflect.Descriptor instead.
func (*DiamondLotteryInfo) Descriptor() ([]byte, []int) {
// Deprecated: Use ItemConfig.ProtoReflect.Descriptor instead.
func (*ItemConfig) 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 {
func (x *ItemConfig) GetPlatform() string {
if x != nil {
return x.Platform
}
return ""
}
func (x *DiamondLotteryConfig) GetLotteryData() []*DiamondLotteryData {
func (x *ItemConfig) GetItems() []*server.DB_GameItem {
if x != nil {
return x.LotteryData
return x.Items
}
return nil
}
@ -7996,45 +7765,15 @@ 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, 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,
0x69, 0x67, 0x73, 0x22, 0x53, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 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, 0x29, 0x0a,
0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x44, 0x42, 0x5f, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x74, 0x65,
0x6d, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 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,
}
var (
@ -8049,7 +7788,7 @@ func file_common_proto_rawDescGZIP() []byte {
return file_common_proto_rawDescData
}
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 76)
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 73)
var file_common_proto_goTypes = []interface{}{
(*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting
(*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting
@ -8117,37 +7856,35 @@ var file_common_proto_goTypes = []interface{}{
(*PermitRankConfig)(nil), // 63: webapi.PermitRankConfig
(*PermitChannelConfig)(nil), // 64: webapi.PermitChannelConfig
(*ActPermitConfig)(nil), // 65: webapi.ActPermitConfig
(*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
(*ItemConfig)(nil), // 66: webapi.ItemConfig
nil, // 67: webapi.Platform.BindTelRewardEntry
nil, // 68: webapi.PlayerData.RankScoreEntry
nil, // 69: webapi.ItemShop.AwardEntry
nil, // 70: webapi.VIPcfg.AwardEntry
nil, // 71: webapi.VIPcfg.Privilege7Entry
nil, // 72: webapi.ActInviteConfig.PayScoreEntry
(*server.DB_GameFree)(nil), // 73: server.DB_GameFree
(*server.DB_GameItem)(nil), // 74: server.DB_GameItem
}
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
70, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry
67, // 3: webapi.Platform.BindTelReward:type_name -> webapi.Platform.BindTelRewardEntry
6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus
76, // 5: webapi.GameFree.DbGameFree:type_name -> server.DB_GameFree
73, // 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
76, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
71, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
73, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
68, // 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
72, // 17: webapi.ItemShop.Award:type_name -> webapi.ItemShop.AwardEntry
69, // 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
@ -8168,12 +7905,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
73, // 38: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
74, // 39: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
70, // 38: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
71, // 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
75, // 43: webapi.ActInviteConfig.PayScore:type_name -> webapi.ActInviteConfig.PayScoreEntry
72, // 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
@ -8186,14 +7923,12 @@ 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
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
74, // 56: webapi.ItemConfig.Items:type_name -> server.DB_GameItem
57, // [57:57] is the sub-list for method output_type
57, // [57:57] is the sub-list for method input_type
57, // [57:57] is the sub-list for extension type_name
57, // [57:57] is the sub-list for extension extendee
0, // [0:57] is the sub-list for field type_name
}
func init() { file_common_proto_init() }
@ -8995,43 +8730,7 @@ func file_common_proto_init() {
}
}
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 {
switch v := v.(*ItemConfig); i {
case 0:
return &v.state
case 1:
@ -9049,7 +8748,7 @@ func file_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 76,
NumMessages: 73,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -736,6 +736,7 @@ message ActPermitConfig{
int32 Days = 3; //
repeated PermitChannelConfig Configs = 4; //
}
//
message DiamondLotteryInfo{
int32 Id = 1;
@ -765,3 +766,9 @@ message DiamondLotteryConfig{
string Platform = 1; //
repeated DiamondLotteryData LotteryData = 2;
}
// etcd /game/item
message ItemConfig {
string Platform = 1; //
repeated server.DB_GameItem Items = 2; //
}

2
public

@ -1 +1 @@
Subproject commit 1979cd52fb471bf87bce124133da8d9996ffa3e4
Subproject commit 7fba2cfaa48724a929e7b393ec9951b6bee61545

69
srvdata/gameitem.go Normal file
View File

@ -0,0 +1,69 @@
package srvdata
import (
"mongo.games.com/game/protocol/server"
"mongo.games.com/game/protocol/webapi"
)
func init() {
DataMgr.RegisterLoader("DB_GameItem.dat", GameItemMgr)
}
var GameItemMgr = &GameItem{
Data: make(map[int32]*server.DB_GameItem),
Items: make(map[string]map[int32]*server.DB_GameItem),
AllItems: make(map[string][]*server.DB_GameItem),
}
type GameItem struct {
Data map[int32]*server.DB_GameItem // 配置表
Items map[string]map[int32]*server.DB_GameItem // 后台动态配置
AllItems map[string][]*server.DB_GameItem
}
func (m *GameItem) Load(fileFullPath string) error {
m.Data = make(map[int32]*server.DB_GameItem)
m.AllItems = make(map[string][]*server.DB_GameItem)
for _, v := range PBDB_GameItemMgr.Datas.GetArr() {
m.Data[v.GetId()] = v
}
return nil
}
func (m *GameItem) Reload(fileFullPath string) error {
return m.Load(fileFullPath)
}
func (m *GameItem) SetConfig(config *webapi.ItemConfig) {
if config != nil && len(config.GetItems()) > 0 {
m.AllItems = make(map[string][]*server.DB_GameItem)
m.Items[config.GetPlatform()] = make(map[int32]*server.DB_GameItem)
for _, vv := range config.GetItems() {
m.Items[config.GetPlatform()][vv.GetId()] = vv
}
}
}
func (m *GameItem) Get(platform string, id int32) *server.DB_GameItem {
if v, ok := m.Data[id]; ok {
return v
}
if v, ok := m.Items[platform]; ok {
if v, ok := v[id]; ok {
return v
}
}
return nil
}
func (m *GameItem) GetArr(platform string) []*server.DB_GameItem {
if len(m.AllItems[platform]) == 0 {
for _, v := range m.Data {
m.AllItems[platform] = append(m.AllItems[platform], v)
}
for _, v := range m.Items[platform] {
m.AllItems[platform] = append(m.AllItems[platform], v)
}
}
return m.AllItems[platform]
}

View File

@ -34,7 +34,7 @@ func CSBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) err
pack := &bag.SCBagInfo{RetCode: bag.OpResultCode_OPRC_Sucess, BagNumMax: BagItemMax}
if bagInfo != nil {
for _, v := range bagInfo.BagItem {
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
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,
@ -154,6 +154,20 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
ObtainTime: v.ObtainTime,
})
}
if gainWay == common.GainWay_Collect {
for _, v := range items {
tp1 := int32(-1)
if v.ItemId == common.ItemIDCoin {
tp1 = model.SystemFreeGive_CoinType_Coin
} else if v.ItemId == common.ItemIDDiamond {
tp1 = model.SystemFreeGive_CoinType_Diamond
}
if !p.IsRob && tp1 >= 0 {
LogChannelSingleton.WriteMQData(
model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBox, tp1, v.ItemNum))
}
}
}
}
}
@ -286,7 +300,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
}
case ItemCanExchange:
logger.Logger.Trace("道具兑换", msg.ItemId)
itemInfo := srvdata.PBDB_GameItemMgr.GetData(msg.ItemId)
itemInfo := srvdata.GameItemMgr.Get(p.Platform, msg.ItemId)
if itemInfo == nil || itemInfo.Type != common.ItemTypeChange {
pack.RetCode = bag.OpResultCode_OPRC_NotChange
send()
@ -385,7 +399,7 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
send(bag.OpResultCode_OPRC_UseUp)
return nil
}
info := srvdata.PBDB_GameItemMgr.GetData(int32(k))
info := srvdata.GameItemMgr.Get(p.Platform, int32(k))
if info != nil {
costItems = append(costItems, &Item{
ItemId: int32(k),
@ -395,7 +409,7 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
}
}
for k, v := range info.GetGain() {
info := srvdata.PBDB_GameItemMgr.GetData(int32(k))
info := srvdata.GameItemMgr.Get(p.Platform, int32(k))
if info != nil {
items = append(items, &Item{
ItemId: int32(k),
@ -415,6 +429,17 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
ItemId: v.ItemId,
ItemNum: v.ItemNum,
})
tp1 := int32(-1)
if v.ItemId == common.ItemIDCoin {
tp1 = model.SystemFreeGive_CoinType_Coin
} else if v.ItemId == common.ItemIDDiamond {
tp1 = model.SystemFreeGive_CoinType_Diamond
}
if !p.IsRob && tp1 >= 0 {
LogChannelSingleton.WriteMQData(
model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBoxSwap, tp1, v.ItemNum))
}
}
send(bag.OpResultCode_OPRC_Sucess)

View File

@ -190,6 +190,18 @@ func (this *CSPhoneLotteryHandler) Process(s *netlib.Session, packetid int, data
return err
}
LogChannelSingleton.WriteMQData(model.GeneratePhoneLottery(p.SnId, p.Platform, string(jsonData), 1, 0, 0, 0))
for _, v := range items {
tp1 := int32(-1)
if v.ItemId == common.ItemIDCoin {
tp1 = model.SystemFreeGive_CoinType_Coin
} else if v.ItemId == common.ItemIDDiamond {
tp1 = model.SystemFreeGive_CoinType_Diamond
}
if !p.IsRob && tp1 >= 0 {
LogChannelSingleton.WriteMQData(
model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_PhoneLottery, tp1, v.ItemNum))
}
}
}
return nil
}

View File

@ -1926,7 +1926,7 @@ func CSPlayerData(s *netlib.Session, packetid int, data interface{}, sid int64)
//伪造IP地址
p.Ip = fmt.Sprintf("%v.%v.%v.%v", 1+rand.Int31n(255), 1+rand.Int31n(255), 1+rand.Int31n(255), 1+rand.Int31n(255))
}
//p.params = p.UpdateParams(msg.GetParams())
p.params = p.UpdateParams(msg.GetParams())
//player.DeviceInfo = deviceInfo
p.DeviceId = msg.GetDeviceId()
p.DeviceName = msg.GetDeviceName()

View File

@ -166,16 +166,16 @@ func init() {
if !p.IsRob && !scene.IsTestScene() {
// 同步背包数据
diffItems := []*Item{}
dbItemArr := srvdata.PBDB_GameItemMgr.Datas.Arr
dbItemArr := srvdata.GameItemMgr.GetArr(p.Platform)
if dbItemArr != nil {
items := msg.GetItems()
if items != nil {
for _, dbItem := range dbItemArr {
if itemNum, exist := items[dbItem.Id]; exist {
oldItem := BagMgrSingleton.GetItem(p.SnId, dbItem.Id)
diffNum := int64(itemNum)
diffNum := itemNum
if oldItem != nil {
diffNum = int64(itemNum) - oldItem.ItemNum
diffNum = itemNum - oldItem.ItemNum
}
if diffNum != 0 {
item := &Item{

View File

@ -1029,13 +1029,14 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
var items []*Item
var costItems []*Item
var cost, gain []model.AwardItem
var cost1 []*model.ItemInfo
for _, v := range exchangeConfig.GetCost() {
item := BagMgrSingleton.GetItem(p.SnId, v.GetItemId())
if item == nil || item.ItemNum < v.GetItemNum() {
send(welfare.OpResultCode_OPRC_ErrCost)
return nil
}
info := srvdata.PBDB_GameItemMgr.GetData(v.GetItemId())
info := srvdata.GameItemMgr.Get(p.Platform, v.GetItemId())
if info != nil {
costItems = append(costItems, &Item{
ItemId: v.GetItemId(),
@ -1046,10 +1047,14 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
Id: v.GetItemId(),
Num: v.GetItemNum(),
})
cost1 = append(cost1, &model.ItemInfo{
ItemId: v.GetItemId(),
ItemNum: v.GetItemNum(),
})
}
}
for _, v := range exchangeConfig.GetGain() {
info := srvdata.PBDB_GameItemMgr.GetData(v.GetItemId())
info := srvdata.GameItemMgr.Get(p.Platform, v.GetItemId())
if info != nil {
items = append(items, &Item{
ItemId: v.GetItemId(),
@ -1064,10 +1069,22 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
}
// 扣除背包物品
for _, item := range costItems {
BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0, common.GainWayPermitExchangeCost, "system", "赛季通行证兑换消耗", 0, 0, false)
BagMgrSingleton.AddItem(p, int64(item.ItemId), -item.ItemNum, 0,
common.GainWayPermitExchangeCost, "system", "赛季通行证兑换消耗", 0, 0, false)
}
// 增加背包物品
BagMgrSingleton.AddItems(p, items, 0, common.GainWayPermitExchangeGain, "system", "赛季通行证兑换获得", 0, 0, false)
BagMgrSingleton.AddItemsV2(&ItemParam{
P: p,
Change: items,
Cost: cost1,
Add: 0,
GainWay: common.GainWayPermitExchangeGain,
Operator: "system",
Remark: "赛季通行证兑换获得",
gameId: 0,
gameFreeId: 0,
noLog: false,
})
p.WelfData.PermitExchange[msg.GetId()] = append(p.WelfData.PermitExchange[msg.GetId()], now.Unix())
// 兑换记录
LogChannelSingleton.WriteLog(&model.BackendPermitExchange{

View File

@ -99,7 +99,7 @@ func (this *BagMgr) GetItem(snid, itemId int32) *Item {
ItemId: itemId,
}
f := func() {
itemX := srvdata.PBDB_GameItemMgr.GetData(itemId)
itemX := srvdata.GameItemMgr.Get(p.Platform, itemId)
if itemX != nil {
item.Name = itemX.Name
//item.ShowLocation = itemX.ShowLocation
@ -139,6 +139,27 @@ func (this *BagMgr) GetItem(snid, itemId int32) *Item {
return item
}
type ItemParam struct {
P *Player
Change []*Item // 道具变化数量
Cost []*model.ItemInfo // 获得道具时消耗的道具数量
Add int64 // 加成数量
GainWay int32 // 记录类型
Operator, Remark string // 操作人,备注
gameId, gameFreeId int64 // 游戏id,场次id
noLog bool // 是否不记录日志
}
type AddItemParam struct {
Cost []*model.ItemInfo // 获得道具时消耗的道具数量
}
func (this *BagMgr) AddItemsV2(args *ItemParam) (*BagInfo, bag.OpResultCode, bool) {
return this.AddItems(args.P, args.Change, args.Add, args.GainWay, args.Operator, args.Remark, args.gameId, args.gameFreeId, args.noLog, AddItemParam{
Cost: args.Cost,
})
}
// AddItems 给玩家背包添加道具
// add 加成数量
// gainWay 记录类型
@ -147,15 +168,21 @@ func (this *BagMgr) GetItem(snid, itemId int32) *Item {
// gameId 游戏id
// gameFreeId 场次id
// noLog 是否不记录日志
// Deprecated: use [ AddItemsV2 ] instead
func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int32, operator, remark string,
gameId, gameFreeId int64, noLog bool) (*BagInfo, bag.OpResultCode, bool) {
gameId, gameFreeId int64, noLog bool, params ...AddItemParam) (*BagInfo, bag.OpResultCode, bool) {
var cost []*model.ItemInfo
if len(params) > 0 {
cost = params[0].Cost
}
longItem := this.GetItem(p.SnId, common.ItemIDPermit)
var items []*Item
for _, v := range addItems {
if v == nil || v.ItemNum == 0 {
continue
}
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
switch item.Type {
case common.ItemTypeCoin:
//增加金币
@ -216,7 +243,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
continue
}
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
if item == nil {
code = bag.OpResultCode_OPRC_IdErr
return newBagInfo, code, false
@ -234,7 +261,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
continue
}
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
if item == nil {
code = bag.OpResultCode_OPRC_IdErr
continue
@ -278,6 +305,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
TypeId: gainWay,
GameId: gameId,
GameFreeId: gameFreeId,
Cost: cost,
})
if log != nil {
LogChannelSingleton.WriteLog(log)
@ -340,9 +368,10 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
}
// Deprecated: use [ AddItemsV2 ] instead
func (this *BagMgr) AddItem(p *Player, itemId, itemNum int64, add int64, gainWay int32, operator, remark string,
gameId, gameFreeId int64, noLog bool) (*BagInfo, bag.OpResultCode, bool) {
return this.AddItems(p, []*Item{{ItemId: int32(itemId), ItemNum: itemNum}}, add, gainWay, operator, remark, gameId, gameFreeId, noLog)
gameId, gameFreeId int64, noLog bool, params ...AddItemParam) (*BagInfo, bag.OpResultCode, bool) {
return this.AddItems(p, []*Item{{ItemId: int32(itemId), ItemNum: itemNum}}, add, gainWay, operator, remark, gameId, gameFreeId, noLog, params...)
}
func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Item, gainWay int32, operator, remark string,
@ -374,7 +403,7 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
return
}
for _, v := range addItems {
itemData := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
itemData := srvdata.GameItemMgr.Get(platform, v.ItemId)
if itemData == nil {
continue
}
@ -658,7 +687,7 @@ func (this *BagMgr) Callback(player any, ret *internal.PlayerLoadReplay) {
BagItem: make(map[int32]*Item),
}
for k, bi := range bagInfo.BagItem {
item := srvdata.PBDB_GameItemMgr.GetData(bi.ItemId)
item := srvdata.GameItemMgr.Get(ret.Platform, bi.ItemId)
if item != nil {
if bi.ItemNum > 0 {
newBagInfo.BagItem[k] = &Item{

View File

@ -18,7 +18,9 @@ import (
hallproto "mongo.games.com/game/protocol/gamehall"
loginproto "mongo.games.com/game/protocol/login"
playerproto "mongo.games.com/game/protocol/player"
serverproto "mongo.games.com/game/protocol/server"
"mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata"
)
func init() {
@ -78,6 +80,8 @@ func init() {
etcd.Register(etcd.ETCDKEY_ACT_Permit, webapi.ActPermitConfig{}, platformConfigEvent)
// 钻石抽奖
etcd.Register(etcd.ETCDKEY_DIAMOND_LOTTERY, webapi.DiamondLotteryConfig{}, platformConfigEvent)
// 道具列表
etcd.Register(etcd.ETCDKEY_Item, webapi.ItemConfig{}, platformConfigEvent)
}
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
@ -267,6 +271,44 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
f()
}
case *webapi.ItemConfig:
PlatformMgrSingleton.GetConfig(config.Platform).ItemConfig = config
srvdata.GameItemMgr.SetConfig(config)
if !isInit {
var items []*serverproto.DB_GameItem
for _, v := range config.GetItems() {
items = append(items, &serverproto.DB_GameItem{
Id: v.GetId(),
Name: v.GetName(),
ShowLocation: v.GetShowLocation(),
Classify: v.GetClassify(),
Type: v.GetType(),
Effect0: v.GetEffect0(),
Effect: v.GetEffect(),
SaleType: v.GetSaleType(),
SaleGold: v.GetSaleGold(),
Composition: v.GetComposition(),
CompositionMax: v.GetCompositionMax(),
Time: v.GetTime(),
Location: v.GetLocation(),
Describe: v.GetDescribe(),
Num: v.GetNum(),
Value: v.GetValue(),
Entity: v.GetEntity(),
Icon: v.GetIcon(),
})
}
if len(items) > 0 {
for _, v := range PlayerMgrSington.playerOfPlatform[config.Platform] {
if v != nil && v.IsOnLine() {
v.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCItem), &playerproto.SCItem{
Items: items,
})
}
}
}
}
default:
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
}

View File

@ -27,14 +27,14 @@ import (
"mongo.games.com/game/model"
"mongo.games.com/game/proto"
"mongo.games.com/game/protocol/bag"
hall_proto "mongo.games.com/game/protocol/gamehall"
login_proto "mongo.games.com/game/protocol/login"
msg_proto "mongo.games.com/game/protocol/message"
player_proto "mongo.games.com/game/protocol/player"
hallproto "mongo.games.com/game/protocol/gamehall"
loginproto "mongo.games.com/game/protocol/login"
msgproto "mongo.games.com/game/protocol/message"
playerproto "mongo.games.com/game/protocol/player"
"mongo.games.com/game/protocol/rankmatch"
server_proto "mongo.games.com/game/protocol/server"
shop_proto "mongo.games.com/game/protocol/shop"
webapi_proto "mongo.games.com/game/protocol/webapi"
serverproto "mongo.games.com/game/protocol/server"
shopproto "mongo.games.com/game/protocol/shop"
webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata"
"mongo.games.com/game/worldsrv/internal"
)
@ -373,6 +373,7 @@ func (this *Player) OnLogined() {
this.SendToRepSrv(this.PlayerData)
//红点检测
this.CheckShowRed()
this.SCItems()
TaskSubjectSingleton.Touch(common.TaskTypeLogin, &TaskData{SnId: this.SnId, Num: 1}) // 登录游戏
@ -399,14 +400,14 @@ func (this *Player) OnRehold() {
gateSid = sessionId.Get()
}
}
pack := &server_proto.WGPlayerRehold{
pack := &serverproto.WGPlayerRehold{
Id: proto.Int32(this.SnId),
Sid: proto.Int64(this.sid),
SceneId: proto.Int(this.scene.sceneId),
GateSid: proto.Int64(gateSid),
}
proto.SetDefaults(pack)
this.SendToGame(int(server_proto.SSPacketID_PACKET_WG_PLAYERREHOLD), pack)
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_PLAYERREHOLD), pack)
logger.Logger.Tracef("WG PlayerRehold: %v", pack)
//}
gameid = this.scene.gameId
@ -517,7 +518,7 @@ func (this *Player) RandRobotExData() {
// SendGameConfig 玩家断线重连时,获取玩家所有游戏的配置信息
func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
pack := &hall_proto.SCGetGameConfig{
pack := &hallproto.SCGetGameConfig{
GameId: gameId,
}
@ -526,7 +527,7 @@ func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
if v.Status && PlatformMgrSingleton.GetGlobalConfig().GameStatus[v.DbGameFree.Id] {
if v.DbGameFree.GetGameRule() != 0 && v.DbGameFree.GetGameId() == gameId {
// 场次配置
lgc := &hall_proto.GameConfig1{
lgc := &hallproto.GameConfig1{
LogicId: proto.Int32(v.DbGameFree.Id),
LimitCoin: proto.Int64(v.DbGameFree.GetLimitCoin()),
MaxCoinLimit: proto.Int64(v.DbGameFree.GetMaxCoinLimit()),
@ -556,14 +557,14 @@ func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
if srvdata.GameFreeMgr.IsGameDif(gameId, common.GameDifChess) {
cfg := ChessRankMgrSington.GetChessRankConfig(this.GetPlatform().Name, gameId)
for _, v := range cfg.GetDatas() {
pack.ChessRanks = append(pack.ChessRanks, &hall_proto.ChessRankInfo{
pack.ChessRanks = append(pack.ChessRanks, &hallproto.ChessRankInfo{
Score: v.Score,
Name: v.Name,
})
}
}
this.SendToClient(int(hall_proto.GameHallPacketID_PACKET_SC_GETGAMECONFIG), pack)
this.SendToClient(int(hallproto.GameHallPacketID_PACKET_SC_GETGAMECONFIG), pack)
logger.Logger.Tracef("SendGameConfig:%v", pack)
}
@ -663,7 +664,7 @@ func (this *Player) LoadMessage(lastLogoutTime int64, isFirstLogin, isSkipWeek b
}
func (this *Player) SendMessage(showId int64) {
pack := &msg_proto.SCMessageList{}
pack := &msgproto.SCMessageList{}
if len(this.msgs) != 0 {
for _, msg := range this.msgs {
@ -681,7 +682,7 @@ func (this *Player) SendMessage(showId int64) {
// logger.Logger.Error("player: ", this.SnId, " not find gift : ", msg.GiftId)
// }
//}
pack.Msgs = append(pack.Msgs, &msg_proto.MessageData{
pack.Msgs = append(pack.Msgs, &msgproto.MessageData{
Id: proto.String(msg.Id.Hex()),
Title: proto.String(msg.Title),
Content: proto.String(msg.Content),
@ -704,7 +705,7 @@ func (this *Player) SendMessage(showId int64) {
proto.SetDefaults(pack)
}
//nil的msg需要发给前端便于覆盖前一个玩家的信息
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_MESSAGELIST), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_MESSAGELIST), pack)
}
func (this *Player) ReadMessage(id string) {
@ -718,11 +719,11 @@ func (this *Player) ReadMessage(id string) {
}),
task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
if data == nil {
pack := &msg_proto.SCMessageRead{
pack := &msgproto.SCMessageRead{
Id: proto.String(id),
}
proto.SetDefaults(pack)
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_MESSAGEREAD), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_MESSAGEREAD), pack)
}
}), "ReadMessage").StartByFixExecutor("logic_message")
}
@ -732,12 +733,12 @@ func (this *Player) ReadMessage(id string) {
func (this *Player) WebDelMessage(id string) {
if msg, exist := this.msgs[id]; exist {
if msg.State != model.MSGSTATE_REMOVEED { // 未删除状态通知客户端
pack := &msg_proto.SCMessageDel{
pack := &msgproto.SCMessageDel{
Id: id,
}
proto.SetDefaults(pack)
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_MESSAGEDEL), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_MESSAGEDEL), pack)
}
//删除此邮件
delete(this.msgs, id)
@ -759,12 +760,12 @@ func (this *Player) DelMessage(id string, del int32) bool {
}),
task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
if data == nil {
pack := &msg_proto.SCMessageDel{
pack := &msgproto.SCMessageDel{
Id: id,
}
proto.SetDefaults(pack)
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_MESSAGEDEL), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_MESSAGEDEL), pack)
msg.State = model.MSGSTATE_REMOVEED
//删除此邮件
@ -793,7 +794,7 @@ func (this *Player) MessageShowRed() {
}
}
for showId := range msgMap {
this.SendShowRed(hall_proto.ShowRedCode_Mail, int32(showId), 1)
this.SendShowRed(hallproto.ShowRedCode_Mail, int32(showId), 1)
}
}
@ -911,7 +912,7 @@ func (this *Player) AddMessage(msg *model.Message) {
msgMap[msg.ShowId] = 1
}
for showId := range msgMap {
this.SendShowRed(hall_proto.ShowRedCode_Mail, int32(showId), 1)
this.SendShowRed(hallproto.ShowRedCode_Mail, int32(showId), 1)
}
}
}
@ -1153,11 +1154,11 @@ func (this *Player) GetMessageAttach(id string) {
}
if _, code, _ := BagMgrSingleton.AddItems(this, items, 0, gainWay, "mail", remark, 0, 0, false); code != bag.OpResultCode_OPRC_Sucess { // 领取失败
logger.Logger.Errorf("CSPlayerSettingHandler AddItems err", code)
pack := &msg_proto.SCGetMessageAttach{
pack := &msgproto.SCGetMessageAttach{
Id: proto.String(""),
}
proto.SetDefaults(pack)
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_GETMESSAGEATTACH), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_GETMESSAGEATTACH), pack)
}
this.dirty = true
}
@ -1270,11 +1271,11 @@ func (this *Player) GetMessageAttach(id string) {
}
}
}
pack := &msg_proto.SCGetMessageAttach{
pack := &msgproto.SCGetMessageAttach{
Id: proto.String(id),
}
proto.SetDefaults(pack)
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_GETMESSAGEATTACH), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_GETMESSAGEATTACH), pack)
}
}), "GetMessageAttach").StartByFixExecutor("logic_message")
}
@ -1317,7 +1318,7 @@ func (this *Player) GetMessageAttachs(ids []string) {
}
}
pack := &msg_proto.SCGetMessageAttach{
pack := &msgproto.SCGetMessageAttach{
// Id: proto.String(id),
}
@ -1451,7 +1452,7 @@ func (this *Player) GetMessageAttachs(ids []string) {
}
proto.SetDefaults(pack)
this.SendToClient(int(msg_proto.MSGPacketID_PACKET_SC_GETMESSAGEATTACH), pack)
this.SendToClient(int(msgproto.MSGPacketID_PACKET_SC_GETMESSAGEATTACH), pack)
}
}), "GetMessageAttach").StartByFixExecutor("logic_message")
@ -1470,12 +1471,12 @@ func (this *Player) GetMessageByGiftId(id string) *model.Message {
func (this *Player) Kickout(reason int32) {
if this.IsOnLine() {
logger.Logger.Trace("(this *Player) Kickout()", this.SnId)
scDisconnect := &login_proto.SSDisconnect{
scDisconnect := &loginproto.SSDisconnect{
SessionId: proto.Int64(this.sid),
Type: proto.Int32(reason),
}
proto.SetDefaults(scDisconnect)
this.SendToClient(int(login_proto.GatePacketID_PACKET_SS_DICONNECT), scDisconnect)
this.SendToClient(int(loginproto.GatePacketID_PACKET_SS_DICONNECT), scDisconnect)
LoginStateMgrSington.LogoutBySid(this.sid)
this.DropLine()
@ -1517,12 +1518,12 @@ func (this *Player) DropLine() {
this.PlayerData.LastLogoutTime = time.Now().Local()
FriendMgrSington.UpdateLogoutTime(this.Platform, this.SnId)
if this.scene != nil && this.scene.gameSess != nil {
pack := &server_proto.WGPlayerDropLine{
pack := &serverproto.WGPlayerDropLine{
Id: proto.Int32(this.SnId),
SceneId: proto.Int(this.scene.sceneId),
}
proto.SetDefaults(pack)
this.SendToGame(int(server_proto.SSPacketID_PACKET_WG_PLAYERDROPLINE), pack)
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_PLAYERDROPLINE), pack)
}
PlayerMgrSington.DroplinePlayer(this)
this.sid = 0
@ -1544,11 +1545,11 @@ func (this *Player) Logout() {
// 在线奖励:累计在线时长
//this.OnlineRewardAddUpOnlineDuration()
scLogout := &login_proto.SCLogout{
OpRetCode: login_proto.OpResultCode_OPRC_Sucess,
scLogout := &loginproto.SCLogout{
OpRetCode: loginproto.OpResultCode_OPRC_Sucess,
}
proto.SetDefaults(scLogout)
this.SendToClient(int(login_proto.LoginPacketID_PACKET_SC_LOGOUT), scLogout)
this.SendToClient(int(loginproto.LoginPacketID_PACKET_SC_LOGOUT), scLogout)
this.SetOffline()
this.LastLogoutTime = time.Now().Local()
FriendMgrSington.UpdateLogoutTime(this.Platform, this.SnId)
@ -1727,10 +1728,10 @@ func (this *Player) UnmarshalData(data []byte, scene *Scene) {
this.dirty = true
}
func (this *Player) MarshalIParam() []*server_proto.PlayerIParam {
var params []*server_proto.PlayerIParam
func (this *Player) MarshalIParam() []*serverproto.PlayerIParam {
var params []*serverproto.PlayerIParam
for i, v := range this.Iparams {
params = append(params, &server_proto.PlayerIParam{
params = append(params, &serverproto.PlayerIParam{
ParamId: proto.Int(i),
IntVal: proto.Int64(v),
})
@ -1738,16 +1739,16 @@ func (this *Player) MarshalIParam() []*server_proto.PlayerIParam {
return params
}
func (this *Player) UnmarshalIParam(params []*server_proto.PlayerIParam) {
func (this *Player) UnmarshalIParam(params []*serverproto.PlayerIParam) {
for _, p := range params {
this.Iparams[int(p.GetParamId())] = p.GetIntVal()
}
}
func (this *Player) MarshalSParam() []*server_proto.PlayerSParam {
var params []*server_proto.PlayerSParam
func (this *Player) MarshalSParam() []*serverproto.PlayerSParam {
var params []*serverproto.PlayerSParam
for i, v := range this.sparams {
params = append(params, &server_proto.PlayerSParam{
params = append(params, &serverproto.PlayerSParam{
ParamId: proto.Int(i),
StrVal: proto.String(v),
})
@ -1755,16 +1756,16 @@ func (this *Player) MarshalSParam() []*server_proto.PlayerSParam {
return params
}
func (this *Player) UnmarshalSParam(params []*server_proto.PlayerSParam) {
func (this *Player) UnmarshalSParam(params []*serverproto.PlayerSParam) {
for _, p := range params {
this.sparams[int(p.GetParamId())] = p.GetStrVal()
}
}
func (this *Player) MarshalCParam() []*server_proto.PlayerCParam {
var params []*server_proto.PlayerCParam
func (this *Player) MarshalCParam() []*serverproto.PlayerCParam {
var params []*serverproto.PlayerCParam
for k, v := range this.cparams {
params = append(params, &server_proto.PlayerCParam{
params = append(params, &serverproto.PlayerCParam{
StrKey: proto.String(k),
StrVal: proto.String(v),
})
@ -1913,10 +1914,14 @@ func (this *Player) AddDiamond(num, add int64, gainWay int32, oper, remark strin
} else {
this.Diamond += num
}
TaskSubjectSingleton.Touch(common.TaskTypeCostDiamond, &TaskData{
SnId: this.SnId,
Num: -num,
})
switch gainWay {
case common.GainWay_MatchSignup: // 排除的
default:
TaskSubjectSingleton.Touch(common.TaskTypeCostDiamond, &TaskData{
SnId: this.SnId,
Num: -num,
})
}
}
this.SendDiffData()
@ -2392,36 +2397,36 @@ func (this *Player) GetIP() string {
return this.Ip
}
func (this *Player) CreateScene(sceneId, gameId, gameMode, sceneMode int, numOfGames int32, params []int64, dbGameFree *server_proto.DB_GameFree) (*Scene, hall_proto.OpResultCode_Game) {
func (this *Player) CreateScene(sceneId, gameId, gameMode, sceneMode int, numOfGames int32, params []int64, dbGameFree *serverproto.DB_GameFree) (*Scene, hallproto.OpResultCode_Game) {
gs := GameSessMgrSington.GetMinLoadSess(gameId)
if gs == nil {
logger.Logger.Warnf("(this *Player) EnterScene %v, %v GameSessMgrSington.GetMinLoadSess() = nil ", this.SnId, gameId)
return nil, hall_proto.OpResultCode_Game_OPRC_SceneServerMaintain_Game
return nil, hallproto.OpResultCode_Game_OPRC_SceneServerMaintain_Game
}
s := SceneMgrSingleton.CreateScene(0, this.SnId, sceneId, gameId, gameMode, sceneMode, 1, numOfGames, params, gs, this.GetPlatform(), 0, dbGameFree, dbGameFree.GetId())
if s == nil {
logger.Logger.Tracef("(this *Player) EnterScene %v, SceneMgrSingleton.CreateScene() = nil ", this.SnId)
return nil, hall_proto.OpResultCode_Game_OPRC_Error_Game
return nil, hallproto.OpResultCode_Game_OPRC_Error_Game
}
return s, hall_proto.OpResultCode_Game_OPRC_Sucess_Game
return s, hallproto.OpResultCode_Game_OPRC_Sucess_Game
}
func (this *Player) CreateLocalGameScene(sceneId, gameId, gameSite, sceneMode, playerNum int, params []int64,
dbGameFree *server_proto.DB_GameFree, baseScore, groupId int32) (*Scene, hall_proto.OpResultCode_Game) {
dbGameFree *serverproto.DB_GameFree, baseScore, groupId int32) (*Scene, hallproto.OpResultCode_Game) {
gs := GameSessMgrSington.GetMinLoadSess(gameId)
if gs == nil {
logger.Logger.Warnf("(this *Player) CreateLocalGameScene %v, %v GameSessMgrSington.GetMinLoadSess() = nil ", this.SnId, gameId)
return nil, hall_proto.OpResultCode_Game_OPRC_SceneServerMaintain_Game
return nil, hallproto.OpResultCode_Game_OPRC_SceneServerMaintain_Game
}
s := SceneMgrSingleton.CreateLocalGameScene(this.SnId, sceneId, gameId, gameSite, sceneMode, 1, params, gs,
this.GetPlatform(), playerNum, dbGameFree, baseScore, groupId, dbGameFree.GetId())
if s == nil {
logger.Logger.Tracef("(this *Player) EnterScene %v, SceneMgrSingleton.CreateScene() = nil ", this.SnId)
return nil, hall_proto.OpResultCode_Game_OPRC_Error_Game
return nil, hallproto.OpResultCode_Game_OPRC_Error_Game
}
return s, hall_proto.OpResultCode_Game_OPRC_Sucess_Game
return s, hallproto.OpResultCode_Game_OPRC_Sucess_Game
}
func (this *Player) ReturnScene(isLoaded bool) *Scene {
@ -2435,7 +2440,7 @@ func (this *Player) ReturnScene(isLoaded bool) *Scene {
return nil
}
pack := &server_proto.WGPlayerReturn{
pack := &serverproto.WGPlayerReturn{
PlayerId: proto.Int32(this.SnId),
IsLoaded: proto.Bool(isLoaded),
RoomId: proto.Int(this.scene.sceneId),
@ -2445,7 +2450,7 @@ func (this *Player) ReturnScene(isLoaded bool) *Scene {
pack.EnterTs = proto.Int64(ctx.enterTs)
}
proto.SetDefaults(pack)
if this.SendToGame(int(server_proto.SSPacketID_PACKET_WG_PLAYERRETURN), pack) {
if this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_PLAYERRETURN), pack) {
//比赛场返场检查
//MatchMgrSington.OnPlayerReturnScene(this.scene, this)
return this.scene
@ -2479,7 +2484,7 @@ func (this *Player) AddMoneyPayTotal(amount int64) {
func (this *Player) SendDiffData() {
this.UpdateVip()
var dirty bool
pack := &player_proto.SCPlayerDataUpdate{}
pack := &playerproto.SCPlayerDataUpdate{}
pack.UpdateField = 0
//金币
if this.diffData.Coin != this.Coin {
@ -2581,7 +2586,7 @@ func (this *Player) SendDiffData() {
if dirty {
FriendMgrSington.UpdateInfo(this.Platform, this.SnId)
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PLAYERDATAUPDATE), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PLAYERDATAUPDATE), pack)
logger.Logger.Trace("(this *Player) SendDiffData() ", pack)
}
}
@ -2964,9 +2969,9 @@ func (this *Player) GetPromoterKey() (string, error) {
func (this *Player) SendPlayerInfo() {
this.UpdateVip()
scPlayerData := &player_proto.SCPlayerData{
OpRetCode: player_proto.OpResultCode_OPRC_Sucess,
Data: &player_proto.PlayerData{
scPlayerData := &playerproto.SCPlayerData{
OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
Data: &playerproto.PlayerData{
AccId: proto.String(this.AccountId), //账号ID
Platform: proto.String(this.Platform), //平台
Channel: proto.String(this.Channel), //渠道
@ -3050,14 +3055,14 @@ func (this *Player) SendPlayerInfo() {
if endTime == 0 {
continue
}
weekInfo := player_proto.WeekInfo{
weekInfo := playerproto.WeekInfo{
Id: id,
WeekCardTime: endTime,
WeekCardAward: this.WeekCardAward[id],
}
scPlayerData.Data.WeekCard = append(scPlayerData.Data.WeekCard, &weekInfo)
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PLAYERDATA), scPlayerData)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PLAYERDATA), scPlayerData)
logger.Logger.Tracef("Send SCPlayerData %v", scPlayerData)
if !this.IsRob {
@ -3272,13 +3277,13 @@ func ReportSystemGiveEvent(pd *model.PlayerData, amount, tag int32, notifyClient
player := PlayerMgrSington.GetPlayerBySnId(pd.SnId)
if player != nil {
//通知客户端
sendPack := &shop_proto.SCNotifyGiveCoinInfo{
sendPack := &shopproto.SCNotifyGiveCoinInfo{
GiveCoin: proto.Int64(int64(amount)),
GiveTag: proto.Int32(tag),
}
proto.SetDefaults(sendPack)
player.SendToClient(int(shop_proto.SPacketID_SHOP_SC_GIVECOIN_INFO), sendPack)
player.SendToClient(int(shopproto.SPacketID_SHOP_SC_GIVECOIN_INFO), sendPack)
}
}
}
@ -3303,7 +3308,7 @@ func (this *Player) ReportBankRuptcy(gameid, gamemode, gamefreeid int32) {
//}
}
func (this *Player) CheckType(gameid, gamefreeId int32) *server_proto.DB_PlayerType {
func (this *Player) CheckType(gameid, gamefreeId int32) *serverproto.DB_PlayerType {
types := srvdata.PlayerTypeMgrSington.GetPlayerType(gamefreeId)
cnt := len(types)
if cnt > 0 {
@ -3400,14 +3405,14 @@ func (this *Player) AddPayCoinLog(coin int64, coinType int32, oper string) {
// 充值回调
func (this *Player) SendPlayerRechargeAnswer(coin int64) {
if this.Tel == "" {
pack := &player_proto.SCPlayerRechargeAnswer{
pack := &playerproto.SCPlayerRechargeAnswer{
OpParam: proto.Int64(1),
AddCoin: proto.Int64(coin),
Coin: proto.Int64(this.Coin),
SafeBoxCoin: proto.Int64(this.SafeBoxCoin),
}
proto.SetDefaults(pack)
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PLAYERRECHARGEANSWER), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PLAYERRECHARGEANSWER), pack)
}
}
@ -3459,12 +3464,12 @@ func (this *Player) SendPlayerRechargeAnswer(coin int64) {
//}
func (this *Player) SyncSafeBoxCoinToGame() {
pack := &server_proto.WGSyncPlayerSafeBoxCoin{
pack := &serverproto.WGSyncPlayerSafeBoxCoin{
SnId: proto.Int32(this.SnId),
SafeBoxCoin: proto.Int64(this.SafeBoxCoin),
}
proto.SetDefaults(pack)
this.SendToGame(int(server_proto.SSPacketID_PACKET_WG_SyncPlayerSafeBoxCoin), pack)
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_SyncPlayerSafeBoxCoin), pack)
}
//func (this *Player) GetDgHboPlayerName(plt *Platform) (string, string) {
@ -3518,12 +3523,12 @@ func OnPlayerPay(pd *model.PlayerData, coin int64) {
buf, err := pd.GetPlayerDataEncoder()
if err == nil {
pack := &server_proto.WTPlayerPay{
pack := &serverproto.WTPlayerPay{
AddCoin: proto.Int64(coin),
PlayerData: buf.Bytes(),
}
proto.SetDefaults(pack)
common.SendToActThrSrv(int(server_proto.SSPacketID_PACKET_WT_PLAYERPAY), pack)
common.SendToActThrSrv(int(serverproto.SSPacketID_PACKET_WT_PLAYERPAY), pack)
}
//ActFPayMgrSington.OnPlayerPay(pd.SnId, pd.Platform, coin)
@ -3541,12 +3546,12 @@ func (this *Player) SendPlatformCanUsePromoterBind() {
}
}
pack := &player_proto.SCBindPromoterState{
pack := &playerproto.SCBindPromoterState{
BindState: proto.Int32(state),
}
proto.SetDefaults(pack)
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_BINDPROMOTERSTATE), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_BINDPROMOTERSTATE), pack)
}
func (this *Player) RedirectByGame(packetid int, rawpack interface{}) bool {
@ -3561,13 +3566,13 @@ func (this *Player) RedirectByGame(packetid int, rawpack interface{}) bool {
data, err := netlib.MarshalPacket(packetid, rawpack)
if err == nil {
pack := &server_proto.SSRedirectToPlayer{
pack := &serverproto.SSRedirectToPlayer{
SnId: proto.Int32(this.SnId),
PacketId: proto.Int(packetid),
Data: data,
}
proto.SetDefaults(pack)
return this.SendToGame(int(server_proto.SSPacketID_PACKET_SS_REDIRECTTOPLAYER), pack)
return this.SendToGame(int(serverproto.SSPacketID_PACKET_SS_REDIRECTTOPLAYER), pack)
}
return false
}
@ -3580,12 +3585,12 @@ func (this *Player) SyncPlayerDataToGateSrv(pd *model.PlayerData) {
if err != nil {
logger.Logger.Info("(this *Player) UpdateToGateSrv gob.Marshal error", err)
} else {
pack := &server_proto.WRPlayerData{
pack := &serverproto.WRPlayerData{
Sid: this.sid,
PlayerData: buf.Bytes(),
}
proto.SetDefaults(pack)
this.gateSess.Send(int(server_proto.SSPacketID_PACKET_WR_PlayerData), pack)
this.gateSess.Send(int(serverproto.SSPacketID_PACKET_WR_PlayerData), pack)
}
}
@ -3593,26 +3598,26 @@ func (this *Player) BindGroupTag(tags []string) {
if this.gateSess == nil {
return
}
pack := &server_proto.SGBindGroupTag{
pack := &serverproto.SGBindGroupTag{
Sid: proto.Int64(this.sid),
Code: server_proto.SGBindGroupTag_OpCode_Add,
Code: serverproto.SGBindGroupTag_OpCode_Add,
Tags: tags,
}
proto.SetDefaults(pack)
this.gateSess.Send(int(server_proto.SSPacketID_PACKET_SG_BINDGROUPTAG), pack)
this.gateSess.Send(int(serverproto.SSPacketID_PACKET_SG_BINDGROUPTAG), pack)
}
func (this *Player) UnBindGroupTag(tags []string) {
if this.gateSess == nil {
return
}
pack := &server_proto.SGBindGroupTag{
pack := &serverproto.SGBindGroupTag{
Sid: proto.Int64(this.sid),
Code: server_proto.SGBindGroupTag_OpCode_Del,
Code: serverproto.SGBindGroupTag_OpCode_Del,
Tags: tags,
}
proto.SetDefaults(pack)
this.gateSess.Send(int(server_proto.SSPacketID_PACKET_SG_BINDGROUPTAG), pack)
this.gateSess.Send(int(serverproto.SSPacketID_PACKET_SG_BINDGROUPTAG), pack)
}
func (this *Player) TryRetrieveLostGameCoin(sceneid int) {
@ -3658,9 +3663,9 @@ func (this *Player) SyncGameCoin(sceneid int, enterts int64) {
this.SendDiffData()
}), "GetCoinWALBySnidAndInGameAndGreaterTs").Start()
}
func (this *Player) SendShowRed(showType hall_proto.ShowRedCode, showChild, isShow int32) {
pack := &hall_proto.SCShowRed{
ShowRed: &hall_proto.ShowRed{
func (this *Player) SendShowRed(showType hallproto.ShowRedCode, showChild, isShow int32) {
pack := &hallproto.SCShowRed{
ShowRed: &hallproto.ShowRed{
ShowType: showType,
ShowChild: proto.Int32(showChild),
IsShow: proto.Int32(isShow),
@ -3668,19 +3673,19 @@ func (this *Player) SendShowRed(showType hall_proto.ShowRedCode, showChild, isSh
}
proto.SetDefaults(pack)
logger.Logger.Trace("SCShowRed:", pack)
this.SendToClient(int(hall_proto.HallPacketID_PACKET_SC_SHOWRED), pack)
this.SendToClient(int(hallproto.HallPacketID_PACKET_SC_SHOWRED), pack)
}
func (this *Player) SCVIPBuy(buy int64) {
//buy *= 10000
//this.AddMoneyPayTotal(buy)
//this.GetVIPLevel(0) // 更新下vip等级
pack := &player_proto.SCVIPBuy{
OpRetCode: player_proto.OpResultCode_OPRC_Sucess,
pack := &playerproto.SCVIPBuy{
OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
}
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp() // 获取经验会更新vip等级
pack.Vip = this.VIP
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_VIPBUY), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_VIPBUY), pack)
}
func (this *Player) SCVIPInfo() {
@ -3688,15 +3693,15 @@ func (this *Player) SCVIPInfo() {
return
}
pack := &player_proto.SCVIPInfo{
OpRetCode: player_proto.OpResultCode_OPRC_Error,
pack := &playerproto.SCVIPInfo{
OpRetCode: playerproto.OpResultCode_OPRC_Error,
}
vips := VipMgrSington.GetVIPcfg(this.Platform)
if vips != nil {
pack.MoneyRatio = int32(vips.MoneyRatio)
for _, cfg := range vips.List {
data := &player_proto.VIPcfg{
data := &playerproto.VIPcfg{
VipId: cfg.VipId,
VipEx: cfg.VipEx,
Price: cfg.Price,
@ -3714,13 +3719,13 @@ func (this *Player) SCVIPInfo() {
MatchFreeTimes: cfg.MatchFreeTimes,
}
for itemId, itemNum := range cfg.Award {
data.Item = append(data.Item, &player_proto.ItemInfo{
data.Item = append(data.Item, &playerproto.ItemInfo{
ItemId: int32(itemId),
ItemNum: itemNum,
})
}
for itemId, itemNum := range cfg.Privilege7 {
data.Privilege7 = append(data.Privilege7, &player_proto.ItemInfo{
data.Privilege7 = append(data.Privilege7, &playerproto.ItemInfo{
ItemId: int32(itemId),
ItemNum: itemNum,
})
@ -3741,11 +3746,11 @@ func (this *Player) SCVIPInfo() {
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp(vips)
pack.Vip = this.VIP
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
pack.OpRetCode = playerproto.OpResultCode_OPRC_Sucess
//WelfareMgrSington.MonitorWelfData(this)
//pack.VipId = append(pack.VipId, this.WelfData.VIPGift...)
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_VIPINFO), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_VIPINFO), pack)
}
func (this *Player) GetVIPExpByPay(payTotal int32) int32 {
vips := VipMgrSington.GetVIPcfg(this.Platform)
@ -3753,12 +3758,12 @@ func (this *Player) GetVIPExpByPay(payTotal int32) int32 {
}
func (this *Player) VIPDraw(id int32) {
//WelfareMgrSington.MonitorWelfData(this)
pack := &player_proto.SCVIPDraw{
pack := &playerproto.SCVIPDraw{
Id: id,
OpRetCode: player_proto.OpResultCode_OPRC_Error,
OpRetCode: playerproto.OpResultCode_OPRC_Error,
}
if id != 0 {
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
return
}
if this.WelfData.VIPBag == nil {
@ -3767,7 +3772,7 @@ func (this *Player) VIPDraw(id int32) {
if innerMap, ok := this.WelfData.VIPBag[this.VIP]; ok {
if _, ok := innerMap[0]; ok {
logger.Logger.Trace("VIPDraw VIP is repeat id%v ", id)
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
return
}
} else {
@ -3778,7 +3783,7 @@ func (this *Player) VIPDraw(id int32) {
if vips != nil {
for _, data := range vips.List {
if data.VipId == this.VIP {
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
pack.OpRetCode = playerproto.OpResultCode_OPRC_Sucess
this.WelfData.VIPBag[this.VIP][0] = 1
//金币数量
money := data.Privilege1[0]
@ -3804,12 +3809,12 @@ func (this *Player) VIPDraw(id int32) {
}
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
}
func (this *Player) GetCurrentVIPExp(vipcfg ...*webapi_proto.VIPcfgDataList) (exp int64, money int64) {
var vips *webapi_proto.VIPcfgDataList
func (this *Player) GetCurrentVIPExp(vipcfg ...*webapiproto.VIPcfgDataList) (exp int64, money int64) {
var vips *webapiproto.VIPcfgDataList
if len(vipcfg) == 0 {
vips = VipMgrSington.GetVIPcfg(this.Platform)
} else {
@ -3913,7 +3918,7 @@ func (this *Player) GetPayGoodsInfo() {
case ShopPageBackend:
logger.Logger.Tracef("GetPayGoodsInfo ShopPageBackend %+v", *info)
default:
var itemInfo []*player_proto.PayItem
var itemInfo []*playerproto.PayItem
var items []*Item
if len(info.Amount) > 0 {
this.AddCoin(int64(info.Amount[0]), 0, info.GainWay, "Callback_login", info.Remark)
@ -3923,7 +3928,7 @@ func (this *Player) GetPayGoodsInfo() {
if info.ItemInfo != nil {
for _, v := range info.ItemInfo {
items = append(items, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum})
itemInfo = append(itemInfo, &player_proto.PayItem{
itemInfo = append(itemInfo, &playerproto.PayItem{
ItemId: v.ItemId,
ItemNum: v.ItemNum,
})
@ -3975,12 +3980,12 @@ func (this *Player) GetPayGoodsInfo() {
BagMgrSingleton.AddItems(this, items, 0, info.GainWay, info.Operator, info.Remark, 0, 0, false)
PayGoodsInfo := &player_proto.SCPayGoodsInfo{
PayGoodsInfo := &playerproto.SCPayGoodsInfo{
Gold: info.Amount,
Item: itemInfo,
}
proto.SetDefaults(PayGoodsInfo)
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PAYGOODSINFO), PayGoodsInfo)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PAYGOODSINFO), PayGoodsInfo)
}
if info.ConsumeNum > 0 {
TaskSubjectSingleton.Touch(common.TaskTypePay, &TaskData{
@ -3995,7 +4000,7 @@ func (this *Player) GetPayGoodsInfo() {
}
func (this *Player) SendJackPotInit() {
var pack = &hall_proto.SCHundredSceneGetGameJackpot{}
var pack = &hallproto.SCHundredSceneGetGameJackpot{}
gameFreeIds := []int32{
3010001, 3010002, 3010003, 3010004,
3020001, 3020002, 3020003, 3020004,
@ -4005,7 +4010,7 @@ func (this *Player) SendJackPotInit() {
for _, id := range gameFreeIds {
data := srvdata.PBDB_GameFreeMgr.GetData(id)
if data != nil && len(data.Jackpot) > 0 {
jpfi := &hall_proto.GameJackpotFundInfo{
jpfi := &hallproto.GameJackpotFundInfo{
GameFreeId: proto.Int32(data.Id),
JackPotFund: proto.Int64(int64(data.BaseScore * data.Jackpot[0])),
}
@ -4013,7 +4018,7 @@ func (this *Player) SendJackPotInit() {
}
}
if len(pack.GameJackpotFund) > 0 {
this.SendToClient(int(hall_proto.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack)
this.SendToClient(int(hallproto.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack)
}
}
@ -4150,11 +4155,11 @@ func (this *Player) SendPlayerCoin() {
func (this *Player) UnPlayerPowerEx(power int64) {
logger.Logger.Tracef("解锁炮倍 当前最大解锁炮倍:%v,要解锁的炮倍:%v", this.UnMaxPower, power)
if this.UnPlayerPower(power) {
pack := &player_proto.SCPlayerUnPower{
pack := &playerproto.SCPlayerUnPower{
UnMaxpower: power,
}
this.UnMaxPower = power
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PlayerUnPower), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PlayerUnPower), pack)
logger.Logger.Tracef("通知客户端解锁最大炮倍,snid = %v,power = %v", this.SnId, power)
}
}
@ -4178,10 +4183,10 @@ func (this *Player) ItemUnPlayerPowerListEx(itemId int32) {
if this.UnPlayerPowerList(powerId) {
//通知客户端解锁炮台
pack := &player_proto.SCPlayerUnPowerList{
pack := &playerproto.SCPlayerUnPowerList{
UnPowerList: powerId,
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PlayerUnPowerList), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PlayerUnPowerList), pack)
logger.Logger.Trace("通知客户端解锁炮台 snid = %v,解锁的炮台:%v,当前已有的炮台 = %v", this.SnId, powerId, this.PowerList)
}
}
@ -4194,10 +4199,10 @@ func (this *Player) UnPlayerPowerListEx(powerId int32) {
}
if this.UnPlayerPowerList(powerId) {
//通知客户端解锁炮台
pack := &player_proto.SCPlayerUnPowerList{
pack := &playerproto.SCPlayerUnPowerList{
UnPowerList: powerId,
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PlayerUnPowerList), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PlayerUnPowerList), pack)
logger.Logger.Trace("通知客户端解锁炮台 snid = %v,解锁的炮台:%v,当前已有的炮台 = %v", this.SnId, powerId, this.PowerList)
}
}
@ -4214,12 +4219,12 @@ func (this *Player) UpdatePlayerVipBag(shopId int32) {
}
this.WelfData.VIPBag[shopInfo.VipLevel][shopInfo.Id] = shopInfo.Type
logger.Logger.Tracef("玩家购买VIP商品成功,更新购买状态snid = %v shopId = %v,VIP = %v", this.SnId, shopInfo.Id, shopInfo.VipLevel)
pack := &player_proto.SCVIPDraw{
pack := &playerproto.SCVIPDraw{
Id: shopInfo.Type,
Vip: shopInfo.VipLevel,
OpRetCode: player_proto.OpResultCode_OPRC_Sucess,
OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
//VIP金币礼包&VIP固定礼包统计数据
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
var item []model.ItemInfo
@ -4363,10 +4368,10 @@ func (this *Player) addLotteryCount(count int32) {
this.LotteryCount = math.MaxInt32
}
//通知客户端
pack := &player_proto.SCPhoneLotteryCount{
pack := &playerproto.SCPhoneLotteryCount{
Count: this.LotteryCount,
}
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PhoneLotteryCount), pack)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PhoneLotteryCount), pack)
}
@ -4610,7 +4615,7 @@ func (this *Player) GetWeekCardAwary(id int32) {
logger.Logger.Trace("周卡已过期,不能领取!")
return
}
ret := &player_proto.SCGetWeekCardAwary{}
ret := &playerproto.SCGetWeekCardAwary{}
if !this.WeekCardAward[id] {
//获取周卡奖励
items := data.GetDayRewards()
@ -4618,7 +4623,7 @@ func (this *Player) GetWeekCardAwary(id int32) {
for itemId, itemNum := range items {
item := &Item{ItemId: int32(itemId), ItemNum: itemNum, ObtainTime: time.Now().Unix()}
addItem = append(addItem, item)
itemInfo := &player_proto.PayItem{}
itemInfo := &playerproto.PayItem{}
itemInfo.ItemId = int32(itemId)
itemInfo.ItemNum = itemNum
ret.Items = append(ret.Items, itemInfo)
@ -4628,13 +4633,13 @@ func (this *Player) GetWeekCardAwary(id int32) {
this.WeekCardAward[id] = true
ret.WeekCardAward = this.WeekCardAward[id]
}
info := &player_proto.WeekInfo{
info := &playerproto.WeekInfo{
Id: id,
WeekCardTime: this.WeekCardTime[id],
WeekCardAward: this.WeekCardAward[id],
}
ret.WeekCard = info
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCGetWeekCardAwary), ret)
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCGetWeekCardAwary), ret)
return
}
@ -4668,7 +4673,7 @@ func (this *Player) AddItemRecExpireTime(itemId int32, num, add int64, gainWay i
if num != 0 /*&& !async*/ {
this.dirty = true
if num > 0 {
itemData := srvdata.PBDB_GameItemMgr.GetData(itemId)
itemData := srvdata.GameItemMgr.Get(this.Platform, itemId)
if itemData == nil {
return
}
@ -4684,14 +4689,14 @@ func (this *Player) AddItemRecExpireTime(itemId int32, num, add int64, gainWay i
}
if this.scene != nil && this.scene.gameSess != nil {
msg := &server_proto.WGBuyRecTimeItem{
msg := &serverproto.WGBuyRecTimeItem{
SnId: this.SnId,
ExpireTime: this.ItemRecExpireTime,
Diamond: this.Diamond,
}
proto.SetDefaults(msg)
this.SendToGame(int(server_proto.SSPacketID_PACKET_WG_BUYRECTIMEITEM), msg)
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_BUYRECTIMEITEM), msg)
}
}
@ -4711,3 +4716,38 @@ func (this *Player) GetIsPermit() bool {
}
return false
}
func (this *Player) SCItems() {
cfg := PlatformMgrSingleton.GetConfig(this.Platform).ItemConfig
if cfg == nil {
return
}
var items []*serverproto.DB_GameItem
for _, v := range cfg.GetItems() {
items = append(items, &serverproto.DB_GameItem{
Id: v.GetId(),
Name: v.GetName(),
ShowLocation: v.GetShowLocation(),
Classify: v.GetClassify(),
Type: v.GetType(),
Effect0: v.GetEffect0(),
Effect: v.GetEffect(),
SaleType: v.GetSaleType(),
SaleGold: v.GetSaleGold(),
Composition: v.GetComposition(),
CompositionMax: v.GetCompositionMax(),
Time: v.GetTime(),
Location: v.GetLocation(),
Describe: v.GetDescribe(),
Num: v.GetNum(),
Value: v.GetValue(),
Entity: v.GetEntity(),
Icon: v.GetIcon(),
})
}
pack := &playerproto.SCItem{
Items: items,
}
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCItem), pack)
logger.Logger.Tracef("SCItem: %v", pack)
}

View File

@ -515,7 +515,7 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool {
}
// 道具
dbItemArr := srvdata.PBDB_GameItemMgr.Datas.Arr
dbItemArr := srvdata.GameItemMgr.GetArr(p.Platform)
if dbItemArr != nil {
msg.Items = make(map[int32]int64)
for _, dbItem := range dbItemArr {

View File

@ -576,6 +576,18 @@ func (this *ShopMgr) createPhoneScore(p *Player, shopInfo *model.ShopInfo, costN
if err == nil {
LogChannelSingleton.WriteMQData(model.GeneratePhoneLottery(p.SnId, p.Platform, string(jsonData), 2, 0, 0, int(costNum)))
}
for _, v := range items {
tp1 := int32(-1)
if v.ItemId == common.ItemIDCoin {
tp1 = model.SystemFreeGive_CoinType_Coin
} else if v.ItemId == common.ItemIDDiamond {
tp1 = model.SystemFreeGive_CoinType_Diamond
}
if !p.IsRob && tp1 >= 0 {
LogChannelSingleton.WriteMQData(
model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_PhoneLotterySwap, tp1, v.ItemNum))
}
}
}
}

View File

@ -199,11 +199,12 @@ func (t *TaskHandle) AllTask(id int, data any) {
// 通知变更
if !IsTaskReward(p, v.Id) {
item := &taskproto.TaskData{
Id: v.Id,
N: p.WelfData.Task[v.Id].N,
TargetN: v.TargetTimes,
Status: 0,
Reward: v.Award,
Id: v.Id,
N: p.WelfData.Task[v.Id].N,
TargetN: v.TargetTimes,
Status: 0,
Reward: v.Award,
TaskType: v.TaskType,
}
if item.N > item.TargetN {
item.N = item.TargetN

View File

@ -732,6 +732,12 @@ func (this *Tournament) Start(platform string, tmId int32) {
GameFreeID: tm.dbGameFree.GetId(),
Num: 1,
})
if matchInfo.GetSignupCostDiamond() > 0 {
TaskSubjectSingleton.Touch(common.TaskTypeCostDiamond, &TaskData{
SnId: v.SnId,
Num: matchInfo.GetSignupCostDiamond(),
})
}
}
this.signupPlayers[platform][tmId].signup = make(map[int32]*TmPlayer)
}
@ -1213,7 +1219,7 @@ func (this *Tournament) sendPromotionInfo(mc *PlayerMatchContext, sortId int64,
wg := new(sync.WaitGroup)
if pack.GetRankAward() != nil {
for _, v := range pack.GetRankAward().GetItemInfo() {
data := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
data := srvdata.GameItemMgr.Get(mc.p.Platform, v.ItemId)
if data != nil && data.GetType() == common.ItemTypePhoneCode {
has = true
item := v // 并发需要复制

View File

@ -3927,7 +3927,7 @@ func init() {
award.Diamond = msg.GetAward().Diamond
if msg.GetAward().GetItemId() != nil {
for _, item := range msg.GetAward().ItemId {
if v := srvdata.PBDB_GameItemMgr.GetData(item.ItemId); item != nil {
if v := srvdata.GameItemMgr.Get(msg.Platform, item.ItemId); item != nil {
if item.ItemNum == 0 {
pack.Tag = webapiproto.TagCode_JYB_DATA_ERROR
pack.Msg = "ItemNum failed"
@ -4026,7 +4026,7 @@ func init() {
return common.ResponseTag_ParamError, pack
}
//cdata := ShopMgrSington.GetExchangeData(msg.GoodsId)
item := srvdata.PBDB_GameItemMgr.GetData(VCard)
item := srvdata.GameItemMgr.Get(platform, VCard)
if item == nil {
pack.Tag = webapiproto.TagCode_FAILED
pack.Msg = "item is nil"
@ -4458,7 +4458,7 @@ func getPlayerDataParam(param *playerDataParam) *model.WebPlayerDataParam {
if param.Items == nil {
b := BagMgrSingleton.GetBagInfo(param.P.SnId)
for _, v := range b.BagItem {
e := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
e := srvdata.GameItemMgr.Get(param.P.Platform, v.ItemId)
if e == nil || v.ItemNum <= 0 {
continue
}
@ -4476,7 +4476,7 @@ func getPlayerDataParam(param *playerDataParam) *model.WebPlayerDataParam {
}
} else {
for _, v := range param.Items.BagItem {
e := srvdata.PBDB_GameItemMgr.GetData(v.ItemId)
e := srvdata.GameItemMgr.Get(param.P.Platform, v.ItemId)
if e == nil || v.ItemNum <= 0 {
continue
}

View File

@ -846,6 +846,7 @@ func (this *WelfareMgr) GetAddUp2Award(p *Player, day int32) {
}
typeId := addUpDate2Type[0].Id
addUpDate2Num := addUpDate2Type[0].Num
var cost []*model.ItemInfo
if typeId == 1 {
Num += 1
//看广告任务
@ -861,6 +862,10 @@ func (this *WelfareMgr) GetAddUp2Award(p *Player, day int32) {
p.AddDiamond(int64(-addUpDate2Num), 0, common.GainWaySign7Con, "system", "累计签到进阶奖励钻石消耗")
logger.Logger.Trace("累计签到进阶奖励扣除钻石uid = ", p.SnId)
EndTime = -1
cost = append(cost, &model.ItemInfo{
ItemId: common.ItemIDDiamond,
ItemNum: int64(addUpDate2Num),
})
}
p.WelfData.Sign7.Addup2Data[day] = make(map[int32]int64)
p.WelfData.Sign7.Addup2Data[day][Num+1] = EndTime
@ -879,7 +884,18 @@ func (this *WelfareMgr) GetAddUp2Award(p *Player, day int32) {
items = append(items, item)
}
}
BagMgrSingleton.AddItems(p, items, 0, common.GainWaySign7Add, "system", "累计签到进阶奖励获得", 0, 0, false)
BagMgrSingleton.AddItemsV2(&ItemParam{
P: p,
Change: items,
Cost: cost,
Add: 0,
GainWay: common.GainWaySign7Add,
Operator: "system",
Remark: "累计签到进阶奖励获得",
gameId: 0,
gameFreeId: 0,
noLog: false,
})
}
//通知客户端
this.UpdateAddUp2Date(p, Num, day, EndTime)

Binary file not shown.

Binary file not shown.