动态道具列表

This commit is contained in:
sk 2024-07-09 09:10:11 +08:00
parent 3d96c347d1
commit 0d33bf9fb4
24 changed files with 2493 additions and 2165 deletions

Binary file not shown.

Binary file not shown.

View File

@ -33,4 +33,5 @@ const (
ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关 ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置 ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置 ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
ETCDKEY_Item = "/game/item" // 道具列表
) )

View File

@ -261,16 +261,18 @@ func CSRoomEvent(s *netlib.Session, packetid int, data interface{}, sid int64) e
case 2: // 互动表情 case 2: // 互动表情
var totalCoin int64 var totalCoin int64
for _, v := range msg.GetParam() { for _, v := range msg.GetParam() {
item := srvdata.PBDB_GameItemMgr.GetData(v) item := srvdata.GameItemMgr.Get(p.Platform, v)
switch item.GetType() { if item != nil {
case common.ItemTypeInteract: switch item.GetType() {
totalCoin += item.GetNum() case common.ItemTypeInteract:
totalCoin += item.GetNum()
}
} }
} }
if p.GetCoin() >= totalCoin { if p.GetCoin() >= totalCoin {
for _, v := range msg.GetParam() { for _, v := range msg.GetParam() {
item := srvdata.PBDB_GameItemMgr.GetData(v) item := srvdata.GameItemMgr.Get(p.Platform, v)
if item.GetNum() > 0 { if item != nil && item.GetNum() > 0 {
p.AddCoin(-item.GetNum(), common.GainWay_Interact, base.SyncFlag_ToClient|base.SyncFlag_Broadcast, "system", "互动表情") 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 { for id, num := range realDrop {
remark := fmt.Sprintf("游戏掉落%v", id) remark := fmt.Sprintf("游戏掉落%v", id)
pack.Items[id] = proto.Int32(num) pack.Items[id] = proto.Int32(num)
itemData := srvdata.PBDB_GameItemMgr.GetData(id) itemData := srvdata.GameItemMgr.Get(p.Platform, id)
if itemData != nil { if itemData != nil {
//logType 0获得 1消耗 //logType 0获得 1消耗
log := model.NewItemLogEx(model.ItemParam{ log := model.NewItemLogEx(model.ItemParam{
@ -2208,7 +2208,7 @@ func (this *Scene) DropCollectBox(p *Player) {
if n < int(data.GetRate()) { if n < int(data.GetRate()) {
pack := &player.SCGameExDropItems{} pack := &player.SCGameExDropItems{}
pack.Items = make(map[int32]int32) pack.Items = make(map[int32]int32)
itemData := srvdata.PBDB_GameItemMgr.GetData(common.ItemIDCollectBox) itemData := srvdata.GameItemMgr.Get(p.Platform, common.ItemIDCollectBox)
if itemData != nil { if itemData != nil {
p.Items[itemData.Id] = p.Items[itemData.Id] + 1 p.Items[itemData.Id] = p.Items[itemData.Id] + 1
pack.Items = map[int32]int32{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 { if !p.PlayerData.IsTakeExpireItem {
itemID := int32(60001) itemID := int32(60001)
itemData := srvdata.PBDB_GameItemMgr.GetData(itemID) itemData := srvdata.GameItemMgr.Get(p.Platform, itemID)
if itemData == nil { if itemData == nil {
return return
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@ syntax = "proto3";
package player; package player;
option go_package = "mongo.games.com/game/protocol/player"; option go_package = "mongo.games.com/game/protocol/player";
import "mongo.games.com/game/protocol/server/pbdata.proto";
// //
enum OpResultCode { enum OpResultCode {
OPRC_Sucess = 0; // OPRC_Sucess = 0; //
@ -209,6 +211,7 @@ enum PlayerPacketID {
PACKET_SCExchangeChannel = 2826; // PACKET_SCExchangeChannel = 2826; //
PACKET_CSSMSConfig = 2827; // PACKET_CSSMSConfig = 2827; //
PACKET_SCSMSConfig = 2828; // PACKET_SCSMSConfig = 2828; //
PACKET_SCItem = 2830; //
} }
// //
@ -1210,4 +1213,9 @@ message SCSMSConfig{
message SMSInfo{ message SMSInfo{
int32 Id = 1; int32 Id = 1;
string SmsName = 2; string SmsName = 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; int32 Entity = 17;
string Icon = 18;
} }
message DB_GameItemArray { message DB_GameItemArray {

View File

@ -6636,6 +6636,62 @@ func (x *ActPermitConfig) GetConfigs() []*PermitChannelConfig {
return nil return nil
} }
// etcd /game/item
type ItemConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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 *ItemConfig) Reset() {
*x = ItemConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_common_proto_msgTypes[66]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ItemConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ItemConfig) ProtoMessage() {}
func (x *ItemConfig) 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 ItemConfig.ProtoReflect.Descriptor instead.
func (*ItemConfig) Descriptor() ([]byte, []int) {
return file_common_proto_rawDescGZIP(), []int{66}
}
func (x *ItemConfig) GetPlatform() string {
if x != nil {
return x.Platform
}
return ""
}
func (x *ItemConfig) GetItems() []*server.DB_GameItem {
if x != nil {
return x.Items
}
return nil
}
var File_common_proto protoreflect.FileDescriptor var File_common_proto protoreflect.FileDescriptor
var file_common_proto_rawDesc = []byte{ var file_common_proto_rawDesc = []byte{
@ -7709,10 +7765,15 @@ var file_common_proto_rawDesc = []byte{
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 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, 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, 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, 0x69, 0x67, 0x73, 0x22, 0x53, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20,
0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a,
0x74, 0x6f, 0x33, 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 ( var (
@ -7727,7 +7788,7 @@ func file_common_proto_rawDescGZIP() []byte {
return file_common_proto_rawDescData return file_common_proto_rawDescData
} }
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 72) var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 73)
var file_common_proto_goTypes = []interface{}{ var file_common_proto_goTypes = []interface{}{
(*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting (*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting
(*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting (*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting
@ -7795,33 +7856,35 @@ var file_common_proto_goTypes = []interface{}{
(*PermitRankConfig)(nil), // 63: webapi.PermitRankConfig (*PermitRankConfig)(nil), // 63: webapi.PermitRankConfig
(*PermitChannelConfig)(nil), // 64: webapi.PermitChannelConfig (*PermitChannelConfig)(nil), // 64: webapi.PermitChannelConfig
(*ActPermitConfig)(nil), // 65: webapi.ActPermitConfig (*ActPermitConfig)(nil), // 65: webapi.ActPermitConfig
nil, // 66: webapi.Platform.BindTelRewardEntry (*ItemConfig)(nil), // 66: webapi.ItemConfig
nil, // 67: webapi.PlayerData.RankScoreEntry nil, // 67: webapi.Platform.BindTelRewardEntry
nil, // 68: webapi.ItemShop.AwardEntry nil, // 68: webapi.PlayerData.RankScoreEntry
nil, // 69: webapi.VIPcfg.AwardEntry nil, // 69: webapi.ItemShop.AwardEntry
nil, // 70: webapi.VIPcfg.Privilege7Entry nil, // 70: webapi.VIPcfg.AwardEntry
nil, // 71: webapi.ActInviteConfig.PayScoreEntry nil, // 71: webapi.VIPcfg.Privilege7Entry
(*server.DB_GameFree)(nil), // 72: server.DB_GameFree 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{ var file_common_proto_depIdxs = []int32{
2, // 0: webapi.Platform.Leaderboard:type_name -> webapi.RankSwitch 2, // 0: webapi.Platform.Leaderboard:type_name -> webapi.RankSwitch
3, // 1: webapi.Platform.ClubConfig:type_name -> webapi.ClubConfig 3, // 1: webapi.Platform.ClubConfig:type_name -> webapi.ClubConfig
4, // 2: webapi.Platform.ThirdGameMerchant:type_name -> webapi.ThirdGame 4, // 2: webapi.Platform.ThirdGameMerchant:type_name -> webapi.ThirdGame
66, // 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 6, // 4: webapi.GameConfigGlobal.GameStatus:type_name -> webapi.GameStatus
72, // 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 8, // 6: webapi.PlatformGameConfig.DbGameFrees:type_name -> webapi.GameFree
0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting 0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting
1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting 1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting
1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting 1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting
72, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree 73, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
67, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry 68, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
29, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo 29, // 12: webapi.PlayerData.Items:type_name -> webapi.ItemInfo
20, // 13: webapi.OnlineReport.GameCount:type_name -> webapi.OnlineGameCnt 20, // 13: webapi.OnlineReport.GameCount:type_name -> webapi.OnlineGameCnt
22, // 14: webapi.CommonNoticeList.List:type_name -> webapi.CommonNotice 22, // 14: webapi.CommonNoticeList.List:type_name -> webapi.CommonNotice
25, // 15: webapi.ExchangeShop.ExType:type_name -> webapi.ExchangeType 25, // 15: webapi.ExchangeShop.ExType:type_name -> webapi.ExchangeType
24, // 16: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop 24, // 16: webapi.ExchangeShopList.List:type_name -> webapi.ExchangeShop
68, // 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 27, // 18: webapi.ItemShopList.List:type_name -> webapi.ItemShop
29, // 19: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo 29, // 19: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo
30, // 20: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward 30, // 20: webapi.GameMatchDate.Award:type_name -> webapi.MatchInfoAward
@ -7842,12 +7905,12 @@ var file_common_proto_depIdxs = []int32{
35, // 35: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate 35, // 35: webapi.WelfareSpree.Item:type_name -> webapi.WelfareDate
45, // 36: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree 45, // 36: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree
45, // 37: webapi.WelfareContinuousPayDataList.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, // 38: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
70, // 39: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry 71, // 39: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
48, // 40: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg 48, // 40: webapi.VIPcfgDataList.List:type_name -> webapi.VIPcfg
35, // 41: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate 35, // 41: webapi.ChessRankConfig.Item:type_name -> webapi.WelfareDate
52, // 42: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig 52, // 42: webapi.ChessRankcfgData.Datas:type_name -> webapi.ChessRankConfig
71, // 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, // 44: webapi.ActInviteConfig.Awards1:type_name -> webapi.RankAward
59, // 45: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward 59, // 45: webapi.ActInviteConfig.Awards2:type_name -> webapi.RankAward
59, // 46: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward 59, // 46: webapi.ActInviteConfig.Awards3:type_name -> webapi.RankAward
@ -7860,11 +7923,12 @@ var file_common_proto_depIdxs = []int32{
62, // 53: webapi.PermitChannelConfig.ExchangeConfig:type_name -> webapi.PermitExchangeConfig 62, // 53: webapi.PermitChannelConfig.ExchangeConfig:type_name -> webapi.PermitExchangeConfig
63, // 54: webapi.PermitChannelConfig.RankConfig:type_name -> webapi.PermitRankConfig 63, // 54: webapi.PermitChannelConfig.RankConfig:type_name -> webapi.PermitRankConfig
64, // 55: webapi.ActPermitConfig.Configs:type_name -> webapi.PermitChannelConfig 64, // 55: webapi.ActPermitConfig.Configs:type_name -> webapi.PermitChannelConfig
56, // [56:56] is the sub-list for method output_type 74, // 56: webapi.ItemConfig.Items:type_name -> server.DB_GameItem
56, // [56:56] is the sub-list for method input_type 57, // [57:57] is the sub-list for method output_type
56, // [56:56] is the sub-list for extension type_name 57, // [57:57] is the sub-list for method input_type
56, // [56:56] is the sub-list for extension extendee 57, // [57:57] is the sub-list for extension type_name
0, // [0:56] is the sub-list for field 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() } func init() { file_common_proto_init() }
@ -8665,6 +8729,18 @@ func file_common_proto_init() {
return nil return nil
} }
} }
file_common_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ItemConfig); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -8672,7 +8748,7 @@ func file_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_proto_rawDesc, RawDescriptor: file_common_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 72, NumMessages: 73,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -735,4 +735,10 @@ message ActPermitConfig{
int64 StartTs = 2; // int64 StartTs = 2; //
int32 Days = 3; // int32 Days = 3; //
repeated PermitChannelConfig Configs = 4; // repeated PermitChannelConfig Configs = 4; //
}
// etcd /game/item
message ItemConfig {
string Platform = 1; //
repeated server.DB_GameItem Items = 2; //
} }

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} pack := &bag.SCBagInfo{RetCode: bag.OpResultCode_OPRC_Sucess, BagNumMax: BagItemMax}
if bagInfo != nil { if bagInfo != nil {
for _, v := range bagInfo.BagItem { 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))*/ { 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{ pack.Infos = append(pack.Infos, &bag.ItemInfo{
ItemId: v.ItemId, ItemId: v.ItemId,
@ -286,7 +286,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
} }
case ItemCanExchange: case ItemCanExchange:
logger.Logger.Trace("道具兑换", msg.ItemId) 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 { if itemInfo == nil || itemInfo.Type != common.ItemTypeChange {
pack.RetCode = bag.OpResultCode_OPRC_NotChange pack.RetCode = bag.OpResultCode_OPRC_NotChange
send() send()
@ -385,7 +385,7 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
send(bag.OpResultCode_OPRC_UseUp) send(bag.OpResultCode_OPRC_UseUp)
return nil return nil
} }
info := srvdata.PBDB_GameItemMgr.GetData(int32(k)) info := srvdata.GameItemMgr.Get(p.Platform, int32(k))
if info != nil { if info != nil {
costItems = append(costItems, &Item{ costItems = append(costItems, &Item{
ItemId: int32(k), ItemId: int32(k),
@ -395,7 +395,7 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64
} }
} }
for k, v := range info.GetGain() { for k, v := range info.GetGain() {
info := srvdata.PBDB_GameItemMgr.GetData(int32(k)) info := srvdata.GameItemMgr.Get(p.Platform, int32(k))
if info != nil { if info != nil {
items = append(items, &Item{ items = append(items, &Item{
ItemId: int32(k), ItemId: int32(k),

View File

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

View File

@ -1035,7 +1035,7 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
send(welfare.OpResultCode_OPRC_ErrCost) send(welfare.OpResultCode_OPRC_ErrCost)
return nil return nil
} }
info := srvdata.PBDB_GameItemMgr.GetData(v.GetItemId()) info := srvdata.GameItemMgr.Get(p.Platform, v.GetItemId())
if info != nil { if info != nil {
costItems = append(costItems, &Item{ costItems = append(costItems, &Item{
ItemId: v.GetItemId(), ItemId: v.GetItemId(),
@ -1049,7 +1049,7 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
} }
} }
for _, v := range exchangeConfig.GetGain() { for _, v := range exchangeConfig.GetGain() {
info := srvdata.PBDB_GameItemMgr.GetData(v.GetItemId()) info := srvdata.GameItemMgr.Get(p.Platform, v.GetItemId())
if info != nil { if info != nil {
items = append(items, &Item{ items = append(items, &Item{
ItemId: v.GetItemId(), ItemId: v.GetItemId(),

View File

@ -99,7 +99,7 @@ func (this *BagMgr) GetItem(snid, itemId int32) *Item {
ItemId: itemId, ItemId: itemId,
} }
f := func() { f := func() {
itemX := srvdata.PBDB_GameItemMgr.GetData(itemId) itemX := srvdata.GameItemMgr.Get(p.Platform, itemId)
if itemX != nil { if itemX != nil {
item.Name = itemX.Name item.Name = itemX.Name
//item.ShowLocation = itemX.ShowLocation //item.ShowLocation = itemX.ShowLocation
@ -155,7 +155,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
if v == nil || v.ItemNum == 0 { if v == nil || v.ItemNum == 0 {
continue continue
} }
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
switch item.Type { switch item.Type {
case common.ItemTypeCoin: case common.ItemTypeCoin:
//增加金币 //增加金币
@ -216,7 +216,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
continue continue
} }
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
if item == nil { if item == nil {
code = bag.OpResultCode_OPRC_IdErr code = bag.OpResultCode_OPRC_IdErr
return newBagInfo, code, false return newBagInfo, code, false
@ -234,7 +234,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
continue continue
} }
item := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) item := srvdata.GameItemMgr.Get(p.Platform, v.ItemId)
if item == nil { if item == nil {
code = bag.OpResultCode_OPRC_IdErr code = bag.OpResultCode_OPRC_IdErr
continue continue
@ -374,7 +374,7 @@ func (this *BagMgr) AddItemsOffline(platform string, snid int32, addItems []*Ite
return return
} }
for _, v := range addItems { for _, v := range addItems {
itemData := srvdata.PBDB_GameItemMgr.GetData(v.ItemId) itemData := srvdata.GameItemMgr.Get(platform, v.ItemId)
if itemData == nil { if itemData == nil {
continue continue
} }
@ -658,7 +658,7 @@ func (this *BagMgr) Callback(player any, ret *internal.PlayerLoadReplay) {
BagItem: make(map[int32]*Item), BagItem: make(map[int32]*Item),
} }
for k, bi := range bagInfo.BagItem { 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 item != nil {
if bi.ItemNum > 0 { if bi.ItemNum > 0 {
newBagInfo.BagItem[k] = &Item{ newBagInfo.BagItem[k] = &Item{

View File

@ -18,7 +18,9 @@ import (
hallproto "mongo.games.com/game/protocol/gamehall" hallproto "mongo.games.com/game/protocol/gamehall"
loginproto "mongo.games.com/game/protocol/login" loginproto "mongo.games.com/game/protocol/login"
playerproto "mongo.games.com/game/protocol/player" playerproto "mongo.games.com/game/protocol/player"
serverproto "mongo.games.com/game/protocol/server"
"mongo.games.com/game/protocol/webapi" "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata"
) )
func init() { func init() {
@ -76,6 +78,8 @@ func init() {
etcd.Register(etcd.ETCDKEY_ACT_Invite, webapi.ActInviteConfig{}, platformConfigEvent) etcd.Register(etcd.ETCDKEY_ACT_Invite, webapi.ActInviteConfig{}, platformConfigEvent)
// 赛季通行证 // 赛季通行证
etcd.Register(etcd.ETCDKEY_ACT_Permit, webapi.ActPermitConfig{}, platformConfigEvent) etcd.Register(etcd.ETCDKEY_ACT_Permit, webapi.ActPermitConfig{}, platformConfigEvent)
// 道具列表
etcd.Register(etcd.ETCDKEY_Item, webapi.ItemConfig{}, platformConfigEvent)
} }
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) { func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
@ -263,6 +267,44 @@ func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, e
f() 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: default:
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey) 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/model"
"mongo.games.com/game/proto" "mongo.games.com/game/proto"
"mongo.games.com/game/protocol/bag" "mongo.games.com/game/protocol/bag"
hall_proto "mongo.games.com/game/protocol/gamehall" hallproto "mongo.games.com/game/protocol/gamehall"
login_proto "mongo.games.com/game/protocol/login" loginproto "mongo.games.com/game/protocol/login"
msg_proto "mongo.games.com/game/protocol/message" msgproto "mongo.games.com/game/protocol/message"
player_proto "mongo.games.com/game/protocol/player" playerproto "mongo.games.com/game/protocol/player"
"mongo.games.com/game/protocol/rankmatch" "mongo.games.com/game/protocol/rankmatch"
server_proto "mongo.games.com/game/protocol/server" serverproto "mongo.games.com/game/protocol/server"
shop_proto "mongo.games.com/game/protocol/shop" shopproto "mongo.games.com/game/protocol/shop"
webapi_proto "mongo.games.com/game/protocol/webapi" webapiproto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
"mongo.games.com/game/worldsrv/internal" "mongo.games.com/game/worldsrv/internal"
) )
@ -373,6 +373,7 @@ func (this *Player) OnLogined() {
this.SendToRepSrv(this.PlayerData) this.SendToRepSrv(this.PlayerData)
//红点检测 //红点检测
this.CheckShowRed() this.CheckShowRed()
this.SCItems()
TaskSubjectSingleton.Touch(common.TaskTypeLogin, &TaskData{SnId: this.SnId, Num: 1}) // 登录游戏 TaskSubjectSingleton.Touch(common.TaskTypeLogin, &TaskData{SnId: this.SnId, Num: 1}) // 登录游戏
@ -399,14 +400,14 @@ func (this *Player) OnRehold() {
gateSid = sessionId.Get() gateSid = sessionId.Get()
} }
} }
pack := &server_proto.WGPlayerRehold{ pack := &serverproto.WGPlayerRehold{
Id: proto.Int32(this.SnId), Id: proto.Int32(this.SnId),
Sid: proto.Int64(this.sid), Sid: proto.Int64(this.sid),
SceneId: proto.Int(this.scene.sceneId), SceneId: proto.Int(this.scene.sceneId),
GateSid: proto.Int64(gateSid), GateSid: proto.Int64(gateSid),
} }
proto.SetDefaults(pack) 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) logger.Logger.Tracef("WG PlayerRehold: %v", pack)
//} //}
gameid = this.scene.gameId gameid = this.scene.gameId
@ -517,7 +518,7 @@ func (this *Player) RandRobotExData() {
// SendGameConfig 玩家断线重连时,获取玩家所有游戏的配置信息 // SendGameConfig 玩家断线重连时,获取玩家所有游戏的配置信息
func (this *Player) SendGameConfig(gameId int32, plf, chl string) { func (this *Player) SendGameConfig(gameId int32, plf, chl string) {
pack := &hall_proto.SCGetGameConfig{ pack := &hallproto.SCGetGameConfig{
GameId: gameId, 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.Status && PlatformMgrSingleton.GetGlobalConfig().GameStatus[v.DbGameFree.Id] {
if v.DbGameFree.GetGameRule() != 0 && v.DbGameFree.GetGameId() == gameId { if v.DbGameFree.GetGameRule() != 0 && v.DbGameFree.GetGameId() == gameId {
// 场次配置 // 场次配置
lgc := &hall_proto.GameConfig1{ lgc := &hallproto.GameConfig1{
LogicId: proto.Int32(v.DbGameFree.Id), LogicId: proto.Int32(v.DbGameFree.Id),
LimitCoin: proto.Int64(v.DbGameFree.GetLimitCoin()), LimitCoin: proto.Int64(v.DbGameFree.GetLimitCoin()),
MaxCoinLimit: proto.Int64(v.DbGameFree.GetMaxCoinLimit()), 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) { if srvdata.GameFreeMgr.IsGameDif(gameId, common.GameDifChess) {
cfg := ChessRankMgrSington.GetChessRankConfig(this.GetPlatform().Name, gameId) cfg := ChessRankMgrSington.GetChessRankConfig(this.GetPlatform().Name, gameId)
for _, v := range cfg.GetDatas() { for _, v := range cfg.GetDatas() {
pack.ChessRanks = append(pack.ChessRanks, &hall_proto.ChessRankInfo{ pack.ChessRanks = append(pack.ChessRanks, &hallproto.ChessRankInfo{
Score: v.Score, Score: v.Score,
Name: v.Name, 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) 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) { func (this *Player) SendMessage(showId int64) {
pack := &msg_proto.SCMessageList{} pack := &msgproto.SCMessageList{}
if len(this.msgs) != 0 { if len(this.msgs) != 0 {
for _, msg := range this.msgs { 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) // 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()), Id: proto.String(msg.Id.Hex()),
Title: proto.String(msg.Title), Title: proto.String(msg.Title),
Content: proto.String(msg.Content), Content: proto.String(msg.Content),
@ -704,7 +705,7 @@ func (this *Player) SendMessage(showId int64) {
proto.SetDefaults(pack) proto.SetDefaults(pack)
} }
//nil的msg需要发给前端便于覆盖前一个玩家的信息 //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) { func (this *Player) ReadMessage(id string) {
@ -718,11 +719,11 @@ func (this *Player) ReadMessage(id string) {
}), }),
task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) { task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
if data == nil { if data == nil {
pack := &msg_proto.SCMessageRead{ pack := &msgproto.SCMessageRead{
Id: proto.String(id), Id: proto.String(id),
} }
proto.SetDefaults(pack) 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") }), "ReadMessage").StartByFixExecutor("logic_message")
} }
@ -732,12 +733,12 @@ func (this *Player) ReadMessage(id string) {
func (this *Player) WebDelMessage(id string) { func (this *Player) WebDelMessage(id string) {
if msg, exist := this.msgs[id]; exist { if msg, exist := this.msgs[id]; exist {
if msg.State != model.MSGSTATE_REMOVEED { // 未删除状态通知客户端 if msg.State != model.MSGSTATE_REMOVEED { // 未删除状态通知客户端
pack := &msg_proto.SCMessageDel{ pack := &msgproto.SCMessageDel{
Id: id, Id: id,
} }
proto.SetDefaults(pack) 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) 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) { task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
if data == nil { if data == nil {
pack := &msg_proto.SCMessageDel{ pack := &msgproto.SCMessageDel{
Id: id, Id: id,
} }
proto.SetDefaults(pack) 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 msg.State = model.MSGSTATE_REMOVEED
//删除此邮件 //删除此邮件
@ -793,7 +794,7 @@ func (this *Player) MessageShowRed() {
} }
} }
for showId := range msgMap { 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 msgMap[msg.ShowId] = 1
} }
for showId := range msgMap { 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 { // 领取失败 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) logger.Logger.Errorf("CSPlayerSettingHandler AddItems err", code)
pack := &msg_proto.SCGetMessageAttach{ pack := &msgproto.SCGetMessageAttach{
Id: proto.String(""), Id: proto.String(""),
} }
proto.SetDefaults(pack) 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 this.dirty = true
} }
@ -1270,11 +1271,11 @@ func (this *Player) GetMessageAttach(id string) {
} }
} }
} }
pack := &msg_proto.SCGetMessageAttach{ pack := &msgproto.SCGetMessageAttach{
Id: proto.String(id), Id: proto.String(id),
} }
proto.SetDefaults(pack) 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") }), "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), // Id: proto.String(id),
} }
@ -1451,7 +1452,7 @@ func (this *Player) GetMessageAttachs(ids []string) {
} }
proto.SetDefaults(pack) 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") }), "GetMessageAttach").StartByFixExecutor("logic_message")
@ -1470,12 +1471,12 @@ func (this *Player) GetMessageByGiftId(id string) *model.Message {
func (this *Player) Kickout(reason int32) { func (this *Player) Kickout(reason int32) {
if this.IsOnLine() { if this.IsOnLine() {
logger.Logger.Trace("(this *Player) Kickout()", this.SnId) logger.Logger.Trace("(this *Player) Kickout()", this.SnId)
scDisconnect := &login_proto.SSDisconnect{ scDisconnect := &loginproto.SSDisconnect{
SessionId: proto.Int64(this.sid), SessionId: proto.Int64(this.sid),
Type: proto.Int32(reason), Type: proto.Int32(reason),
} }
proto.SetDefaults(scDisconnect) 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) LoginStateMgrSington.LogoutBySid(this.sid)
this.DropLine() this.DropLine()
@ -1517,12 +1518,12 @@ func (this *Player) DropLine() {
this.PlayerData.LastLogoutTime = time.Now().Local() this.PlayerData.LastLogoutTime = time.Now().Local()
FriendMgrSington.UpdateLogoutTime(this.Platform, this.SnId) FriendMgrSington.UpdateLogoutTime(this.Platform, this.SnId)
if this.scene != nil && this.scene.gameSess != nil { if this.scene != nil && this.scene.gameSess != nil {
pack := &server_proto.WGPlayerDropLine{ pack := &serverproto.WGPlayerDropLine{
Id: proto.Int32(this.SnId), Id: proto.Int32(this.SnId),
SceneId: proto.Int(this.scene.sceneId), SceneId: proto.Int(this.scene.sceneId),
} }
proto.SetDefaults(pack) 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) PlayerMgrSington.DroplinePlayer(this)
this.sid = 0 this.sid = 0
@ -1544,11 +1545,11 @@ func (this *Player) Logout() {
// 在线奖励:累计在线时长 // 在线奖励:累计在线时长
//this.OnlineRewardAddUpOnlineDuration() //this.OnlineRewardAddUpOnlineDuration()
scLogout := &login_proto.SCLogout{ scLogout := &loginproto.SCLogout{
OpRetCode: login_proto.OpResultCode_OPRC_Sucess, OpRetCode: loginproto.OpResultCode_OPRC_Sucess,
} }
proto.SetDefaults(scLogout) 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.SetOffline()
this.LastLogoutTime = time.Now().Local() this.LastLogoutTime = time.Now().Local()
FriendMgrSington.UpdateLogoutTime(this.Platform, this.SnId) FriendMgrSington.UpdateLogoutTime(this.Platform, this.SnId)
@ -1727,10 +1728,10 @@ func (this *Player) UnmarshalData(data []byte, scene *Scene) {
this.dirty = true this.dirty = true
} }
func (this *Player) MarshalIParam() []*server_proto.PlayerIParam { func (this *Player) MarshalIParam() []*serverproto.PlayerIParam {
var params []*server_proto.PlayerIParam var params []*serverproto.PlayerIParam
for i, v := range this.Iparams { for i, v := range this.Iparams {
params = append(params, &server_proto.PlayerIParam{ params = append(params, &serverproto.PlayerIParam{
ParamId: proto.Int(i), ParamId: proto.Int(i),
IntVal: proto.Int64(v), IntVal: proto.Int64(v),
}) })
@ -1738,16 +1739,16 @@ func (this *Player) MarshalIParam() []*server_proto.PlayerIParam {
return params return params
} }
func (this *Player) UnmarshalIParam(params []*server_proto.PlayerIParam) { func (this *Player) UnmarshalIParam(params []*serverproto.PlayerIParam) {
for _, p := range params { for _, p := range params {
this.Iparams[int(p.GetParamId())] = p.GetIntVal() this.Iparams[int(p.GetParamId())] = p.GetIntVal()
} }
} }
func (this *Player) MarshalSParam() []*server_proto.PlayerSParam { func (this *Player) MarshalSParam() []*serverproto.PlayerSParam {
var params []*server_proto.PlayerSParam var params []*serverproto.PlayerSParam
for i, v := range this.sparams { for i, v := range this.sparams {
params = append(params, &server_proto.PlayerSParam{ params = append(params, &serverproto.PlayerSParam{
ParamId: proto.Int(i), ParamId: proto.Int(i),
StrVal: proto.String(v), StrVal: proto.String(v),
}) })
@ -1755,16 +1756,16 @@ func (this *Player) MarshalSParam() []*server_proto.PlayerSParam {
return params return params
} }
func (this *Player) UnmarshalSParam(params []*server_proto.PlayerSParam) { func (this *Player) UnmarshalSParam(params []*serverproto.PlayerSParam) {
for _, p := range params { for _, p := range params {
this.sparams[int(p.GetParamId())] = p.GetStrVal() this.sparams[int(p.GetParamId())] = p.GetStrVal()
} }
} }
func (this *Player) MarshalCParam() []*server_proto.PlayerCParam { func (this *Player) MarshalCParam() []*serverproto.PlayerCParam {
var params []*server_proto.PlayerCParam var params []*serverproto.PlayerCParam
for k, v := range this.cparams { for k, v := range this.cparams {
params = append(params, &server_proto.PlayerCParam{ params = append(params, &serverproto.PlayerCParam{
StrKey: proto.String(k), StrKey: proto.String(k),
StrVal: proto.String(v), StrVal: proto.String(v),
}) })
@ -2396,36 +2397,36 @@ func (this *Player) GetIP() string {
return this.Ip 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) gs := GameSessMgrSington.GetMinLoadSess(gameId)
if gs == nil { if gs == nil {
logger.Logger.Warnf("(this *Player) EnterScene %v, %v GameSessMgrSington.GetMinLoadSess() = nil ", this.SnId, gameId) 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()) s := SceneMgrSingleton.CreateScene(0, this.SnId, sceneId, gameId, gameMode, sceneMode, 1, numOfGames, params, gs, this.GetPlatform(), 0, dbGameFree, dbGameFree.GetId())
if s == nil { if s == nil {
logger.Logger.Tracef("(this *Player) EnterScene %v, SceneMgrSingleton.CreateScene() = nil ", this.SnId) 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, 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) gs := GameSessMgrSington.GetMinLoadSess(gameId)
if gs == nil { if gs == nil {
logger.Logger.Warnf("(this *Player) CreateLocalGameScene %v, %v GameSessMgrSington.GetMinLoadSess() = nil ", this.SnId, gameId) 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, s := SceneMgrSingleton.CreateLocalGameScene(this.SnId, sceneId, gameId, gameSite, sceneMode, 1, params, gs,
this.GetPlatform(), playerNum, dbGameFree, baseScore, groupId, dbGameFree.GetId()) this.GetPlatform(), playerNum, dbGameFree, baseScore, groupId, dbGameFree.GetId())
if s == nil { if s == nil {
logger.Logger.Tracef("(this *Player) EnterScene %v, SceneMgrSingleton.CreateScene() = nil ", this.SnId) 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 { func (this *Player) ReturnScene(isLoaded bool) *Scene {
@ -2439,7 +2440,7 @@ func (this *Player) ReturnScene(isLoaded bool) *Scene {
return nil return nil
} }
pack := &server_proto.WGPlayerReturn{ pack := &serverproto.WGPlayerReturn{
PlayerId: proto.Int32(this.SnId), PlayerId: proto.Int32(this.SnId),
IsLoaded: proto.Bool(isLoaded), IsLoaded: proto.Bool(isLoaded),
RoomId: proto.Int(this.scene.sceneId), RoomId: proto.Int(this.scene.sceneId),
@ -2449,7 +2450,7 @@ func (this *Player) ReturnScene(isLoaded bool) *Scene {
pack.EnterTs = proto.Int64(ctx.enterTs) pack.EnterTs = proto.Int64(ctx.enterTs)
} }
proto.SetDefaults(pack) 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) //MatchMgrSington.OnPlayerReturnScene(this.scene, this)
return this.scene return this.scene
@ -2483,7 +2484,7 @@ func (this *Player) AddMoneyPayTotal(amount int64) {
func (this *Player) SendDiffData() { func (this *Player) SendDiffData() {
this.UpdateVip() this.UpdateVip()
var dirty bool var dirty bool
pack := &player_proto.SCPlayerDataUpdate{} pack := &playerproto.SCPlayerDataUpdate{}
pack.UpdateField = 0 pack.UpdateField = 0
//金币 //金币
if this.diffData.Coin != this.Coin { if this.diffData.Coin != this.Coin {
@ -2585,7 +2586,7 @@ func (this *Player) SendDiffData() {
if dirty { if dirty {
FriendMgrSington.UpdateInfo(this.Platform, this.SnId) 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) logger.Logger.Trace("(this *Player) SendDiffData() ", pack)
} }
} }
@ -2968,9 +2969,9 @@ func (this *Player) GetPromoterKey() (string, error) {
func (this *Player) SendPlayerInfo() { func (this *Player) SendPlayerInfo() {
this.UpdateVip() this.UpdateVip()
scPlayerData := &player_proto.SCPlayerData{ scPlayerData := &playerproto.SCPlayerData{
OpRetCode: player_proto.OpResultCode_OPRC_Sucess, OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
Data: &player_proto.PlayerData{ Data: &playerproto.PlayerData{
AccId: proto.String(this.AccountId), //账号ID AccId: proto.String(this.AccountId), //账号ID
Platform: proto.String(this.Platform), //平台 Platform: proto.String(this.Platform), //平台
Channel: proto.String(this.Channel), //渠道 Channel: proto.String(this.Channel), //渠道
@ -3054,14 +3055,14 @@ func (this *Player) SendPlayerInfo() {
if endTime == 0 { if endTime == 0 {
continue continue
} }
weekInfo := player_proto.WeekInfo{ weekInfo := playerproto.WeekInfo{
Id: id, Id: id,
WeekCardTime: endTime, WeekCardTime: endTime,
WeekCardAward: this.WeekCardAward[id], WeekCardAward: this.WeekCardAward[id],
} }
scPlayerData.Data.WeekCard = append(scPlayerData.Data.WeekCard, &weekInfo) 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) logger.Logger.Tracef("Send SCPlayerData %v", scPlayerData)
if !this.IsRob { if !this.IsRob {
@ -3276,13 +3277,13 @@ func ReportSystemGiveEvent(pd *model.PlayerData, amount, tag int32, notifyClient
player := PlayerMgrSington.GetPlayerBySnId(pd.SnId) player := PlayerMgrSington.GetPlayerBySnId(pd.SnId)
if player != nil { if player != nil {
//通知客户端 //通知客户端
sendPack := &shop_proto.SCNotifyGiveCoinInfo{ sendPack := &shopproto.SCNotifyGiveCoinInfo{
GiveCoin: proto.Int64(int64(amount)), GiveCoin: proto.Int64(int64(amount)),
GiveTag: proto.Int32(tag), GiveTag: proto.Int32(tag),
} }
proto.SetDefaults(sendPack) proto.SetDefaults(sendPack)
player.SendToClient(int(shop_proto.SPacketID_SHOP_SC_GIVECOIN_INFO), sendPack) player.SendToClient(int(shopproto.SPacketID_SHOP_SC_GIVECOIN_INFO), sendPack)
} }
} }
} }
@ -3307,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) types := srvdata.PlayerTypeMgrSington.GetPlayerType(gamefreeId)
cnt := len(types) cnt := len(types)
if cnt > 0 { if cnt > 0 {
@ -3404,14 +3405,14 @@ func (this *Player) AddPayCoinLog(coin int64, coinType int32, oper string) {
// 充值回调 // 充值回调
func (this *Player) SendPlayerRechargeAnswer(coin int64) { func (this *Player) SendPlayerRechargeAnswer(coin int64) {
if this.Tel == "" { if this.Tel == "" {
pack := &player_proto.SCPlayerRechargeAnswer{ pack := &playerproto.SCPlayerRechargeAnswer{
OpParam: proto.Int64(1), OpParam: proto.Int64(1),
AddCoin: proto.Int64(coin), AddCoin: proto.Int64(coin),
Coin: proto.Int64(this.Coin), Coin: proto.Int64(this.Coin),
SafeBoxCoin: proto.Int64(this.SafeBoxCoin), SafeBoxCoin: proto.Int64(this.SafeBoxCoin),
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PLAYERRECHARGEANSWER), pack) this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PLAYERRECHARGEANSWER), pack)
} }
} }
@ -3463,12 +3464,12 @@ func (this *Player) SendPlayerRechargeAnswer(coin int64) {
//} //}
func (this *Player) SyncSafeBoxCoinToGame() { func (this *Player) SyncSafeBoxCoinToGame() {
pack := &server_proto.WGSyncPlayerSafeBoxCoin{ pack := &serverproto.WGSyncPlayerSafeBoxCoin{
SnId: proto.Int32(this.SnId), SnId: proto.Int32(this.SnId),
SafeBoxCoin: proto.Int64(this.SafeBoxCoin), SafeBoxCoin: proto.Int64(this.SafeBoxCoin),
} }
proto.SetDefaults(pack) 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) { //func (this *Player) GetDgHboPlayerName(plt *Platform) (string, string) {
@ -3522,12 +3523,12 @@ func OnPlayerPay(pd *model.PlayerData, coin int64) {
buf, err := pd.GetPlayerDataEncoder() buf, err := pd.GetPlayerDataEncoder()
if err == nil { if err == nil {
pack := &server_proto.WTPlayerPay{ pack := &serverproto.WTPlayerPay{
AddCoin: proto.Int64(coin), AddCoin: proto.Int64(coin),
PlayerData: buf.Bytes(), PlayerData: buf.Bytes(),
} }
proto.SetDefaults(pack) 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) //ActFPayMgrSington.OnPlayerPay(pd.SnId, pd.Platform, coin)
@ -3545,12 +3546,12 @@ func (this *Player) SendPlatformCanUsePromoterBind() {
} }
} }
pack := &player_proto.SCBindPromoterState{ pack := &playerproto.SCBindPromoterState{
BindState: proto.Int32(state), BindState: proto.Int32(state),
} }
proto.SetDefaults(pack) 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 { func (this *Player) RedirectByGame(packetid int, rawpack interface{}) bool {
@ -3565,13 +3566,13 @@ func (this *Player) RedirectByGame(packetid int, rawpack interface{}) bool {
data, err := netlib.MarshalPacket(packetid, rawpack) data, err := netlib.MarshalPacket(packetid, rawpack)
if err == nil { if err == nil {
pack := &server_proto.SSRedirectToPlayer{ pack := &serverproto.SSRedirectToPlayer{
SnId: proto.Int32(this.SnId), SnId: proto.Int32(this.SnId),
PacketId: proto.Int(packetid), PacketId: proto.Int(packetid),
Data: data, Data: data,
} }
proto.SetDefaults(pack) 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 return false
} }
@ -3584,12 +3585,12 @@ func (this *Player) SyncPlayerDataToGateSrv(pd *model.PlayerData) {
if err != nil { if err != nil {
logger.Logger.Info("(this *Player) UpdateToGateSrv gob.Marshal error", err) logger.Logger.Info("(this *Player) UpdateToGateSrv gob.Marshal error", err)
} else { } else {
pack := &server_proto.WRPlayerData{ pack := &serverproto.WRPlayerData{
Sid: this.sid, Sid: this.sid,
PlayerData: buf.Bytes(), PlayerData: buf.Bytes(),
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
this.gateSess.Send(int(server_proto.SSPacketID_PACKET_WR_PlayerData), pack) this.gateSess.Send(int(serverproto.SSPacketID_PACKET_WR_PlayerData), pack)
} }
} }
@ -3597,26 +3598,26 @@ func (this *Player) BindGroupTag(tags []string) {
if this.gateSess == nil { if this.gateSess == nil {
return return
} }
pack := &server_proto.SGBindGroupTag{ pack := &serverproto.SGBindGroupTag{
Sid: proto.Int64(this.sid), Sid: proto.Int64(this.sid),
Code: server_proto.SGBindGroupTag_OpCode_Add, Code: serverproto.SGBindGroupTag_OpCode_Add,
Tags: tags, Tags: tags,
} }
proto.SetDefaults(pack) 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) { func (this *Player) UnBindGroupTag(tags []string) {
if this.gateSess == nil { if this.gateSess == nil {
return return
} }
pack := &server_proto.SGBindGroupTag{ pack := &serverproto.SGBindGroupTag{
Sid: proto.Int64(this.sid), Sid: proto.Int64(this.sid),
Code: server_proto.SGBindGroupTag_OpCode_Del, Code: serverproto.SGBindGroupTag_OpCode_Del,
Tags: tags, Tags: tags,
} }
proto.SetDefaults(pack) 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) { func (this *Player) TryRetrieveLostGameCoin(sceneid int) {
@ -3662,9 +3663,9 @@ func (this *Player) SyncGameCoin(sceneid int, enterts int64) {
this.SendDiffData() this.SendDiffData()
}), "GetCoinWALBySnidAndInGameAndGreaterTs").Start() }), "GetCoinWALBySnidAndInGameAndGreaterTs").Start()
} }
func (this *Player) SendShowRed(showType hall_proto.ShowRedCode, showChild, isShow int32) { func (this *Player) SendShowRed(showType hallproto.ShowRedCode, showChild, isShow int32) {
pack := &hall_proto.SCShowRed{ pack := &hallproto.SCShowRed{
ShowRed: &hall_proto.ShowRed{ ShowRed: &hallproto.ShowRed{
ShowType: showType, ShowType: showType,
ShowChild: proto.Int32(showChild), ShowChild: proto.Int32(showChild),
IsShow: proto.Int32(isShow), IsShow: proto.Int32(isShow),
@ -3672,19 +3673,19 @@ func (this *Player) SendShowRed(showType hall_proto.ShowRedCode, showChild, isSh
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
logger.Logger.Trace("SCShowRed:", 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) { func (this *Player) SCVIPBuy(buy int64) {
//buy *= 10000 //buy *= 10000
//this.AddMoneyPayTotal(buy) //this.AddMoneyPayTotal(buy)
//this.GetVIPLevel(0) // 更新下vip等级 //this.GetVIPLevel(0) // 更新下vip等级
pack := &player_proto.SCVIPBuy{ pack := &playerproto.SCVIPBuy{
OpRetCode: player_proto.OpResultCode_OPRC_Sucess, OpRetCode: playerproto.OpResultCode_OPRC_Sucess,
} }
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp() // 获取经验会更新vip等级 pack.TolVipExp, pack.Money = this.GetCurrentVIPExp() // 获取经验会更新vip等级
pack.Vip = this.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() { func (this *Player) SCVIPInfo() {
@ -3692,15 +3693,15 @@ func (this *Player) SCVIPInfo() {
return return
} }
pack := &player_proto.SCVIPInfo{ pack := &playerproto.SCVIPInfo{
OpRetCode: player_proto.OpResultCode_OPRC_Error, OpRetCode: playerproto.OpResultCode_OPRC_Error,
} }
vips := VipMgrSington.GetVIPcfg(this.Platform) vips := VipMgrSington.GetVIPcfg(this.Platform)
if vips != nil { if vips != nil {
pack.MoneyRatio = int32(vips.MoneyRatio) pack.MoneyRatio = int32(vips.MoneyRatio)
for _, cfg := range vips.List { for _, cfg := range vips.List {
data := &player_proto.VIPcfg{ data := &playerproto.VIPcfg{
VipId: cfg.VipId, VipId: cfg.VipId,
VipEx: cfg.VipEx, VipEx: cfg.VipEx,
Price: cfg.Price, Price: cfg.Price,
@ -3718,13 +3719,13 @@ func (this *Player) SCVIPInfo() {
MatchFreeTimes: cfg.MatchFreeTimes, MatchFreeTimes: cfg.MatchFreeTimes,
} }
for itemId, itemNum := range cfg.Award { for itemId, itemNum := range cfg.Award {
data.Item = append(data.Item, &player_proto.ItemInfo{ data.Item = append(data.Item, &playerproto.ItemInfo{
ItemId: int32(itemId), ItemId: int32(itemId),
ItemNum: itemNum, ItemNum: itemNum,
}) })
} }
for itemId, itemNum := range cfg.Privilege7 { for itemId, itemNum := range cfg.Privilege7 {
data.Privilege7 = append(data.Privilege7, &player_proto.ItemInfo{ data.Privilege7 = append(data.Privilege7, &playerproto.ItemInfo{
ItemId: int32(itemId), ItemId: int32(itemId),
ItemNum: itemNum, ItemNum: itemNum,
}) })
@ -3745,11 +3746,11 @@ func (this *Player) SCVIPInfo() {
pack.TolVipExp, pack.Money = this.GetCurrentVIPExp(vips) pack.TolVipExp, pack.Money = this.GetCurrentVIPExp(vips)
pack.Vip = this.VIP pack.Vip = this.VIP
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess pack.OpRetCode = playerproto.OpResultCode_OPRC_Sucess
//WelfareMgrSington.MonitorWelfData(this) //WelfareMgrSington.MonitorWelfData(this)
//pack.VipId = append(pack.VipId, this.WelfData.VIPGift...) //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 { func (this *Player) GetVIPExpByPay(payTotal int32) int32 {
vips := VipMgrSington.GetVIPcfg(this.Platform) vips := VipMgrSington.GetVIPcfg(this.Platform)
@ -3757,12 +3758,12 @@ func (this *Player) GetVIPExpByPay(payTotal int32) int32 {
} }
func (this *Player) VIPDraw(id int32) { func (this *Player) VIPDraw(id int32) {
//WelfareMgrSington.MonitorWelfData(this) //WelfareMgrSington.MonitorWelfData(this)
pack := &player_proto.SCVIPDraw{ pack := &playerproto.SCVIPDraw{
Id: id, Id: id,
OpRetCode: player_proto.OpResultCode_OPRC_Error, OpRetCode: playerproto.OpResultCode_OPRC_Error,
} }
if id != 0 { if id != 0 {
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack) this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_DRAWVIPGIFT), pack)
return return
} }
if this.WelfData.VIPBag == nil { if this.WelfData.VIPBag == nil {
@ -3771,7 +3772,7 @@ func (this *Player) VIPDraw(id int32) {
if innerMap, ok := this.WelfData.VIPBag[this.VIP]; ok { if innerMap, ok := this.WelfData.VIPBag[this.VIP]; ok {
if _, ok := innerMap[0]; ok { if _, ok := innerMap[0]; ok {
logger.Logger.Trace("VIPDraw VIP is repeat id%v ", id) 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 return
} }
} else { } else {
@ -3782,7 +3783,7 @@ func (this *Player) VIPDraw(id int32) {
if vips != nil { if vips != nil {
for _, data := range vips.List { for _, data := range vips.List {
if data.VipId == this.VIP { 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 this.WelfData.VIPBag[this.VIP][0] = 1
//金币数量 //金币数量
money := data.Privilege1[0] money := data.Privilege1[0]
@ -3808,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) { func (this *Player) GetCurrentVIPExp(vipcfg ...*webapiproto.VIPcfgDataList) (exp int64, money int64) {
var vips *webapi_proto.VIPcfgDataList var vips *webapiproto.VIPcfgDataList
if len(vipcfg) == 0 { if len(vipcfg) == 0 {
vips = VipMgrSington.GetVIPcfg(this.Platform) vips = VipMgrSington.GetVIPcfg(this.Platform)
} else { } else {
@ -3917,7 +3918,7 @@ func (this *Player) GetPayGoodsInfo() {
case ShopPageBackend: case ShopPageBackend:
logger.Logger.Tracef("GetPayGoodsInfo ShopPageBackend %+v", *info) logger.Logger.Tracef("GetPayGoodsInfo ShopPageBackend %+v", *info)
default: default:
var itemInfo []*player_proto.PayItem var itemInfo []*playerproto.PayItem
var items []*Item var items []*Item
if len(info.Amount) > 0 { if len(info.Amount) > 0 {
this.AddCoin(int64(info.Amount[0]), 0, info.GainWay, "Callback_login", info.Remark) this.AddCoin(int64(info.Amount[0]), 0, info.GainWay, "Callback_login", info.Remark)
@ -3927,7 +3928,7 @@ func (this *Player) GetPayGoodsInfo() {
if info.ItemInfo != nil { if info.ItemInfo != nil {
for _, v := range info.ItemInfo { for _, v := range info.ItemInfo {
items = append(items, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum}) items = append(items, &Item{ItemId: v.ItemId, ItemNum: v.ItemNum})
itemInfo = append(itemInfo, &player_proto.PayItem{ itemInfo = append(itemInfo, &playerproto.PayItem{
ItemId: v.ItemId, ItemId: v.ItemId,
ItemNum: v.ItemNum, ItemNum: v.ItemNum,
}) })
@ -3979,12 +3980,12 @@ func (this *Player) GetPayGoodsInfo() {
BagMgrSingleton.AddItems(this, items, 0, info.GainWay, info.Operator, info.Remark, 0, 0, false) BagMgrSingleton.AddItems(this, items, 0, info.GainWay, info.Operator, info.Remark, 0, 0, false)
PayGoodsInfo := &player_proto.SCPayGoodsInfo{ PayGoodsInfo := &playerproto.SCPayGoodsInfo{
Gold: info.Amount, Gold: info.Amount,
Item: itemInfo, Item: itemInfo,
} }
proto.SetDefaults(PayGoodsInfo) 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 { if info.ConsumeNum > 0 {
TaskSubjectSingleton.Touch(common.TaskTypePay, &TaskData{ TaskSubjectSingleton.Touch(common.TaskTypePay, &TaskData{
@ -3999,7 +4000,7 @@ func (this *Player) GetPayGoodsInfo() {
} }
func (this *Player) SendJackPotInit() { func (this *Player) SendJackPotInit() {
var pack = &hall_proto.SCHundredSceneGetGameJackpot{} var pack = &hallproto.SCHundredSceneGetGameJackpot{}
gameFreeIds := []int32{ gameFreeIds := []int32{
3010001, 3010002, 3010003, 3010004, 3010001, 3010002, 3010003, 3010004,
3020001, 3020002, 3020003, 3020004, 3020001, 3020002, 3020003, 3020004,
@ -4009,7 +4010,7 @@ func (this *Player) SendJackPotInit() {
for _, id := range gameFreeIds { for _, id := range gameFreeIds {
data := srvdata.PBDB_GameFreeMgr.GetData(id) data := srvdata.PBDB_GameFreeMgr.GetData(id)
if data != nil && len(data.Jackpot) > 0 { if data != nil && len(data.Jackpot) > 0 {
jpfi := &hall_proto.GameJackpotFundInfo{ jpfi := &hallproto.GameJackpotFundInfo{
GameFreeId: proto.Int32(data.Id), GameFreeId: proto.Int32(data.Id),
JackPotFund: proto.Int64(int64(data.BaseScore * data.Jackpot[0])), JackPotFund: proto.Int64(int64(data.BaseScore * data.Jackpot[0])),
} }
@ -4017,7 +4018,7 @@ func (this *Player) SendJackPotInit() {
} }
} }
if len(pack.GameJackpotFund) > 0 { if len(pack.GameJackpotFund) > 0 {
this.SendToClient(int(hall_proto.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack) this.SendToClient(int(hallproto.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack)
} }
} }
@ -4154,11 +4155,11 @@ func (this *Player) SendPlayerCoin() {
func (this *Player) UnPlayerPowerEx(power int64) { func (this *Player) UnPlayerPowerEx(power int64) {
logger.Logger.Tracef("解锁炮倍 当前最大解锁炮倍:%v,要解锁的炮倍:%v", this.UnMaxPower, power) logger.Logger.Tracef("解锁炮倍 当前最大解锁炮倍:%v,要解锁的炮倍:%v", this.UnMaxPower, power)
if this.UnPlayerPower(power) { if this.UnPlayerPower(power) {
pack := &player_proto.SCPlayerUnPower{ pack := &playerproto.SCPlayerUnPower{
UnMaxpower: power, UnMaxpower: power,
} }
this.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) logger.Logger.Tracef("通知客户端解锁最大炮倍,snid = %v,power = %v", this.SnId, power)
} }
} }
@ -4182,10 +4183,10 @@ func (this *Player) ItemUnPlayerPowerListEx(itemId int32) {
if this.UnPlayerPowerList(powerId) { if this.UnPlayerPowerList(powerId) {
//通知客户端解锁炮台 //通知客户端解锁炮台
pack := &player_proto.SCPlayerUnPowerList{ pack := &playerproto.SCPlayerUnPowerList{
UnPowerList: powerId, 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) logger.Logger.Trace("通知客户端解锁炮台 snid = %v,解锁的炮台:%v,当前已有的炮台 = %v", this.SnId, powerId, this.PowerList)
} }
} }
@ -4198,10 +4199,10 @@ func (this *Player) UnPlayerPowerListEx(powerId int32) {
} }
if this.UnPlayerPowerList(powerId) { if this.UnPlayerPowerList(powerId) {
//通知客户端解锁炮台 //通知客户端解锁炮台
pack := &player_proto.SCPlayerUnPowerList{ pack := &playerproto.SCPlayerUnPowerList{
UnPowerList: powerId, 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) logger.Logger.Trace("通知客户端解锁炮台 snid = %v,解锁的炮台:%v,当前已有的炮台 = %v", this.SnId, powerId, this.PowerList)
} }
} }
@ -4218,12 +4219,12 @@ func (this *Player) UpdatePlayerVipBag(shopId int32) {
} }
this.WelfData.VIPBag[shopInfo.VipLevel][shopInfo.Id] = shopInfo.Type 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) 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, Id: shopInfo.Type,
Vip: shopInfo.VipLevel, 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固定礼包统计数据 //VIP金币礼包&VIP固定礼包统计数据
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
var item []model.ItemInfo var item []model.ItemInfo
@ -4367,10 +4368,10 @@ func (this *Player) addLotteryCount(count int32) {
this.LotteryCount = math.MaxInt32 this.LotteryCount = math.MaxInt32
} }
//通知客户端 //通知客户端
pack := &player_proto.SCPhoneLotteryCount{ pack := &playerproto.SCPhoneLotteryCount{
Count: this.LotteryCount, Count: this.LotteryCount,
} }
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_PhoneLotteryCount), pack) this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_PhoneLotteryCount), pack)
} }
@ -4614,7 +4615,7 @@ func (this *Player) GetWeekCardAwary(id int32) {
logger.Logger.Trace("周卡已过期,不能领取!") logger.Logger.Trace("周卡已过期,不能领取!")
return return
} }
ret := &player_proto.SCGetWeekCardAwary{} ret := &playerproto.SCGetWeekCardAwary{}
if !this.WeekCardAward[id] { if !this.WeekCardAward[id] {
//获取周卡奖励 //获取周卡奖励
items := data.GetDayRewards() items := data.GetDayRewards()
@ -4622,7 +4623,7 @@ func (this *Player) GetWeekCardAwary(id int32) {
for itemId, itemNum := range items { for itemId, itemNum := range items {
item := &Item{ItemId: int32(itemId), ItemNum: itemNum, ObtainTime: time.Now().Unix()} item := &Item{ItemId: int32(itemId), ItemNum: itemNum, ObtainTime: time.Now().Unix()}
addItem = append(addItem, item) addItem = append(addItem, item)
itemInfo := &player_proto.PayItem{} itemInfo := &playerproto.PayItem{}
itemInfo.ItemId = int32(itemId) itemInfo.ItemId = int32(itemId)
itemInfo.ItemNum = itemNum itemInfo.ItemNum = itemNum
ret.Items = append(ret.Items, itemInfo) ret.Items = append(ret.Items, itemInfo)
@ -4632,13 +4633,13 @@ func (this *Player) GetWeekCardAwary(id int32) {
this.WeekCardAward[id] = true this.WeekCardAward[id] = true
ret.WeekCardAward = this.WeekCardAward[id] ret.WeekCardAward = this.WeekCardAward[id]
} }
info := &player_proto.WeekInfo{ info := &playerproto.WeekInfo{
Id: id, Id: id,
WeekCardTime: this.WeekCardTime[id], WeekCardTime: this.WeekCardTime[id],
WeekCardAward: this.WeekCardAward[id], WeekCardAward: this.WeekCardAward[id],
} }
ret.WeekCard = info ret.WeekCard = info
this.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCGetWeekCardAwary), ret) this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCGetWeekCardAwary), ret)
return return
} }
@ -4672,7 +4673,7 @@ func (this *Player) AddItemRecExpireTime(itemId int32, num, add int64, gainWay i
if num != 0 /*&& !async*/ { if num != 0 /*&& !async*/ {
this.dirty = true this.dirty = true
if num > 0 { if num > 0 {
itemData := srvdata.PBDB_GameItemMgr.GetData(itemId) itemData := srvdata.GameItemMgr.Get(this.Platform, itemId)
if itemData == nil { if itemData == nil {
return return
} }
@ -4688,14 +4689,14 @@ func (this *Player) AddItemRecExpireTime(itemId int32, num, add int64, gainWay i
} }
if this.scene != nil && this.scene.gameSess != nil { if this.scene != nil && this.scene.gameSess != nil {
msg := &server_proto.WGBuyRecTimeItem{ msg := &serverproto.WGBuyRecTimeItem{
SnId: this.SnId, SnId: this.SnId,
ExpireTime: this.ItemRecExpireTime, ExpireTime: this.ItemRecExpireTime,
Diamond: this.Diamond, Diamond: this.Diamond,
} }
proto.SetDefaults(msg) proto.SetDefaults(msg)
this.SendToGame(int(server_proto.SSPacketID_PACKET_WG_BUYRECTIMEITEM), msg) this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_BUYRECTIMEITEM), msg)
} }
} }
@ -4715,3 +4716,38 @@ func (this *Player) GetIsPermit() bool {
} }
return false 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 { if dbItemArr != nil {
msg.Items = make(map[int32]int64) msg.Items = make(map[int32]int64)
for _, dbItem := range dbItemArr { for _, dbItem := range dbItemArr {

View File

@ -1219,7 +1219,7 @@ func (this *Tournament) sendPromotionInfo(mc *PlayerMatchContext, sortId int64,
wg := new(sync.WaitGroup) wg := new(sync.WaitGroup)
if pack.GetRankAward() != nil { if pack.GetRankAward() != nil {
for _, v := range pack.GetRankAward().GetItemInfo() { 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 { if data != nil && data.GetType() == common.ItemTypePhoneCode {
has = true has = true
item := v // 并发需要复制 item := v // 并发需要复制

View File

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

Binary file not shown.