动态道具列表
This commit is contained in:
parent
3d96c347d1
commit
0d33bf9fb4
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -33,4 +33,5 @@ const (
|
|||
ETCDKEY_ChannelSwitch = "/game/channel/switch" // 渠道开关
|
||||
ETCDKEY_ACT_Invite = "/game/act_invite" // 邀请活动配置
|
||||
ETCDKEY_ACT_Permit = "/game/act_permit" // 赛季通行证配置
|
||||
ETCDKEY_Item = "/game/item" // 道具列表
|
||||
)
|
||||
|
|
|
@ -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", "互动表情")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -123,6 +123,8 @@ type AllConfig struct {
|
|||
*webapi.ActPermitConfig
|
||||
PermitStartTs int64 // 开始时间戳
|
||||
PermitEndTs int64 // 结束时间戳
|
||||
// 道具配置
|
||||
*webapi.ItemConfig
|
||||
}
|
||||
|
||||
type GlobalConfig struct {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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,6 +211,7 @@ enum PlayerPacketID {
|
|||
PACKET_SCExchangeChannel = 2826; // 开启兑换的渠道
|
||||
PACKET_CSSMSConfig = 2827; //获取运营商配置
|
||||
PACKET_SCSMSConfig = 2828; //返回运营商配置
|
||||
PACKET_SCItem = 2830; // 返回道具列表
|
||||
}
|
||||
|
||||
// 账变记录
|
||||
|
@ -1210,4 +1213,9 @@ message SCSMSConfig{
|
|||
message SMSInfo{
|
||||
int32 Id = 1;
|
||||
string SmsName = 2;
|
||||
}
|
||||
|
||||
// PACKET_SCItem
|
||||
message SCItem{
|
||||
repeated server.DB_GameItem Items = 1; // 道具列表
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -879,6 +879,8 @@ message DB_GameItem {
|
|||
|
||||
int32 Entity = 17;
|
||||
|
||||
string Icon = 18;
|
||||
|
||||
}
|
||||
|
||||
message DB_GameItemArray {
|
||||
|
|
|
@ -6636,6 +6636,62 @@ func (x *ActPermitConfig) GetConfigs() []*PermitChannelConfig {
|
|||
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_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,
|
||||
0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x43, 0x68, 0x61,
|
||||
0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x73, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d,
|
||||
0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x69, 0x67, 0x73, 0x22, 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 (
|
||||
|
@ -7727,7 +7788,7 @@ func file_common_proto_rawDescGZIP() []byte {
|
|||
return file_common_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 72)
|
||||
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 73)
|
||||
var file_common_proto_goTypes = []interface{}{
|
||||
(*MysqlDbSetting)(nil), // 0: webapi.MysqlDbSetting
|
||||
(*MongoDbSetting)(nil), // 1: webapi.MongoDbSetting
|
||||
|
@ -7795,33 +7856,35 @@ var file_common_proto_goTypes = []interface{}{
|
|||
(*PermitRankConfig)(nil), // 63: webapi.PermitRankConfig
|
||||
(*PermitChannelConfig)(nil), // 64: webapi.PermitChannelConfig
|
||||
(*ActPermitConfig)(nil), // 65: webapi.ActPermitConfig
|
||||
nil, // 66: webapi.Platform.BindTelRewardEntry
|
||||
nil, // 67: webapi.PlayerData.RankScoreEntry
|
||||
nil, // 68: webapi.ItemShop.AwardEntry
|
||||
nil, // 69: webapi.VIPcfg.AwardEntry
|
||||
nil, // 70: webapi.VIPcfg.Privilege7Entry
|
||||
nil, // 71: webapi.ActInviteConfig.PayScoreEntry
|
||||
(*server.DB_GameFree)(nil), // 72: server.DB_GameFree
|
||||
(*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
|
||||
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
|
||||
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
|
||||
0, // 7: webapi.PlatformDbConfig.Mysql:type_name -> webapi.MysqlDbSetting
|
||||
1, // 8: webapi.PlatformDbConfig.MongoDb:type_name -> webapi.MongoDbSetting
|
||||
1, // 9: webapi.PlatformDbConfig.MongoDbLog:type_name -> webapi.MongoDbSetting
|
||||
72, // 10: webapi.GameConfigGroup.DbGameFree:type_name -> server.DB_GameFree
|
||||
67, // 11: webapi.PlayerData.RankScore:type_name -> webapi.PlayerData.RankScoreEntry
|
||||
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
|
||||
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
|
||||
29, // 19: webapi.MatchInfoAward.ItemId:type_name -> webapi.ItemInfo
|
||||
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
|
||||
45, // 36: webapi.WelfareFirstPayDataList.List:type_name -> webapi.WelfareSpree
|
||||
45, // 37: webapi.WelfareContinuousPayDataList.List:type_name -> webapi.WelfareSpree
|
||||
69, // 38: webapi.VIPcfg.Award:type_name -> webapi.VIPcfg.AwardEntry
|
||||
70, // 39: webapi.VIPcfg.Privilege7:type_name -> webapi.VIPcfg.Privilege7Entry
|
||||
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
|
||||
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, // 45: webapi.ActInviteConfig.Awards2: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
|
||||
63, // 54: webapi.PermitChannelConfig.RankConfig:type_name -> webapi.PermitRankConfig
|
||||
64, // 55: webapi.ActPermitConfig.Configs:type_name -> webapi.PermitChannelConfig
|
||||
56, // [56:56] is the sub-list for method output_type
|
||||
56, // [56:56] is the sub-list for method input_type
|
||||
56, // [56:56] is the sub-list for extension type_name
|
||||
56, // [56:56] is the sub-list for extension extendee
|
||||
0, // [0:56] is the sub-list for field type_name
|
||||
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() }
|
||||
|
@ -8665,6 +8729,18 @@ func file_common_proto_init() {
|
|||
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{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -8672,7 +8748,7 @@ func file_common_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_common_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 72,
|
||||
NumMessages: 73,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -735,4 +735,10 @@ message ActPermitConfig{
|
|||
int64 StartTs = 2; // 开始日期
|
||||
int32 Days = 3; // 持续天数
|
||||
repeated PermitChannelConfig Configs = 4; // 渠道配置
|
||||
}
|
||||
|
||||
// etcd /game/item
|
||||
message ItemConfig {
|
||||
string Platform = 1; // 平台
|
||||
repeated server.DB_GameItem Items = 2; // 道具列表
|
||||
}
|
|
@ -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]
|
||||
}
|
|
@ -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,
|
||||
|
@ -286,7 +286,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 +385,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 +395,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),
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -1035,7 +1035,7 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
|
|||
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(),
|
||||
|
@ -1049,7 +1049,7 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int
|
|||
}
|
||||
}
|
||||
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(),
|
||||
|
|
|
@ -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
|
||||
|
@ -155,7 +155,7 @@ func (this *BagMgr) AddItems(p *Player, addItems []*Item, add int64, gainWay int
|
|||
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 +216,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 +234,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
|
||||
|
@ -374,7 +374,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 +658,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{
|
||||
|
|
|
@ -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() {
|
||||
|
@ -76,6 +78,8 @@ func init() {
|
|||
etcd.Register(etcd.ETCDKEY_ACT_Invite, webapi.ActInviteConfig{}, platformConfigEvent)
|
||||
// 赛季通行证
|
||||
etcd.Register(etcd.ETCDKEY_ACT_Permit, webapi.ActPermitConfig{}, platformConfigEvent)
|
||||
// 道具列表
|
||||
etcd.Register(etcd.ETCDKEY_Item, webapi.ItemConfig{}, platformConfigEvent)
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
})
|
||||
|
@ -2396,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 {
|
||||
|
@ -2439,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),
|
||||
|
@ -2449,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
|
||||
|
@ -2483,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 {
|
||||
|
@ -2585,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)
|
||||
}
|
||||
}
|
||||
|
@ -2968,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), //渠道
|
||||
|
@ -3054,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 {
|
||||
|
@ -3276,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
cnt := len(types)
|
||||
if cnt > 0 {
|
||||
|
@ -3404,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3463,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) {
|
||||
|
@ -3522,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)
|
||||
|
@ -3545,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 {
|
||||
|
@ -3565,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
|
||||
}
|
||||
|
@ -3584,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3597,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) {
|
||||
|
@ -3662,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),
|
||||
|
@ -3672,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() {
|
||||
|
@ -3692,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,
|
||||
|
@ -3718,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,
|
||||
})
|
||||
|
@ -3745,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)
|
||||
|
@ -3757,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 {
|
||||
|
@ -3771,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 {
|
||||
|
@ -3782,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]
|
||||
|
@ -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) {
|
||||
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 {
|
||||
|
@ -3917,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)
|
||||
|
@ -3927,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,
|
||||
})
|
||||
|
@ -3979,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{
|
||||
|
@ -3999,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,
|
||||
|
@ -4009,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])),
|
||||
}
|
||||
|
@ -4017,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4154,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)
|
||||
}
|
||||
}
|
||||
|
@ -4182,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)
|
||||
}
|
||||
}
|
||||
|
@ -4198,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)
|
||||
}
|
||||
}
|
||||
|
@ -4218,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
|
||||
|
@ -4367,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)
|
||||
|
||||
}
|
||||
|
||||
|
@ -4614,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()
|
||||
|
@ -4622,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)
|
||||
|
@ -4632,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
|
||||
}
|
||||
|
||||
|
@ -4672,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
|
||||
}
|
||||
|
@ -4688,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4715,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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1219,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 // 并发需要复制
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue