Compare commits

..

No commits in common. "c5610f58dc510922410f17ac5f0ee1e89583e171" and "15014b54bb29ff7d773e93ad02d7180c0569c894" have entirely different histories.

174 changed files with 62612 additions and 13994 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "public"]
path = public
url = git@git.pogorockgames.com:mango-games/server/public.git

View File

@ -2,6 +2,27 @@
游戏业务代码 游戏业务代码
### 子仓库
public子仓库本项目本身并没有使用只是用来暴露部分公共代码供其他项目使用。
例如:
1.客户端同步通信协议
2.客户端同步游戏配置
#### 初始化子仓库
```
git submodule update --init --recursive
```
#### 更新子仓库
```
git submodule update --remote
```
#### 更新并提交子仓库代码
```
update_public.sh
```
### 脚本 ### 脚本
#### gen_data.bat #### gen_data.bat
xlsx文件转换为json,dat文件,生成pbdata.proto,生成srvdata包 xlsx文件转换为json,dat文件,生成pbdata.proto,生成srvdata包

View File

@ -77,12 +77,7 @@ const (
GameId_IceAge = 304 // 冰河世纪 GameId_IceAge = 304 // 冰河世纪
GameId_TamQuoc = 305 // 百战成神 GameId_TamQuoc = 305 // 百战成神
GameId_Fruits = 306 // 水果拉霸 GameId_Fruits = 306 // 水果拉霸
GameId_Richblessed = 307 // 多福 GameId_Richblessed = 307 // 多福多财
GameId_FortuneTiger = 308 // FortuneTiger
GameId_FortuneDragon = 309 // FortuneDragon
GameId_FortuneRabbit = 310 // FortuneRabbit
GameId_FortuneOx = 311 // FortuneOx
GameId_FortuneMouse = 312 // FortuneMouse
__GameId_Fishing_Min__ = 400 //################捕鱼类################ __GameId_Fishing_Min__ = 400 //################捕鱼类################
GameId_HFishing = 401 //欢乐捕鱼 GameId_HFishing = 401 //欢乐捕鱼
GameId_TFishing = 402 //天天捕鱼 GameId_TFishing = 402 //天天捕鱼
@ -98,7 +93,7 @@ const (
GameId_Clawdoll = 608 // 娃娃机 GameId_Clawdoll = 608 // 娃娃机
__GameId_ThrGame_Min__ = 700 //################三方类################ __GameId_ThrGame_Min__ = 700 //################三方类################
GameId_Thr_Dg = 701 //DG Game GameId_Thr_Dg = 701 //DG Game
GameId_Thr_XHJ = 901 ///DG Game GameId_Thr_XHJ = 901 //DG Game
) )
const ( const (
@ -176,24 +171,27 @@ func IsDaZhong(gameId int) bool {
// 房间编号区间 // 房间编号区间
const ( const (
PrivateSceneStartId = 100000 PrivateSceneStartId = 10000000
PrivateSceneMaxId = 999999 PrivateSceneMaxId = 99999999
MatchSceneStartId = 100000000 MatchSceneStartId = 100000000
MatchSceneMaxId = 199999999 MatchSceneMaxId = 199999999
HundredSceneStartId = 200000000 HundredSceneStartId = 200000000
HundredSceneMaxId = 299999999 HundredSceneMaxId = 299999999
CoinSceneStartId = 1000000000 HallSceneStartId = 300000000
HallSceneMaxId = 399999999
MiniGameSceneStartId = 400000000
MiniGameSceneMaxId = 409999999
CoinSceneStartId = 1000000000 //区间预留大点,因为队列匹配比较耗id,假定一天100w牌局,那么这个id区间够用1000天
CoinSceneMaxId = 1999999999 CoinSceneMaxId = 1999999999
DgSceneId = 99 DgSceneId = 99
) )
// 房间模式 // 房间模式
const ( const (
SceneModePublic = 0 // 公共房间 SceneMode_Public = 0 //公共房间
SceneModePrivate = 2 // 私人房间 SceneMode_Private = 2 //私人房间
SceneModeMatch = 3 // 赛事房间 SceneMode_Match = 3 //赛事房间
SceneModeThr = 4 // 三方房间 SceneMode_Thr = 4 //三方房间
SceneModePrivateMatch = 5 // 竞技馆房间
) )
const ( const (
@ -311,9 +309,6 @@ const (
GainWayItemFenGain = 103 // 道具分解获得 GainWayItemFenGain = 103 // 道具分解获得
GainWayGuide = 104 //新手引导奖励 GainWayGuide = 104 //新手引导奖励
GainWayVipGift9 = 105 //vip等级礼包 GainWayVipGift9 = 105 //vip等级礼包
GainWayRoomCost = 106 //房费消耗
GainWayRoomGain = 107 //房卡场获得
GainWayItemShop = 108 // 交易市场道具交易
) )
// 后台选择 金币变化类型 的充值 类型id号起始 // 后台选择 金币变化类型 的充值 类型id号起始
@ -356,6 +351,30 @@ const (
PlayerLeaveReason_AutoState //托管状态踢出房间 PlayerLeaveReason_AutoState //托管状态踢出房间
) )
// 万分比
const RATE_BASE_VALUE int32 = 10000
const (
SceneState_Normal int = iota
SceneState_Fishing //鱼潮
)
const (
PlayerType_Rob int32 = 0
PlayerType_Undefine = 1
PlayerType_Black = -1
PlayerType_White = -2
)
const (
CoinPoolAIModel_Default int32 = iota //默认
CoinPoolAIModel_Normal //正常模式
CoinPoolAIModel_ShouFen //收分模式
CoinPoolAIModel_ZheZhong //折中模式
CoinPoolAIModel_TuFen //吐分
CoinPoolAIModel_Max //
)
const ( const (
RobotServerType int = 9 RobotServerType int = 9
RobotServerId = 901 RobotServerId = 901
@ -438,6 +457,12 @@ const (
MatchTrueMan_Priority = 1 //优先匹配真人 MatchTrueMan_Priority = 1 //优先匹配真人
) )
const (
SingleAdjustModeNormal = 0
SingleAdjustModeWin = 1
SingleAdjustModeLose = 2
)
// 自动化标签(程序里产生的全部<0) // 自动化标签(程序里产生的全部<0)
const ( const (
AutomaticTag_QZNN_Smart int32 = -1 AutomaticTag_QZNN_Smart int32 = -1
@ -482,6 +507,35 @@ const (
CodeTypeNo = 3 // 不使用验证码 CodeTypeNo = 3 // 不使用验证码
) )
const (
ActId_Share int = iota //0.微信分享
ActId_OnlineReward //1.在线奖励
ActId_UpgradeAccount //2.升级账号
ActId_GoldTask //3.财神任务
ActId_GoldCome //4.财神降临
ActId_LuckyTurntable //5.转盘活动
ActId_Yeb //6.余额宝
ActId_Card //7.周卡月卡
ActId_RebateTask //8.返利获取
ActId_IOSINSTALLSTABLE //9.ios安装奖励
ActId_VipLevelBonus //10.vip日周月等级奖励
ActId_LoginRandCoin //11.登录红包
ActId_OnlineRandCoin //12.红包雨
ActId_MatchSwitch //13.比赛开关
ActId_PromoterBind //14.手动绑定推广员
ActId_Lottery //15.彩金池
ActId_Task //16.活跃任务
ActId_PROMOTER //17.全民推广
ActId_Activity //18.活动界面
ActId_NewYear //19.新年暗号红包活动
ActId_Guess //20.猜灯谜活动
ActId_Sign //21.七日签到
ExchangeId_Alipay //22.兑换到支付宝
ExchangeId_Bank //23.兑换到银行卡
ExchangeId_Wechat //24.兑换到微信
ActId_Max
)
// 匹配模式 // 匹配模式
const ( const (
MatchMode_Normal int32 = iota //普通匹配 MatchMode_Normal int32 = iota //普通匹配
@ -701,7 +755,6 @@ const (
InviteScoreTypePay = 2 // 充值 InviteScoreTypePay = 2 // 充值
InviteScoreTypeRecharge = 3 // 充值完成 InviteScoreTypeRecharge = 3 // 充值完成
InviteScoreTypePayMe = 4 // 充值(给自己) InviteScoreTypePayMe = 4 // 充值(给自己)
InviteScoreTypeBindTel = 5 // 绑定手机号
) )
func InMatchChannel(ls []string, n string) bool { func InMatchChannel(ls []string, n string) bool {
@ -814,36 +867,3 @@ const (
DataConfigSprite = 1 // 精灵配置 DataConfigSprite = 1 // 精灵配置
DataConfigMatchAudience = 2 // 赛事观战开关 DataConfigMatchAudience = 2 // 赛事观战开关
) )
// 房间状态
const (
SceneStateWaite = 0 // 等待
SceneStateStart = 1 // 开始
SceneStateEnd = 2 // 结束
)
const (
// PlayerHistoryModel .
PlayerHistoryModel = iota + 1
// BIGWIN_HISTORY_MODEL .
BIGWIN_HISTORY_MODEL
// GameHistoryModel .
GameHistoryModel
)
type ListOpType int // 列表操作类型
const (
ListModify ListOpType = 1 // 修改
ListAdd ListOpType = 2 // 增加
ListDel ListOpType = 3 // 减少
ListFind ListOpType = 4 // 查询
)
type NotifyType int // 通知类型
const (
NotifyPrivateRoomList NotifyType = 1 // 私人房间列表
)

View File

@ -452,22 +452,6 @@ func SliceValueWeight(sl []int, index int) float64 {
return float64(value) / float64(totle) return float64(value) / float64(totle)
} }
func GetMapKeys[K comparable, V any](data map[K]V) []K {
var ret []K
for k := range data {
ret = append(ret, k)
}
return ret
}
func GetMapValues[K comparable, V any](data map[K]V) []V {
var ret []V
for _, v := range data {
ret = append(ret, v)
}
return ret
}
type Int32Slice []int32 type Int32Slice []int32
func (p Int32Slice) Len() int { return len(p) } func (p Int32Slice) Len() int { return len(p) }

View File

@ -103,8 +103,3 @@
²°»€ŽÎ€áë €„¯_XÈ`À¤ÿ ²°»€ŽÎ€áë €„¯_XÈ`À¤ÿ
³°»€Æ†<C386>€åšw €”ëÜ`À¶üš ³°»€Æ†<C386>€åšw €”ëÜ`À¶üš
´°»€Œ<E282AC>ž€Êµî €¨Ö¹`€íøµ ´°»€Œ<E282AC>ž€Êµî €¨Ö¹`€íøµ
Áþ»€›îÀ–± €ÚÄ XÈ` ÝŒ
Ñ̼€ŽÎ€áë €„¯_XÈ`À¤ÿ
áš½€Æ†<C386>€åšw €”ëÜ`À¶üš
ñè½€Œ<E282AC>ž€Êµî €¨Ö¹`€íøµ
<08>·¾€Œ<E282AC>ž€Êµî €¨Ö¹`€íøµ

View File

@ -1065,46 +1065,6 @@
"UpperLimit": 2000000000, "UpperLimit": 2000000000,
"CtrlRate": 200, "CtrlRate": 200,
"InitNovicValue": 650000000 "InitNovicValue": 650000000
},
{
"Id": 3080001,
"InitValue": 6000000,
"LowerLimit": 5000000,
"UpperLimit": 20000000,
"CtrlRate": 200,
"InitNovicValue": 6500000
},
{
"Id": 3090001,
"InitValue": 60000000,
"LowerLimit": 50000000,
"UpperLimit": 200000000,
"CtrlRate": 200,
"InitNovicValue": 65000000
},
{
"Id": 3100001,
"InitValue": 300000000,
"LowerLimit": 250000000,
"UpperLimit": 1000000000,
"CtrlRate": 200,
"InitNovicValue": 325000000
},
{
"Id": 3110001,
"InitValue": 600000000,
"LowerLimit": 500000000,
"UpperLimit": 2000000000,
"CtrlRate": 200,
"InitNovicValue": 650000000
},
{
"Id": 3120001,
"InitValue": 600000000,
"LowerLimit": 500000000,
"UpperLimit": 2000000000,
"CtrlRate": 200,
"InitNovicValue": 650000000
} }
] ]
} }

Binary file not shown.

View File

@ -6491,175 +6491,10 @@
"PlayerWaterRate": 100, "PlayerWaterRate": 100,
"BetWaterRate": 100 "BetWaterRate": 100
}, },
{
"Id": 3080001,
"Name": "FortuneTiger",
"Title": "1",
"GameId": 308,
"GameRule": 30800,
"GameType": 3,
"SceneType": 1,
"Desc": "0",
"ShowType": 2,
"ShowId": 30800,
"BaseScore": 1000,
"Turn": 30800,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
0
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "308",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{
"Id": 3090001,
"Name": "FortuneDragon",
"Title": "1",
"GameId": 309,
"GameRule": 30900,
"GameType": 3,
"SceneType": 1,
"Desc": "0",
"ShowType": 2,
"ShowId": 30900,
"BaseScore": 1000,
"Turn": 30900,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
0
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "309",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{
"Id": 3100001,
"Name": "FortuneRabbit",
"Title": "1",
"GameId": 310,
"GameRule": 31000,
"GameType": 3,
"SceneType": 1,
"Desc": "0",
"ShowType": 2,
"ShowId": 31000,
"BaseScore": 1000,
"Turn": 31000,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
0
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "310",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{
"Id": 3110001,
"Name": "FortuneOx",
"Title": "1",
"GameId": 311,
"GameRule": 31100,
"GameType": 3,
"SceneType": 1,
"Desc": "0",
"ShowType": 2,
"ShowId": 31100,
"BaseScore": 1000,
"Turn": 31100,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
0
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "311",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{
"Id": 3120001,
"Name": "FortuneMouse",
"Title": "1",
"GameId": 312,
"GameRule": 31200,
"GameType": 3,
"SceneType": 1,
"Desc": "0",
"ShowType": 2,
"ShowId": 31200,
"BaseScore": 1000,
"Turn": 31200,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
0
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "312",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{ {
"Id": 6080001, "Id": 6080001,
"Name": "娃娃机", "Name": "娃娃机",
"Title": "大娃娃场", "Title": "1",
"GameId": 608, "GameId": 608,
"GameRule": 60800, "GameRule": 60800,
"GameType": 1, "GameType": 1,
@ -6688,105 +6523,6 @@
], ],
"PlayerWaterRate": 100, "PlayerWaterRate": 100,
"BetWaterRate": 100 "BetWaterRate": 100
},
{
"Id": 6080002,
"Name": "娃娃机",
"Title": "大娃娃场",
"GameId": 608,
"GameRule": 60800,
"GameType": 1,
"SceneType": 2,
"Desc": "0",
"ShowType": 3,
"ShowId": 60800,
"BaseScore": 1000,
"Turn": 60800,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
0
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "608",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{
"Id": 6080003,
"Name": "娃娃机",
"Title": "中娃娃场",
"GameId": 608,
"GameRule": 60800,
"GameType": 1,
"SceneType": 3,
"Desc": "0",
"ShowType": 3,
"ShowId": 60800,
"BaseScore": 1000,
"Turn": 60800,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
1
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "608",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
},
{
"Id": 6080004,
"Name": "娃娃机",
"Title": "中娃娃场",
"GameId": 608,
"GameRule": 60800,
"GameType": 1,
"SceneType": 4,
"Desc": "0",
"ShowType": 3,
"ShowId": 60800,
"BaseScore": 1000,
"Turn": 60800,
"BetDec": "1000",
"Ai": [
0
],
"OtherIntParams": [
1
],
"RobotNumRng": [
0
],
"SameIpLimit": 1,
"GameDif": "608",
"GameClass": 2,
"PlatformName": "越南棋牌",
"MaxBetCoin": [
0
],
"PlayerWaterRate": 100,
"BetWaterRate": 100
} }
] ]
} }

Binary file not shown.

View File

@ -435,72 +435,6 @@
"Location": "0", "Location": "0",
"Describe": "作用:用于报名冠军赛事;\n产出途径参加任意锦标赛获得冠军\n" "Describe": "作用:用于报名冠军赛事;\n产出途径参加任意锦标赛获得冠军\n"
}, },
{
"Id": 40002,
"Name": "房卡",
"ShowLocation": [
1,
1
],
"Classify": [
1,
1,
0
],
"Type": 24,
"Effect0": [
0,
0,
0,
0,
0
],
"Effect": [
0,
0,
0,
0,
0
],
"SaleGold": 10000,
"Composition": 1,
"CompositionMax": 9999,
"Location": "0",
"Describe": "作用:用于参与竞技馆内玩法;\n产出途径商城购买\n"
},
{
"Id": 40003,
"Name": "娃娃卡",
"ShowLocation": [
1,
1
],
"Classify": [
1,
1,
0
],
"Type": 23,
"Effect0": [
0,
0,
0,
0,
0
],
"Effect": [
0,
0,
0,
0,
0
],
"SaleGold": 10000,
"Composition": 1,
"CompositionMax": 9999,
"Location": "0",
"Describe": "作用:用于抓娃娃机抓娃娃;\n产出途径商城购买\n"
},
{ {
"Id": 50001, "Id": 50001,
"Name": "碎片礼盒", "Name": "碎片礼盒",

Binary file not shown.

View File

@ -10,43 +10,43 @@
"Id": 20800, "Id": 20800,
"Name": "Tienlen自由桌娱乐场-WTA", "Name": "Tienlen自由桌娱乐场-WTA",
"GameId": 208, "GameId": 208,
"GameDif": "207" "GameDif": "208"
}, },
{ {
"Id": 20900, "Id": 20900,
"Name": "Tienlen自由桌经典场(打到底)", "Name": "Tienlen自由桌经典场(打到底)",
"GameId": 209, "GameId": 209,
"GameDif": "207" "GameDif": "209"
}, },
{ {
"Id": 21000, "Id": 21000,
"Name": "Tienlen自由桌娱乐场(打到底)", "Name": "Tienlen自由桌娱乐场(打到底)",
"GameId": 210, "GameId": 210,
"GameDif": "207" "GameDif": "210"
}, },
{ {
"Id": 24000, "Id": 24000,
"Name": "Tienlen经典场-WTA", "Name": "Tienlen经典场-WTA",
"GameId": 240, "GameId": 240,
"GameDif": "207" "GameDif": "240"
}, },
{ {
"Id": 24400, "Id": 24400,
"Name": "Tienlen经典场打到底", "Name": "Tienlen经典场打到底",
"GameId": 244, "GameId": 244,
"GameDif": "207" "GameDif": "244"
}, },
{ {
"Id": 24100, "Id": 24100,
"Name": "Tienlen娱乐场-WTA", "Name": "Tienlen娱乐场-WTA",
"GameId": 241, "GameId": 241,
"GameDif": "207" "GameDif": "241"
}, },
{ {
"Id": 24500, "Id": 24500,
"Name": "tienlen娱乐版打到底", "Name": "tienlen娱乐版打到底",
"GameId": 245, "GameId": 245,
"GameDif": "207" "GameDif": "245"
}, },
{ {
"Id": 40100, "Id": 40100,
@ -64,14 +64,14 @@
"Id": 52200, "Id": 52200,
"Name": "ChessCambodianRobot", "Name": "ChessCambodianRobot",
"GameId": 522, "GameId": 522,
"GameDif": "521" "GameDif": "522"
}, },
{ {
"Id": 21100, "Id": 21100,
"Name": "十三张(四人场)", "Name": "十三张(四人场)",
"GameId": 211, "GameId": 211,
"Params": [ "Params": [
4, 0,
0, 0,
30, 30,
50, 50,
@ -84,20 +84,20 @@
"Name": "十三张(八人场)", "Name": "十三张(八人场)",
"GameId": 212, "GameId": 212,
"Params": [ "Params": [
8, 1,
0, 0,
30, 30,
50, 50,
0 0
], ],
"GameDif": "211" "GameDif": "212"
}, },
{ {
"Id": 21300, "Id": 21300,
"Name": "十三张(自由场经典场)", "Name": "十三张(自由场经典场)",
"GameId": 213, "GameId": 213,
"Params": [ "Params": [
8, 1,
0, 0,
30, 30,
50, 50,
@ -110,7 +110,7 @@
"Name": "十三张(自由场癞子场)", "Name": "十三张(自由场癞子场)",
"GameId": 214, "GameId": 214,
"Params": [ "Params": [
8, 1,
0, 0,
30, 30,
50, 50,
@ -122,49 +122,49 @@
"Id": 24200, "Id": 24200,
"Name": "Tienlen排位赛经典场-WTA", "Name": "Tienlen排位赛经典场-WTA",
"GameId": 242, "GameId": 242,
"GameDif": "207" "GameDif": "242"
}, },
{ {
"Id": 24600, "Id": 24600,
"Name": "Tienlen排位赛经典场打到底", "Name": "Tienlen排位赛经典场打到底",
"GameId": 246, "GameId": 246,
"GameDif": "207" "GameDif": "246"
}, },
{ {
"Id": 24300, "Id": 24300,
"Name": "Tienlen排位赛娱乐场-WTA", "Name": "Tienlen排位赛娱乐场-WTA",
"GameId": 243, "GameId": 243,
"GameDif": "207" "GameDif": "243"
}, },
{ {
"Id": 24700, "Id": 24700,
"Name": "tienlen排位赛娱乐打到底", "Name": "tienlen排位赛娱乐打到底",
"GameId": 247, "GameId": 247,
"GameDif": "207" "GameDif": "247"
}, },
{ {
"Id": 21500, "Id": 21500,
"Name": "tienlen房卡经典", "Name": "tienlen房卡经典",
"GameId": 215, "GameId": 215,
"GameDif": "207" "GameDif": "215"
}, },
{ {
"Id": 21600, "Id": 21600,
"Name": "tienlen房卡娱乐", "Name": "tienlen房卡娱乐",
"GameId": 216, "GameId": 216,
"GameDif": "207" "GameDif": "216"
}, },
{ {
"Id": 21700, "Id": 21700,
"Name": "tienlen房卡经典打到底", "Name": "tienlen房卡经典打到底",
"GameId": 217, "GameId": 217,
"GameDif": "207" "GameDif": "217"
}, },
{ {
"Id": 21800, "Id": 21800,
"Name": "tienlen房卡娱乐打到底", "Name": "tienlen房卡娱乐打到底",
"GameId": 218, "GameId": 218,
"GameDif": "207" "GameDif": "218"
}, },
{ {
"Id": 60600, "Id": 60600,
@ -220,41 +220,10 @@
"GameId": 307, "GameId": 307,
"GameDif": "307" "GameDif": "307"
}, },
{
"Id": 30800,
"Name": "FortuneTiger",
"GameId": 308,
"GameDif": "308"
},
{
"Id": 30900,
"Name": "FortuneDragon",
"GameId": 309,
"GameDif": "309"
},
{
"Id": 31000,
"Name": "FortuneRabbit",
"GameId": 310,
"GameDif": "310"
},
{
"Id": 31100,
"Name": "FortuneOx",
"GameId": 311,
"GameDif": "311"
},
{
"Id": 31200,
"Name": "FortuneMouse",
"GameId": 312,
"GameDif": "312"
},
{ {
"Id": 60800, "Id": 60800,
"Name": "娃娃机", "Name": "娃娃机",
"GameId": 608, "GameId": 608
"GameDif": "608"
} }
] ]
} }

Binary file not shown.

View File

@ -1,9 +1,8 @@
$0@HЂ‡§ $0@HЂ‡§
08d@HЂЪД 0@HЂЪД
08<@­в 0@­в
08(@HЂк0 0@HЂк0
08@H В 08@H В
 08@Hа§  08d@Hа§
08 082@HАљ
@HАљ

View File

@ -5,7 +5,7 @@
"RankType": 1, "RankType": 1,
"Level": 36, "Level": 36,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 200, "Award2Num": 1000,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 30000000 "Award3Num": 30000000
}, },
@ -14,7 +14,7 @@
"RankType": 1, "RankType": 1,
"Level": 31, "Level": 31,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 100, "Award2Num": 500,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 20000000 "Award3Num": 20000000
}, },
@ -23,7 +23,7 @@
"RankType": 1, "RankType": 1,
"Level": 26, "Level": 26,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 60, "Award2Num": 300,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 10000000 "Award3Num": 10000000
}, },
@ -32,7 +32,7 @@
"RankType": 1, "RankType": 1,
"Level": 21, "Level": 21,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 40, "Award2Num": 200,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 800000 "Award3Num": 800000
}, },
@ -41,7 +41,7 @@
"RankType": 1, "RankType": 1,
"Level": 16, "Level": 16,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 30, "Award2Num": 150,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 500000 "Award3Num": 500000
}, },
@ -50,7 +50,7 @@
"RankType": 1, "RankType": 1,
"Level": 11, "Level": 11,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 20, "Award2Num": 100,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 300000 "Award3Num": 300000
}, },
@ -59,7 +59,7 @@
"RankType": 1, "RankType": 1,
"Level": 6, "Level": 6,
"Award2Id": 2, "Award2Id": 2,
"Award2Num": 10, "Award2Num": 50,
"Award3Id": 1, "Award3Id": 1,
"Award3Num": 200000 "Award3Num": 200000
} }

Binary file not shown.

View File

@ -1,10 +0,0 @@
{
"GameName":"dragon",
"GameId":309,
"GameMode":[0],
"SceneType":[1,2,3,4],
"CanForceStart":true,
"DefaultPlayerCnt":1,
"DependentPlayerCnt":true,
"EnterAfterStart":true
}

View File

@ -1,10 +0,0 @@
{
"GameName":"mouse",
"GameId":312,
"GameMode":[0],
"SceneType":[1,2,3,4],
"CanForceStart":true,
"DefaultPlayerCnt":1,
"DependentPlayerCnt":true,
"EnterAfterStart":true
}

View File

@ -1,10 +0,0 @@
{
"GameName":"ox",
"GameId":311,
"GameMode":[0],
"SceneType":[1,2,3,4],
"CanForceStart":true,
"DefaultPlayerCnt":1,
"DependentPlayerCnt":true,
"EnterAfterStart":true
}

View File

@ -1,10 +0,0 @@
{
"GameName":"rabbit",
"GameId":310,
"GameMode":[0],
"SceneType":[1,2,3,4],
"CanForceStart":true,
"DefaultPlayerCnt":1,
"DependentPlayerCnt":true,
"EnterAfterStart":true
}

View File

@ -1,10 +0,0 @@
{
"GameName":"tiger",
"GameId":308,
"GameMode":[0],
"SceneType":[1,2,3,4],
"CanForceStart":true,
"DefaultPlayerCnt":1,
"DependentPlayerCnt":true,
"EnterAfterStart":true
}

View File

@ -12,7 +12,6 @@
"DependentPlayerCnt":true, "DependentPlayerCnt":true,
"EnterAfterStart":true, "EnterAfterStart":true,
"PerGameTakeCard":100, "PerGameTakeCard":100,
"BaseScore": 10,
"Params":[ "Params":[
] ]
} }

View File

@ -12,7 +12,6 @@
"DependentPlayerCnt":true, "DependentPlayerCnt":true,
"EnterAfterStart":true, "EnterAfterStart":true,
"PerGameTakeCard":100, "PerGameTakeCard":100,
"BaseScore": 10,
"Params":[ "Params":[
] ]
} }

View File

@ -1,36 +0,0 @@
package mq
import (
"encoding/json"
"mongo.games.com/goserver/core/broker"
"mongo.games.com/goserver/core/broker/rabbitmq"
"mongo.games.com/game/dbproxy/svc"
"mongo.games.com/game/model"
"mongo.games.com/game/mq"
)
func init() {
mq.RegisterSubscriber(mq.DBCustomLog, func(e broker.Event) (err error) {
msg := e.Message()
if msg != nil {
defer func() {
e.Ack()
}()
var log model.CustomLog
err = json.Unmarshal(msg.Body, &log)
if err != nil {
return
}
c := svc.DbCustomLogCollection(log.Platform)
if c != nil {
err = c.Insert(log)
}
return
}
return nil
}, broker.Queue(mq.DBCustomLog), broker.DisableAutoAck(), rabbitmq.DurableQueue())
}

View File

@ -160,7 +160,7 @@ func init() {
} }
switch log.Tp { switch log.Tp {
case common.InviteScoreTypeBind, common.InviteScoreTypeBindTel: case common.InviteScoreTypeBind:
// 更新绑定数量 // 更新绑定数量
// 更新邀请积分 // 更新邀请积分
// 1.邀请人增加积分 // 1.邀请人增加积分

View File

@ -1,25 +0,0 @@
package svc
import (
"github.com/globalsign/mgo"
"mongo.games.com/game/dbproxy/mongo"
"mongo.games.com/game/model"
)
func DbCustomLogCollection(plt string) *mongo.Collection {
s := mongo.MgoSessionMgrSington.GetPltMgoSession(plt, model.DbCustomLogDBName)
if s != nil {
d, first := s.DB().C(model.DbCustomLogCollName)
if first {
d.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
d.EnsureIndex(mgo.Index{Key: []string{"-startts", "cycleid"}, Background: true, Sparse: true})
d.EnsureIndex(mgo.Index{Key: []string{"roomconfigid"}, Background: true, Sparse: true})
d.EnsureIndex(mgo.Index{Key: []string{"roomid"}, Background: true, Sparse: true})
d.EnsureIndex(mgo.Index{Key: []string{"startts"}, Background: true, Sparse: true})
d.EnsureIndex(mgo.Index{Key: []string{"endts"}, Background: true, Sparse: true})
d.EnsureIndex(mgo.Index{Key: []string{"-endts"}, Background: true, Sparse: true})
}
return d
}
return nil
}

View File

@ -28,8 +28,6 @@ func GameDetailedLogsCollection(plt string) *mongo.Collection {
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"matchid"}, Background: true, Sparse: true}) c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"matchid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "gameid"}, Background: true, Sparse: true}) c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "gameid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "gamefreeid"}, Background: true, Sparse: true}) c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "gamefreeid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
} }
return c_gamedetailed return c_gamedetailed
} }

View File

@ -41,8 +41,6 @@ func GamePlayerListLogsCollection(plt string) *mongo.Collection {
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "gamefreeid"}, Background: true, Sparse: true}) c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "gamefreeid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "snid", "gameid"}, Background: true, Sparse: true}) c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "snid", "gameid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "snid", "gamefreeid"}, Background: true, Sparse: true}) c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "snid", "gamefreeid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
} }
return c_gameplayerlistlog return c_gameplayerlistlog
} }

View File

@ -26,8 +26,6 @@ func ItemLogsCollection(plt string) *mongo.Collection {
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gameid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gameid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gamefreeid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"gamefreeid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"snid", "logtype", "itemid", "typeid"}, Background: true, Sparse: true}) c_itemlog.EnsureIndex(mgo.Index{Key: []string{"snid", "logtype", "itemid", "typeid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"roomconfigid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"typeid", "roomconfigid"}, Background: true, Sparse: true})
} }
return c_itemlog return c_itemlog
} }

View File

@ -156,12 +156,10 @@ func upJybUser(cjybuse, cjyb *mongo.Collection, snId, codeType int32, plt, useCo
if jybuser.JybInfos == nil { if jybuser.JybInfos == nil {
jybuser.JybInfos = make(map[string]int32) jybuser.JybInfos = make(map[string]int32)
} else if _, exist := jybuser.JybInfos[jybuseerid]; exist { // 该类型礼包玩家已经领取过 } else if _, exist := jybuser.JybInfos[jybuseerid]; exist { // 该类型礼包玩家已经领取过
if ret.CodeType != 3 {
return model.ErrJYBPlCode return model.ErrJYBPlCode
} }
}
jybuser.JybInfos[jybuseerid]++ jybuser.JybInfos[jybuseerid] = 1
err = cjybuse.Update(bson.M{"_id": jybuser.JybUserId}, bson.D{{"$set", bson.D{{"jybinfos", jybuser.JybInfos}}}}) err = cjybuse.Update(bson.M{"_id": jybuser.JybUserId}, bson.D{{"$set", bson.D{{"jybinfos", jybuser.JybInfos}}}})
if err != nil { if err != nil {

View File

@ -101,8 +101,7 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error {
for id, v := range args.BagItem { for id, v := range args.BagItem {
if item, exist := bag.BagItem[id]; !exist { if item, exist := bag.BagItem[id]; !exist {
if v.ItemNum <= 0 { if v.ItemNum <= 0 {
err = errors.New("item num not enough") continue
break
} }
bag.BagItem[id] = &model.Item{ bag.BagItem[id] = &model.Item{
ItemId: v.ItemId, ItemId: v.ItemId,
@ -111,8 +110,7 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error {
} }
} else { } else {
if v.ItemNum < 0 && -v.ItemNum > item.ItemNum { if v.ItemNum < 0 && -v.ItemNum > item.ItemNum {
err = errors.New("item num not enough") v.ItemNum = -item.ItemNum
break
} }
item.ItemNum += v.ItemNum item.ItemNum += v.ItemNum
} }
@ -121,18 +119,10 @@ func (svc *BagSvc) AddBagItem(args *model.BagInfo, ret *bool) error {
vCard = v.ItemNum vCard = v.ItemNum
} }
} }
if err != nil {
*ret = false
logger.Logger.Errorf("AddBagItem error: %v", err)
return err
}
_, err = cbag.Upsert(bson.M{"_id": bag.BagId}, bag) _, err = cbag.Upsert(bson.M{"_id": bag.BagId}, bag)
if err != nil { if err != nil {
*ret = false *ret = false
logger.Logger.Info("AddBagItem error ", err) logger.Logger.Info("AddBagItem error ", err)
return err
} }
// v卡返还 // v卡返还

View File

@ -227,7 +227,7 @@ func (svc *PlayerDataSvc) CreatePlayerDataByThird(args *model.CreatePlayer, ret
var dataParams model.PlayerParams var dataParams model.PlayerParams
json.Unmarshal([]byte(a.Params), &dataParams) json.Unmarshal([]byte(a.Params), &dataParams)
pd = model.NewPlayerDataThird(acc, name, args.HeadUrl, id, a.Channel, a.Platform, a.Params, pd = model.NewPlayerDataThird(acc, name, args.HeadUrl, id, a.Channel, a.Platform, a.Params,
a.Tel, a.PackegeTag, dataParams.Ip, a.TagKey, a.AccountType, a.DeviceOs, a.ChannelId) a.Tel, a.PackegeTag, dataParams.Ip, a.TagKey, a.AccountType, a.DeviceOs)
if pd != nil { if pd != nil {
err = cplayerdata.Insert(pd) err = cplayerdata.Insert(pd)
if err != nil { if err != nil {

View File

@ -1,71 +0,0 @@
package svc
import (
"errors"
"net/rpc"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
"mongo.games.com/game/dbproxy/mongo"
"mongo.games.com/game/model"
)
var (
PlayerGameDataDBName = "user"
PlayerGameDataCollName = "user_gamedata"
PlayerGameDataColError = errors.New("PlayerGameData collection open failed")
PlayerGameDataSvcSingle = &PlayerGameDataSvc{}
)
func PlayerGameDataCollection(plt string) *mongo.Collection {
s := mongo.MgoSessionMgrSington.GetPltMgoSession(plt, PlayerGameDataDBName)
if s != nil {
c, first := s.DB().C(PlayerGameDataCollName)
if first {
c.EnsureIndex(mgo.Index{Key: []string{"snid", "id"}, Unique: true, Background: true, Sparse: true})
c.EnsureIndex(mgo.Index{Key: []string{"id"}, Background: true, Sparse: true})
}
return c
}
return nil
}
func init() {
rpc.Register(PlayerGameDataSvcSingle)
}
type PlayerGameDataSvc struct{}
func (p *PlayerGameDataSvc) Save(req *model.PlayerGameSaveReq, b *bool) error {
c := PlayerGameDataCollection(req.Platform)
if c == nil {
return PlayerGameDataColError
}
for _, v := range req.Data {
_, err := c.Upsert(bson.M{"snid": v.SnId, "id": v.Id}, v)
if err != nil {
return err
}
}
*b = true
return nil
}
func (p *PlayerGameDataSvc) Find(req *model.PlayerGameDataFindReq, res *model.PlayerGameDataFindRes) error {
c := PlayerGameDataCollection(req.Platform)
if c == nil {
return PlayerGameDataColError
}
var ret []*model.PlayerGameData
err := c.Find(bson.M{"snid": req.SnId}).All(&ret)
if err != nil {
return err
}
res.Data = ret
return nil
}

View File

@ -39,7 +39,6 @@ const (
ETCDKEY_RANK_TYPE = "/game/RankType" // 排行榜奖励配置 ETCDKEY_RANK_TYPE = "/game/RankType" // 排行榜奖励配置
ETCDKEY_AWARD_CONFIG = "/game/awardlog_config" //获奖记录 ETCDKEY_AWARD_CONFIG = "/game/awardlog_config" //获奖记录
ETCDKEY_GUIDE = "/game/guide_config" //新手引导配置 ETCDKEY_GUIDE = "/game/guide_config" //新手引导配置
ETCDKEY_MACHINE = "/game/machine_config" //娃娃机配置
ETCDKEY_MatchAudience = "/game/match_audience" //比赛观众 ETCDKEY_MatchAudience = "/game/match_audience" //比赛观众
ETCDKEY_Spirit = "/game/spirit" // 小精灵配置 ETCDKEY_Spirit = "/game/spirit" // 小精灵配置
ETCDKEY_RoomType = "/game/room_type" // 房间类型配置 ETCDKEY_RoomType = "/game/room_type" // 房间类型配置

View File

@ -8,70 +8,18 @@ const (
ClawDollSceneStateStart //开始倒计时 ClawDollSceneStateStart //开始倒计时
ClawDollSceneStatePlayGame //游戏中 ClawDollSceneStatePlayGame //游戏中
ClawDollSceneStateBilled //结算 ClawDollSceneStateBilled //结算
ClawDollSceneWaitPayCoin //等待下一局投币
ClawDollSceneStateMax ClawDollSceneStateMax
) )
// 玩家状态
const ( const (
ClawDollPlayerStateWait int32 = iota //等待状态 ClawDollSceneWaitTimeout = time.Second * 2 //等待倒计时
ClawDollPlayerStateStart //开始倒计时 ClawDollSceneStartTimeout = time.Second * 6 //开始倒计时
ClawDollPlayerStatePlayGame //游戏中
ClawDollPlayerStateBilled //结算
ClawDollPlayerWaitPayCoin //等待下一局投币
ClawDollPlayerAudience //观众状态
ClawDollPlayerStateMax
)
const (
ClawDollSceneWaitTimeout = time.Second * 6 //等待倒计时
ClawDollSceneStartTimeout = time.Second * 1 //开始倒计时
ClawDollScenePlayTimeout = time.Second * 30 //娃娃机下抓倒计时
ClawDollSceneBilledTimeout = time.Second * 2 //结算 ClawDollSceneBilledTimeout = time.Second * 2 //结算
ClawDollSceneWaitPayCoinimeout = time.Second * 10 //等待下一局投币
) )
// 玩家操作 // 玩家操作
const ( const (
ClawDollPlayerOpPayCoin = iota + 1 // 上分 投币 ClawDollPlayerOpScore = iota + 1 // 上分
ClawDollPlayerOpGo // 下抓 ClawDollPlayerOpGo // 下抓
ClawDollPlayerOpMove // 玩家操控动作 // 1-前 2-后 3-左 4-右 ClawDollPlayerOpMove // 移动方向
ClawDollPlayerCancelPayCoin // 取消投币
)
// 1-前 2-后 3-左 4-右 5-投币
const (
ButtonFront = iota + 1 /*前*/
ButtonBack /*后*/
ButtonLeft /*左*/
ButtonRight /*右*/
ButtonPayCoin /*投币*/
)
const (
MoveStop = 0 /*移动停止*/
MoveStar = 1 /*移动开始*/
)
const (
ClawWeak = iota + 1 //弱力抓
ClawStrong //强力抓
ClawGain //必出抓
)
const (
RoomStat_Audience = iota //观众旁观者
RoomStat_Wait //等待状态
)
// actionType : 1 禁止推流 ForbidRTCStream
// actionType : 2 恢复推流 ResumeRTCStream
const (
Zego_ForbidRTCStream = iota + 1
Zego_ResumeRTCStream = iota + 1
)
const (
ClawDoorItemID = 40003
) )

View File

@ -2,11 +2,3 @@ package clawdoll
type Logic struct { type Logic struct {
} }
type ZegoForbidRTCResp struct {
Code int64
Message string
RequestId string
Data any
Error int
}

View File

@ -1,221 +0,0 @@
package clawdoll
// queue队列容器包
// 以动态数组的形式实现
// 该容器可以在尾部实现线性增加元素,在首部实现线性减少元素
// 队列的扩容和缩容同vector一样,即数组小采用翻倍扩缩容/折半缩容,数组大时采用固定扩/缩容
// 该容器满足FIFO的先进先出模式
// 可接纳不同类型的元素
// queue队列结构体
// 包含泛型切片和该切片的首尾位的下标
// 当删除节点时仅仅需要后移首位一位即可
// 当剩余长度较小时采用缩容策略进行缩容以释放空间
// 当添加节点时若未占满全部已分配空间则尾指针后移一位同时进行覆盖存放
// 当添加节点时尾指针大于已分配空间长度,则先去掉首部多出来的空间,如果还不足则进行扩容
// 首节点指针始终不能超过尾节点指针
type Queue struct {
data []interface{} //泛型切片
begin uint64 //首节点下标
end uint64 //尾节点下标
cap uint64 //容量
}
//queue队列容器接口
//存放了queue容器可使用的函数
//对应函数介绍见下方
type queuer interface {
Size() (size uint64) //返回该队列中元素的使用空间大小
Clear() //清空该队列
Empty() (b bool) //判断该队列是否为空
Push(e interface{}) //将元素e添加到该队列末尾
Pop() (e interface{}) //将该队列首元素弹出并返回
Front() (e interface{}) //获取该队列首元素
Back() (e interface{}) //获取该队列尾元素
}
// 新建一个queue队列容器并返回
// 初始queue的切片数组为空
// 初始queue的首尾指针均置零
//
// @receiver nil
// @param nil
// @return q *Queue 新建的queue指针
func New() (q *Queue) {
return &Queue{
data: make([]interface{}, 1, 1),
begin: 0,
end: 0,
cap: 1,
}
}
// 返回该容器当前含有元素的数量
// 该长度并非实际占用空间数量
// 若容器为空则返回0
//
// @receiver q *Queue 接受者queue的指针
// @param nil
// @return size uint64 容器中实际使用元素所占空间大小
func (q *Queue) Size() (size uint64) {
if q == nil {
q = New()
}
return q.end - q.begin
}
// 以queue队列容器做接收者
// 将该容器中所承载的元素清空
// 将该容器的首尾指针均置0,容量设为1
//
// @receiver q *Queue 接受者queue的指针
// @param nil
// @return nil
func (q *Queue) Clear() {
if q == nil {
q = New()
}
q.data = make([]interface{}, 1, 1)
q.begin = 0
q.end = 0
q.cap = 1
}
// 判断该queue队列容器是否含有元素
// 如果含有元素则不为空,返回false
// 如果不含有元素则说明为空,返回true
// 如果容器不存在,返回true
// 该判断过程通过首尾指针数值进行判断
// 当尾指针数值等于首指针时说明不含有元素
// 当尾指针数值大于首指针时说明含有元素
//
// @receiver q *Queue 接受者queue的指针
// @param nil
// @return b bool 该容器是空的吗?
func (q *Queue) Empty() (b bool) {
if q == nil {
q = New()
}
return q.Size() <= 0
}
// 在容器尾部插入元素
// 若尾指针小于切片实际使用长度,则对当前指针位置进行覆盖,同时尾下标后移一位
// 若尾指针等于切片实际使用长度,则对实际使用量和实际占用量进行判断
// 当首部还有冗余时则删将实际使用整体前移到首部,否则对尾部进行扩容即可
//
// @receiver q *Queue 接受者queue的指针
// @param e interface{} 待插入元素
// @return nil
func (q *Queue) Push(e interface{}) {
if q == nil {
q = New()
}
if q.end < q.cap {
//不需要扩容
q.data[q.end] = e
} else {
//需要扩容
if q.begin > 0 {
//首部有冗余,整体前移
for i := uint64(0); i < q.end-q.begin; i++ {
q.data[i] = q.data[i+q.begin]
}
q.end -= q.begin
q.begin = 0
} else {
//冗余不足,需要扩容
if q.cap <= 65536 {
//容量翻倍
if q.cap == 0 {
q.cap = 1
}
q.cap *= 2
} else {
//容量增加2^16
q.cap += 2 ^ 16
}
//复制扩容前的元素
tmp := make([]interface{}, q.cap, q.cap)
copy(tmp, q.data)
q.data = tmp
}
q.data[q.end] = e
}
q.end++
}
// 弹出容器第一个元素,同时首下标后移一位
// 若容器为空,则不进行弹出
// 弹出结束后,进行缩容判断,考虑到queue的冗余会存在于前后两个方向
// 所以需要对前后两方分别做判断, 但由于首部主要是减少,并不会增加,所以不需要太多冗余量,而尾部只做添加,所以需要更多的冗余
// 所以可以对首部预留2^10的冗余,当超过时直接对首部冗余清除即可,释放首部空间时尾部空间仍然保留不变
// 当首部冗余不足2^10时,但冗余超过实际使用空间,也会对首部进行缩容,尾部不变
// 同时返回队首元素
//
// @receiver q *Queue 接受者queue的指针
// @param nil
// @return e interface{} 队首元素
func (q *Queue) Pop() (e interface{}) {
if q == nil {
q = New()
return nil
}
if q.Empty() {
q.Clear()
return nil
}
e = q.data[q.begin]
q.begin++
if q.begin >= 1024 || q.begin*2 > q.end {
//首部冗余超过2^10或首部冗余超过实际使用
q.cap -= q.begin
q.end -= q.begin
tmp := make([]interface{}, q.cap, q.cap)
copy(tmp, q.data[q.begin:])
q.data = tmp
q.begin = 0
}
return e
}
// 返回该容器的第一个元素
// 若该容器当前为空,则返回nil
//
// @receiver q *Queue 接受者queue的指针
// @param nil
// @return e interface{} 容器的第一个元素
func (q *Queue) Front() (e interface{}) {
if q == nil {
q = New()
return nil
}
if q.Empty() {
q.Clear()
return nil
}
return q.data[q.begin]
}
// 返回该容器的最后一个元素
// 若该容器当前为空,则返回nil
//
// @receiver q *Queue 接受者queue的指针
// @param nil
// @return e interface{} 容器的最后一个元素
func (q *Queue) Back() (e interface{}) {
if q == nil {
q = New()
return nil
}
if q.Empty() {
q.Clear()
return nil
}
return q.data[q.end-1]
}

View File

@ -29,7 +29,6 @@ const (
TIenLenTianhuTimeout = time.Second * 2 // 天胡动画时长 TIenLenTianhuTimeout = time.Second * 2 // 天胡动画时长
TienLenHandNotExceedTimeLimit = time.Second * 3 //玩家没有牌可以接上家的牌,出牌时间上限 TienLenHandNotExceedTimeLimit = time.Second * 3 //玩家没有牌可以接上家的牌,出牌时间上限
TienLenHandAutoStateTimeOut = time.Second * 1 //玩家托管出牌时间上限 TienLenHandAutoStateTimeOut = time.Second * 1 //玩家托管出牌时间上限
TienLenCustomWaiteStatTimeout = time.Millisecond * 1500
) )
// 场景状态 // 场景状态

View File

@ -13,6 +13,39 @@ import (
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
) )
type CSDestroyRoomPacketFactory struct {
}
type CSDestroyRoomHandler struct {
}
func (this *CSDestroyRoomPacketFactory) CreatePacket() interface{} {
pack := &gamehall.CSDestroyRoom{}
return pack
}
func (this *CSDestroyRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSDestroyRoomHandler Process recv ", data)
p := base.PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSDestroyRoomHandler p == nil")
return nil
}
scene := p.GetScene()
if scene == nil {
logger.Logger.Warn("CSDestroyRoomHandler p.GetScene() == nil")
return nil
}
if !scene.HasPlayer(p) {
return nil
}
if scene.Creator != p.SnId {
logger.Logger.Warn("CSDestroyRoomHandler s.creator != p.AccountId")
return nil
}
scene.Destroy(true)
return nil
}
type CSLeaveRoomPacketFactory struct { type CSLeaveRoomPacketFactory struct {
} }
type CSLeaveRoomHandler struct { type CSLeaveRoomHandler struct {
@ -46,7 +79,7 @@ func (this *CSLeaveRoomHandler) Process(s *netlib.Session, packetid int, data in
logger.Logger.Warnf("CSLeaveRoomHandler[%v][%v] scene.gaming==true", scene.SceneId, p.SnId) logger.Logger.Warnf("CSLeaveRoomHandler[%v][%v] scene.gaming==true", scene.SceneId, p.SnId)
pack := &gamehall.SCLeaveRoom{ pack := &gamehall.SCLeaveRoom{
OpRetCode: gamehall.OpResultCode_Game_OPRC_YourAreGamingCannotLeave_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_YourAreGamingCannotLeave_Game,
RoomId: scene.SceneId, RoomId: proto.Int(scene.SceneId),
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack) p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
@ -63,7 +96,7 @@ func (this *CSLeaveRoomHandler) Process(s *netlib.Session, packetid int, data in
Reason: proto.Int(0), Reason: proto.Int(0),
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game, OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
Mode: msg.Mode, Mode: msg.Mode,
RoomId: scene.SceneId, RoomId: proto.Int(scene.SceneId),
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack) p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
@ -256,55 +289,10 @@ func CSRoomEvent(s *netlib.Session, packetid int, data interface{}, sid int64) e
return nil return nil
} }
func CSDestroyRoom(s *netlib.Session, packetid int, data interface{}, sid int64) error {
logger.Logger.Trace("CSDestroyRoomHandler Process recv ", data)
p := base.PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSDestroyRoomHandler p == nil")
return nil
}
scene := p.GetScene()
if scene == nil {
logger.Logger.Warn("CSDestroyRoomHandler p.GetScene() == nil")
return nil
}
if !scene.HasPlayer(p) {
return nil
}
pack := &gamehall.SCDestroyRoom{
RoomId: scene.SceneId,
OpRetCode: gamehall.OpResultCode_Game_OPRC_Error_Game,
}
send := func() {
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_DESTROYROOM), pack)
logger.Logger.Tracef("SCDestroyRoom: %v", pack)
}
if scene.Creator != p.SnId {
logger.Logger.Warn("CSDestroyRoomHandler s.creator != p.AccountId")
send()
return nil
}
// 房卡场开始后不能解散
if scene.IsCustom() && scene.NumOfGames > 0 {
send()
return nil
}
if scene.ExtraData != nil {
gs, ok := scene.ExtraData.(base.GameScene)
if ok {
gs.SceneDestroy(true)
return nil
}
}
scene.Destroy(true)
return nil
}
func init() { func init() {
// 房间创建者解散房间 // 房间创建者解散房间
common.Register(int(gamehall.GameHallPacketID_PACKET_CS_DESTROYROOM), &gamehall.CSDestroyRoom{}, CSDestroyRoom) common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_DESTROYROOM), &CSDestroyRoomHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_DESTROYROOM), &CSDestroyRoomPacketFactory{})
// 离开或暂离房间 // 离开或暂离房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_LEAVEROOM), &CSLeaveRoomHandler{}) common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_LEAVEROOM), &CSLeaveRoomHandler{})

View File

@ -4,73 +4,22 @@ import (
"mongo.games.com/game/protocol/machine" "mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"sync"
) )
var MachineMap = make(map[int]*DollMachine) var MachineMap = make(map[int]string)
var MachineMapLock = sync.Mutex{}
type DollMachine struct { func MSDollMachineList(session *netlib.Session, packetId int, data interface{}) error {
Id int
MachineStatus int32 //娃娃机链接状态 0:离线 1:在线
Status bool //标记是否被占用
VideoAddr string
}
func MSDollMachineListHandler(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("TestHandler %v", data) logger.Logger.Tracef("TestHandler %v", data)
MachineMap = make(map[int]*DollMachine) MachineMap = make(map[int]string)
if msg, ok := data.(*machine.MSDollMachineList); ok { if msg, ok := data.(*machine.MSDollMachineList); ok {
for i, info := range msg.Data { for i, info := range msg.Data {
MachineMap[i+1] = &DollMachine{ MachineMap[i+1] = info.VideoAddr
Id: i + 1,
Status: false,
VideoAddr: info.VideoAddr,
MachineStatus: 1,
}
logger.Logger.Tracef("MachineMap[%v] = %v", i, info.VideoAddr) logger.Logger.Tracef("MachineMap[%v] = %v", i, info.VideoAddr)
} }
} }
return nil return nil
} }
// 获取空闲娃娃机标识
func GetFreeDollMachineId(id int32) int {
if MachineMap[int(id)] != nil && MachineMap[int(id)].MachineStatus == 1 {
return int(id)
} else {
return 0
}
return 0
}
// 获取指定娃娃机链接状态
func GetDollMachineStatus(id int) int32 {
if MachineMap[id] == nil {
return 0
}
return MachineMap[id].MachineStatus
}
func MSUpdateDollMachineStatusHandler(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("MSUpdateDollMachineStatusHandler %v", data)
if msg, ok := data.(*machine.MSUpdateDollMachineStatus); ok {
if MachineMap[int(msg.Id)] == nil {
MachineMap[int(msg.Id)] = &DollMachine{
Id: int(msg.Id),
Status: false,
VideoAddr: msg.VideoAddr,
MachineStatus: msg.Status,
}
} else {
MachineMap[int(msg.Id)].MachineStatus = msg.Status
}
logger.Logger.Tracef("更新娃娃机连接状态 id = %d,status= %d", msg.Id, msg.GetStatus())
}
return nil
}
func init() { func init() {
netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineListHandler) netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList)
//更新娃娃机链接状态
netlib.Register(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), &machine.MSUpdateDollMachineStatus{}, MSUpdateDollMachineStatusHandler)
} }

View File

@ -38,101 +38,118 @@ func HandleWGBuyRecTimeItem(session *netlib.Session, packetId int, data interfac
return nil return nil
} }
//func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}) error { func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}) error {
// logger.Logger.Trace("receive WGPlayerLeaveGame") logger.Logger.Trace("receive WGPlayerLeaveGame")
// if msg, ok := data.(*server.WGPlayerLeave); ok { if msg, ok := data.(*server.WGPlayerLeave); ok {
// p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId()) p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
// if p != nil { if p != nil {
// scene := p.GetScene() scene := p.GetScene()
// if scene != nil { if scene != nil {
// scene.PlayerLeave(p, common.PlayerLeaveReason_DropLine, false) scene.PlayerLeave(p, common.PlayerLeaveReason_DropLine, false)
// }
// }
// }
// return nil
//}
//func HandlePlayerChangeItems(session *netlib.Session, packetId int, data interface{}) error {
// logger.Logger.Tracef("receive PlayerChangeItems %v", data)
// msg, ok := data.(*server.PlayerChangeItems)
// if !ok {
// return nil
// }
// p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
// if p == nil {
// return nil
// }
// var items []*model.Item
// for _, v := range msg.GetItems() {
// items = append(items, &model.Item{
// ItemId: v.GetId(),
// ItemNum: v.GetNum(),
// })
// }
// p.ReceiveAddItems(items)
// return nil
//}
func CreateScene(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("receive CreateScene %v", data)
msg, ok := data.(*server.WGCreateScene)
if !ok {
return nil
}
base.SceneMgrSington.CreateScene(&base.CreateSceneParam{
Session: session,
WGCreateScene: msg,
})
return nil
}
func DestroyScene(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Trace("receive WGDestroyScene:", data)
msg, ok := data.(*server.WGDestroyScene)
if !ok {
return nil
}
if !msg.IsGrace {
// 立刻删除,不管游戏是否结束
for _, v := range msg.Ids {
s := base.SceneMgrSington.GetScene(int(v))
if s == nil {
continue
}
if gameScene, ok := s.ExtraData.(base.GameScene); ok {
gameScene.SceneDestroy(true)
}
}
return nil
}
// 游戏结束后删除房间
for _, v := range msg.Ids {
s := base.SceneMgrSington.GetScene(int(v))
if s == nil {
continue
}
if s.IsHundredScene() || s.Gaming {
s.SetGraceDestroy()
} else {
if s.IsMatchScene() {
s.SetGraceDestroy()
}
if gameScene, ok := s.ExtraData.(base.GameScene); ok {
gameScene.SceneDestroy(true)
} }
} }
} }
return nil return nil
} }
func init() { func init() {
// 创建房间 //创建场景
netlib.Register(int(server.SSPacketID_PACKET_WG_CREATESCENE), &server.WGCreateScene{}, CreateScene) netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.PacketFactoryWrapper(func() interface{} {
// 删除房间 return &server.WGCreateScene{}
netlib.Register(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), &server.WGDestroyScene{}, DestroyScene) }))
netlib.RegisterHandler(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
logger.Logger.Trace("receive WGCreateScene:", pack)
if msg, ok := pack.(*server.WGCreateScene); ok {
sceneId := int(msg.GetSceneId())
gameMode := int(msg.GetGameMode())
sceneMode := int(msg.GetSceneMode())
gameId := int(msg.GetGameId())
paramsEx := msg.GetParamsEx()
hallId := msg.GetHallId()
groupId := msg.GetGroupId()
dbGameFree := msg.GetDBGameFree()
bEnterAfterStart := msg.GetEnterAfterStart()
totalOfGames := msg.GetTotalOfGames()
baseScore := msg.GetBaseScore()
playerNum := int(msg.GetPlayerNum())
matchInfoId := msg.GetMatchInfoId()
scene := base.SceneMgrSington.CreateScene(s, sceneId, gameMode, sceneMode, gameId, msg.GetPlatform(), msg.GetParams(),
msg.GetAgentor(), msg.GetCreator(), msg.GetReplayCode(), hallId, groupId, totalOfGames, dbGameFree,
bEnterAfterStart, baseScore, playerNum, msg.GetChessRank(), paramsEx...)
if scene != nil {
if scene.IsMatchScene() {
scene.MatchInfoId = matchInfoId
if len(scene.Params) > 0 {
scene.MatchId = scene.Params[0]
}
if len(scene.Params) > 1 {
scene.MatchFinals = scene.Params[1] == 1
}
if len(scene.Params) > 2 {
scene.MatchRound = scene.Params[2]
}
if len(scene.Params) > 3 {
scene.MatchCurPlayerNum = scene.Params[3]
}
if len(scene.Params) > 4 {
scene.MatchNextNeed = scene.Params[4]
}
if len(scene.Params) > 5 {
scene.MatchType = scene.Params[5]
}
}
scene.ClubId = msg.GetClub()
scene.RoomId = msg.GetClubRoomId()
scene.RoomPos = msg.GetClubRoomPos()
scene.PumpCoin = msg.GetClubRate()
scene.RealCtrl = msg.RealCtrl
}
}
return nil
}))
//删除场景
// 立刻删除,不管游戏是否结束
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), netlib.PacketFactoryWrapper(func() interface{} {
return &server.WGDestroyScene{}
}))
netlib.RegisterHandler(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), netlib.HandlerWrapper(func(s *netlib.Session, packetid int, pack interface{}) error {
logger.Logger.Trace("receive WGDestroyScene:", pack)
msg, ok := pack.(*server.WGDestroyScene)
if !ok {
return nil
}
if !msg.IsGrace {
// 立刻删除,不管游戏是否结束
for _, v := range msg.Ids {
s := base.SceneMgrSington.GetScene(int(v))
if s != nil {
if gameScene, ok := s.ExtraData.(base.GameScene); ok {
gameScene.SceneDestroy(true)
}
}
}
} else {
// 游戏结束后删除房间
for _, v := range msg.Ids {
s := base.SceneMgrSington.GetScene(int(v))
if s != nil {
if s.IsHundredScene() || s.Gaming {
s.SetGraceDestroy(true)
} else {
if s.IsMatchScene() {
s.SetGraceDestroy(true)
}
if gameScene, ok := s.ExtraData.(base.GameScene); ok {
gameScene.SceneDestroy(true)
}
}
}
}
}
return nil
}))
//玩家进入 //玩家进入
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_PLAYERENTER), netlib.PacketFactoryWrapper(func() interface{} { netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_PLAYERENTER), netlib.PacketFactoryWrapper(func() interface{} {
@ -239,7 +256,7 @@ func init() {
} }
if scene.Testing { if scene.Testing {
p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin()) p.Coin = int64(scene.DbGameFree.GetTestTakeCoin())
} }
base.PlayerMgrSington.ManagePlayer(p) base.PlayerMgrSington.ManagePlayer(p)
scene.PlayerEnter(p, isload) scene.PlayerEnter(p, isload)
@ -356,7 +373,7 @@ func init() {
//p.coin = msg.GetTakeCoin() //p.coin = msg.GetTakeCoin()
//p.takeCoin = msg.GetTakeCoin() //p.takeCoin = msg.GetTakeCoin()
if scene.Testing { if scene.Testing {
p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin()) p.Coin = int64(scene.DbGameFree.GetTestTakeCoin())
} }
p.LastSyncCoin = p.Coin p.LastSyncCoin = p.Coin
scene.AudienceSit(p) scene.AudienceSit(p)
@ -562,12 +579,10 @@ func init() {
})) }))
common.RegisterMulticastHandler() common.RegisterMulticastHandler()
// 玩家离开 //玩家离开
//netlib.Register(int(server.SSPacketID_PACKET_WG_PlayerLEAVE), server.WGPlayerLeave{}, HandleWGPlayerLeave) netlib.Register(int(server.SSPacketID_PACKET_WG_PlayerLEAVE), server.WGPlayerLeave{}, HandleWGPlayerLeave)
// 同步记牌器过期时间 //同步记牌器过期时间
netlib.Register(int(server.SSPacketID_PACKET_WG_BUYRECTIMEITEM), server.WGBuyRecTimeItem{}, HandleWGBuyRecTimeItem) netlib.Register(int(server.SSPacketID_PACKET_WG_BUYRECTIMEITEM), server.WGBuyRecTimeItem{}, HandleWGBuyRecTimeItem)
// 修改皮肤 // 修改皮肤
netlib.Register(int(server.SSPacketID_PACKET_WG_UpdateSkin), server.WGUpdateSkin{}, HandleWGUpdateSkin) netlib.Register(int(server.SSPacketID_PACKET_WG_UpdateSkin), server.WGUpdateSkin{}, HandleWGUpdateSkin)
// 同步道具数量
//netlib.Register(int(server.SSPacketID_PACKET_PlayerChangeItems), server.PlayerChangeItems{}, HandlePlayerChangeItems)
} }

View File

@ -57,14 +57,14 @@ func (this *AvengersSceneData) SceneDestroy(force bool) {
} }
func (this *AvengersSceneData) init() bool { func (this *AvengersSceneData) init() bool {
if this.GetDBGameFree() == nil { if this.DbGameFree == nil {
return false return false
} }
params := this.GetDBGameFree().GetJackpot() params := this.DbGameFree.GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -100,7 +100,7 @@ type AvengersSpinResult struct {
} }
func (this *AvengersSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes AvengersSpinResult) { func (this *AvengersSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes AvengersSpinResult) {
taxRate := this.GetDBGameFree().GetTaxRate() taxRate := this.DbGameFree.GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -188,7 +188,7 @@ func (this *AvengersSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.GetDBGameFree().Id), GameFreeId: proto.Int32(this.DbGameFree.Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -215,7 +215,7 @@ func (this *AvengersSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -223,7 +223,7 @@ func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int
func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) { func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId) return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*avengers.AvengersBurstHistoryInfo var logsp []*avengers.AvengersBurstHistoryInfo
if data != nil { if data != nil {
@ -251,7 +251,7 @@ func (this *AvengersSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *AvengersSceneData) SetLastBurstJackPot() { func (this *AvengersSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -267,7 +267,7 @@ func (this *AvengersSceneData) SetLastBurstJackPot() {
func (this *AvengersSceneData) AIAddJackPot() { func (this *AvengersSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -280,20 +280,20 @@ func (this *AvengersSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *AvengersSceneData) AIBurstJackPot() { func (this *AvengersSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.GetDBGameFree().GetJackpot() jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet) this.RecordBurstLog(this.RandNickName(), val, bet)
} }
} }
@ -314,11 +314,11 @@ func (this *AvengersSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.GetDBGameFree().GetPlayNumLimit() != 0 && // this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -95,7 +95,7 @@ func (this *ScenePolicyAvengers) OnPlayerEnter(s *base.Scene, p *base.Player) {
if sceneEx, ok := s.ExtraData.(*AvengersSceneData); ok { if sceneEx, ok := s.ExtraData.(*AvengersSceneData); ok {
playerEx := &AvengersPlayerData{Player: p} playerEx := &AvengersPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注 playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
AvengersSendRoomInfo(s, p, sceneEx, playerEx, nil) AvengersSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -229,14 +229,14 @@ func (this *ScenePolicyAvengers) GetJackPotVal(s *base.Scene) int64 {
func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneData, playerEx *AvengersPlayerData, data *avengers.GameBilledData) { func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneData, playerEx *AvengersPlayerData, data *avengers.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &avengers.SCAvengersRoomInfo{ pack := &avengers.SCAvengersRoomInfo{
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: s.GameId, GameId: proto.Int(s.GameId),
RoomMode: s.GameMode, RoomMode: proto.Int(s.GameMode),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
GameFreeId: proto.Int32(s.GetDBGameFree().Id), GameFreeId: proto.Int32(s.DbGameFree.Id),
BilledData: data, BilledData: data,
} }
if playerEx != nil { if playerEx != nil {
@ -252,7 +252,7 @@ func AvengersSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *AvengersSceneD
pack.Players = append(pack.Players, pd) pack.Players = append(pack.Players, pd)
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore) pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 { if playerEx.totalPriceBonus > 0 {
switch playerEx.bonusStage { switch playerEx.bonusStage {
@ -367,8 +367,8 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) { if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
logger.Logger.Warnf("avengers snid[%v] opcode[%v] params[%v] BaseScore[%v]", p.SnId, opcode, params, sceneEx.GetDBGameFree().GetBaseScore()) logger.Logger.Warnf("avengers snid[%v] opcode[%v] params[%v] BaseScore[%v]", p.SnId, opcode, params, sceneEx.DbGameFree.GetBaseScore())
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -405,7 +405,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, avengers.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -419,7 +419,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
//获取当前水池的上下文环境 //获取当前水池的上下文环境
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
//税收比例 //税收比例
taxRate := sceneEx.GetDBGameFree().GetTaxRate() taxRate := sceneEx.DbGameFree.GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Warnf("AvengersErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Warnf("AvengersErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -448,8 +448,8 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
// 奖池参数 // 奖池参数
jackpotParams := sceneEx.GetDBGameFree().GetJackpot() jackpotParams := sceneEx.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 //奖池/水池增量 var jackpotFundAdd, prizeFundAdd int64 //奖池/水池增量
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -469,7 +469,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
////统计参与游戏次数 ////统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), // GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -668,7 +668,7 @@ func (this *SceneStateAvengersStart) OnPlayerOp(s *base.Scene, p *base.Player, o
case AvengersPlayerHistory: case AvengersPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.Itoa(int(playerEx.SnId)) spinid := strconv.Itoa(int(playerEx.SnId))
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId)) //复仇者联盟存储个人操作记录不分场次,因为选场界面也需要拉去个人操作记录 gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId) //复仇者联盟存储个人操作记录不分场次,因为选场界面也需要拉去个人操作记录
pack := &avengers.SCAvengersPlayerHistory{} pack := &avengers.SCAvengersPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
if v.GameDetailedLogId == "" { if v.GameDetailedLogId == "" {
@ -806,7 +806,7 @@ func (this *SceneStateAvengersStart) BenchTest(s *base.Scene, p *base.Player) {
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
p.Coin = 5000 * int64(s.GetDBGameFree().GetBaseScore()) p.Coin = 5000 * int64(s.DbGameFree.GetBaseScore())
if playerEx, ok := p.ExtraData.(*AvengersPlayerData); ok { if playerEx, ok := p.ExtraData.(*AvengersPlayerData); ok {
for i := 0; i < BENCH_CNT; i++ { for i := 0; i < BENCH_CNT; i++ {
startCoin := p.Coin startCoin := p.Coin
@ -817,7 +817,7 @@ func (this *SceneStateAvengersStart) BenchTest(s *base.Scene, p *base.Player) {
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet) inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
taxCoin := playerEx.RollGameType.BaseResult.Tax taxCoin := playerEx.RollGameType.BaseResult.Tax
lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.GetDBGameFree().GetBaseScore()) * float64(10000.0-s.GetDBGameFree().GetTaxRate()) / 10000.0 lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.DbGameFree.GetBaseScore()) * float64(10000.0-s.DbGameFree.GetTaxRate()) / 10000.0
jackpotScore := outCoin - playerEx.RollGameType.BaseResult.ChangeCoin - int64(lineScore+0.00001) jackpotScore := outCoin - playerEx.RollGameType.BaseResult.ChangeCoin - int64(lineScore+0.00001)
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin, str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin,
@ -860,7 +860,7 @@ func (this *SceneStateAvengersStart) WinTargetBenchTest(s *base.Scene, p *base.P
} }
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,爆奖,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
switch s.GetDBGameFree().GetSceneType() { switch s.DbGameFree.GetSceneType() {
case 1: case 1:
p.Coin = 100000 p.Coin = 100000
case 2: case 2:
@ -883,7 +883,7 @@ func (this *SceneStateAvengersStart) WinTargetBenchTest(s *base.Scene, p *base.P
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet) inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
taxCoin := playerEx.RollGameType.BaseResult.Tax taxCoin := playerEx.RollGameType.BaseResult.Tax
lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.GetDBGameFree().GetBaseScore()) * float64(10000.0-s.GetDBGameFree().GetTaxRate()) / 10000.0 lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.DbGameFree.GetBaseScore()) * float64(10000.0-s.DbGameFree.GetTaxRate()) / 10000.0
jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001) jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001)
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin, str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin,
@ -915,7 +915,7 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -974,8 +974,8 @@ func AvengersCheckAndSaveLog(sceneEx *AvengersSceneData, playerEx *AvengersPlaye
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: sceneEx.SceneId, SceneId: proto.Int(sceneEx.SceneId),
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -2,5 +2,5 @@ package base
// 提供税收和流水,根据代理需求后台进行分账 // 提供税收和流水,根据代理需求后台进行分账
func ProfitDistribution(p *Player, tax, taxex, validFlow int64) { func ProfitDistribution(p *Player, tax, taxex, validFlow int64) {
//LogChannelSingleton.WriteMQData(model.GenerateTaxDivide(p.SnId, p.Platform, p.Channel, p.BeUnderAgentCode, p.PackageID, tax, taxex, validFlow, p.scene.GameId, p.scene.GameMode, p.scene.GetDBGameFree().GetId(), p.PromoterTree)) //LogChannelSingleton.WriteMQData(model.GenerateTaxDivide(p.SnId, p.Platform, p.Channel, p.BeUnderAgentCode, p.PackageID, tax, taxex, validFlow, p.scene.GameId, p.scene.GameMode, p.scene.DbGameFree.GetId(), p.PromoterTree))
} }

View File

@ -24,8 +24,6 @@ func init() {
etcd.Register(etcd.ETCDKEY_ChannelSwitch, webapi.ChannelSwitchConfig{}, platformConfigEtcd) etcd.Register(etcd.ETCDKEY_ChannelSwitch, webapi.ChannelSwitchConfig{}, platformConfigEtcd)
// 皮肤配置 // 皮肤配置
etcd.Register(etcd.ETCDKEY_SKin, webapi.SkinConfig{}, platformConfigEtcd) etcd.Register(etcd.ETCDKEY_SKin, webapi.SkinConfig{}, platformConfigEtcd)
// 娃娃机配置
etcd.Register(etcd.ETCDKEY_MACHINE, webapi.MachineConfig{}, platformConfigEtcd)
} }
func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) { func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
@ -43,8 +41,6 @@ func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, ev
ConfigMgrInst.GetConfig(d.Platform).ChannelSwitch[d.GetTp()] = d ConfigMgrInst.GetConfig(d.Platform).ChannelSwitch[d.GetTp()] = d
case *webapi.SkinConfig: case *webapi.SkinConfig:
ConfigMgrInst.GetConfig(d.Platform).SkinConfig = d ConfigMgrInst.GetConfig(d.Platform).SkinConfig = d
case *webapi.MachineConfig:
ConfigMgrInst.GetConfig(d.Platform).MachineConfig = d
default: default:
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey) logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
} }

View File

@ -3,8 +3,6 @@ package base
import ( import (
"reflect" "reflect"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/game/model" "mongo.games.com/game/model"
"mongo.games.com/game/mq" "mongo.games.com/game/mq"
) )
@ -40,7 +38,6 @@ func (c *LogChannel) WriteLog(log interface{}) {
if cname == "" { if cname == "" {
cname = "_null_" cname = "_null_"
} }
logger.Logger.Tracef("LogChannel ==> %#v", log)
mq.Send(cname, log) mq.Send(cname, log)
} }
@ -57,5 +54,4 @@ func init() {
LogChannelSingleton.RegisterLogCName(model.GamePlayerListLogCollName, &model.GamePlayerListLog{}) LogChannelSingleton.RegisterLogCName(model.GamePlayerListLogCollName, &model.GamePlayerListLog{})
LogChannelSingleton.RegisterLogCName(model.FriendRecordLogCollName, &model.FriendRecord{}) LogChannelSingleton.RegisterLogCName(model.FriendRecordLogCollName, &model.FriendRecord{})
LogChannelSingleton.RegisterLogCName(model.ItemLogCollName, &model.ItemLog{}) LogChannelSingleton.RegisterLogCName(model.ItemLogCollName, &model.ItemLog{})
LogChannelSingleton.RegisterLogCName(mq.DBCustomLog, &model.CustomLog{})
} }

View File

@ -68,8 +68,8 @@ const (
) )
type Player struct { type Player struct {
model.WGPlayerInfo model.PlayerData //po 持久化对象
ExtraData interface{} //具体游戏对局中的玩家扩展信息 ExtraData interface{} //扩展接口
gateSess *netlib.Session //所在GateServer的session gateSess *netlib.Session //所在GateServer的session
worldSess *netlib.Session //所在WorldServer的session worldSess *netlib.Session //所在WorldServer的session
scene *Scene //当前所在个Scene scene *Scene //当前所在个Scene
@ -113,7 +113,7 @@ type Player struct {
Iparams map[int]int64 //整形参数 Iparams map[int]int64 //整形参数
sparams map[int]string //字符参数 sparams map[int]string //字符参数
IsLocal bool //是否本地player IsLocal bool //是否本地player
Items map[int32]int64 //背包数据, 不可直接修改,使用 AddItems 方法 Items map[int32]int64 //背包数据
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色、假皮肤 MatchParams []int32 //比赛参数 排名、段位、假snid、假角色、假皮肤
MatchRobotGrades []MatchRobotGrade MatchRobotGrades []MatchRobotGrade
TestLog []string // 调试日志 TestLog []string // 调试日志
@ -141,15 +141,13 @@ func NewPlayer(sid int64, data []byte, ws, gs *netlib.Session) *Player {
RankScore: make(map[int32]int64), RankScore: make(map[int32]int64),
} }
//todo 初始化 // 需要make的统一在这里初始化默认值,别的地方就不用再初始化了
p.WGPlayerInfo = model.WGPlayerInfo{ p.PlayerData = model.PlayerData{
PlayerData: &model.PlayerData{ //TotalGameData: make(map[int][]*model.PlayerGameTotal),
GDatas: make(map[string]*model.PlayerGameInfo), GDatas: make(map[string]*model.PlayerGameInfo),
ShopTotal: make(map[int32]*model.ShopTotal), ShopTotal: make(map[int32]*model.ShopTotal),
ShopLastLookTime: make(map[int32]int64), ShopLastLookTime: make(map[int32]int64),
IsFoolPlayer: make(map[string]bool), IsFoolPlayer: make(map[string]bool),
},
GameData: make(map[string]*model.PlayerGameData),
} }
if p.init(data) { if p.init(data) {
@ -248,7 +246,7 @@ func (this *Player) SyncFlagToWorld() {
} }
pack := &server.GWPlayerFlag{ pack := &server.GWPlayerFlag{
SnId: proto.Int32(this.SnId), SnId: proto.Int32(this.SnId),
RoomId: this.scene.SceneId, RoomId: proto.Int(this.scene.SceneId),
Flag: proto.Int(this.flag), Flag: proto.Int(this.flag),
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
@ -375,20 +373,7 @@ func (this *Player) OnAudienceLeave(reason int) {
} }
func (this *Player) MarshalData(gameid int) (d []byte, e error) { func (this *Player) MarshalData(gameid int) (d []byte, e error) {
// 防止参数遗漏 d, e = netlib.Gob.Marshal(&this.PlayerData)
for k, v := range this.GameData {
if v.SnId == 0 {
v.SnId = this.SnId
}
if v.Platform == "" {
v.Platform = this.Platform
}
if v.Id == "" {
v.Id = k
}
}
d, e = netlib.Gob.Marshal(&this.WGPlayerInfo)
logger.Logger.Trace("(this *Player) MarshalData(gameid int)") logger.Logger.Trace("(this *Player) MarshalData(gameid int)")
return return
} }
@ -397,7 +382,7 @@ func (this *Player) UnmarshalData(data []byte) bool {
if len(data) == 0 { if len(data) == 0 {
return true return true
} }
err := netlib.Gob.Unmarshal(data, &this.WGPlayerInfo) err := netlib.Gob.Unmarshal(data, &this.PlayerData)
if err == nil { if err == nil {
this.dirty = true this.dirty = true
return true return true
@ -454,6 +439,7 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
return return
} }
this.Coin += num this.Coin += num
this.Items[common.ItemIDCoin] = this.Coin
if this.scene != nil { if this.scene != nil {
if !this.IsRob && !this.scene.Testing { //机器人log排除掉 if !this.IsRob && !this.scene.Testing { //机器人log排除掉
log := model.NewCoinLogEx(&model.CoinLogParam{ log := model.NewCoinLogEx(&model.CoinLogParam{
@ -481,6 +467,9 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
if this.Coin < 0 { if this.Coin < 0 {
this.Coin = 0 this.Coin = 0
} }
if this.scene.IsHundredScene() {
this.scene.NewBigCoinNotice(this, int64(num), 5)
}
} }
//增加玩家经验 //增加玩家经验
if num > 0 { if num > 0 {
@ -535,6 +524,7 @@ func (this *Player) AddCoinAsync(num int64, gainWay int32, notifyC, broadcast bo
return return
} }
this.Coin += num this.Coin += num
this.Items[common.ItemIDCoin] = this.Coin
if this.scene != nil { if this.scene != nil {
if !this.IsRob && !this.scene.Testing && writeLog { //机器人log排除掉 if !this.IsRob && !this.scene.Testing && writeLog { //机器人log排除掉
log := model.NewCoinLogEx(&model.CoinLogParam{ log := model.NewCoinLogEx(&model.CoinLogParam{
@ -617,6 +607,62 @@ func (this *Player) AddRankScore(rankType int32, num int64) {
} }
} }
// 保存金币变动日志
// 数据用途: 个人房间内牌局账变记录,后台部分报表使用,确保数据计算无误,否则可能影响月底对账
// takeCoin: 牌局结算前玩家身上的金币
// changecoin: 本局玩家输赢的钱,注意是税后
// coin: 结算后玩家当前身上的金币余额
// totalbet: 总下注额
// taxcoin: 本局该玩家产生的税收,这里要包含俱乐部的税
// wincoin: 本局赢取的金币,含税 wincoin==changecoin+taxcoin
// jackpotWinCoin: 从奖池中赢取的金币(拉霸类游戏)
// smallGameWinCoin: 小游戏赢取的金币(拉霸类游戏)
func (this *Player) SaveSceneCoinLog(takeCoin, changecoin, coin, totalbet, taxcoin, wincoin int64, jackpotWinCoin int64, smallGameWinCoin int64) {
if this.scene != nil {
if !this.IsRob && !this.scene.Testing && !this.scene.IsMatchScene() { //机器人log排除掉
var eventType int64 //输赢事件值 默认值为0
if coin-takeCoin > 0 {
eventType = 1
} else if coin-takeCoin < 0 {
eventType = -1
}
log := model.NewSceneCoinLogEx(this.SnId, changecoin, takeCoin, coin, eventType,
int64(this.scene.DbGameFree.GetBaseScore()), totalbet, int32(this.scene.GameId), this.PlayerData.Ip,
this.scene.paramsEx[0], this.Pos, this.Platform, this.Channel, this.BeUnderAgentCode, int32(this.scene.SceneId),
this.scene.DbGameFree.GetGameMode(), this.scene.GetGameFreeId(), taxcoin, wincoin,
jackpotWinCoin, smallGameWinCoin, this.PackageID)
if log != nil {
LogChannelSingleton.WriteLog(log)
}
}
}
}
// 需要关照
func (this *Player) IsNeedCare() bool {
return false
}
// 需要削弱
func (this *Player) IsNeedWeaken() bool {
return false
}
func (this *Player) GetCoinOverPercent() int32 {
return 0
}
func (this *Player) SyncCoin() {
pack := &player.SCPlayerCoinChange{
SnId: proto.Int32(this.SnId),
AddCoin: proto.Int64(0),
RestCoin: proto.Int64(this.Coin),
}
proto.SetDefaults(pack)
this.SendToClient(int(player.PlayerPacketID_PACKET_SC_PLAYERCOINCHANGE), pack)
logger.Logger.Trace("(this *Player) SyncCoin SCPlayerCoinChange:", pack)
}
func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow, in, out int64) { func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow, in, out int64) {
// 记录玩家 首次参与该场次的游戏时间 游戏次数 // 记录玩家 首次参与该场次的游戏时间 游戏次数
var gameFirstTime, gameFreeFirstTime time.Time var gameFirstTime, gameFreeFirstTime time.Time
@ -636,12 +682,25 @@ func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow,
gamingTime := int32(time.Now().Sub(this.scene.GameNowTime).Seconds()) gamingTime := int32(time.Now().Sub(this.scene.GameNowTime).Seconds())
LogChannelSingleton.WriteMQData(model.GenerateGameEvent(model.CreatePlayerGameRecEvent(this.SnId, tax, taxex, changeCoin, validbet, validFlow, in, out, LogChannelSingleton.WriteMQData(model.GenerateGameEvent(model.CreatePlayerGameRecEvent(this.SnId, tax, taxex, changeCoin, validbet, validFlow, in, out,
int32(this.scene.GameId), this.scene.GetGameFreeId(), int32(this.scene.GameMode), int32(this.scene.GameId), this.scene.DbGameFree.GetId(), int32(this.scene.GameMode),
this.scene.GetRecordId(), this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS, this.scene.GetRecordId(), this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS,
this.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime, this.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime,
this.TelephonePromoter, this.DeviceId))) this.TelephonePromoter, this.DeviceId)))
} }
// 破产事件
func (this *Player) ReportBankRuptcy(gameId, gameMode, gameFreeId int32) {
//if !this.IsRob {
// d, e := model.MarshalBankruptcyEvent(2, this.SnId, this.TelephonePromoter, this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.CreateTime, gameId, gameMode, gameFreeId)
// if e == nil {
// rmd := model.NewInfluxDBData("hj.player_bankruptcy", d)
// if rmd != nil {
// InfluxDBDataChannelSington.Write(rmd)
// }
// }
//}
}
// 汇总玩家该次游戏总产生的税收 // 汇总玩家该次游戏总产生的税收
// 数据用途: 平台和推广间分账用,确保数据计算无误, // 数据用途: 平台和推广间分账用,确保数据计算无误,
// 注意:该税收不包含俱乐部的抽水 // 注意:该税收不包含俱乐部的抽水
@ -655,6 +714,30 @@ func (this *Player) AddServiceFee(tax int64) {
} }
} }
//func (this *Player) SaveReportForm(showId, sceneMode int, keyGameId string, profitCoin, flow int64, validBet int64) {
// //个人报表统计
// if this.TotalGameData == nil {
// this.TotalGameData = make(map[int][]*model.PlayerGameTotal)
// }
// if this.TotalGameData[showId] == nil {
// this.TotalGameData[showId] = []*model.PlayerGameTotal{new(model.PlayerGameTotal)}
// }
// td := this.TotalGameData[showId][len(this.TotalGameData[showId])-1]
// td.ProfitCoin += profitCoin
// td.BetCoin += validBet
// td.FlowCoin += flow
// ///////////////最多盈利
// if pgs, exist := this.GDatas[keyGameId]; exist {
// if pgs.Statics.MaxSysOut < profitCoin {
// pgs.Statics.MaxSysOut = profitCoin
// }
// } else {
// gs := model.NewPlayerGameStatics()
// gs.MaxSysOut = profitCoin
// this.GDatas[keyGameId] = &model.PlayerGameInfo{FirstTime: time.Now(), Statics: *gs}
// }
//}
// Statics 弃用,使用 Scene.Statistics 方法 // Statics 弃用,使用 Scene.Statistics 方法
// 个人投入产出汇总以游戏id为key存储 // 个人投入产出汇总以游戏id为key存储
// 数据用途:计算玩家赔率用,数据确保计算无误,否则可能影响玩家手牌的调控 // 数据用途:计算玩家赔率用,数据确保计算无误,否则可能影响玩家手牌的调控
@ -768,18 +851,61 @@ func (this *Player) Statics(keyGameId string, keyGameFreeId string, gain int64,
////} ////}
} }
func (this *Player) SendTrusteeshipTips() {
pack := &player.SCTrusteeshipTips{
Trusteeship: proto.Int32(this.Trusteeship),
TotalNum: proto.Int32(model.GameParamData.PlayerWatchNum),
}
proto.SetDefaults(pack)
logger.Logger.Trace("SCTrusteeshipTips: ", pack)
this.SendToClient(int(player.PlayerPacketID_PACKET_SC_TRUSTEESHIPTIPS), pack)
}
func (this *Player) MarshalIParam() []*server.PlayerIParam {
var params []*server.PlayerIParam
for i, v := range this.Iparams {
params = append(params, &server.PlayerIParam{
ParamId: proto.Int(i),
IntVal: proto.Int64(v),
})
}
return params
}
func (this *Player) UnmarshalIParam(params []*server.PlayerIParam) { func (this *Player) UnmarshalIParam(params []*server.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.PlayerSParam {
var params []*server.PlayerSParam
for i, v := range this.sparams {
params = append(params, &server.PlayerSParam{
ParamId: proto.Int(i),
StrVal: proto.String(v),
})
}
return params
}
func (this *Player) UnmarshalSParam(params []*server.PlayerSParam) { func (this *Player) UnmarshalSParam(params []*server.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.PlayerCParam {
var params []*server.PlayerCParam
for k, v := range this.cparams {
params = append(params, &server.PlayerCParam{
StrKey: proto.String(k),
StrVal: proto.String(v),
})
}
return params
}
func (this *Player) UnmarshalCParam(params []*server.PlayerCParam) { func (this *Player) UnmarshalCParam(params []*server.PlayerCParam) {
for _, p := range params { for _, p := range params {
this.cparams[p.GetStrKey()] = p.GetStrVal() this.cparams[p.GetStrKey()] = p.GetStrVal()
@ -1093,6 +1219,17 @@ func (this *Player) NoviceOdds(gameId int) (int32, bool) {
return int32(odds), b1 return int32(odds), b1
} }
/*// 设置玩家捕鱼等级
func (this *Player) SetFishLevel(level int64) {
data := srvdata.PBDB_PlayerExpMgr.GetData(int32(level))
if data == nil {
logger.Logger.Errorf("设置玩家等级错误snid = %v, lvel = %v", this.SnId, level)
return
}
this.FishLevel = level
this.FishExp = int64(data.Exp)
}*/
// 增加玩家经验 // 增加玩家经验
func (this *Player) AddPlayerExp(exp int64) bool { func (this *Player) AddPlayerExp(exp int64) bool {
this.Exp += exp this.Exp += exp
@ -1258,71 +1395,3 @@ func (this *Player) PetUseSkill() bool {
func (this *Player) GetSkillAdd(id int32) int32 { func (this *Player) GetSkillAdd(id int32) int32 {
return this.GetSkillAdd2(id, ConfigMgrInst) return this.GetSkillAdd2(id, ConfigMgrInst)
} }
// AddItems 添加道具
// 增加或减少道具
// 同步到 worldsrv
func (this *Player) AddItems(args *model.AddItemParam) {
pack := &server.PlayerChangeItems{
SnId: args.P.SnId,
}
for _, v := range args.Change {
item := srvdata.GameItemMgr.Get(this.Platform, v.ItemId)
if item == nil {
continue
}
if v.ItemNum < 0 && this.Items[v.ItemId] < -v.ItemNum {
v.ItemNum = -this.Items[v.ItemId]
}
if v.ItemNum == 0 {
continue
}
this.Items[v.ItemId] += v.ItemNum
if !args.NoLog {
logType := 0
if v.ItemNum < 0 {
logType = 1
}
LogChannelSingleton.WriteLog(model.NewItemLogEx(model.ItemParam{
Platform: this.Platform,
SnId: this.SnId,
LogType: int32(logType),
ItemId: v.ItemId,
ItemName: item.Name,
Count: v.ItemNum,
Remark: args.Remark,
TypeId: args.GainWay,
GameId: args.GameId,
GameFreeId: args.GameFreeId,
Cost: args.Cost,
}))
}
pack.Items = append(pack.Items, &server.Item{
Id: v.ItemId,
Num: v.ItemNum,
})
}
if len(pack.Items) > 0 {
this.SendToWorld(int(server.SSPacketID_PACKET_PlayerChangeItems), pack)
logger.Logger.Tracef("PlayerChangeItems: %v", pack)
}
}
//func (this *Player) ReceiveAddItems(items []*model.Item) {
// for _, v := range items {
// item := srvdata.GameItemMgr.Get(this.Platform, v.ItemId)
// if item == nil {
// continue
// }
// if v.ItemNum < 0 && this.Items[v.ItemId] < -v.ItemNum {
// v.ItemNum = -this.Items[v.ItemId]
// }
// if v.ItemNum == 0 {
// continue
// }
// this.Items[v.ItemId] += v.ItemNum
// logger.Logger.Tracef("ReceiveAddItems snid:%v, item:%v, num:%v change:%v", this.SnId, v.ItemId, this.Items[v.ItemId], v.ItemNum)
// }
//}

View File

@ -55,9 +55,9 @@ func (this *PlayerMgr) AddPlayer(id int64, data []byte, ws, gs *netlib.Session)
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v player exist snid=%v", id, oldPlayer.SnId) logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v player exist snid=%v", id, oldPlayer.SnId)
testFlag = true testFlag = true
if oldPlayer.scene != nil { if oldPlayer.scene != nil {
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId) logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
if SceneMgrSington.GetScene(int(oldPlayer.scene.SceneId)) != nil { if SceneMgrSington.GetScene(oldPlayer.scene.SceneId) != nil {
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v snid=%v in sceneid=%v SceneMgrSington.GetScene(oldPlayer.scene.sceneId) != nil", id, oldPlayer.SnId, oldPlayer.scene.SceneId) logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v SceneMgrSington.GetScene(oldPlayer.scene.sceneId) != nil", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
} }
} }
this.DelPlayer(id) this.DelPlayer(id)

View File

@ -13,6 +13,11 @@ import (
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
) )
const (
ReplayServerType int = 8
ReplayServerId = 801
)
var _replayIgnorePacketIds = map[int]bool{} var _replayIgnorePacketIds = map[int]bool{}
type ReplayRecorder struct { type ReplayRecorder struct {
@ -92,13 +97,13 @@ func (this *ReplayRecorder) Fini(s *Scene) {
// todo dev // todo dev
//Rec: this.rs, //Rec: this.rs,
LogId: proto.String(this.Logid), LogId: proto.String(this.Logid),
GameId: int32(s.GetGameId()), GameId: proto.Int32(s.DbGameFree.GetGameId()),
RoomMode: int32(s.GetGameMode()), RoomMode: proto.Int32(s.DbGameFree.GetGameMode()),
NumOfGames: proto.Int(s.NumOfGames), NumOfGames: proto.Int(s.NumOfGames),
Platform: proto.String(s.Platform), Platform: proto.String(s.Platform),
DatasVer: proto.Int32(s.rrVer), DatasVer: proto.Int32(s.rrVer),
GameFreeid: proto.Int32(s.GetGameFreeId()), GameFreeid: proto.Int32(s.GetGameFreeId()),
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
} }
if s.ClubId != 0 { if s.ClubId != 0 {
pack.ClubId = proto.Int32(s.ClubId) pack.ClubId = proto.Int32(s.ClubId)

File diff suppressed because it is too large Load Diff

View File

@ -21,82 +21,136 @@ var SceneMgrSington = &SceneMgr{
} }
type SceneMgr struct { type SceneMgr struct {
scenes map[int]*Scene // 房间id scenes map[int]*Scene
scenesByGame map[int]map[int]*Scene // 游戏id:房间id scenesByGame map[int]map[int]*Scene
scenesByGameFree map[int32]map[int]*Scene // 场次id:房间id scenesByGameFree map[int32]map[int]*Scene
lastSendJackPot time.Time // lastSendJackPot time.Time
PlatformScene map[string]bool // PlatformScene map[string]bool
} }
type CreateSceneParam struct { func (this *SceneMgr) makeKey(gameid, gamemode int) int {
Session *netlib.Session return int(gameid*10000 + gamemode)
*server.WGCreateScene
} }
func (this *SceneMgr) CreateScene(args *CreateSceneParam) *Scene { func (this *SceneMgr) CreateScene(s *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string,
scene := NewScene(args) params []int64, agentor, creator int32, replayCode string, hallId, groupId, totalOfGames int32,
dbGameFree *server.DB_GameFree, bEnterAfterStart bool, baseScore int32, playerNum int, chessRank []int32, paramsEx ...int32) *Scene {
scene := NewScene(s, sceneId, gameMode, sceneMode, gameId, platform, params, agentor, creator, replayCode,
hallId, groupId, totalOfGames, dbGameFree, bEnterAfterStart, baseScore, playerNum, chessRank, paramsEx...)
if scene == nil { if scene == nil {
logger.Logger.Error("(this *SceneMgr) CreateScene, scene == nil") logger.Logger.Error("(this *SceneMgr) CreateScene, scene == nil")
return nil return nil
} }
this.scenes[scene.SceneId] = scene
platform := args.GetPlatform()
gameId := args.GetGameId()
gameFreeId := args.GetDBGameFree().GetId()
// 平台标记
this.scenes[int(scene.SceneId)] = scene
if _, ok := this.PlatformScene[platform]; !ok { if _, ok := this.PlatformScene[platform]; !ok {
this.PlatformScene[platform] = true this.PlatformScene[platform] = true
} }
// 游戏id索引 //
if ss, exist := this.scenesByGame[int(gameId)]; exist { key := this.makeKey(gameId, gameMode)
ss[int(scene.SceneId)] = scene if ss, exist := this.scenesByGame[key]; exist {
ss[scene.SceneId] = scene
} else { } else {
ss = make(map[int]*Scene) ss = make(map[int]*Scene)
ss[int(scene.SceneId)] = scene ss[scene.SceneId] = scene
this.scenesByGame[int(gameId)] = ss this.scenesByGame[key] = ss
} }
// 场次id索引 //
if ss, exist := this.scenesByGameFree[gameFreeId]; exist { if ss, exist := this.scenesByGameFree[dbGameFree.GetId()]; exist {
ss[int(scene.SceneId)] = scene ss[scene.SceneId] = scene
} else { } else {
ss = make(map[int]*Scene) ss = make(map[int]*Scene)
ss[int(scene.SceneId)] = scene ss[scene.SceneId] = scene
this.scenesByGameFree[gameFreeId] = ss this.scenesByGameFree[dbGameFree.GetId()] = ss
} }
scene.OnStart() scene.OnStart()
logger.Logger.Infof("(this *SceneMgr) CreateScene,New scene,id:[%d] replaycode:[%v]", scene.SceneId, args.GetReplayCode()) logger.Logger.Infof("(this *SceneMgr) CreateScene,New scene,id:[%d] replaycode:[%v]", scene.SceneId, replayCode)
return scene return scene
} }
func (this *SceneMgr) DestroyScene(sceneId int) { func (this *SceneMgr) DestroyScene(sceneId int) {
if scene, exist := this.scenes[sceneId]; exist { if scene, exist := this.scenes[sceneId]; exist {
scene.OnStop() scene.OnStop()
// 游戏id //
if ss, exist := this.scenesByGame[scene.GetGameId()]; exist { key := this.makeKey(scene.GameId, scene.GameMode)
delete(ss, int(scene.SceneId)) if ss, exist := this.scenesByGame[key]; exist {
delete(ss, scene.SceneId)
} }
// 场次id //
if ss, exist := this.scenesByGameFree[scene.GetGameFreeId()]; exist { if ss, exist := this.scenesByGameFree[scene.GetGameFreeId()]; exist {
delete(ss, int(scene.SceneId)) delete(ss, scene.SceneId)
} }
// 房间id
delete(this.scenes, sceneId) delete(this.scenes, sceneId)
logger.Logger.Infof("(this *SceneMgr) DestroyScene, sceneid = %v", sceneId) logger.Logger.Infof("(this *SceneMgr) DestroyScene, sceneid = %v", sceneId)
} }
} }
func (this *SceneMgr) GetPlayerNumByGameFree(platform string, gamefreeid, groupId int32) int32 {
var num int32
if ss, exist := SceneMgrSington.scenesByGameFree[gamefreeid]; exist {
for _, scene := range ss {
if groupId != 0 {
if scene.GroupId == groupId {
cnt := scene.GetRealPlayerCnt()
num += int32(cnt)
}
} else {
if scene.Platform == platform {
cnt := scene.GetRealPlayerCnt()
num += int32(cnt)
}
}
}
}
return num
}
func (this *SceneMgr) GetPlayerNumByGame(platform string, gameid, gamemode, groupId int32) map[int32]int32 {
nums := make(map[int32]int32)
key := this.makeKey(int(gameid), int(gamemode))
if ss, exist := SceneMgrSington.scenesByGame[key]; exist {
for _, scene := range ss {
if groupId != 0 {
if scene.GroupId == groupId {
cnt := scene.GetRealPlayerCnt()
nums[scene.GetGameFreeId()] = nums[scene.GetGameFreeId()] + int32(cnt)
}
} else {
if scene.Platform == platform {
cnt := scene.GetRealPlayerCnt()
nums[scene.GetGameFreeId()] = nums[scene.GetGameFreeId()] + int32(cnt)
}
}
}
}
return nums
}
func (this *SceneMgr) GetPlayersByGameFree(platform string, gamefreeid int32) []*Player {
players := make([]*Player, 0)
if ss, exist := SceneMgrSington.scenesByGameFree[gamefreeid]; exist {
for _, scene := range ss {
if scene.Platform == platform {
for _, p := range scene.Players {
if p != nil {
players = append(players, p)
}
}
}
}
}
return players
}
func (this *SceneMgr) GetScene(sceneId int) *Scene { func (this *SceneMgr) GetScene(sceneId int) *Scene {
if s, exist := this.scenes[sceneId]; exist { if s, exist := this.scenes[sceneId]; exist {
return s return s
} }
return nil return nil
} }
func (this *SceneMgr) GetSceneByGameId(platform string, gameId int32) []*Scene { func (this *SceneMgr) GetSceneByGameId(platform string, gameId int32) []*Scene {
key := this.makeKey(int(gameId), 0)
var ss []*Scene var ss []*Scene
if data, ok := this.scenesByGame[int(gameId)]; ok { if data, ok := this.scenesByGame[key]; ok {
for _, scene := range data { for _, scene := range data {
if scene.Platform == platform { if scene.Platform == platform {
ss = append(ss, scene) ss = append(ss, scene)
@ -105,7 +159,6 @@ func (this *SceneMgr) GetSceneByGameId(platform string, gameId int32) []*Scene {
} }
return ss return ss
} }
func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) { func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
for _, gameId := range gameIds { for _, gameId := range gameIds {
ss := this.GetSceneByGameId(platform, gameId) ss := this.GetSceneByGameId(platform, gameId)
@ -116,7 +169,7 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
val := s.sp.GetJackPotVal(s) val := s.sp.GetJackPotVal(s)
if val > 0 { if val > 0 {
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(s.GetGameFreeId()), GameFreeId: proto.Int32(s.DbGameFree.Id),
JackPotFund: proto.Int64(val), JackPotFund: proto.Int64(val),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -152,13 +205,16 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
} }
} }
} }
func (this *SceneMgr) OnMiniTimer() { func (this *SceneMgr) OnMiniTimer() {
for _, scene := range this.scenes {
scene.SyncPlayerCoin()
}
} }
func (this *SceneMgr) OnHourTimer() { func (this *SceneMgr) OnHourTimer() {
// for _, scene := range this.scenes {
// scene.OnHourTimer()
// }
} }
func (this *SceneMgr) OnDayTimer() { func (this *SceneMgr) OnDayTimer() {

View File

@ -1,9 +1,15 @@
package base package base
import (
"time"
)
// 根据不同的房间模式,选择不同的房间业务逻辑 // 根据不同的房间模式,选择不同的房间业务逻辑
var ScenePolicyPool = make(map[int]map[int]ScenePolicy) // gameId:gameMode var ScenePolicyPool = make(map[int]map[int]ScenePolicy) // gameId:gameMode
type ScenePolicy interface { type ScenePolicy interface {
//心跳间隔
GetHeartBeatInterval() time.Duration
//场景开启事件 //场景开启事件
OnStart(s *Scene) OnStart(s *Scene)
//场景关闭事件 //场景关闭事件
@ -99,6 +105,7 @@ func RegisteScenePolicy(gameId, mode int, sp ScenePolicy) {
type BaseScenePolicy struct { type BaseScenePolicy struct {
} }
func (bsp *BaseScenePolicy) GetHeartBeatInterval() time.Duration { return time.Second }
func (bsp *BaseScenePolicy) OnStart(s *Scene) { func (bsp *BaseScenePolicy) OnStart(s *Scene) {
if s.aiMgr != nil { if s.aiMgr != nil {
s.aiMgr.OnStart(s) s.aiMgr.OnStart(s)

View File

@ -1,6 +1,7 @@
package base package base
import ( import (
"fmt"
"mongo.games.com/game/common" "mongo.games.com/game/common"
"mongo.games.com/game/protocol/machine" "mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
@ -31,7 +32,7 @@ func (this *SrvSessMgr) OnRegiste(s *netlib.Session) {
} else if srvInfo.GetType() == 10 { } else if srvInfo.GetType() == 10 {
logger.Logger.Warn("(this *SrvSessMgr) OnRegiste (Machine):", s) logger.Logger.Warn("(this *SrvSessMgr) OnRegiste (Machine):", s)
s.Send(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{}) s.Send(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{})
logger.Logger.Info("与娃娃机服务器连接成功\n") fmt.Printf("与娃娃机服务器连接成功\n")
} }
} }
} }

View File

@ -59,14 +59,14 @@ func (this *CaiShenSceneData) SceneDestroy(force bool) {
} }
func (this *CaiShenSceneData) init() bool { func (this *CaiShenSceneData) init() bool {
if this.GetDBGameFree() == nil { if this.DbGameFree == nil {
return false return false
} }
params := this.GetDBGameFree().GetJackpot() params := this.DbGameFree.GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
} }
str := base.XSlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.XSlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -102,7 +102,7 @@ type CaiShenSpinResult struct {
} }
func (this *CaiShenSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes CaiShenSpinResult) { func (this *CaiShenSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes CaiShenSpinResult) {
taxRate := this.GetDBGameFree().GetTaxRate() taxRate := this.DbGameFree.GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -188,7 +188,7 @@ func (this *CaiShenSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.GetDBGameFree().Id), GameFreeId: proto.Int32(this.DbGameFree.Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -215,7 +215,7 @@ func (this *CaiShenSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -223,7 +223,7 @@ func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int6
func (this *CaiShenSceneData) BurstHistory(player *CaiShenPlayerData) { func (this *CaiShenSceneData) BurstHistory(player *CaiShenPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId) return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*caishen.CaiShenBurstHistoryInfo var logsp []*caishen.CaiShenBurstHistoryInfo
if data != nil { if data != nil {
@ -251,7 +251,7 @@ func (this *CaiShenSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *CaiShenSceneData) SetLastBurstJackPot() { func (this *CaiShenSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -267,7 +267,7 @@ func (this *CaiShenSceneData) SetLastBurstJackPot() {
func (this *CaiShenSceneData) AIAddJackPot() { func (this *CaiShenSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -280,20 +280,20 @@ func (this *CaiShenSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *CaiShenSceneData) AIBurstJackPot() { func (this *CaiShenSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.GetDBGameFree().GetJackpot() jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, int64(bet)) this.RecordBurstLog(this.RandNickName(), val, int64(bet))
} }
} }
@ -314,11 +314,11 @@ func (this *CaiShenSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.GetDBGameFree().GetPlayNumLimit() != 0 && // this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -95,7 +95,7 @@ func (this *ScenePolicyCaiShen) OnPlayerEnter(s *base.Scene, p *base.Player) {
if sceneEx, ok := s.ExtraData.(*CaiShenSceneData); ok { if sceneEx, ok := s.ExtraData.(*CaiShenSceneData); ok {
playerEx := &CaiShenPlayerData{Player: p} playerEx := &CaiShenPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注 playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
CaiShenSendRoomInfo(s, p, sceneEx, playerEx, nil) CaiShenSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -230,14 +230,14 @@ func (this *ScenePolicyCaiShen) GetJackPotVal(s *base.Scene) int64 {
func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerData, data *caishen.GameBilledData) { func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerData, data *caishen.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &caishen.SCCaiShenRoomInfo{ pack := &caishen.SCCaiShenRoomInfo{
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: s.GameId, GameId: proto.Int(s.GameId),
RoomMode: s.GameMode, RoomMode: proto.Int(s.GameMode),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
GameFreeId: proto.Int32(s.GetDBGameFree().Id), GameFreeId: proto.Int32(s.DbGameFree.Id),
BilledData: data, BilledData: data,
} }
@ -257,7 +257,7 @@ func CaiShenSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *CaiShenSceneDat
//} //}
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore) pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 { if playerEx.totalPriceBonus > 0 {
switch playerEx.bonusStage { switch playerEx.bonusStage {
@ -373,7 +373,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) { if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -407,7 +407,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, caishen.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -422,7 +422,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
//税收比例 //税收比例
taxRate := sceneEx.GetDBGameFree().GetTaxRate() taxRate := sceneEx.DbGameFree.GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Tracef("CaiShenErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Tracef("CaiShenErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -445,8 +445,8 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
// 奖池参数 // 奖池参数
var jackpotParam = sceneEx.GetDBGameFree().GetJackpot() var jackpotParam = sceneEx.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParam[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParam[rule.CAISHEN_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 var jackpotFundAdd, prizeFundAdd int64
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -466,7 +466,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
////统计参与游戏次数 ////统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), // GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -656,7 +656,7 @@ func (this *SceneStateCaiShenStart) OnPlayerOp(s *base.Scene, p *base.Player, op
case CaiShenPlayerHistory: case CaiShenPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId)) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId)
pack := &caishen.SCCaiShenPlayerHistory{} pack := &caishen.SCCaiShenPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -847,7 +847,7 @@ func (this *SceneStateCaiShenStart) WinTargetBenchTest(s *base.Scene, p *base.Pl
} }
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
switch s.GetDBGameFree().GetSceneType() { switch s.DbGameFree.GetSceneType() {
case 1: case 1:
p.Coin = 100000 p.Coin = 100000
case 2: case 2:
@ -905,7 +905,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
}) })
caiShenBenchTestTimes++ caiShenBenchTestTimes++
fileName := fmt.Sprintf("caishen-total-%v-%d.csv", s.GetDBGameFree().GetSceneType(), caiShenBenchTestTimes) fileName := fmt.Sprintf("caishen-total-%v-%d.csv", s.DbGameFree.GetSceneType(), caiShenBenchTestTimes)
file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm) file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
defer file.Close() defer file.Close()
if err != nil { if err != nil {
@ -918,7 +918,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
playersFile := make(map[int32]*os.File) playersFile := make(map[int32]*os.File)
oldCoins := make(map[int32]int64) oldCoins := make(map[int32]int64)
hasCoin := 1000 * int64(s.GetDBGameFree().GetBaseScore()) hasCoin := 1000 * int64(s.DbGameFree.GetBaseScore())
robots := make(map[int32]bool) robots := make(map[int32]bool)
testPlayers := make(map[int32]*base.Player) testPlayers := make(map[int32]*base.Player)
for _, p := range s.Players { for _, p := range s.Players {
@ -926,7 +926,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
p.IsRob = false p.IsRob = false
robots[p.SnId] = true robots[p.SnId] = true
} }
fileName := fmt.Sprintf("caishen-player%v-%v-%d.csv", p.SnId, s.GetDBGameFree().GetSceneType(), caiShenBenchTestTimes) fileName := fmt.Sprintf("caishen-player%v-%v-%d.csv", p.SnId, s.DbGameFree.GetSceneType(), caiShenBenchTestTimes)
file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm) file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
if err != nil { if err != nil {
file, err = os.Create(fileName) file, err = os.Create(fileName)
@ -955,7 +955,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
} }
}() }()
totalBet := int64(s.GetDBGameFree().GetBaseScore()) * int64(len(rule.AllBetLines)) totalBet := int64(s.DbGameFree.GetBaseScore()) * int64(len(rule.AllBetLines))
for i := 0; i < BENCH_CNT; i++ { for i := 0; i < BENCH_CNT; i++ {
for snid, p := range testPlayers { for snid, p := range testPlayers {
if playerEx, ok := p.ExtraData.(*CaiShenPlayerData); ok { if playerEx, ok := p.ExtraData.(*CaiShenPlayerData); ok {
@ -970,7 +970,7 @@ func (this *SceneStateCaiShenStart) MultiplayerBenchTest(s *base.Scene) {
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet) inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
taxCoin := playerEx.RollGameType.BaseResult.Tax taxCoin := playerEx.RollGameType.BaseResult.Tax
lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.GetDBGameFree().GetBaseScore()) * float64(10000.0-s.GetDBGameFree().GetTaxRate()) / 10000.0 lineScore := float64(playerEx.RollGameType.BaseResult.WinRate*s.DbGameFree.GetBaseScore()) * float64(10000.0-s.DbGameFree.GetTaxRate()) / 10000.0
jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001) jackpotScore := outCoin - playerEx.RollGameType.BaseResult.WinSmallGame - int64(lineScore+0.00001)
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, StartCoin, p.Coin, inCoin, outCoin, taxCoin, str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, StartCoin, p.Coin, inCoin, outCoin, taxCoin,
@ -1004,7 +1004,7 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -1063,8 +1063,8 @@ func CaiShenCheckAndSaveLog(sceneEx *CaiShenSceneData, playerEx *CaiShenPlayerDa
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: sceneEx.SceneId, SceneId: proto.Int(sceneEx.SceneId),
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -53,7 +53,7 @@ func getChessVariant(gameId int) int {
} }
func NewSceneEx(s *base.Scene) *SceneEx { func NewSceneEx(s *base.Scene) *SceneEx {
variant := getChessVariant(int(s.GameId)) variant := getChessVariant(s.GameId)
chess := rule.NewChess(variant) chess := rule.NewChess(variant)
chess.Init() chess.Init()
sceneEx := &SceneEx{ sceneEx := &SceneEx{

View File

@ -485,7 +485,7 @@ func CreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *SceneEx, playe
State: proto.Int32(int32(s.GetSceneState().GetState())), State: proto.Int32(int32(s.GetSceneState().GetState())),
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)), TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
TotalOfGames: sceneEx.TotalOfGames, TotalOfGames: proto.Int(sceneEx.TotalOfGames),
CurOpIdx: proto.Int(-1), CurOpIdx: proto.Int(-1),
MasterSnid: proto.Int32(sceneEx.masterSnId), MasterSnid: proto.Int32(sceneEx.masterSnId),
AudienceNum: proto.Int(s.GetAudiencesNum()), AudienceNum: proto.Int(s.GetAudiencesNum()),
@ -528,7 +528,7 @@ func CreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *SceneEx, playe
} }
pack.MatchFinals = 0 pack.MatchFinals = 0
if s.GetMatch().GetIsFinals() { if s.MatchFinals {
pack.MatchFinals = 1 pack.MatchFinals = 1
if s.NumOfGames >= 2 { if s.NumOfGames >= 2 {
pack.MatchFinals = 2 pack.MatchFinals = 2
@ -852,7 +852,7 @@ func (this *SceneStateWaitStart) OnTick(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*SceneEx); ok { if sceneEx, ok := s.GetExtraData().(*SceneEx); ok {
if sceneEx.IsMatchScene() { if sceneEx.IsMatchScene() {
delayT := time.Second * 2 delayT := time.Second * 2
if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画 if sceneEx.MatchRound != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画
delayT = time.Second * 4 delayT = time.Second * 4
} }
if time.Now().Sub(sceneEx.StateStartTime) > delayT { if time.Now().Sub(sceneEx.StateStartTime) > delayT {
@ -1215,14 +1215,14 @@ func (this *SceneStateBilled) OnEnter(s *base.Scene) {
pack := &chesstitians.SCChesstitiansGameBilled{} pack := &chesstitians.SCChesstitiansGameBilled{}
chessType := model.ChesstitiansType{ chessType := model.ChesstitiansType{
GameId: int(sceneEx.GameId), GameId: sceneEx.GameId,
RoomId: int32(sceneEx.GetSceneId()), RoomId: int32(sceneEx.GetSceneId()),
RoomType: sceneEx.Scene.GetDBGameFree().GetSceneType(), RoomType: int32(sceneEx.Scene.SceneType),
NumOfGames: int32(sceneEx.Scene.NumOfGames), NumOfGames: int32(sceneEx.Scene.NumOfGames),
BankId: sceneEx.masterSnId, BankId: sceneEx.masterSnId,
PlayerCount: rule.MaxNumOfPlayer, PlayerCount: rule.MaxNumOfPlayer,
BaseScore: s.BaseScore, BaseScore: s.BaseScore,
TaxRate: s.GetDBGameFree().GetTaxRate(), TaxRate: s.DbGameFree.GetTaxRate(),
RoomMode: s.GetSceneMode(), RoomMode: s.GetSceneMode(),
} }
@ -1462,7 +1462,7 @@ func (this *SceneStateBilled) OnLeave(s *base.Scene) {
return return
} }
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场 if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
s.TryRelease() s.TryRelease()

View File

@ -1,15 +1,11 @@
package clawdoll package clawdoll
import ( import (
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
"mongo.games.com/game/common" "mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base" "mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"strconv"
) )
type CSPlayerOpPacketFactory struct { type CSPlayerOpPacketFactory struct {
@ -52,126 +48,8 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf
} }
return nil return nil
} }
func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!")
if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok {
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
if p == nil {
logger.Logger.Warn("MSDollMachineoCoinResultHandler p == nil")
return nil
}
s := p.GetScene()
if s == nil {
logger.Logger.Warn("MSDollMachineoCoinResultHandler p.scene == nil")
return nil
}
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return nil
}
switch msg.TypeId {
case 1:
if msg.Result == 1 {
logger.Logger.Tracef("上分成功snid = ", msg.Snid)
//发送向前移动指令
//sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonFront)
s.ChangeSceneState(rule.ClawDollSceneStateStart)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
ClawdollBroadcastPlayingInfo(s)
} else {
logger.Logger.Tracef("上分失败snid = ", msg.Snid)
}
case 2:
if msg.Result == 1 {
// 获得娃娃卡
logger.Logger.Tracef("下抓成功snid = ", msg.Snid)
} else {
logger.Logger.Tracef("下抓失败snid = ", msg.Snid)
}
s.ChangeSceneState(rule.ClawDollSceneStateBilled)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
}
}
return nil
}
type CSGetTokenPacketFactory struct {
}
type CSGetTokenHandler struct {
}
func (f *CSGetTokenPacketFactory) CreatePacket() interface{} {
pack := &clawdoll.CSCLAWDOLLGetToken{}
return pack
}
func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
//转发到娃娃机主机
logger.Logger.Tracef("CSGetTokenHandler")
if _, ok := data.(*clawdoll.CSCLAWDOLLGetToken); ok {
p := base.PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSGetTokenHandler p == nil")
return nil
}
scene := p.GetScene()
if scene == nil {
return nil
}
sceneEx, ok := scene.ExtraData.(*SceneEx)
if !ok {
return nil
}
machineId := scene.GetDBGameFree().GetId() % 6080000
machineInfo := sceneEx.GetMachineServerInfo(machineId, p.Platform)
if machineInfo == nil {
logger.Logger.Warn("CSGetTokenHandler machineId = %v not found", machineId)
return nil
}
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v,snid = %d", machineInfo.AppId, machineInfo.ServerSecret, machineInfo.StreamId, p.SnId)
//生成token
token, err := token04.GenerateToken04(uint32(machineInfo.AppId), strconv.Itoa(int(p.SnId)), machineInfo.ServerSecret, 3600, "")
if err != nil {
logger.Logger.Error(err)
return err
}
logger.Logger.Trace("======================token========================", token)
pack := &clawdoll.SCCLAWDOLLSendToken{
LogicId: scene.DBGameFree.GetId(),
Appid: machineInfo.AppId,
Token: token,
StreamId: machineInfo.StreamId,
}
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_SENDTOKEN), pack)
}
return nil
}
func init() { func init() {
common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_PLAYEROP), &CSPlayerOpHandler{}) common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpHandler{})
netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_PLAYEROP), &CSPlayerOpPacketFactory{}) netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpPacketFactory{})
netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{}, MSDollMachineoCoinResultHandler)
//客户端请求token
common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_GETTOKEN), &CSGetTokenHandler{})
netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_GETTOKEN), &CSGetTokenPacketFactory{})
} }

View File

@ -1,19 +1,13 @@
package clawdoll package clawdoll
import ( import (
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base" "mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/srvdata"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
) )
type PlayerEx struct { type PlayerEx struct {
*base.Player //玩家信息 *base.Player //玩家信息
clawDollState int32 // 抓娃娃状态
dollCardsCnt int32 // 娃娃卡数量
winDollCardType int32 // 本局赢取娃娃的类型
gainCoin int64 // 本局赢的金币 gainCoin int64 // 本局赢的金币
taxCoin int64 // 本局税收 taxCoin int64 // 本局税收
odds int32 odds int32
@ -37,68 +31,14 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
return true return true
} }
// 能否投币 func (this *PlayerEx) CanPayCoinByPos() bool {
func (this *PlayerEx) CanPayCoin() bool {
itemID := int32(rule.ClawDoorItemID)
itemCount := this.GetItemCount(itemID)
if itemCount < 1 {
return true
}
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
if itemData == nil {
return false return false
}
num, ok := this.Items[itemID]
if !ok || num < 1 {
return false
}
return true
}
// 投币消耗
func (this *PlayerEx) CostPlayCoin(count int32) bool {
return true
}
// 能否移动
func (this *PlayerEx) CanMove() bool {
s := this.GetScene()
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if !sceneEx.Gaming {
return false
}
}
return true
}
// 能否下抓
func (this *PlayerEx) CanGrab() bool {
s := this.GetScene()
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if !sceneEx.Gaming {
return false
}
}
return true
} }
// 游戏新一局 设置数据 // 游戏新一局 设置数据
func (this *PlayerEx) ReStartGame() { func (this *PlayerEx) ReStartGame() {
this.ReDataStartGame() this.ReDataStartGame()
this.UnmarkFlag(base.PlayerState_WaitNext)
this.UnmarkFlag(base.PlayerState_GameBreak)
this.MarkFlag(base.PlayerState_Ready)
this.gainCoin = 0 this.gainCoin = 0
this.taxCoin = 0 this.taxCoin = 0
this.odds = 0 this.odds = 0
@ -109,7 +49,7 @@ func (this *PlayerEx) InitData(baseScore int32) {
} }
// 重置数据 // 重置下注数据
func (this *PlayerEx) ResetData() { func (this *PlayerEx) ResetData() {
} }
@ -129,26 +69,3 @@ func (this *PlayerEx) CanLeaveScene(sceneState int) bool {
return true return true
} }
// 获取状态
func (this *PlayerEx) GetClawState() int32 {
return this.clawDollState
}
// 设置状态
func (this *PlayerEx) SetClawState(state int32) {
this.clawDollState = state
}
func (this *PlayerEx) GetItemCount(itemID int32) int64 {
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
if itemData != nil {
v, ok := this.Items[itemID]
if ok {
return v
} else {
return 0
}
}
return 0
}

View File

@ -1,29 +1,13 @@
package clawdoll package clawdoll
import ( import (
"container/list" "mongo.games.com/game/protocol/clawdoll"
"crypto/md5" "mongo.games.com/goserver/core/logger"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"mongo.games.com/game/common" "mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll" rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base" "mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/proto" "mongo.games.com/game/proto"
"mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/game/protocol/machine"
"mongo.games.com/game/protocol/webapi"
"mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/task"
"mongo.games.com/goserver/core/timer"
"mongo.games.com/goserver/srvlib"
"net/http"
"net/url"
"time"
) )
type PlayerData struct { type PlayerData struct {
@ -57,21 +41,15 @@ type SceneEx struct {
PlayerBackup map[int32]*PlayerData // 本局离场玩家数据备份 PlayerBackup map[int32]*PlayerData // 本局离场玩家数据备份
seats []*PlayerEx // 本局游戏中的玩家状态数据 seats []*PlayerEx // 本局游戏中的玩家状态数据
waitPlayers *list.List
playingSnid int32 // 正在玩的玩家snid
RoundId int // 局数,第几局 RoundId int // 局数,第几局
robotNum int // 参与游戏的机器人数量 robotNum int // 参与游戏的机器人数量
logid string logid string
machineId int //娃娃机ID
machineConn *netlib.Session //娃娃机链接
machineStatus int32 //娃娃机链接状态 0:离线 1:在线
} }
// 游戏是否能开始 // 游戏是否能开始
func (this *SceneEx) CanStart() bool { func (this *SceneEx) CanStart() bool {
//人数>=1自动开始 //人数>=1自动开始
if len(this.players) >= 1 && (this.GetRealPlayerNum() >= 1 || this.IsPreCreateScene() || this.IsHasPlaying()) { if len(this.players) >= 0 && (this.GetRealPlayerNum() >= 0 || this.IsPreCreateScene()) {
return true return true
} }
return false return false
@ -80,74 +58,25 @@ func (this *SceneEx) CanStart() bool {
// 从房间删除玩家 // 从房间删除玩家
func (this *SceneEx) delPlayer(p *base.Player) { func (this *SceneEx) delPlayer(p *base.Player) {
if p, exist := this.players[p.SnId]; exist { if p, exist := this.players[p.SnId]; exist {
//this.seats[p.GetPos()] = nil this.seats[p.GetPos()] = nil
delete(this.players, p.SnId) delete(this.players, p.SnId)
this.RemoveWaitPlayer(p.SnId)
} }
} }
// 广播玩家进入
func (this *SceneEx) BroadcastPlayerEnter(p *base.Player, reason int) {
pack := &clawdoll.SCCLAWDOLLPlayerEnter{}
pack.Data = &clawdoll.CLAWDOLLPlayerDigestInfo{}
pack.Data.SnId = p.GetSnId()
pack.Data.Head = p.Head
pack.Data.HeadUrl = p.HeadUrl
pack.Data.Name = p.Name
if playerEx, ok := p.ExtraData.(*PlayerEx); ok {
pack.Data.Stat = playerEx.clawDollState
}
proto.SetDefaults(pack)
this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PlayerEnter), pack, p.GetSid())
}
// 广播玩家离开 // 广播玩家离开
func (this *SceneEx) BroadcastPlayerLeave(p *base.Player, reason int) { func (this *SceneEx) BroadcastPlayerLeave(p *base.Player, reason int) {
scLeavePack := &clawdoll.SCCLAWDOLLPlayerLeave{ scLeavePack := &clawdoll.SCCLAWDOLLPlayerLeave{
SnId: proto.Int32(p.SnId), Pos: proto.Int(p.GetPos()),
} }
proto.SetDefaults(scLeavePack) proto.SetDefaults(scLeavePack)
this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PlayerLeave), scLeavePack, p.GetSid()) this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave), scLeavePack, p.GetSid())
}
// 玩家进入事件
func (this *SceneEx) OnPlayerEnter(p *base.Player, reason int) {
this.BroadcastPlayerEnter(p, reason)
machineId := this.GetDBGameFree().GetId() % 6080000
machineInfo := this.GetMachineServerInfo(machineId, p.Platform)
if machineInfo == nil {
return
}
if this.GetPlayerNum() >= 1 && this.GetPlayerNum() <= 3 {
// 发送http Get请求 恢复直播间流
//operateTask(this, 2, rule.Zego_ResumeRTCStream, p.Platform)
}
} }
// 玩家离开事件 // 玩家离开事件
func (this *SceneEx) OnPlayerLeave(p *base.Player, reason int) { func (this *SceneEx) OnPlayerLeave(p *base.Player, reason int) {
this.delPlayer(p) this.delPlayer(p)
this.BroadcastPlayerLeave(p, reason) this.BroadcastPlayerLeave(p, reason)
machineId := this.GetDBGameFree().GetId() % 6080000
machineInfo := this.GetMachineServerInfo(machineId, p.Platform)
if machineInfo == nil {
return
}
if len(this.players) <= 0 {
// 发送http Get请求 关闭直播间流
//operateTask(this, 2, rule.Zego_ForbidRTCStream, p.Platform)
}
} }
func (this *SceneEx) SceneDestroy(force bool) { func (this *SceneEx) SceneDestroy(force bool) {
//销毁房间 //销毁房间
@ -159,7 +88,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu
SnId: proto.Int32(snId), SnId: proto.Int32(snId),
OpCode: proto.Int32(int32(opcode)), OpCode: proto.Int32(int32(opcode)),
Params: params, Params: params,
OpRetCode: opRetCode, OpRetCode: clawdoll.OpResultCode_OPRC_Success,
} }
proto.SetDefaults(pack) proto.SetDefaults(pack)
@ -169,7 +98,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu
// OnPlayerSCOp 发送玩家操作情况 // OnPlayerSCOp 发送玩家操作情况
func (e *SceneEx) OnPlayerSCOp(p *base.Player, opcode int, opRetCode clawdoll.OpResultCode, params []int64) { func (e *SceneEx) OnPlayerSCOp(p *base.Player, opcode int, opRetCode clawdoll.OpResultCode, params []int64) {
pack := e.playerOpPack(p.SnId, opcode, opRetCode, params) pack := e.playerOpPack(p.SnId, opcode, opRetCode, params)
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYEROP), pack) p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYEROP), pack)
logger.Logger.Tracef("OnPlayerSCOp %s", pack) logger.Logger.Tracef("OnPlayerSCOp %s", pack)
} }
@ -204,7 +133,6 @@ func (this *SceneEx) ClawdollCreateRoomInfoPacket(s *base.Scene, p *base.Player)
VIP: proto.Int32(playerEx.VIP), VIP: proto.Int32(playerEx.VIP),
WinCoin: proto.Int64(playerEx.gainCoin), WinCoin: proto.Int64(playerEx.gainCoin),
ClawDollState: proto.Int32(playerEx.clawDollState),
} }
pack.Players = append(pack.Players, pd) pack.Players = append(pack.Players, pd)
@ -224,8 +152,8 @@ func NewClawdollSceneData(s *base.Scene) *SceneEx {
Scene: s, Scene: s,
logic: new(rule.Logic), logic: new(rule.Logic),
players: make(map[int32]*PlayerEx), players: make(map[int32]*PlayerEx),
seats: make([]*PlayerEx, s.GetPlayerNum()),
PlayerBackup: make(map[int32]*PlayerData), PlayerBackup: make(map[int32]*PlayerData),
waitPlayers: list.New(),
} }
return sceneEx return sceneEx
@ -236,40 +164,9 @@ func (this *SceneEx) init() bool {
return true return true
} }
// 检查上分投币是否合法 // 检查上分是否合法
func (this *SceneEx) CheckPayCoinOp(p *PlayerEx) bool { func (this *SceneEx) CheckPayOp(betVal int64, takeMul int64) bool { //游戏底分
if p == nil {
return false
}
if p.SnId == this.playingSnid {
return true return true
}
return false
}
// 检查移动是否合法
func (this *SceneEx) CheckMoveOp(p *PlayerEx) bool {
if p == nil {
return false
}
if p.SnId == this.playingSnid {
return true
}
return false
}
// 下抓是否合法
func (this *SceneEx) CheckGrapOp(p *PlayerEx) bool {
if p == nil {
return false
}
if p.SnId == this.playingSnid {
return true
}
return false
} }
func (this *SceneEx) Clear() { func (this *SceneEx) Clear() {
@ -277,29 +174,13 @@ func (this *SceneEx) Clear() {
this.PlayerBackup = make(map[int32]*PlayerData) this.PlayerBackup = make(map[int32]*PlayerData)
this.RoundId = 0 this.RoundId = 0
for e := this.waitPlayers.Front(); e != nil; e = e.Next() { for i := 0; i < this.GetPlayerNum(); i++ {
if e != nil { if this.seats[i] != nil {
p := e.Value.(*PlayerEx) this.seats[i].Clear(this.GetBaseScore())
p.Clear(0)
} }
} }
} }
// 是否有玩家正在玩
func (this *SceneEx) IsHasPlaying() bool {
if this.playingSnid == 0 {
return false
}
return true
}
// 等待下一个玩家
func (this *SceneEx) ReStartGame() {
this.playingSnid = 0
}
func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
this.PlayerBackup[p.SnId] = &PlayerData{ this.PlayerBackup[p.SnId] = &PlayerData{
SnId: p.SnId, SnId: p.SnId,
@ -322,218 +203,3 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
BeUnderAgentCode: p.BeUnderAgentCode, BeUnderAgentCode: p.BeUnderAgentCode,
} }
} }
func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 {
if player == nil {
return rule.ClawWeak
}
if this.RoundId/2 == 0 && this.RoundId != 0 {
return rule.ClawStrong
}
return rule.ClawWeak
}
func (this *SceneEx) AddWaitPlayer(player *PlayerEx) {
if player == nil {
return
}
this.waitPlayers.PushBack(player)
}
func (this *SceneEx) RemoveWaitPlayer(SnId int32) bool {
l := this.waitPlayers
for e := l.Front(); e != nil; e = e.Next() {
if p := e.Value.(*PlayerEx); p.SnId == SnId {
this.waitPlayers.Remove(e)
return true
}
}
return false
}
func (this *SceneEx) GetPlayingEx() *PlayerEx {
if this.playingSnid == 0 {
return nil
}
return this.players[this.playingSnid]
}
func (this *SceneEx) SetPlayingState(state int32) {
if this.playingSnid == 0 {
return
}
playerEx := this.players[this.playingSnid]
if playerEx != nil {
oldState := playerEx.GetClawState()
if oldState != state {
if oldState == rule.ClawDollPlayerStateWait && (state >= rule.ClawDollPlayerStateStart && state <= rule.ClawDollPlayerWaitPayCoin) {
ClawdollBroadcastPlayingInfo(this.Scene)
}
if state == rule.ClawDollPlayerStateWait && (oldState >= rule.ClawDollPlayerStateStart && oldState <= rule.ClawDollPlayerWaitPayCoin) {
ClawdollBroadcastPlayingInfo(this.Scene)
}
}
playerEx.SetClawState(state)
}
}
// 时间到 系统开始下抓
func (this *SceneEx) TimeOutPlayGrab() bool {
playerEx := this.players[this.playingSnid]
if playerEx != nil {
grapType := this.GetPlayGrabType(playerEx)
this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), grapType)
}
return true
}
// OnPlayerSMGrabOp 下抓 //1-弱力抓 2 -强力抓 3-必出抓
func (this *SceneEx) OnPlayerSMGrabOp(SnId, Id, GrabType int32) {
pack := &machine.SMDollMachineGrab{
Snid: proto.Int32(SnId),
Id: proto.Int32(Id),
TypeId: proto.Int32(GrabType),
}
this.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)
}
// OnPlayerSCOp 发送玩家操作情况 1-前 2-后 3-左 4-右 5-投币
func (this *SceneEx) OnPlayerSMPerateOp(SnId, Id, Perate int32) {
pack := &machine.SMDollMachineoPerate{
Snid: proto.Int32(SnId),
Id: proto.Int32(Id),
Perate: proto.Int32(Perate),
}
this.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack)
}
// 向娃娃机主机发送消息
func (this *SceneEx) SendToMachine(pid int, msg interface{}) {
this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001)
if this.machineConn != nil {
this.machineConn.Send(pid, msg)
} else {
logger.Logger.Error("MachineConn is nil !")
}
}
// actionType : 1 禁止推流 ForbidRTCStream
// actionType : 2 恢复推流 ResumeRTCStream
func operateTask(sceneEx *SceneEx, times int, actionType int, platform string) {
machineId := sceneEx.GetDBGameFree().GetId() % 6080000
machineInfo := sceneEx.GetMachineServerInfo(machineId, platform)
if machineInfo == nil {
logger.Logger.Errorf("ZegoRTCStreamAction machineId: %v, platform: %v", machineId, platform)
return
}
actionTypeStr := "NoneAction"
if actionType == rule.Zego_ForbidRTCStream {
actionTypeStr = "ForbidRTCStream"
} else {
actionTypeStr = "ResumeRTCStream"
}
logger.Logger.Tracef("ZegoRTCStreamAction: actionTypeStr: %v, machineId: %v, machineInfo: %v", actionTypeStr, machineId, machineInfo)
var resp rule.ZegoForbidRTCResp
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
resp = ZegoRTCStreamAction(actionTypeStr, machineInfo)
return nil
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
if resp.Error == 0 && resp.Code == 0 && resp.Message == "ok" {
} else {
logger.Logger.Errorf("ZegoForbidRTCResp Code: %v, Error: %v, Message: %v", resp.Code, resp.Error, resp.Message)
if times > 0 {
timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool {
operateTask(sceneEx, times-1, actionType, platform)
return true
}), nil, time.Second*5, 1)
}
}
}), "ZegoRTCStream_Action").Start()
}
func ZegoRTCStreamAction(Action string, machineInfo *webapi.MachineInfo) rule.ZegoForbidRTCResp {
var zegoForbidRTCResp = rule.ZegoForbidRTCResp{
Error: 1,
}
timestamp := time.Now().Unix()
queryParams := url.Values{}
queryParams.Set("StreamId", "test")
queryParams.Set("Sequence", fmt.Sprintf("%d", timestamp))
// 生成16进制随机字符串(16位)
nonce := make([]byte, 8)
rand.Read(nonce)
hexNonce := hex.EncodeToString(nonce)
// 生成签名
signature := generateSignature(uint32(machineInfo.AppId), machineInfo.ServerSecret, hexNonce, timestamp)
authParams := url.Values{}
authParams.Set("AppId", fmt.Sprintf("%d", uint32(machineInfo.AppId)))
//公共参数中的随机数和生成签名的随机数要一致
authParams.Set("SignatureNonce", hexNonce)
authParams.Set("SignatureVersion", "2.0")
//公共参数中的时间戳和生成签名的时间戳要一致
authParams.Set("Timestamp", fmt.Sprintf("%d", timestamp))
authParams.Set("Signature", signature)
//authParams.Set("IsTest", "true")
// rtc-api.zego.im 表示使用的产品是云通讯产品包括了实时音视频Express Video、实时音频Express Audio、低延迟直播L3
addr := fmt.Sprintf("https://rtc-api.zego.im/?Action=%s&%s&%s", Action, authParams.Encode(), queryParams.Encode())
logger.Logger.Tracef("ZegoRTCStreamAction Get addr: %+v", addr)
rsp, err := http.Get(addr)
if err != nil {
logger.Logger.Errorf("ZegoRTCStreamAction Get err %v", err)
return zegoForbidRTCResp
}
defer rsp.Body.Close()
body, err := ioutil.ReadAll(rsp.Body)
if err != nil {
logger.Logger.Errorf("ZegoRTCStreamAction ioutil.ReadAll err %v", err)
return zegoForbidRTCResp
}
logger.Logger.Tracef("ZegoRTCStreamAction Action: %+v, body: %+v", Action, string(body))
err = json.Unmarshal(body, &zegoForbidRTCResp)
if err != nil {
zegoForbidRTCResp.Error = 5
logger.Logger.Errorf("ZegoRTCStreamAction %v %v", zegoForbidRTCResp, err.Error())
return zegoForbidRTCResp
}
zegoForbidRTCResp.Error = 0
return zegoForbidRTCResp
}
// 生成签名
// Signature=md5(AppId + SignatureNonce + ServerSecret + Timestamp)
func generateSignature(appId uint32, serverSecret, signatureNonce string, timeStamp int64) string {
data := fmt.Sprintf("%d%s%s%d", appId, signatureNonce, serverSecret, timeStamp)
h := md5.New()
h.Write([]byte(data))
return hex.EncodeToString(h.Sum(nil))
}

View File

@ -1,10 +1,7 @@
package clawdoll package clawdoll
import ( import (
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
"mongo.games.com/game/gamesrv/action"
"mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/clawdoll"
"strconv"
"time" "time"
"mongo.games.com/goserver/core" "mongo.games.com/goserver/core"
@ -64,32 +61,6 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) {
if s.SceneState != nil { if s.SceneState != nil {
s.SceneState.OnTick(s) s.SceneState.OnTick(s)
} }
sceneEx, ok := s.ExtraData.(*SceneEx)
if ok {
if sceneEx.machineId == 0 {
machineId := s.DBGameFree.GetId() % 6080000
sceneEx.machineId = action.GetFreeDollMachineId(machineId)
}
if sceneEx.machineId != 0 {
machineStatus := action.GetDollMachineStatus(sceneEx.machineId)
if machineStatus == 0 {
//链接状态不可用 踢出所有玩家
for _, p := range sceneEx.players {
sceneEx.delPlayer(p.Player)
}
sceneEx.machineStatus = 0
logger.Logger.Trace("娃娃机离线,当前场景暂停服务!")
//通知客户单房间不可用
} else {
if sceneEx.machineStatus == 0 {
sceneEx.machineStatus = machineStatus
//通知客户端房间可用
}
}
}
}
} }
func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) { func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) {
@ -98,29 +69,36 @@ func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) {
} }
logger.Logger.Trace("(this *PolicyClawdoll) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.SnId) logger.Logger.Trace("(this *PolicyClawdoll) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.SnId)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok { if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
pos := -1
for i := 0; i < sceneEx.GetPlayerNum(); i++ {
if sceneEx.seats[i] == nil {
pos = i
break
}
}
if pos != -1 {
playerEx := &PlayerEx{Player: p} playerEx := &PlayerEx{Player: p}
sceneEx.seats[pos] = playerEx
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
baseScore := sceneEx.GetBaseScore() baseScore := sceneEx.GetBaseScore()
p.Pos = pos
p.ExtraData = playerEx p.ExtraData = playerEx
playerEx.Clear(baseScore) playerEx.Clear(baseScore)
//playerEx.clawDollState = rule.ClawDollPlayerAudience
if sceneEx.Gaming {
p.MarkFlag(base.PlayerState_WaitNext) p.MarkFlag(base.PlayerState_WaitNext)
p.UnmarkFlag(base.PlayerState_Ready) p.UnmarkFlag(base.PlayerState_Ready)
}
//给自己发送房间信息 //给自己发送房间信息
this.SendRoomInfo(s, p, sceneEx) this.SendRoomInfo(s, p, sceneEx)
ClawdollSendRoomWaitPlayers(s, p)
ClawdollBroadcastPlayingInfo(s)
// 玩家数据发送
sceneEx.OnPlayerEnter(p, 0)
this.SendGetVideoToken(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventEnter, nil) s.FirePlayerEvent(p, base.PlayerEventEnter, nil)
} }
}
} }
func (this *PolicyClawdoll) OnPlayerLeave(s *base.Scene, p *base.Player, reason int) { func (this *PolicyClawdoll) OnPlayerLeave(s *base.Scene, p *base.Player, reason int) {
@ -173,10 +151,6 @@ func (this *PolicyClawdoll) OnPlayerRehold(s *base.Scene, p *base.Player) {
p.MarkFlag(base.PlayerState_Ready) p.MarkFlag(base.PlayerState_Ready)
} }
this.SendRoomInfo(s, p, sceneEx) this.SendRoomInfo(s, p, sceneEx)
ClawdollSendRoomWaitPlayers(s, p)
ClawdollBroadcastPlayingInfo(s)
this.SendGetVideoToken(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventRehold, nil) s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
} }
} }
@ -194,10 +168,6 @@ func (this *PolicyClawdoll) OnPlayerReturn(s *base.Scene, p *base.Player) {
p.MarkFlag(base.PlayerState_Ready) p.MarkFlag(base.PlayerState_Ready)
} }
this.SendRoomInfo(s, p, sceneEx) this.SendRoomInfo(s, p, sceneEx)
ClawdollSendRoomWaitPlayers(s, p)
ClawdollBroadcastPlayingInfo(s)
this.SendGetVideoToken(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventReturn, nil) s.FirePlayerEvent(p, base.PlayerEventReturn, nil)
} }
} }
@ -237,6 +207,9 @@ func (this *PolicyClawdoll) IsCompleted(s *base.Scene) bool {
} }
func (this *PolicyClawdoll) IsCanForceStart(s *base.Scene) bool { func (this *PolicyClawdoll) IsCanForceStart(s *base.Scene) bool {
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
return len(s.Players) >= 2 && !sceneEx.Gaming
}
return false return false
} }
@ -261,49 +234,8 @@ func (this *PolicyClawdoll) CanChangeCoinScene(s *base.Scene, p *base.Player) bo
} }
func (this *PolicyClawdoll) SendRoomInfo(s *base.Scene, p *base.Player, sceneEx *SceneEx) { func (this *PolicyClawdoll) SendRoomInfo(s *base.Scene, p *base.Player, sceneEx *SceneEx) {
if s == nil || p == nil || sceneEx == nil {
return
}
pack := sceneEx.ClawdollCreateRoomInfoPacket(s, p) pack := sceneEx.ClawdollCreateRoomInfoPacket(s, p)
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMINFO), pack)
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_ROOMINFO), pack)
}
func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sceneEx *SceneEx) {
//转发到娃娃机主机
if s == nil || p == nil || sceneEx == nil {
return
}
logger.Logger.Tracef("ClawdollGetVideoToken")
if p == nil {
logger.Logger.Warn("ClawdollGetVideoToken p == nil")
return
}
machineId := s.DBGameFree.GetId() % 6080000
machineinfo := sceneEx.GetMachineServerInfo(machineId, p.Platform)
if machineinfo == nil {
logger.Logger.Warn("CSGetTokenHandler machineId = %v not found", machineId)
return
}
//生成token
token, err := token04.GenerateToken04(uint32(machineinfo.AppId), strconv.Itoa(int(p.SnId)), machineinfo.ServerSecret, 3600, "")
if err != nil {
logger.Logger.Error(err)
return
}
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v, token = %v", machineinfo.AppId, machineinfo.ServerSecret, machineinfo.StreamId, token)
pack := &clawdoll.SCCLAWDOLLSendToken{
LogicId: s.DBGameFree.GetId(),
Appid: machineinfo.AppId,
Token: token,
StreamId: machineinfo.StreamId,
}
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_SENDTOKEN), pack)
} }
// 广播房间状态 // 广播房间状态
@ -312,80 +244,7 @@ func ClawdollBroadcastRoomState(s *base.Scene, params ...float32) {
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Params: params, Params: params,
} }
s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_ROOMSTATE), pack, 0) s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMSTATE), pack, 0)
}
// 玩家状态信息变化
func ClawdollSendPlayerInfo(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
playerEx := sceneEx.GetPlayingEx()
if playerEx != nil && playerEx.SnId == sceneEx.playingSnid {
pack := &clawdoll.SCCLAWDOLLPlayerInfo{
SnId: proto.Int32(playerEx.SnId),
ClawDollState: proto.Int32(playerEx.GetClawState()),
Coin: proto.Int64(playerEx.Coin),
GainCoin: proto.Int64(playerEx.gainCoin),
}
proto.SetDefaults(pack)
playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYERINFO), pack)
}
}
}
// 广播房间里所有等待玩家信息
func ClawdollSendRoomWaitPlayers(s *base.Scene, p *base.Player) {
pack := &clawdoll.CLAWDOLLWaitPlayers{}
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
for _, playerEx := range sceneEx.players {
// 玩家信息
if playerEx.SnId != sceneEx.playingSnid {
pd := &clawdoll.CLAWDOLLPlayerDigestInfo{
SnId: proto.Int32(playerEx.SnId),
Head: proto.Int32(playerEx.Head),
HeadUrl: proto.String(playerEx.HeadUrl),
Name: proto.String(playerEx.Name),
Stat: proto.Int32(playerEx.clawDollState),
}
pack.WaitPlayersInfo = append(pack.WaitPlayersInfo, pd)
}
}
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_WAITPLAYERS), pack)
}
}
// 广播房间正在控制娃娃机的玩家信息
func ClawdollBroadcastPlayingInfo(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if !sceneEx.IsHasPlaying() {
pack := &clawdoll.CLAWDOLLPlayerDigestInfo{
SnId: proto.Int32(0),
Head: proto.Int32(0),
}
s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO), pack, 0)
return
}
playerEx := sceneEx.GetPlayingEx()
if playerEx != nil && playerEx.SnId == sceneEx.playingSnid {
pack := &clawdoll.CLAWDOLLPlayerDigestInfo{
SnId: proto.Int32(playerEx.SnId),
Head: proto.Int32(playerEx.Head),
HeadUrl: proto.String(playerEx.HeadUrl),
Name: proto.String(playerEx.Name),
}
s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO), pack, 0)
//playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYERINFO), pack)
}
}
} }
//===================================== //=====================================
@ -408,14 +267,14 @@ func (this *BaseState) CanChangeTo(s base.SceneState) bool {
func (this *BaseState) CanChangeCoinScene(s *base.Scene, p *base.Player) bool { func (this *BaseState) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
playerEx, ok := p.ExtraData.(*PlayerEx) //playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok { //if !ok {
return false // return false
} //}
//
if !playerEx.CanLeaveScene(s.GetSceneState().GetState()) { //if !playerEx.CanLeaveScene(s.GetSceneState().GetState()) {
return false // return false
} //}
return true return true
} }
@ -429,7 +288,6 @@ func (this *BaseState) OnEnter(s *base.Scene) {
func (this *BaseState) OnLeave(s *base.Scene) {} func (this *BaseState) OnLeave(s *base.Scene) {}
func (this *BaseState) OnTick(s *base.Scene) { func (this *BaseState) OnTick(s *base.Scene) {
} }
func (this *BaseState) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { func (this *BaseState) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
@ -460,19 +318,23 @@ func (this *StateWait) CanChangeTo(s base.SceneState) bool {
} }
func (this *StateWait) GetTimeout(s *base.Scene) int { func (this *StateWait) GetTimeout(s *base.Scene) int {
return this.BaseState.GetTimeout(s) return this.BaseState.GetTimeout(s)
} }
func (this *StateWait) OnEnter(s *base.Scene) { func (this *StateWait) OnEnter(s *base.Scene) {
this.BaseState.OnEnter(s) this.BaseState.OnEnter(s)
if _, ok := s.ExtraData.(*SceneEx); ok { if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if s.Gaming { if s.Gaming {
s.NotifySceneRoundPause() s.NotifySceneRoundPause()
} }
s.Gaming = false s.Gaming = false
ClawdollBroadcastRoomState(s) ClawdollBroadcastRoomState(s, float32(0), float32(0))
ClawdollSendPlayerInfo(s)
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStateStart)
}
} }
} }
@ -499,44 +361,13 @@ func (this *StateWait) OnTick(s *base.Scene) {
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
return return
} }
} if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneWaitTimeout {
} //切换到准备开局状态
func (this *StateWait) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
if this.BaseState.OnPlayerOp(s, p, opcode, params) {
return true
}
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return false
}
switch opcode {
case rule.ClawDollPlayerOpPayCoin:
if sceneEx.IsHasPlaying() {
return false
}
if !playerEx.CanPayCoin() {
return false
}
// 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
if sceneEx.CanStart() { if sceneEx.CanStart() {
sceneEx.playingSnid = playerEx.SnId s.ChangeSceneState(rule.ClawDollSceneStateStart)
}
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
} }
} }
return false
} }
//===================================== //=====================================
@ -555,8 +386,6 @@ func (this *StateStart) CanChangeTo(s base.SceneState) bool {
switch s.GetState() { switch s.GetState() {
case rule.ClawDollSceneStatePlayGame: case rule.ClawDollSceneStatePlayGame:
return true return true
case rule.ClawDollSceneStateWait:
return true
} }
return false return false
} }
@ -564,12 +393,11 @@ func (this *StateStart) CanChangeTo(s base.SceneState) bool {
func (this *StateStart) OnEnter(s *base.Scene) { func (this *StateStart) OnEnter(s *base.Scene) {
this.BaseState.OnEnter(s) this.BaseState.OnEnter(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok { if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
ClawdollBroadcastRoomState(s) ClawdollBroadcastRoomState(s, float32(0), float32(0))
ClawdollSendPlayerInfo(s)
s.Gaming = false s.Gaming = false
sceneEx.GameNowTime = time.Now() sceneEx.GameNowTime = time.Now()
sceneEx.NumOfGames++ sceneEx.NumOfGames++
} }
} }
@ -578,24 +406,32 @@ func (this *StateStart) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*SceneEx); ok { if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneStartTimeout { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneStartTimeout {
//切换到等待操作状态 //切换到等待操作状态
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStatePlayGame) s.ChangeSceneState(rule.ClawDollSceneStatePlayGame)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStatePlayGame)) } else {
s.ChangeSceneState(rule.ClawDollSceneStateWait)
ClawdollBroadcastRoomState(s) }
ClawdollSendPlayerInfo(s)
} }
} }
} }
func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool { func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
if this.BaseState.OnPlayerOp(s, p, opcode, params) {
return true
}
return false return false
} }
func (this *StateStart) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) { func (this *StateStart) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
logger.Logger.Trace("(this *StateStart) OnPlayerEvent, sceneId=", s.GetSceneId(), " player=", p.SnId, " evtcode=", evtcode) logger.Logger.Trace("(this *StateStart) OnPlayerEvent, sceneId=", s.GetSceneId(), " player=", p.SnId, " evtcode=", evtcode)
this.BaseState.OnPlayerEvent(s, p, evtcode, params) this.BaseState.OnPlayerEvent(s, p, evtcode, params)
if _, ok := s.ExtraData.(*SceneEx); ok { if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
switch evtcode { switch evtcode {
case base.PlayerEventLeave:
if !sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStateWait)
}
case base.PlayerEventEnter: case base.PlayerEventEnter:
if !p.IsReady() { if !p.IsReady() {
p.MarkFlag(base.PlayerState_Ready) p.MarkFlag(base.PlayerState_Ready)
@ -631,8 +467,7 @@ func (this *PlayGame) OnEnter(s *base.Scene) {
s.Gaming = true s.Gaming = true
ClawdollBroadcastRoomState(s) ClawdollBroadcastRoomState(s, float32(0), float32(0))
ClawdollSendPlayerInfo(s)
} }
@ -644,68 +479,11 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
return true return true
} }
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return false
}
switch opcode {
case rule.ClawDollPlayerOpGo:
if !sceneEx.CheckGrapOp(playerEx) {
return false
}
if !playerEx.CanGrab() {
return false
}
grapType := sceneEx.GetPlayGrabType(playerEx)
logger.Logger.Trace("StatePlayGame OnPlayerOp-----SnId:", p.SnId, " grapType: ", grapType)
//1-弱力抓 2 -强力抓
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType)
sceneEx.Gaming = false
case rule.ClawDollPlayerOpMove:
if !sceneEx.CheckMoveOp(playerEx) {
return false
}
if !playerEx.CanMove() {
return false
}
if params[0] < rule.ButtonFront || params[0] > rule.ButtonRight {
logger.Logger.Trace("StatePlayGame OnPlayerOp-----SnId:", p.SnId, " opcode: ", opcode, " params:", params)
return false
}
// 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(params[0]))
}
return false return false
} }
func (this *PlayGame) OnTick(s *base.Scene) { func (this *PlayGame) OnTick(s *base.Scene) {
this.BaseState.OnTick(s) this.BaseState.OnTick(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout {
if sceneEx.TimeOutPlayGrab() {
sceneEx.Gaming = false
logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId)
}
return
}
}
} }
//===================================== //=====================================
@ -722,7 +500,7 @@ func (this *StateBilled) GetState() int {
func (this *StateBilled) CanChangeTo(s base.SceneState) bool { func (this *StateBilled) CanChangeTo(s base.SceneState) bool {
switch s.GetState() { switch s.GetState() {
case rule.ClawDollSceneWaitPayCoin: case rule.ClawDollSceneStateStart:
return true return true
} }
return false return false
@ -735,26 +513,6 @@ func (this *StateBilled) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, p
func (this *StateBilled) OnEnter(s *base.Scene) { func (this *StateBilled) OnEnter(s *base.Scene) {
logger.Logger.Trace("(this *StateBilled) OnEnter, sceneid=", s.GetSceneId()) logger.Logger.Trace("(this *StateBilled) OnEnter, sceneid=", s.GetSceneId())
this.BaseState.OnEnter(s) this.BaseState.OnEnter(s)
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return
}
playerEx := sceneEx.GetPlayingEx()
if playerEx != nil {
pack := &clawdoll.SCCLAWDOLLRoundGameBilled{
RoundId: proto.Int32(int32(sceneEx.RoundId)),
ClowResult: proto.Int32(0),
Award: proto.Int64(playerEx.gainCoin),
Balance: proto.Int64(playerEx.Coin),
}
// logger.Logger.Trace("SCSmallRocketRoundGameBilled is pack: ", pack)
proto.SetDefaults(pack)
playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack)
}
} }
func (this *StateBilled) OnLeave(s *base.Scene) { func (this *StateBilled) OnLeave(s *base.Scene) {
@ -774,158 +532,11 @@ func (this *StateBilled) OnTick(s *base.Scene) {
this.BaseState.OnTick(s) this.BaseState.OnTick(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok { if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneBilledTimeout { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneBilledTimeout {
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneWaitPayCoin)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneWaitPayCoin))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
return
}
}
}
//=====================================
// StateWaitPayCoin 等待下一局投币
//=====================================
type StateWaitPayCoin struct {
BaseState
}
func (this *StateWaitPayCoin) GetState() int {
return rule.ClawDollSceneWaitPayCoin
}
func (this *StateWaitPayCoin) CanChangeTo(s base.SceneState) bool {
switch s.GetState() {
case rule.ClawDollSceneStateStart:
return true
case rule.ClawDollSceneStateWait:
return true
}
return false
}
func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
logger.Logger.Trace("StatePlayGame OnPlayerOp-----SnId:", p.SnId, " opcode: ", opcode, " params:", params)
if this.BaseState.OnPlayerOp(s, p, opcode, params) {
return true
}
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return false
}
switch opcode {
case rule.ClawDollPlayerOpPayCoin:
if sceneEx.playingSnid != playerEx.SnId {
logger.Logger.Trace("StateWaitPayCoin OnPlayerOp-----sceneEx.playingSnid:", sceneEx.playingSnid, " playerEx.SnId: ", playerEx.SnId)
return false
}
// 投币检测
if !playerEx.CanPayCoin() {
logger.Logger.Trace("StateWaitPayCoin OnPlayerOp-----CanPayCoin: false")
return false
}
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
playerEx.ReStartGame()
s.ChangeSceneState(rule.ClawDollSceneStateStart) s.ChangeSceneState(rule.ClawDollSceneStateStart)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart)) } else {
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
case rule.ClawDollPlayerCancelPayCoin:
if sceneEx.playingSnid != playerEx.SnId {
logger.Logger.Trace("StateWaitPayCoin OnPlayerOp-----sceneEx.playingSnid:", sceneEx.playingSnid, " playerEx.SnId: ", playerEx.SnId)
return false
}
// 先设置时间
playingEx := sceneEx.GetPlayingEx()
if playingEx != nil {
playingEx.ReStartGame()
ClawdollSendPlayerInfo(s)
}
// 再重置scene数据
sceneEx.ReStartGame()
s.ChangeSceneState(rule.ClawDollSceneStateWait) s.ChangeSceneState(rule.ClawDollSceneStateWait)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateWait))
ClawdollBroadcastRoomState(s)
ClawdollBroadcastPlayingInfo(s)
} }
return false
}
func (this *StateWaitPayCoin) OnEnter(s *base.Scene) {
logger.Logger.Trace("(this *StateWaitPayCoin) OnEnter, sceneid=", s.GetSceneId())
this.BaseState.OnEnter(s)
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return
}
playerEx := sceneEx.GetPlayingEx()
if playerEx != nil {
pack := &clawdoll.SCCLAWDOLLRoundGameBilled{
RoundId: proto.Int32(int32(sceneEx.RoundId)),
ClowResult: proto.Int32(0),
Award: proto.Int64(playerEx.gainCoin),
Balance: proto.Int64(playerEx.Coin),
}
// logger.Logger.Trace("SCSmallRocketRoundGameBilled is pack: ", pack)
proto.SetDefaults(pack)
playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack)
}
}
func (this *StateWaitPayCoin) OnLeave(s *base.Scene) {
logger.Logger.Trace("(this *StateWaitPayCoin) OnLeave, sceneid=", s.GetSceneId())
this.BaseState.OnLeave(s)
}
func (this *StateWaitPayCoin) OnTick(s *base.Scene) {
this.BaseState.OnTick(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneWaitPayCoinimeout {
// 先设置时间
playingEx := sceneEx.GetPlayingEx()
if playingEx != nil {
playingEx.ReStartGame()
ClawdollSendPlayerInfo(s)
}
// 再重置scene数据
sceneEx.ReStartGame()
s.ChangeSceneState(rule.ClawDollSceneStateWait)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateWait))
ClawdollBroadcastRoomState(s)
ClawdollBroadcastPlayingInfo(s)
return return
} }
} }
@ -956,7 +567,6 @@ func init() {
PolicyClawdollSingleton.RegisteSceneState(&StateStart{}) PolicyClawdollSingleton.RegisteSceneState(&StateStart{})
PolicyClawdollSingleton.RegisteSceneState(&PlayGame{}) PolicyClawdollSingleton.RegisteSceneState(&PlayGame{})
PolicyClawdollSingleton.RegisteSceneState(&StateBilled{}) PolicyClawdollSingleton.RegisteSceneState(&StateBilled{})
PolicyClawdollSingleton.RegisteSceneState(&StateWaitPayCoin{})
core.RegisteHook(core.HOOK_BEFORE_START, func() error { core.RegisteHook(core.HOOK_BEFORE_START, func() error {
base.RegisteScenePolicy(common.GameId_Clawdoll, 0, PolicyClawdollSingleton) base.RegisteScenePolicy(common.GameId_Clawdoll, 0, PolicyClawdollSingleton)

View File

@ -53,14 +53,14 @@ func (this *EasterIslandSceneData) OnPlayerLeave(p *base.Player, reason int) {
} }
func (this *EasterIslandSceneData) init() bool { func (this *EasterIslandSceneData) init() bool {
if this.GetDBGameFree() == nil { if this.DbGameFree == nil {
return false return false
} }
params := this.GetDBGameFree().GetJackpot() params := this.DbGameFree.GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -101,7 +101,7 @@ type EasterIslandSpinResult struct {
} }
func (this *EasterIslandSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes EasterIslandSpinResult) { func (this *EasterIslandSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes EasterIslandSpinResult) {
taxRate := this.GetDBGameFree().GetTaxRate() taxRate := this.DbGameFree.GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -192,7 +192,7 @@ func (this *EasterIslandSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.GetDBGameFree().Id), GameFreeId: proto.Int32(this.DbGameFree.Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -218,7 +218,7 @@ func (this *EasterIslandSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -226,7 +226,7 @@ func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet
func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) { func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId) return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*easterisland.EasterIslandBurstHistoryInfo var logsp []*easterisland.EasterIslandBurstHistoryInfo
if data != nil { if data != nil {
@ -254,7 +254,7 @@ func (this *EasterIslandSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *EasterIslandSceneData) SetLastBurstJackPot() { func (this *EasterIslandSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -269,7 +269,7 @@ func (this *EasterIslandSceneData) SetLastBurstJackPot() {
func (this *EasterIslandSceneData) AIAddJackPot() { func (this *EasterIslandSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -282,20 +282,20 @@ func (this *EasterIslandSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *EasterIslandSceneData) AIBurstJackPot() { func (this *EasterIslandSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.GetDBGameFree().GetJackpot() jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet) this.RecordBurstLog(this.RandNickName(), val, bet)
} }
} }
@ -316,11 +316,11 @@ func (this *EasterIslandSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.GetDBGameFree().GetPlayNumLimit() != 0 && // this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -95,7 +95,7 @@ func (this *ScenePolicyEasterIsland) OnPlayerEnter(s *base.Scene, p *base.Player
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok { if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
playerEx := &EasterIslandPlayerData{Player: p} playerEx := &EasterIslandPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注 playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
EasterIslandSendRoomInfo(s, p, sceneEx, playerEx, nil) EasterIslandSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -230,14 +230,14 @@ func (this *ScenePolicyEasterIsland) GetJackPotVal(s *base.Scene) int64 {
func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIslandSceneData, playerEx *EasterIslandPlayerData, data *easterisland.GameBilledData) { func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIslandSceneData, playerEx *EasterIslandPlayerData, data *easterisland.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &easterisland.SCEasterIslandRoomInfo{ pack := &easterisland.SCEasterIslandRoomInfo{
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: s.GameId, GameId: proto.Int(s.GameId),
RoomMode: s.GameMode, RoomMode: proto.Int(s.GameMode),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
GameFreeId: proto.Int32(s.GetDBGameFree().Id), GameFreeId: proto.Int32(s.DbGameFree.Id),
BilledData: data, BilledData: data,
} }
if playerEx != nil { if playerEx != nil {
@ -256,7 +256,7 @@ func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIsla
//} //}
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore) pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 { if playerEx.totalPriceBonus > 0 {
switch playerEx.bonusStage { switch playerEx.bonusStage {
@ -367,7 +367,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) { if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -401,7 +401,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -413,7 +413,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
//获取当前水池的上下文环境 //获取当前水池的上下文环境
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
taxRate := sceneEx.GetDBGameFree().GetTaxRate() taxRate := sceneEx.DbGameFree.GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Warnf("EasterIslandErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Warnf("EasterIslandErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -431,8 +431,8 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额 gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
} }
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
jackpotParams := sceneEx.GetDBGameFree().GetJackpot() // 奖池参数 jackpotParams := sceneEx.DbGameFree.GetJackpot() // 奖池参数
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 var jackpotFundAdd, prizeFundAdd int64
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -449,7 +449,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
////统计参与游戏次数 ////统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), // GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -629,7 +629,7 @@ func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Playe
case EasterIslandPlayerHistory: case EasterIslandPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId)) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId)
pack := &easterisland.SCEasterIslandPlayerHistory{} pack := &easterisland.SCEasterIslandPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -819,7 +819,7 @@ func (this *SceneStateEasterIslandStart) WinTargetBenchTest(s *base.Scene, p *ba
} }
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n") file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
oldCoin := p.Coin oldCoin := p.Coin
switch s.GetDBGameFree().GetSceneType() { switch s.DbGameFree.GetSceneType() {
case 1: case 1:
p.Coin = 100000 p.Coin = 100000
case 2: case 2:
@ -873,7 +873,7 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -932,8 +932,8 @@ func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *Easte
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: sceneEx.SceneId, SceneId: proto.Int(sceneEx.SceneId),
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -406,7 +406,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
status := false status := false
for _, s := range strSlice { for _, s := range strSlice {
num, _ := strconv.Atoi(s) num, _ := strconv.Atoi(s)
if int32(num) == player.GetScene().GetSceneType() { if num == player.GetScene().SceneType {
status = true status = true
} }
} }
@ -414,7 +414,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
pack.Result = 1 pack.Result = 1
pack.Status = fishing_proto.SCFishSkillUseResp_ROOM_DISALLOW pack.Status = fishing_proto.SCFishSkillUseResp_ROOM_DISALLOW
player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack) player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack)
fishlogger.Trace("当前房间不允许使用此技能 skillId = %v,sceneType = %v", skillId, player.GetScene().GetSceneType()) fishlogger.Trace("当前房间不允许使用此技能 skillId = %v,sceneType = %v", skillId, player.GetScene().SceneType)
return nil return nil
} }
//判断当前技能在不在CD中 //判断当前技能在不在CD中
@ -516,7 +516,7 @@ func (this *CSSkillListReqHandler) Process(s *netlib.Session, packetid int, data
pack := &fishing_proto.SCSkillListResp{} pack := &fishing_proto.SCSkillListResp{}
for _, skill := range srvdata.PBDB_FishSkillMgr.Datas.Arr { for _, skill := range srvdata.PBDB_FishSkillMgr.Datas.Arr {
//获取房间类型 //获取房间类型
sceneType := player.GetScene().GetSceneType() sceneType := player.GetScene().SceneType
str := skill.Hidden str := skill.Hidden
num, err := strconv.Atoi(str) num, err := strconv.Atoi(str)
status := true status := true

View File

@ -300,7 +300,7 @@ func (this *FishingPlayerData) SaveDetailedLog(s *base.Scene) {
GameCoinTs: proto.Int64(this.GameCoinTs), GameCoinTs: proto.Int64(this.GameCoinTs),
} }
gwPlayerData := &server_proto.GWPlayerData{ gwPlayerData := &server_proto.GWPlayerData{
SceneId: sceneEx.SceneId, SceneId: proto.Int(sceneEx.SceneId),
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerData.Datas = append(gwPlayerData.Datas, playerBet) gwPlayerData.Datas = append(gwPlayerData.Datas, playerBet)

View File

@ -108,11 +108,12 @@ func (this *FishingSceneData) init() bool {
this.SetPlayerNum(4) this.SetPlayerNum(4)
this.gameId = this.GetGameId() this.gameId = this.GetGameId()
this.platform = this.GetPlatform() this.platform = this.GetPlatform()
this.sceneType = int(this.GetDBGameFree().GetSceneType()) this.sceneType = int(this.DbGameFree.GetSceneType())
this.keyGameId = this.GetKeyGameId() this.keyGameId = this.GetKeyGameId()
this.testing = this.GetTesting() this.testing = this.GetTesting()
this.gamefreeId = this.GetGameFreeId() this.gamefreeId = this.GetGameFreeId()
this.groupId = this.GetGroupId() this.groupId = this.GetGroupId()
this.agentor = this.GetAgentor()
this.sceneMode = this.GetSceneMode() this.sceneMode = this.GetSceneMode()
this.TimePoint = 0 this.TimePoint = 0
this.lastLittleBossTime = time.Now().Unix() this.lastLittleBossTime = time.Now().Unix()
@ -904,7 +905,7 @@ func (this *FishingSceneData) fishSettlements(fishs []*Fish, player *FishingPlay
} }
//BOSS鱼死亡 更新BOSS池和个人池 //BOSS鱼死亡 更新BOSS池和个人池
if value.IsBoss == fishing.Boss { if value.IsBoss == fishing.Boss {
bossPond := base.GetCoinPoolMgr().GetBossPond(this.GetDBGameFree().SceneType) bossPond := base.GetCoinPoolMgr().GetBossPond(this.DbGameFree.SceneType)
this.isBossDie(player, int64(dropCoin), bossPond) this.isBossDie(player, int64(dropCoin), bossPond)
} }
@ -1507,7 +1508,7 @@ func (this *FishingSceneData) AddBossPond(player *FishingPlayerData, fishtype in
// 减掉个人池数值 // 减掉个人池数值
if score > 0 { if score > 0 {
player.MoneyPond -= score player.MoneyPond -= score
base.GetCoinPoolMgr().AddBossPond(this.GetDBGameFree().SceneType, score) base.GetCoinPoolMgr().AddBossPond(this.DbGameFree.SceneType, score)
} }
} }
@ -1521,7 +1522,7 @@ func (this *FishingSceneData) isBossDie(player *FishingPlayerData, score int64,
minNum = bossPond minNum = bossPond
} }
player.MoneyPond += minNum player.MoneyPond += minNum
base.GetCoinPoolMgr().AddBossPond(this.GetDBGameFree().SceneType, -minNum) base.GetCoinPoolMgr().AddBossPond(this.DbGameFree.SceneType, -minNum)
fishlogger.Infof("玩家:%vBoss奖池剩余金币数量%v\n", player.SnId, bossPond) fishlogger.Infof("玩家:%vBoss奖池剩余金币数量%v\n", player.SnId, bossPond)
} }

View File

@ -101,7 +101,7 @@ func (p *FruitsPlayerData) Clear() {
p.weightPos = 0 p.weightPos = 0
} }
func (p *FruitsPlayerData) TestCode(eleLineAppearRate [][]int32, sceneEx *FruitsSceneData) bool { func (p *FruitsPlayerData) TestCode(eleLineAppearRate [][]int32, sceneEx *FruitsSceneData) bool {
//if sceneEx.GetDBGameFree().GetId() == 3060004 { //if sceneEx.DbGameFree.GetId() == 3060004 {
// p.result.CreateLine(eleLineAppearRate, p.gameState == fruits.FreeGame) // p.result.CreateLine(eleLineAppearRate, p.gameState == fruits.FreeGame)
// if p.testIdx == 1 { // if p.testIdx == 1 {
// //test mary // //test mary
@ -186,7 +186,7 @@ func (p *FruitsPlayerData) CreateResult(eleLineAppearRate [][]int32, sceneEx *Fr
case 5: case 5:
winjackpot = int64(math.Ceil(float64(JackPotVal) * 0.4 / float64(fruits.NowByte))) winjackpot = int64(math.Ceil(float64(JackPotVal) * 0.4 / float64(fruits.NowByte)))
} }
if winjackpot < int64(sceneEx.GetDBGameFree().GetJackpotMin())*fruits.NowByte { if winjackpot < int64(sceneEx.DbGameFree.GetJackpotMin())*fruits.NowByte {
isNeed = false isNeed = false
break break
} }

View File

@ -40,7 +40,7 @@ func NewFruitsSceneData(s *base.Scene) *FruitsSceneData {
func (s *FruitsSceneData) Init() { func (s *FruitsSceneData) Init() {
s.LoadJackPotData() s.LoadJackPotData()
//for _, data := range srvdata.PBDB_SlotRateWeightMgr.Datas.Arr { //for _, data := range srvdata.PBDB_SlotRateWeightMgr.Datas.Arr {
// if data.Id == s.GetDBGameFree().Id { // if data.Id == s.DbGameFree.Id {
// //s.levelRate = append(s.levelRate, data.EleWeight1) // //s.levelRate = append(s.levelRate, data.EleWeight1)
// //s.slotRateWeightTotal = append(s.slotRateWeightTotal, data.EleWeight1, data.EleWeight2, data.EleWeight3, data.EleWeight4, data.EleWeight5) // //s.slotRateWeightTotal = append(s.slotRateWeightTotal, data.EleWeight1, data.EleWeight2, data.EleWeight3, data.EleWeight4, data.EleWeight5)
// } // }
@ -59,12 +59,12 @@ func (s *FruitsSceneData) SceneDestroy(force bool) {
} }
func (s *FruitsSceneData) AddPrizeCoin(playerEx *FruitsPlayerData) { func (s *FruitsSceneData) AddPrizeCoin(playerEx *FruitsPlayerData) {
val := playerEx.betCoin val := playerEx.betCoin
tax := int64(math.Ceil(float64(val) * float64(s.GetDBGameFree().GetTaxRate()) / 10000)) tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//playerEx.taxCoin = tax //playerEx.taxCoin = tax
//playerEx.AddServiceFee(tax) //playerEx.AddServiceFee(tax)
val -= tax val -= tax
addPrizeCoin := int64(math.Floor(float64(val*fruits.NowByte*int64(s.GetDBGameFree().GetJackpotRatio())) / 1000)) //扩大10000倍 addPrizeCoin := int64(math.Floor(float64(val*fruits.NowByte*int64(s.DbGameFree.GetJackpotRatio())) / 1000)) //扩大10000倍
s.jackpot.AddToSmall(playerEx.IsRob, addPrizeCoin) s.jackpot.AddToSmall(playerEx.IsRob, addPrizeCoin)
logger.Logger.Tracef("奖池增加...AddPrizeCoin... %f", float64(addPrizeCoin)/float64(fruits.NowByte)) logger.Logger.Tracef("奖池增加...AddPrizeCoin... %f", float64(addPrizeCoin)/float64(fruits.NowByte))
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot) base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
@ -95,7 +95,7 @@ func (s *FruitsSceneData) OnPlayerLeave(p *base.Player, reason int) {
if playerEx.winCoin != 0 { if playerEx.winCoin != 0 {
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false)
//tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//playerEx.taxCoin = tax //playerEx.taxCoin = tax
//playerEx.winCoin -= tax //playerEx.winCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -140,7 +140,7 @@ func (s *FruitsSceneData) Win(p *FruitsPlayerData) {
p.noWinTimes = 0 p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//p.taxCoin = tax //p.taxCoin = tax
//p.winCoin -= tax //p.winCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -210,7 +210,7 @@ func (s *FruitsSceneData) LoadJackPotData() {
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot) base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
} else { } else {
s.jackpot = &base.SlotJackpotPool{} s.jackpot = &base.SlotJackpotPool{}
jp := s.GetDBGameFree().GetJackpot() jp := s.DbGameFree.GetJackpot()
if len(jp) > 0 { if len(jp) > 0 {
s.jackpot.Small += int64(jp[0] * 10000) s.jackpot.Small += int64(jp[0] * 10000)
} }
@ -244,7 +244,7 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) {
} }
} }
FruitsType := model.FruitsType{ FruitsType := model.FruitsType{
RoomId: int(s.SceneId), RoomId: s.SceneId,
BasicScore: int32(p.oneBetCoin), BasicScore: int32(p.oneBetCoin),
PlayerSnId: p.SnId, PlayerSnId: p.SnId,
BeforeCoin: p.startCoin, BeforeCoin: p.startCoin,
@ -372,7 +372,7 @@ func (s *FruitsSceneData) SendPlayerBet(p *FruitsPlayerData) {
Tax: proto.Int64(p.taxCoin), Tax: proto.Int64(p.taxCoin),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()), GameFreeId: proto.Int32(s.DbGameFree.GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
s.SyncPlayerDatas(&base.PlayerDataParam{ s.SyncPlayerDatas(&base.PlayerDataParam{
@ -604,8 +604,8 @@ func (s *FruitsSceneData) GetEleWeight(needpos int32) (norms, frees, marys [][]i
curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId) curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
curCoin = int64(math.Floor(float64(curCoin) / float64(fruits.NowByte))) curCoin = int64(math.Floor(float64(curCoin) / float64(fruits.NowByte)))
for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- { for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
balance := s.GetDBGameFree().BalanceLine[i] balance := s.DbGameFree.BalanceLine[i]
if curCoin >= int64(balance) { if curCoin >= int64(balance) {
key = int32(i) key = int32(i)
break break

View File

@ -148,16 +148,16 @@ func FruitsSendRoomInfo(s *base.Scene, sceneEx *FruitsSceneData, playerEx *Fruit
func FruitsCreateRoomInfoPacket(s *base.Scene, sceneEx *FruitsSceneData, playerEx *FruitsPlayerData) interface{} { func FruitsCreateRoomInfoPacket(s *base.Scene, sceneEx *FruitsSceneData, playerEx *FruitsPlayerData) interface{} {
//房间信息 //房间信息
pack := &protocol.SCFruitsRoomInfo{ pack := &protocol.SCFruitsRoomInfo{
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
GameId: s.GameId, GameId: proto.Int(s.GameId),
RoomMode: s.SceneMode, RoomMode: proto.Int(s.SceneMode),
SceneType: s.GetSceneType(), SceneType: proto.Int(s.SceneType),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
ParamsEx: s.GetDBGameFree().OtherIntParams, ParamsEx: s.DbGameFree.OtherIntParams,
GameFreeId: proto.Int32(s.GetDBGameFree().Id), GameFreeId: proto.Int32(s.DbGameFree.Id),
//BetLimit: s.GetDBGameFree().BetLimit, //BetLimit: s.DbGameFree.BetLimit,
} }
//自己的信息 //自己的信息
@ -299,11 +299,11 @@ func (this *SceneBaseStateFruits) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*FruitsSceneData); ok { if sceneEx, ok := s.ExtraData.(*FruitsSceneData); ok {
//for _, p := range sceneEx.players { //for _, p := range sceneEx.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 && // sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
// s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}
@ -397,7 +397,7 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
//只有开始算操作 //只有开始算操作
p.LastOPTimer = time.Now() p.LastOPTimer = time.Now()
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx { if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
pack := &protocol.SCFruitsOp{ pack := &protocol.SCFruitsOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
OpRetCode: proto.Int(3), OpRetCode: proto.Int(3),
@ -419,12 +419,12 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
if playerEx.gameState == fruits.Normal { if playerEx.gameState == fruits.Normal {
playerEx.freeTotal = 0 playerEx.freeTotal = 0
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / 9 playerEx.oneBetCoin = playerEx.betCoin / 9
//playerEx.isReportGameEvent = true //playerEx.isReportGameEvent = true
playerEx.noWinTimes++ playerEx.noWinTimes++
if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) { if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
//押注限制(低于该值不能押注) //押注限制(低于该值不能押注)
pack := &protocol.SCFruitsOp{ pack := &protocol.SCFruitsOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
@ -486,9 +486,9 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
case fruits.FruitsPlayerOpSwitch: case fruits.FruitsPlayerOpSwitch:
if len(params) > 0 && playerEx.freeTimes == 0 && playerEx.maryFreeTimes == 0 { if len(params) > 0 && playerEx.freeTimes == 0 && playerEx.maryFreeTimes == 0 {
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx { if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / 9 playerEx.oneBetCoin = playerEx.betCoin / 9
} }
} }

View File

@ -67,7 +67,7 @@ func (this *IceAgeSceneData) init() bool {
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.GetPlatform()) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.GetPlatform())
@ -238,7 +238,7 @@ func (this *IceAgeSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.GetDBGameFree().Id), GameFreeId: proto.Int32(this.DbGameFree.Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -264,7 +264,7 @@ func (this *IceAgeSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -272,7 +272,7 @@ func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64
func (this *IceAgeSceneData) BurstHistory(player *IceAgePlayerData) { func (this *IceAgeSceneData) BurstHistory(player *IceAgePlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId) return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*iceage.IceAgeBurstHistoryInfo var logsp []*iceage.IceAgeBurstHistoryInfo
if data != nil { if data != nil {
@ -300,7 +300,7 @@ func (this *IceAgeSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *IceAgeSceneData) SetLastBurstJackPot() { func (this *IceAgeSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -313,7 +313,7 @@ func (this *IceAgeSceneData) SetLastBurstJackPot() {
func (this *IceAgeSceneData) AIAddJackPot() { func (this *IceAgeSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -324,20 +324,20 @@ func (this *IceAgeSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *IceAgeSceneData) AIBurstJackPot() { func (this *IceAgeSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.GetDBGameFree().GetJackpot() jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet) this.RecordBurstLog(this.RandNickName(), val, bet)
} }
} }
@ -358,11 +358,11 @@ func (this *IceAgeSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.GetDBGameFree().GetPlayNumLimit() != 0 && // this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -253,7 +253,7 @@ func IceAgeSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *IceAgeSceneData,
pack.Players = append(pack.Players, pd) pack.Players = append(pack.Players, pd)
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore) pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus) pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
} }
@ -681,7 +681,7 @@ func (this *SceneStateIceAgeStart) OnPlayerOp(s *base.Scene, p *base.Player, opc
case IceAgePlayerHistory: case IceAgePlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), s.GetGameId()) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GetGameId())
pack := &iceage.SCIceAgePlayerHistory{} pack := &iceage.SCIceAgePlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -982,7 +982,7 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData)
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: sceneEx.SceneId, SceneId: proto.Int(sceneEx.SceneId),
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)

View File

@ -19,7 +19,6 @@ import (
// game // game
_ "mongo.games.com/game/gamesrv/chess" _ "mongo.games.com/game/gamesrv/chess"
_ "mongo.games.com/game/gamesrv/clawdoll"
_ "mongo.games.com/game/gamesrv/fishing" _ "mongo.games.com/game/gamesrv/fishing"
_ "mongo.games.com/game/gamesrv/smallrocket" _ "mongo.games.com/game/gamesrv/smallrocket"
_ "mongo.games.com/game/gamesrv/thirteen" _ "mongo.games.com/game/gamesrv/thirteen"

View File

@ -58,12 +58,12 @@ func (s *RichBlessedSceneData) SceneDestroy(force bool) {
} }
func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) { func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) {
val := playerEx.betCoin val := playerEx.betCoin
tax := int64(math.Ceil(float64(val) * float64(s.GetDBGameFree().GetTaxRate()) / 10000)) tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//playerEx.taxCoin = tax //playerEx.taxCoin = tax
//playerEx.AddServiceFee(tax) //playerEx.AddServiceFee(tax)
val -= tax val -= tax
addPrizeCoin := val * richblessed.NowByte * int64(s.GetDBGameFree().GetJackpotRatio()) //扩大10000倍 addPrizeCoin := val * richblessed.NowByte * int64(s.DbGameFree.GetJackpotRatio()) //扩大10000倍
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份 jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
s.jackpot.AddToGrand(playerEx.IsRob, jk1) s.jackpot.AddToGrand(playerEx.IsRob, jk1)
s.jackpot.AddToBig(playerEx.IsRob, jk1) s.jackpot.AddToBig(playerEx.IsRob, jk1)
@ -177,7 +177,7 @@ func (s *RichBlessedSceneData) Win(p *RichBlessedPlayerData) {
p.noWinTimes = 0 p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//p.taxCoin = tax //p.taxCoin = tax
//p.winCoin -= tax //p.winCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -198,7 +198,7 @@ func (s *RichBlessedSceneData) JACKPOTWin(p *RichBlessedPlayerData) {
p.noWinTimes = 0 p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin) //SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.JackwinCoin, false) p.Statics(s.KeyGameId, s.KeyGamefreeId, p.JackwinCoin, false)
//tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000)) //tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//p.taxCoin = tax //p.taxCoin = tax
//p.JackwinCoin -= tax //p.JackwinCoin -= tax
//p.AddServiceFee(tax) //p.AddServiceFee(tax)
@ -271,7 +271,7 @@ func (s *RichBlessedSceneData) LoadJackPotData() {
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot) base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
} else { } else {
s.jackpot = &base.SlotJackpotPool{} s.jackpot = &base.SlotJackpotPool{}
jp := s.GetDBGameFree().GetJackpot() jp := s.DbGameFree.GetJackpot()
if len(jp) > 0 { if len(jp) > 0 {
s.jackpot.Small += int64(jp[0] * 10000) s.jackpot.Small += int64(jp[0] * 10000)
} }
@ -300,7 +300,7 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int)
} }
RichBlessed := model.RichBlessedType{ RichBlessed := model.RichBlessedType{
RoomId: int(s.SceneId), RoomId: s.SceneId,
BasicScore: int32(p.oneBetCoin), BasicScore: int32(p.oneBetCoin),
PlayerSnId: p.SnId, PlayerSnId: p.SnId,
BeforeCoin: p.startCoin, BeforeCoin: p.startCoin,
@ -388,8 +388,8 @@ func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int
curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId) curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
curCoin = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte))) curCoin = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte)))
for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- { for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
balance := s.GetDBGameFree().BalanceLine[i] balance := s.DbGameFree.BalanceLine[i]
if curCoin >= int64(balance) { if curCoin >= int64(balance) {
key = int32(i) key = int32(i)
break break
@ -426,7 +426,7 @@ func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int
} }
func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) { func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) {
//if s.GetDBGameFree().GetId() == 3070004 { //if s.DbGameFree.GetId() == 3070004 {
// playerEx.TestCode(eleLineAppearRate) // playerEx.TestCode(eleLineAppearRate)
//} else { //} else {
playerEx.result.CreateLine(eleLineAppearRate) playerEx.result.CreateLine(eleLineAppearRate)
@ -448,7 +448,7 @@ func (s *RichBlessedSceneData) SendPlayerBet(p *RichBlessedPlayerData) {
GameCoinTs: p.GameCoinTs, GameCoinTs: p.GameCoinTs,
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()), GameFreeId: proto.Int32(s.DbGameFree.GetId()),
SceneId: int32(s.SceneId), SceneId: int32(s.SceneId),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)

View File

@ -71,7 +71,7 @@ func (this *ScenePolicyRichBlessed) OnPlayerEnter(s *base.Scene, p *base.Player)
if s == nil || p == nil { if s == nil || p == nil {
return return
} }
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.GetDBGameFree().GetOtherIntParams()) logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.DbGameFree.GetOtherIntParams())
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok { if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
playerEx := &RichBlessedPlayerData{Player: p} playerEx := &RichBlessedPlayerData{Player: p}
playerEx.init() playerEx.init()
@ -148,15 +148,15 @@ func RichBlessedSendRoomInfo(s *base.Scene, sceneEx *RichBlessedSceneData, playe
func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} { func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} {
//房间信息 //房间信息
pack := &protocol.SCRBRoomInfo{ pack := &protocol.SCRBRoomInfo{
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
GameId: s.GameId, GameId: proto.Int(s.GameId),
RoomMode: s.SceneMode, RoomMode: proto.Int(s.SceneMode),
SceneType: s.GetSceneType(), SceneType: proto.Int(s.SceneType),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
ParamsEx: common.Int64ToInt32(s.GetDBGameFree().OtherIntParams), //s.GetParamsEx(), ParamsEx: common.Int64ToInt32(s.DbGameFree.OtherIntParams), //s.GetParamsEx(),
//BetLimit: s.GetDBGameFree().BetLimit, //BetLimit: s.DbGameFree.BetLimit,
NowGameState: proto.Int(playerEx.gameState), NowGameState: proto.Int(playerEx.gameState),
BetIdx: proto.Int(playerEx.betIdx), BetIdx: proto.Int(playerEx.betIdx),
@ -172,11 +172,11 @@ func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneDat
WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)), WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)),
JackpotEle: proto.Int32(playerEx.result.JackpotEle), JackpotEle: proto.Int32(playerEx.result.JackpotEle),
WinJackpot: proto.Int64(playerEx.JackwinCoin), WinJackpot: proto.Int64(playerEx.JackwinCoin),
GameFreeId: proto.Int32(s.GetDBGameFree().Id), GameFreeId: proto.Int32(s.DbGameFree.Id),
} }
if playerEx.oneBetCoin == 0 && len(s.GetDBGameFree().GetOtherIntParams()) != 0 { // 初始化客户端jack显示 if playerEx.oneBetCoin == 0 && len(s.DbGameFree.GetOtherIntParams()) != 0 { // 初始化客户端jack显示
oneBetCoin := int64(s.GetDBGameFree().GetOtherIntParams()[0] / richblessed.LineNum) oneBetCoin := int64(s.DbGameFree.GetOtherIntParams()[0] / richblessed.LineNum)
pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl] pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl]
pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy] pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy]
pack.BigJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldGirl] pack.BigJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldGirl]
@ -302,11 +302,11 @@ func (this *SceneBaseStateRichBlessed) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok { if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok {
//for _, p := range sceneEx.players { //for _, p := range sceneEx.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 && // sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
// s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}
@ -401,7 +401,7 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
//只有开始算操作 //只有开始算操作
p.LastOPTimer = time.Now() p.LastOPTimer = time.Now()
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx { if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
pack := &protocol.SCRichBlessedOp{ pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
OpRetCode: proto.Int(3), OpRetCode: proto.Int(3),
@ -423,13 +423,13 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
if playerEx.gameState == richblessed.Normal { if playerEx.gameState == richblessed.Normal {
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin) logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin)
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
maxidx := len(sceneEx.GetDBGameFree().GetOtherIntParams()) - 1 maxidx := len(sceneEx.DbGameFree.GetOtherIntParams()) - 1
playerEx.maxbetCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[maxidx]) playerEx.maxbetCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[maxidx])
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注 playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注
playerEx.noWinTimes++ playerEx.noWinTimes++
if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) { if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
//押注限制(低于该值不能押注) //押注限制(低于该值不能押注)
pack := &protocol.SCRichBlessedOp{ pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),
@ -495,9 +495,9 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
case richblessed.RichBlessedPlayerOpSwitch: case richblessed.RichBlessedPlayerOpSwitch:
if len(params) > 0 && playerEx.freeTimes == 0 { if len(params) > 0 && playerEx.freeTimes == 0 {
idx := int(params[0]) idx := int(params[0])
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx { if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
playerEx.betIdx = idx playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx]) playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum
pack := &protocol.SCRichBlessedOp{ pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode), OpCode: proto.Int(opcode),

View File

@ -271,15 +271,15 @@ func (this *SceneEx) init() bool {
} }
func (this *SceneEx) GetBaseScore() int32 { //游戏底分 func (this *SceneEx) GetBaseScore() int32 { //游戏底分
if this.GetDBGameFree() != nil { if this.DbGameFree != nil {
return this.GetDBGameFree().GetBaseScore() return this.DbGameFree.GetBaseScore()
} }
return 1 return 1
} }
func (this *SceneEx) GetBetMaxCoin() int32 { //游戏底分 func (this *SceneEx) GetBetMaxCoin() int32 { //游戏底分
if this.GetDBGameFree() != nil { if this.DbGameFree != nil {
return this.GetDBGameFree().GetBaseScore() * 10000 return this.DbGameFree.GetBaseScore() * 10000
} }
return 1 * 10000 return 1 * 10000
} }

View File

@ -52,14 +52,14 @@ func (this *TamQuocSceneData) SceneDestroy(force bool) {
} }
func (this *TamQuocSceneData) init() bool { func (this *TamQuocSceneData) init() bool {
if this.GetDBGameFree() == nil { if this.DbGameFree == nil {
return false return false
} }
params := this.GetDBGameFree().GetJackpot() params := this.DbGameFree.GetJackpot()
this.jackpot = &base.SlotJackpotPool{} this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 { if this.jackpot.Small <= 0 {
this.jackpot.Small = 0 this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) this.jackpot.VirtualJK = int64(params[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
} }
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform) str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" { if str != "" {
@ -95,7 +95,7 @@ type TamQuocSpinResult struct {
} }
func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes TamQuocSpinResult) { func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes TamQuocSpinResult) {
taxRate := this.GetDBGameFree().GetTaxRate() taxRate := this.DbGameFree.GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 { calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil { if taxScore != nil {
@ -114,7 +114,7 @@ func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betVa
if spinRes.TotalPrizeJackpot == 0 { // 第一个爆奖 获取当前奖池所有 if spinRes.TotalPrizeJackpot == 0 { // 第一个爆奖 获取当前奖池所有
prizeJackpot = this.jackpot.VirtualJK prizeJackpot = this.jackpot.VirtualJK
} else { // 之后的爆奖 奖励为奖池初值 } else { // 之后的爆奖 奖励为奖池初值
prizeJackpot = int64(this.GetDBGameFree().GetJackpot()[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) prizeJackpot = int64(this.DbGameFree.GetJackpot()[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
} }
prizeJackpot = calcTaxScore(prizeJackpot, &spinRes.TotalTaxScore) prizeJackpot = calcTaxScore(prizeJackpot, &spinRes.TotalTaxScore)
spinRes.TotalPrizeJackpot += prizeJackpot spinRes.TotalPrizeJackpot += prizeJackpot
@ -177,7 +177,7 @@ func (this *TamQuocSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{} pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{ jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.GetDBGameFree().Id), GameFreeId: proto.Int32(this.DbGameFree.Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK), JackPotFund: proto.Int64(this.jackpot.VirtualJK),
} }
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi) pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -204,7 +204,7 @@ func (this *TamQuocSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
} }
} }
func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int64) { func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet) log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log) return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start() }), nil, "InsertBurstJackpotLogs").Start()
@ -212,7 +212,7 @@ func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int6
func (this *TamQuocSceneData) BurstHistory(player *TamQuocPlayerData) { func (this *TamQuocSceneData) BurstHistory(player *TamQuocPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId) return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) { }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*tamquoc.TamQuocBurstHistoryInfo var logsp []*tamquoc.TamQuocBurstHistoryInfo
if data != nil { if data != nil {
@ -240,7 +240,7 @@ func (this *TamQuocSceneData) GetLastBurstJackPot() time.Time {
} }
func (this *TamQuocSceneData) SetLastBurstJackPot() { func (this *TamQuocSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200 var randT = rand.Intn(25200-7200+1) + 7200
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(25200-7200+1) + 7200 randT = rand.Intn(25200-7200+1) + 7200
case 2: case 2:
@ -254,7 +254,7 @@ func (this *TamQuocSceneData) SetLastBurstJackPot() {
func (this *TamQuocSceneData) AIAddJackPot() { func (this *TamQuocSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 { if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1 var randT = rand.Intn(3) + 1
switch this.GetDBGameFree().SceneType { switch this.DbGameFree.SceneType {
case 1: case 1:
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
case 2: case 2:
@ -265,20 +265,20 @@ func (this *TamQuocSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1 randT = rand.Intn(3) + 1
} }
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT)) this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000)) val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val this.jackpot.VirtualJK += val
} }
} }
func (this *TamQuocSceneData) AIBurstJackPot() { func (this *TamQuocSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 { if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot() this.SetLastBurstJackPot()
jackpotParams := this.GetDBGameFree().GetJackpot() jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
//AI机器人爆奖 //AI机器人爆奖
val := this.jackpot.VirtualJK val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit this.jackpot.VirtualJK = jackpotInit
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM) bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, int64(bet)) this.RecordBurstLog(this.RandNickName(), val, int64(bet))
} }
} }
@ -299,11 +299,11 @@ func (this *TamQuocSceneData) KickPlayerByTime() {
} }
//for _, p := range this.players { //for _, p := range this.players {
// //游戏次数达到目标值 // //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId())) // todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// if !p.IsRob && // if !p.IsRob &&
// todayGamefreeIDSceneData != nil && // todayGamefreeIDSceneData != nil &&
// this.GetDBGameFree().GetPlayNumLimit() != 0 && // this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) { // todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true) // this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// } // }
//} //}

View File

@ -91,7 +91,7 @@ func (this *ScenePolicyTamQuoc) OnPlayerEnter(s *base.Scene, p *base.Player) {
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok { if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
playerEx := &TamQuocPlayerData{Player: p} playerEx := &TamQuocPlayerData{Player: p}
playerEx.init(s) // 玩家当前信息初始化 playerEx.init(s) // 玩家当前信息初始化
playerEx.score = sceneEx.GetDBGameFree().GetBaseScore() // 底注 playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
sceneEx.players[p.SnId] = playerEx sceneEx.players[p.SnId] = playerEx
p.ExtraData = playerEx p.ExtraData = playerEx
TamQuocSendRoomInfo(s, p, sceneEx, playerEx, nil) TamQuocSendRoomInfo(s, p, sceneEx, playerEx, nil)
@ -226,10 +226,10 @@ func (this *ScenePolicyTamQuoc) GetJackPotVal(s *base.Scene) int64 {
func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerData, data *tamquoc.GameBilledData) { func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerData, data *tamquoc.GameBilledData) {
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId) logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
pack := &tamquoc.SCTamQuocRoomInfo{ pack := &tamquoc.SCTamQuocRoomInfo{
RoomId: s.SceneId, RoomId: proto.Int(s.SceneId),
Creator: proto.Int32(s.Creator), Creator: proto.Int32(s.Creator),
GameId: s.GameId, GameId: proto.Int(s.GameId),
RoomMode: s.GameMode, RoomMode: proto.Int(s.GameMode),
Params: common.CopySliceInt64ToInt32(s.Params), Params: common.CopySliceInt64ToInt32(s.Params),
State: proto.Int(s.SceneState.GetState()), State: proto.Int(s.SceneState.GetState()),
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK), Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
@ -252,7 +252,7 @@ func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneDat
//} //}
pack.BetLines = playerEx.betLines pack.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes) pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore) pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
pack.SpinID = proto.Int64(playerEx.spinID) pack.SpinID = proto.Int64(playerEx.spinID)
if playerEx.totalPriceBonus > 0 && playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Before(time.Now()) { if playerEx.totalPriceBonus > 0 && playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Before(time.Now()) {
playerEx.totalPriceBonus = 0 playerEx.totalPriceBonus = 0
@ -339,7 +339,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
return false return false
} }
//先做底注校验 //先做底注校验
if sceneEx.GetDBGameFree().GetBaseScore() != int32(params[0]) { if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
return false return false
} }
@ -373,7 +373,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin { if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} else if playerEx.freeTimes <= 0 && int64(sceneEx.GetDBGameFree().GetBetLimit()) > playerEx.Coin { //押注限制 } else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params) this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
return false return false
} }
@ -388,7 +388,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId) sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
//税收比例 //税收比例
taxRate := sceneEx.GetDBGameFree().GetTaxRate() taxRate := sceneEx.DbGameFree.GetTaxRate()
if taxRate < 0 || taxRate > 10000 { if taxRate < 0 || taxRate > 10000 {
logger.Logger.Tracef("TamQuocErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate) logger.Logger.Tracef("TamQuocErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
taxRate = 500 taxRate = 500
@ -410,8 +410,8 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额 prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
// 奖池参数 // 奖池参数
var jackpotParam = sceneEx.GetDBGameFree().GetJackpot() var jackpotParam = sceneEx.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(sceneEx.GetDBGameFree().GetBaseScore()) //奖池初始值 var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot]) * int64(sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
var jackpotFundAdd, prizeFundAdd int64 var jackpotFundAdd, prizeFundAdd int64
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注 if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
@ -431,7 +431,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
//统计参与游戏次数 //统计参与游戏次数
//if !sceneEx.Testing && !playerEx.IsRob { //if !sceneEx.Testing && !playerEx.IsRob {
// pack := &server.GWSceneEnd{ // pack := &server.GWSceneEnd{
// GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), // GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}}, // Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
// } // }
// proto.SetDefaults(pack) // proto.SetDefaults(pack)
@ -454,11 +454,11 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
var slotDataIsOk bool var slotDataIsOk bool
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
slotData = rule.GenerateSlotsData_v2(symbolType) slotData = rule.GenerateSlotsData_v2(symbolType)
//if sceneEx.GetDBGameFree().GetSceneType() == 1 { //if sceneEx.DbGameFree.GetSceneType() == 1 {
// slotData = []int{1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7} // slotData = []int{1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7}
//} //}
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0]) spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
//if sceneEx.GetDBGameFree().GetSceneType() == 1 { //if sceneEx.DbGameFree.GetSceneType() == 1 {
// slotDataIsOk = true // slotDataIsOk = true
// break // break
//} //}
@ -641,7 +641,7 @@ func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, op
case TamQuocPlayerHistory: case TamQuocPlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10) spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), int(s.GameId)) gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId)
pack := &tamquoc.SCTamQuocPlayerHistory{} pack := &tamquoc.SCTamQuocPlayerHistory{}
for _, v := range gpl.Data { for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" { //if v.GameDetailedLogId == "" {
@ -759,7 +759,7 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
//log2 //log2
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.GetDBGameFree().GetBaseScore() playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore()
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId) playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
@ -818,8 +818,8 @@ func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerDa
GameCoinTs: proto.Int64(playerEx.GameCoinTs), GameCoinTs: proto.Int64(playerEx.GameCoinTs),
} }
gwPlayerBet := &server.GWPlayerData{ gwPlayerBet := &server.GWPlayerData{
SceneId: sceneEx.SceneId, SceneId: proto.Int(sceneEx.SceneId),
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()), GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
} }
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet) gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{ sceneEx.SyncPlayerDatas(&base.PlayerDataParam{

View File

@ -173,6 +173,7 @@ func (this *SceneEx) ThirteenWaterCreateRoomInfoPacket(s *base.Scene, p *base.Pl
Creator: proto.Int32(s.GetCreator()), Creator: proto.Int32(s.GetCreator()),
GameId: proto.Int(s.GetGameId()), GameId: proto.Int(s.GetGameId()),
RoomMode: proto.Int(s.GetSceneMode()), RoomMode: proto.Int(s.GetSceneMode()),
AgentId: proto.Int32(s.GetAgentor()),
SceneType: s.GetDBGameFree().SceneType, SceneType: s.GetDBGameFree().SceneType,
State: proto.Int(s.GetSceneState().GetState()), State: proto.Int(s.GetSceneState().GetState()),
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)), TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
@ -368,15 +369,15 @@ func (this *SceneEx) ThirteenWaterCreateRoomInfoPacket(s *base.Scene, p *base.Pl
} }
func (this *SceneEx) GetBaseScore() int64 { //游戏底分 func (this *SceneEx) GetBaseScore() int64 { //游戏底分
if this.GetDBGameFree().FreeMode == 1 { if this.DbGameFree.FreeMode == 1 {
baseScore := this.GetParam(rule.ParamBaseScore) baseScore := this.GetParam(rule.ParamBaseScore)
if baseScore > 0 { if baseScore > 0 {
return baseScore return baseScore
} }
} }
if this.GetDBGameFree() != nil { if this.DbGameFree != nil {
return int64(this.GetDBGameFree().GetBaseScore()) return int64(this.DbGameFree.GetBaseScore())
} }
return 1 return 1
} }
@ -1268,7 +1269,7 @@ func (this *SceneEx) CountBilled() {
} }
if playerEx.gainCoin > 0 { if playerEx.gainCoin > 0 {
gainCoin := playerEx.gainCoin gainCoin := playerEx.gainCoin
playerEx.gainCoin = playerEx.gainCoin * int64(10000-this.GetDBGameFree().GetTaxRate()) / 10000 playerEx.gainCoin = playerEx.gainCoin * int64(10000-this.DbGameFree.GetTaxRate()) / 10000
playerEx.taxCoin = gainCoin - playerEx.gainCoin playerEx.taxCoin = gainCoin - playerEx.gainCoin
} }
logger.Logger.Tracef("玩家分数 %v, coin:%v tax:%v win:%v", playerEx.SnId, playerEx.gainCoin, playerEx.taxCoin, playerEx.winAllPlayers) logger.Logger.Tracef("玩家分数 %v, coin:%v tax:%v win:%v", playerEx.SnId, playerEx.gainCoin, playerEx.taxCoin, playerEx.winAllPlayers)
@ -1334,7 +1335,7 @@ func (this *SceneEx) SendHandCardOdds() {
if seat.IsRob { if seat.IsRob {
robotPlayers = append(robotPlayers, seat) robotPlayers = append(robotPlayers, seat)
} else { } else {
seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotNum > 0)
seat.playerPool = int(this.PlayerPoolOdds(seat.Player)) seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
if seat.odds > 0 { if seat.odds > 0 {
realPlayersGood = append(realPlayersGood, seat) realPlayersGood = append(realPlayersGood, seat)

View File

@ -1258,9 +1258,9 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
if sceneEx.gamePlayerNum-sceneEx.robotNum > 0 { if sceneEx.gamePlayerNum-sceneEx.robotNum > 0 {
/////////////////////////////////////统计牌局详细记录 /////////////////////////////////////统计牌局详细记录
thirteenWaterType := model.ThirteenWaterType{ thirteenWaterType := model.ThirteenWaterType{
RoomId: sceneEx.SceneId, RoomId: int32(sceneEx.SceneId),
RoomRounds: int32(sceneEx.NumOfGames), RoomRounds: int32(sceneEx.NumOfGames),
RoomType: sceneEx.GetSceneType(), RoomType: int32(sceneEx.SceneType),
BaseScore: int32(sceneEx.GetBaseScore()), BaseScore: int32(sceneEx.GetBaseScore()),
NowRound: int32(sceneEx.NumOfGames), NowRound: int32(sceneEx.NumOfGames),
ClubRate: sceneEx.Scene.PumpCoin, ClubRate: sceneEx.Scene.PumpCoin,
@ -1462,7 +1462,7 @@ func (this *StateBilled) OnLeave(s *base.Scene) {
s.TryDismissRob() s.TryDismissRob()
} }
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场 if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
s.TryRelease() s.TryRelease()

View File

@ -21,17 +21,6 @@ import (
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
) )
type BilledInfo struct {
Round int32 // 第几局
ChangeScore int64 // 积分变化
Score int64 // 结算后积分
}
type Item struct {
Id int32
Num int64
}
// 房间上的额外数据 // 房间上的额外数据
type TienLenSceneData struct { type TienLenSceneData struct {
*base.Scene //场景 *base.Scene //场景
@ -67,11 +56,6 @@ type TienLenSceneData struct {
isCardsKu bool //是否是牌库 isCardsKu bool //是否是牌库
cardsKuId int32 //牌库ID cardsKuId int32 //牌库ID
ctrlType int // 1控赢 2控输 0不控 ctrlType int // 1控赢 2控输 0不控
BilledList map[int32]*[]*BilledInfo // 多轮结算记录, 玩家id:每局结算记录
RoundEndTime []int64 // 每局结束时间
RoundLogId []string // 每局牌局记录id
CustomLogSave bool // 是否已经保存日志
PlayerAward map[int32]*[]*model.Item // 房卡场最终奖励
} }
func NewTienLenSceneData(s *base.Scene) *TienLenSceneData { func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
@ -79,8 +63,6 @@ func NewTienLenSceneData(s *base.Scene) *TienLenSceneData {
Scene: s, Scene: s,
poker: rule.NewPoker(), poker: rule.NewPoker(),
players: make(map[int32]*TienLenPlayerData), players: make(map[int32]*TienLenPlayerData),
BilledList: map[int32]*[]*BilledInfo{},
PlayerAward: make(map[int32]*[]*model.Item),
} }
sceneEx.Clear() sceneEx.Clear()
return sceneEx return sceneEx
@ -161,11 +143,6 @@ func (this *TienLenSceneData) CanStart() bool {
return false return false
} }
} }
if this.IsCustom() {
return this.IsAllReady() && this.GetPlayerCnt() >= this.GetPlayerNum()
}
// 房间人数>=2开始,并且有真人或者是预创建房间,并且有房主 // 房间人数>=2开始,并且有真人或者是预创建房间,并且有房主
if nPlayerCount >= 2 && (this.GetRealPlayerNum() > 0 || this.IsPreCreateScene()) { //人数>=2开始 if nPlayerCount >= 2 && (this.GetRealPlayerNum() > 0 || this.IsPreCreateScene()) { //人数>=2开始
return true return true
@ -287,13 +264,9 @@ func (this *TienLenSceneData) OnPlayerLeave(p *base.Player, reason int) {
} }
} }
} }
if !this.GetDestroyed() && this.IsCustom() && len(this.players) == 0 {
this.SceneDestroy(true)
}
} }
func (this *TienLenSceneData) SceneDestroy(force bool) { func (this *TienLenSceneData) SceneDestroy(force bool) {
this.SaveCustomLog()
//销毁房间 //销毁房间
this.Scene.Destroy(force) this.Scene.Destroy(force)
} }
@ -398,7 +371,7 @@ func (this *TienLenSceneData) BroadcastOpPos() {
for _, seat := range this.seats { for _, seat := range this.seats {
if seat != nil && seat.IsGameing() { if seat != nil && seat.IsGameing() {
if !seat.IsRob { if !seat.IsRob {
seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotGamingNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
if seat.odds < 0 { if seat.odds < 0 {
B -= seat.odds B -= seat.odds
} }
@ -550,7 +523,7 @@ func (this *TienLenSceneData) IsTienLenToEnd() bool {
return common.IsTienLenToEnd(this.GetGameId()) return common.IsTienLenToEnd(this.GetGameId())
} }
func (this *TienLenSceneData) GetFreeGameSceneType() int32 { func (this *TienLenSceneData) GetFreeGameSceneType() int32 {
return this.GetSceneType() return int32(this.SceneType)
} }
// 比赛场发牌 // 比赛场发牌
@ -1088,7 +1061,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
if seat.IsRob { if seat.IsRob {
robotPlayers = append(robotPlayers, seat) robotPlayers = append(robotPlayers, seat)
} else { } else {
seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotGamingNum > 0) seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
seat.playerPool = int(this.PlayerPoolOdds(seat.Player)) seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
if seat.odds > 0 { if seat.odds > 0 {
realPlayersGood = append(realPlayersGood, seat) realPlayersGood = append(realPlayersGood, seat)
@ -1099,7 +1072,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
} else { } else {
realPlayers = append(realPlayers, seat) realPlayers = append(realPlayers, seat)
} }
_, isNovice := seat.NoviceOdds(int(this.GameId)) _, isNovice := seat.NoviceOdds(this.GameId)
if isNovice { if isNovice {
novicePlayers = append(novicePlayers, seat) novicePlayers = append(novicePlayers, seat)
} else { } else {
@ -1979,7 +1952,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() {
logger.Logger.Trace("宠物技能抵挡炸弹生效,发送消息 SCTienLenPetSkillRes: ", pack) logger.Logger.Trace("宠物技能抵挡炸弹生效,发送消息 SCTienLenPetSkillRes: ", pack)
} }
if score != 0 { if score != 0 {
taxRate := this.GetDBGameFree().GetTaxRate() //万分比 taxRate := this.DbGameFree.GetTaxRate() //万分比
gainScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) //税后
bombTaxScore := score - gainScore bombTaxScore := score - gainScore
// win // win
@ -2105,62 +2078,3 @@ func (this *TienLenSceneData) SendFirstGiveTimeItem(p *base.Player) {
p.SendToClient(int(tienlen.TienLenPacketID_PACKET_SCTienLenFirstGiveItemItem), pack) p.SendToClient(int(tienlen.TienLenPacketID_PACKET_SCTienLenFirstGiveItemItem), pack)
} }
} }
// SaveCustomLog 保存竞技馆对局记录
func (this *TienLenSceneData) SaveCustomLog() {
if this.CustomLogSave || !this.IsCustom() || this.NumOfGames == 0 {
return
}
this.CustomLogSave = true
state := int32(0)
if len(this.RoundEndTime) < int(this.TotalOfGames) {
state = 1
}
log := &model.CustomLog{
Platform: this.Platform,
CycleId: this.CycleID,
RoomConfigId: this.GetCustom().GetRoomConfigId(),
GameFreeId: this.GetGameFreeId(),
TotalRound: this.TotalOfGames,
PlayerNum: this.PlayerNum,
Password: this.GetCustom().GetPassword(),
CostType: this.GetCustom().GetCostType(),
Voice: this.GetCustom().GetVoice(),
RoomId: this.SceneId,
StartTs: this.GameStartTime.Unix(),
EndTs: time.Now().Unix(),
State: state,
}
for snid := range this.BilledList {
var items []*model.Item
if this.PlayerAward[snid] != nil {
items = *this.PlayerAward[snid]
}
log.SnId = append(log.SnId, model.PlayerInfo{
SnId: snid,
Awards: items,
})
}
sort.Slice(log.SnId, func(i, j int) bool {
p1 := base.PlayerMgrSington.GetPlayerBySnId(log.SnId[i].SnId)
p2 := base.PlayerMgrSington.GetPlayerBySnId(log.SnId[j].SnId)
return p1.GetCoin() > p2.GetCoin()
})
for k, v := range this.RoundEndTime {
score := make([]int64, len(this.BilledList))
for kk, vv := range log.SnId {
if k < len(*this.BilledList[vv.SnId]) {
score[kk] = (*this.BilledList[vv.SnId])[k].ChangeScore
}
}
log.List = append(log.List, model.RoundInfo{
Round: int32(k + 1),
Ts: v,
Score: score,
LogId: this.RoundLogId[k],
})
}
base.LogChannelSingleton.WriteLog(log)
}

View File

@ -423,7 +423,7 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
State: proto.Int32(int32(s.GetSceneState().GetState())), State: proto.Int32(int32(s.GetSceneState().GetState())),
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)), TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
NumOfGames: proto.Int(sceneEx.NumOfGames), NumOfGames: proto.Int(sceneEx.NumOfGames),
TotalOfGames: sceneEx.TotalOfGames, TotalOfGames: proto.Int(sceneEx.TotalOfGames),
CurOpIdx: proto.Int(-1), CurOpIdx: proto.Int(-1),
MasterSnid: proto.Int32(sceneEx.masterSnid), MasterSnid: proto.Int32(sceneEx.masterSnid),
AudienceNum: proto.Int(s.GetAudiencesNum()), AudienceNum: proto.Int(s.GetAudiencesNum()),
@ -432,27 +432,19 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
RankType: s.GetDBGameFree().GetRankType(), RankType: s.GetDBGameFree().GetRankType(),
SceneAdd: s.GetDBGameFree().GetSceneAdd(), SceneAdd: s.GetDBGameFree().GetSceneAdd(),
// 比赛场相关 // 比赛场相关
Round: s.GetMatch().GetCurrRound(), Round: int32(s.MatchRound),
CurPlayerNum: s.GetMatch().GetCurrPlayerNum(), CurPlayerNum: int32(s.MatchCurPlayerNum),
NextNeed: s.GetMatch().GetNextPlayerNum(), NextNeed: int32(s.MatchNextNeed),
RecordId: sceneEx.recordId, RecordId: sceneEx.recordId,
TMInfoId: s.GetMatch().GetMatchId(), TMInfoId: sceneEx.MatchInfoId,
RoomTypeId: s.GetCustom().GetRoomTypeId(),
RoomConfigId: s.GetCustom().GetRoomConfigId(),
CostType: s.GetCustom().GetCostType(),
Voice: s.GetCustom().GetVoice(),
Password: s.GetCustom().GetPassword(),
}
if s.GetCustom().GetPassword() != "" {
pack.NeedPassword = 1
} }
pack.IsMatch = int32(0) pack.IsMatch = int32(0)
// 0.普通场 1.锦标赛 2.冠军赛 3.vip专属 // 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
if s.IsMatchScene() { if s.IsMatchScene() {
pack.IsMatch = s.GetMatch().GetMatchType() pack.IsMatch = int32(s.MatchType)
} }
pack.MatchFinals = 0 pack.MatchFinals = 0
if s.GetMatch().GetIsFinals() { if s.MatchFinals {
pack.MatchFinals = 1 pack.MatchFinals = 1
if s.NumOfGames >= 2 { if s.NumOfGames >= 2 {
pack.MatchFinals = 2 pack.MatchFinals = 2
@ -822,7 +814,7 @@ func (this *SceneWaitStartStateTienLen) OnEnter(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok { if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
sceneEx.Clear() sceneEx.Clear()
sceneEx.SetGaming(false) sceneEx.SetGaming(false)
this.BroadcastRoomState(s, this.GetState(), int64(sceneEx.NumOfGames)) this.BroadcastRoomState(s, this.GetState())
logger.Logger.Trace("(this *SceneWaitStartStateTienLen) OnEnter", this.GetState()) logger.Logger.Trace("(this *SceneWaitStartStateTienLen) OnEnter", this.GetState())
} }
} }
@ -888,7 +880,7 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok { if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
if sceneEx.IsMatchScene() { if sceneEx.IsMatchScene() {
delayT := time.Second * 2 delayT := time.Second * 2
if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画 if sceneEx.MatchRound != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画
delayT = time.Second * 4 delayT = time.Second * 4
} }
if time.Now().Sub(sceneEx.StateStartTime) > delayT { if time.Now().Sub(sceneEx.StateStartTime) > delayT {
@ -896,23 +888,14 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
return return
} }
} }
if sceneEx.SceneMode == common.SceneModePublic { if sceneEx.SceneMode == common.SceneMode_Public {
if time.Now().Sub(sceneEx.StateStartTime) > rule.TienLenWaitStartTimeout { if time.Now().Sub(sceneEx.StateStartTime) > rule.TienLenWaitStartTimeout {
if sceneEx.Creator != 0 && sceneEx.GetRealPlayerNum() == 0 { if sceneEx.Creator != 0 && sceneEx.GetRealPlayerNum() == 0 {
sceneEx.Destroy(true) sceneEx.Destroy(true)
return return
} }
//开始前再次检查开始条件 //开始前再次检查开始条件
if sceneEx.CanStart() { if sceneEx.CanStart() == true {
s.ChangeSceneState(rule.TienLenSceneStateHandCard)
} else {
s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer)
}
}
}
if sceneEx.IsCustom() {
if time.Now().Sub(sceneEx.StateStartTime) > rule.TienLenCustomWaiteStatTimeout {
if sceneEx.CanStart() {
s.ChangeSceneState(rule.TienLenSceneStateHandCard) s.ChangeSceneState(rule.TienLenSceneStateHandCard)
} else { } else {
s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer) s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer)
@ -971,17 +954,13 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
s.NotifySceneRoundStart(s.NumOfGames) s.NotifySceneRoundStart(s.NumOfGames)
this.BroadcastRoomState(s, this.GetState(), int64(s.NumOfGames)) this.BroadcastRoomState(s, this.GetState(), int64(s.NumOfGames))
if s.IsCustom() && s.NumOfGames == 1 {
s.SyncSceneState(common.SceneStateStart)
}
//同步防伙牌数据 //同步防伙牌数据
sceneEx.SyncScenePlayer() sceneEx.SyncScenePlayer()
//发牌 //发牌
if rule.TestOpen { if rule.TestOpen {
sceneEx.SendHandCardTest() sceneEx.SendHandCardTest()
} else { } else {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
sceneEx.SendHandCard_Match() sceneEx.SendHandCard_Match()
} else { } else {
sceneEx.SendHandCardOdds() sceneEx.SendHandCardOdds()
@ -1003,7 +982,7 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
seat.tianHu = rule.TianHu12Straight seat.tianHu = rule.TianHu12Straight
} }
if seat.tianHu > 0 { if seat.tianHu > 0 {
keyNovice := common.GetKeyNoviceGameId(int(sceneEx.GameId)) keyNovice := common.GetKeyNoviceGameId(sceneEx.GameId)
data, ok := seat.GDatas[keyNovice] data, ok := seat.GDatas[keyNovice]
if !ok { if !ok {
data = &model.PlayerGameInfo{FirstTime: time.Now()} data = &model.PlayerGameInfo{FirstTime: time.Now()}
@ -1658,14 +1637,14 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
winRankScore := int64(0) winRankScore := int64(0)
pack := &tienlen.SCTienLenGameBilled{} pack := &tienlen.SCTienLenGameBilled{}
tienlenType := model.TienLenType{ tienlenType := model.TienLenType{
GameId: int(sceneEx.GameId), GameId: sceneEx.GameId,
RoomId: int32(sceneEx.GetSceneId()), RoomId: int32(sceneEx.GetSceneId()),
RoomType: sceneEx.GetFreeGameSceneType(), RoomType: sceneEx.GetFreeGameSceneType(),
NumOfGames: int32(sceneEx.Scene.NumOfGames), NumOfGames: int32(sceneEx.Scene.NumOfGames),
BankId: sceneEx.masterSnid, BankId: sceneEx.masterSnid,
PlayerCount: sceneEx.curGamingPlayerNum, PlayerCount: sceneEx.curGamingPlayerNum,
BaseScore: s.GetBaseScore(), BaseScore: s.GetBaseScore(),
TaxRate: s.GetDBGameFree().GetTaxRate(), TaxRate: s.DbGameFree.GetTaxRate(),
RoomMode: s.GetSceneMode(), RoomMode: s.GetSceneMode(),
PlayerPool: make(map[int]int), PlayerPool: make(map[int]int),
} }
@ -1794,7 +1773,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
gainScore = losePlayerCoin gainScore = losePlayerCoin
} }
losePlayerScore = gainScore losePlayerScore = gainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { //比赛场是积分,不应该增加账变 if sceneEx.IsMatchScene() { //比赛场是积分,不应该增加账变
losePlayer.AddCoinNoLog(int64(-gainScore), 0) losePlayer.AddCoinNoLog(int64(-gainScore), 0)
} else { } else {
losePlayer.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName()) losePlayer.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
@ -1809,7 +1788,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分 // vip加成分
vipScore = int64(math.Ceil(float64(rankScore) * float64(losePlayer.VipExtra) / 100.0)) vipScore = int64(math.Ceil(float64(rankScore) * float64(losePlayer.VipExtra) / 100.0))
// 角色加成分 // 角色加成分
_, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(losePlayer.PlayerData, common.RoleAddRankScore) _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&losePlayer.PlayerData, common.RoleAddRankScore)
roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0))
//周卡加成 //周卡加成
if losePlayer.GetWeekCardPrivilege(2) { if losePlayer.GetWeekCardPrivilege(2) {
@ -1936,7 +1915,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
astWinGainScore = lastWinPlayerCoin astWinGainScore = lastWinPlayerCoin
} }
lastWinPlayerScore = astWinGainScore lastWinPlayerScore = astWinGainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
lastWinPlayer.AddCoinNoLog(int64(-astWinGainScore), 0) lastWinPlayer.AddCoinNoLog(int64(-astWinGainScore), 0)
} else { } else {
lastWinPlayer.AddCoin(int64(-astWinGainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName()) lastWinPlayer.AddCoin(int64(-astWinGainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
@ -1951,7 +1930,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分 // vip加成分
vipScore = int64(math.Ceil(float64(rankScore) * float64(lastWinPlayer.VipExtra) / 100.0)) vipScore = int64(math.Ceil(float64(rankScore) * float64(lastWinPlayer.VipExtra) / 100.0))
// 角色加成分 // 角色加成分
_, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(lastWinPlayer.PlayerData, common.RoleAddRankScore) _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&lastWinPlayer.PlayerData, common.RoleAddRankScore)
roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0))
//周卡加成 //周卡加成
if lastWinPlayer.GetWeekCardPrivilege(2) { if lastWinPlayer.GetWeekCardPrivilege(2) {
@ -2041,7 +2020,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分 var otherScore int64 // 额外总加分
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
rankScore = loseRankScore rankScore = loseRankScore
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比 taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
gainScore := int64(float64(losePlayerScore) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(losePlayerScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := losePlayerScore - gainScore // 税收 gainTaxScore := losePlayerScore - gainScore // 税收
if playerNum == 3 { if playerNum == 3 {
@ -2049,7 +2028,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
gainTaxScore = losePlayerScore + lastWinPlayerScore - gainScore gainTaxScore = losePlayerScore + lastWinPlayerScore - gainScore
rankScore = loseRankScore + lastWinPlayerRankScore rankScore = loseRankScore + lastWinPlayerRankScore
} }
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
playerEx.AddCoinNoLog(int64(gainScore), 0) playerEx.AddCoinNoLog(int64(gainScore), 0)
} else { } else {
playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName()) playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName())
@ -2062,7 +2041,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分 // vip加成分
vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0)) vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0))
// 角色加成分 // 角色加成分
_, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(playerEx.PlayerData, common.RoleAddRankScore) _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&playerEx.PlayerData, common.RoleAddRankScore)
roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0))
//周卡加成 //周卡加成
if playerEx.GetWeekCardPrivilege(2) { if playerEx.GetWeekCardPrivilege(2) {
@ -2151,10 +2130,10 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分 var otherScore int64 // 额外总加分
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType()) oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
rankScore = lastWinPlayerRankScore rankScore = lastWinPlayerRankScore
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比 taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
gainScore := int64(float64(lastWinPlayerScore) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(lastWinPlayerScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := lastWinPlayerScore - gainScore gainTaxScore := lastWinPlayerScore - gainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
playerEx.AddCoinNoLog(int64(gainScore), 0) playerEx.AddCoinNoLog(int64(gainScore), 0)
} else { } else {
playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName()) playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName())
@ -2167,7 +2146,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分 // vip加成分
vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0)) vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0))
// 角色加成分 // 角色加成分
_, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(playerEx.PlayerData, common.RoleAddRankScore) _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&playerEx.PlayerData, common.RoleAddRankScore)
roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0))
//周卡加成 //周卡加成
if playerEx.GetWeekCardPrivilege(2) { if playerEx.GetWeekCardPrivilege(2) {
@ -2296,7 +2275,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
gainScore = losePlayerCoin gainScore = losePlayerCoin
} }
winScore += gainScore winScore += gainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
playerEx.AddCoinNoLog(int64(-gainScore), 0) playerEx.AddCoinNoLog(int64(-gainScore), 0)
} else { } else {
playerEx.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName()) playerEx.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
@ -2316,7 +2295,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分 // vip加成分
vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0)) vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0))
// 角色加成分 // 角色加成分
_, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(playerEx.PlayerData, common.RoleAddRankScore) _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&playerEx.PlayerData, common.RoleAddRankScore)
roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0))
//周卡加成 //周卡加成
if playerEx.GetWeekCardPrivilege(2) { if playerEx.GetWeekCardPrivilege(2) {
@ -2432,10 +2411,10 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分 var otherScore int64 // 额外总加分
playerEx := sceneEx.players[winSnid] playerEx := sceneEx.players[winSnid]
if playerEx != nil { if playerEx != nil {
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比 taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
gainScore := int64(float64(winScore) * float64(10000-taxRate) / 10000.0) //税后 gainScore := int64(float64(winScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := winScore - gainScore gainTaxScore := winScore - gainScore
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
playerEx.AddCoinNoLog(int64(gainScore), 0) playerEx.AddCoinNoLog(int64(gainScore), 0)
} else { } else {
playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName()) playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName())
@ -2448,7 +2427,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分 // vip加成分
vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0)) vipScore = int64(math.Ceil(float64(rankScore) * float64(playerEx.VipExtra) / 100.0))
// 角色加成分 // 角色加成分
_, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(playerEx.PlayerData, common.RoleAddRankScore) _, roleAdd = srvdata.RolePetMgrSington.GetRoleAdd(&playerEx.PlayerData, common.RoleAddRankScore)
roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0)) roleScore = int64(math.Ceil(float64(rankScore) * float64(roleAdd) / 100.0))
//周卡加成 //周卡加成
if playerEx.GetWeekCardPrivilege(2) { if playerEx.GetWeekCardPrivilege(2) {
@ -2552,92 +2531,6 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
s.Broadcast(int(tienlen.TienLenPacketID_PACKET_SCTienLenGameBilled), pack, 0) s.Broadcast(int(tienlen.TienLenPacketID_PACKET_SCTienLenGameBilled), pack, 0)
logger.Logger.Trace("TienLenPacketID_PACKET_SCTienLenGameBilled gameFreeId:", sceneEx.GetGameFreeId(), ";pack:", pack) logger.Logger.Trace("TienLenPacketID_PACKET_SCTienLenGameBilled gameFreeId:", sceneEx.GetGameFreeId(), ";pack:", pack)
if sceneEx.IsCustom() && sceneEx.TotalOfGames > 0 {
for _, v := range tienlenType.PlayerData {
d := sceneEx.BilledList[v.UserId]
if d == nil {
arr := make([]*BilledInfo, 0)
d = &arr
sceneEx.BilledList[v.UserId] = d
}
*d = append(*d, &BilledInfo{
Round: int32(sceneEx.NumOfGames),
ChangeScore: v.BillCoin,
Score: base.PlayerMgrSington.GetPlayerBySnId(v.UserId).GetCoin(),
})
}
sceneEx.RoundEndTime = append(sceneEx.RoundEndTime, time.Now().Unix())
sceneEx.RoundLogId = append(sceneEx.RoundLogId, sceneEx.recordId)
if sceneEx.NumOfGames >= int(sceneEx.TotalOfGames) {
packBilled := &tienlen.SCTienLenCycleBilled{}
for snid, billedList := range sceneEx.BilledList {
info := &tienlen.TienLenCycleBilledInfo{
SnId: snid,
TotalScore: 1000,
Score: 1000,
}
for _, bill := range *billedList {
info.RoundScore = append(info.RoundScore, bill.ChangeScore)
info.TotalScore += bill.ChangeScore
}
packBilled.List = append(packBilled.List, info)
}
sort.Slice(packBilled.List, func(i, j int) bool {
var a, b int64
for _, v := range packBilled.List[i].RoundScore {
a += v
}
a += packBilled.List[i].Score
for _, v := range packBilled.List[j].RoundScore {
b += v
}
b += packBilled.List[j].Score
return a > b
})
if len(packBilled.List) > 0 {
for _, v := range sceneEx.Items {
packBilled.List[0].Award = append(packBilled.List[0].Award, &tienlen.ItemInfo{
Id: v.Id,
Num: v.Num,
})
}
// 发奖品
if len(sceneEx.Items) > 0 {
p := base.PlayerMgrSington.GetPlayerBySnId(packBilled.List[0].SnId)
if p != nil {
var items []*model.Item
for _, v := range packBilled.List[0].Award {
itemData := srvdata.GameItemMgr.Get(p.Platform, v.GetId())
if itemData != nil {
items = append(items, &model.Item{
ItemId: v.GetId(),
ItemNum: v.GetNum(),
})
}
}
p.AddItems(&model.AddItemParam{
P: p.PlayerData,
Change: items,
GainWay: common.GainWayRoomGain,
Operator: "system",
Remark: "房卡场奖励",
GameId: int64(sceneEx.GameId),
GameFreeId: int64(sceneEx.GetGameFreeId()),
})
sceneEx.PlayerAward[p.SnId] = &items
}
}
}
s.Broadcast(int(tienlen.TienLenPacketID_PACKET_SCTienLenCycleBilled), packBilled, 0)
logger.Logger.Tracef("SCTienLenCycleBilled: %v", packBilled)
s.SyncSceneState(common.SceneStateEnd)
sceneEx.SaveCustomLog()
sceneEx.BilledList = make(map[int32]*[]*BilledInfo)
sceneEx.RoundEndTime = sceneEx.RoundEndTime[:0]
sceneEx.RoundLogId = sceneEx.RoundLogId[:0]
}
}
// 牌局记录 // 牌局记录
info, err := model.MarshalGameNoteByFIGHT(&tienlenType) info, err := model.MarshalGameNoteByFIGHT(&tienlenType)
if err == nil { if err == nil {
@ -2686,11 +2579,10 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
}) })
// 保存玩家游戏记录 // 保存玩家游戏记录
param := base.GetSaveGamePlayerListLogParam(o_player.Platform, o_player.Channel, o_player.Promoter, sceneEx.SaveGamePlayerListLog(o_player.UserId,
base.GetSaveGamePlayerListLogParam(o_player.Platform, o_player.Channel, o_player.Promoter,
o_player.PackageTag, sceneEx.recordId, o_player.InviterId, totalin, totalout, o_player.BillTaxCoin, o_player.PackageTag, sceneEx.recordId, o_player.InviterId, totalin, totalout, o_player.BillTaxCoin,
0, 0, o_player.GainCoin+o_player.BombCoin, validBet, validFlow, o_player.IsFirst, o_player.IsLeave) 0, 0, o_player.GainCoin+o_player.BombCoin, validBet, validFlow, o_player.IsFirst, o_player.IsLeave))
param.CycleId = sceneEx.CycleID
sceneEx.SaveGamePlayerListLog(o_player.UserId, param)
} }
} }
if isSave { if isSave {
@ -2699,7 +2591,6 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
Trend20Lately: "", Trend20Lately: "",
CtrlType: sceneEx.ctrlType, CtrlType: sceneEx.ctrlType,
PlayerPool: tienlenType.PlayerPool, PlayerPool: tienlenType.PlayerPool,
CycleId: sceneEx.CycleID,
}) })
} }
} }
@ -2762,10 +2653,7 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) {
continue continue
} }
player_data.Clear() player_data.Clear()
if sceneEx.IsCustom() { if sceneEx.IsMatchScene() {
player_data.UnmarkFlag(base.PlayerState_WaitNext)
}
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
continue continue
} }
if !player_data.IsOnLine() { if !player_data.IsOnLine() {
@ -2806,10 +2694,7 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) {
s.TryDismissRob() s.TryDismissRob()
} }
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场 if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true)
}
if s.TotalOfGames > 0 && s.NumOfGames >= int(s.TotalOfGames) {
sceneEx.SceneDestroy(true) sceneEx.SceneDestroy(true)
} }
s.RankMatchDestroy() s.RankMatchDestroy()
@ -2896,11 +2781,6 @@ func init() {
base.RegisteScenePolicy(common.GameId_TienLenRank_toend, 0, ScenePolicyTienLenSingleton) base.RegisteScenePolicy(common.GameId_TienLenRank_toend, 0, ScenePolicyTienLenSingleton)
base.RegisteScenePolicy(common.GameId_TienLenRank_yl, 0, ScenePolicyTienLenSingleton) base.RegisteScenePolicy(common.GameId_TienLenRank_yl, 0, ScenePolicyTienLenSingleton)
base.RegisteScenePolicy(common.GameId_TienLenRank_yl_toend, 0, ScenePolicyTienLenSingleton) base.RegisteScenePolicy(common.GameId_TienLenRank_yl_toend, 0, ScenePolicyTienLenSingleton)
// 房卡场
base.RegisteScenePolicy(common.GameId_TienLenCustom, 0, ScenePolicyTienLenSingleton)
base.RegisteScenePolicy(common.GameId_TienLenCustom_toend, 0, ScenePolicyTienLenSingleton)
base.RegisteScenePolicy(common.GameId_TienLenCustom_yl, 0, ScenePolicyTienLenSingleton)
base.RegisteScenePolicy(common.GameId_TienLenCustom_yl_toend, 0, ScenePolicyTienLenSingleton)
return nil return nil
}) })
} }

View File

@ -1,150 +1,153 @@
package transact package transact
import ( //
"errors" //import (
"sync" // "errors"
// "fmt"
"mongo.games.com/goserver/core/logger" // "mongo.games.com/game/common"
"mongo.games.com/goserver/core/netlib" // "mongo.games.com/game/gamesrv/base"
"mongo.games.com/goserver/core/transact" // "mongo.games.com/game/model"
// "mongo.games.com/game/proto"
"mongo.games.com/game/common" // webapi_proto "mongo.games.com/game/protocol/webapi"
"mongo.games.com/game/gamesrv/base" // "mongo.games.com/goserver/core/basic"
"mongo.games.com/game/gamesrv/tienlen" // "mongo.games.com/goserver/core/logger"
"mongo.games.com/game/proto" // "mongo.games.com/goserver/core/netlib"
webapiproto "mongo.games.com/game/protocol/webapi" // "mongo.games.com/goserver/core/task"
) // "mongo.games.com/goserver/core/transact"
// "sync"
const __REQIP__ = "__REQIP__" //)
//
var ( //const __REQIP__ = "__REQIP__"
WebAPIErrParam = errors.New("param err") //
WebAPIErrNoPlayer = errors.New("player no find") //var (
) // WebAPIErrParam = errors.New("param err")
// WebAPIErrNoPlayer = errors.New("player no find")
func init() { //)
transact.RegisteHandler(common.TransType_GameSrvWebApi, &WebAPITranscateHandler{}) //
} //func init() {
// transact.RegisteHandler(common.TransType_GameSrvWebApi, &WebAPITranscateHandler{})
var WebAPIHandlerMgrSingleton = &WebAPIHandlerMgr{wshMap: make(map[string]WebAPIHandler)} //}
//
type WebAPITranscateHandler struct { //var WebAPIHandlerMgrSingleton = &WebAPIHandlerMgr{wshMap: make(map[string]WebAPIHandler)}
} //
//type WebAPITranscateHandler struct {
func (this *WebAPITranscateHandler) OnExcute(tNode *transact.TransNode, ud interface{}) transact.TransExeResult { //}
logger.Logger.Trace("WebAPITranscateHandler.OnExcute ") //
req := &common.M2GWebApiRequest{} //func (this *WebAPITranscateHandler) OnExcute(tNode *transact.TransNode, ud interface{}) transact.TransExeResult {
err := netlib.UnmarshalPacketNoPackId(ud.([]byte), req) // logger.Logger.Trace("WebAPITranscateHandler.OnExcute ")
if err == nil { // req := &common.M2GWebApiRequest{}
wsh := WebAPIHandlerMgrSingleton.GetWebAPIHandler(req.Path) // err := netlib.UnmarshalPacketNoPackId(ud.([]byte), req)
if wsh == nil { // if err == nil {
logger.Logger.Error("WebAPITranscateHandler no registe WebAPIHandler ", req.Path) // wsh := WebAPIHandlerMgrSingleton.GetWebAPIHandler(req.Path)
return transact.TransExeResult_Failed // if wsh == nil {
} // logger.Logger.Error("WebAPITranscateHandler no registe WebAPIHandler ", req.Path)
tag, msg := wsh.Handler(tNode, req.Body) // return transact.TransExeResult_Failed
tNode.TransRep.RetFiels = msg // }
switch tag { // tag, msg := wsh.Handler(tNode, req.Body)
case common.ResponseTag_Ok: // tNode.TransRep.RetFiels = msg
return transact.TransExeResult_Success // switch tag {
case common.ResponseTag_TransactYield: // case common.ResponseTag_Ok:
return transact.TransExeResult_Yield // return transact.TransExeResult_Success
} // case common.ResponseTag_TransactYield:
} // return transact.TransExeResult_Yield
logger.Logger.Error("WebAPITranscateHandler.OnExcute err:", err.Error()) // }
return transact.TransExeResult_Failed // }
} // logger.Logger.Error("WebAPITranscateHandler.OnExcute err:", err.Error())
// return transact.TransExeResult_Failed
func (this *WebAPITranscateHandler) OnCommit(tNode *transact.TransNode) transact.TransExeResult { //}
logger.Logger.Trace("WebAPITranscateHandler.OnCommit ") //
return transact.TransExeResult_Success //func (this *WebAPITranscateHandler) OnCommit(tNode *transact.TransNode) transact.TransExeResult {
} // logger.Logger.Trace("WebAPITranscateHandler.OnCommit ")
// return transact.TransExeResult_Success
func (this *WebAPITranscateHandler) OnRollBack(tNode *transact.TransNode) transact.TransExeResult { //}
logger.Logger.Trace("WebAPITranscateHandler.OnRollBack ") //
return transact.TransExeResult_Success //func (this *WebAPITranscateHandler) OnRollBack(tNode *transact.TransNode) transact.TransExeResult {
} // logger.Logger.Trace("WebAPITranscateHandler.OnRollBack ")
// return transact.TransExeResult_Success
func (this *WebAPITranscateHandler) OnChildTransRep(tNode *transact.TransNode, hChild transact.TransNodeID, retCode int, //}
ud interface{}) transact.TransExeResult { //
logger.Logger.Trace("WebAPITranscateHandler.OnChildTransRep ") //func (this *WebAPITranscateHandler) OnChildTransRep(tNode *transact.TransNode, hChild transact.TransNodeID, retCode int,
return transact.TransExeResult_Success // ud interface{}) transact.TransExeResult {
} // logger.Logger.Trace("WebAPITranscateHandler.OnChildTransRep ")
// return transact.TransExeResult_Success
type WebAPIHandler interface { //}
Handler(*transact.TransNode, []byte) (int, proto.Message) //
} //type WebAPIHandler interface {
// Handler(*transact.TransNode, []byte) (int, proto.Message)
type WebAPIHandlerWrapper func(*transact.TransNode, []byte) (int, proto.Message) //}
//
func (wshw WebAPIHandlerWrapper) Handler(tNode *transact.TransNode, params []byte) (int, proto.Message) { //type WebAPIHandlerWrapper func(*transact.TransNode, []byte) (int, proto.Message)
return wshw(tNode, params) //
} //func (wshw WebAPIHandlerWrapper) Handler(tNode *transact.TransNode, params []byte) (int, proto.Message) {
// return wshw(tNode, params)
type WebAPIHandlerMgr struct { //}
wshMap map[string]WebAPIHandler //
DataWaitList sync.Map //type WebAPIHandlerMgr struct {
} // wshMap map[string]WebAPIHandler
// DataWaitList sync.Map
func (this *WebAPIHandlerMgr) RegisteWebAPIHandler(name string, wsh WebAPIHandler) { //}
this.wshMap[name] = wsh //
} //func (this *WebAPIHandlerMgr) RegisteWebAPIHandler(name string, wsh WebAPIHandler) {
// this.wshMap[name] = wsh
func (this *WebAPIHandlerMgr) GetWebAPIHandler(name string) WebAPIHandler { //}
if wsh, exist := this.wshMap[name]; exist { //
return wsh //func (this *WebAPIHandlerMgr) GetWebAPIHandler(name string) WebAPIHandler {
} // if wsh, exist := this.wshMap[name]; exist {
return nil // return wsh
} // }
// return nil
func init() { //}
// 对局详情 //
WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/room_info", WebAPIHandlerWrapper( //func init() {
func(tNode *transact.TransNode, params []byte) (int, proto.Message) { // //单控
pack := &webapiproto.SARoomInfo{} // WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/game/SinglePlayerAdjust", WebAPIHandlerWrapper(
msg := &webapiproto.ASRoomInfo{} // func(tNode *transact.TransNode, params []byte) (int, proto.Message) {
err := proto.Unmarshal(params, msg) // pack := &webapi_proto.SASinglePlayerAdjust{}
if err != nil { // msg := &webapi_proto.ASSinglePlayerAdjust{}
pack.Tag = webapiproto.TagCode_FAILED // err := proto.Unmarshal(params, msg)
pack.Msg = "数据序列化失败" // if err != nil {
return common.ResponseTag_Ok, pack // fmt.Printf("err:%v", err)
} // pack.Tag = webapi_proto.TagCode_FAILED
pack.Tag = webapiproto.TagCode_SUCCESS // pack.Msg = "数据序列化失败"
// return common.ResponseTag_ParamError, pack
scene := base.SceneMgrSington.GetScene(int(msg.GetRoomId())) // }
if scene == nil || scene.ExtraData == nil { // pack.Tag = webapi_proto.TagCode_SUCCESS
pack.Tag = webapiproto.TagCode_NotFound // switch msg.GetOpration() {
pack.Msg = "房间没找到" // case 1:
return common.ResponseTag_Ok, pack // psa := base.PlayerSingleAdjustMgr.AddNewSingleAdjust(msg.GetPlayerSingleAdjust())
} // if psa != nil {
// task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
switch d := scene.ExtraData.(type) { // return model.AddNewSingleAdjust(psa)
case *tienlen.TienLenSceneData: // }), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
for k := range d.BilledList { // if data != nil {
pack.SnId = append(pack.SnId, k) // pack.Tag = webapi_proto.TagCode_FAILED
} // pack.Msg = "insert err" + data.(error).Error()
for k, v := range d.RoundLogId { // }
var score []int64 // tNode.TransRep.RetFiels = pack
for _, vv := range pack.SnId { // tNode.Resume()
list := d.BilledList[vv] // }), "AddNewSingleAdjust").Start()
if list == nil || len(*list) <= k { // return common.ResponseTag_TransactYield, pack
score = append(score, 0) // }
continue // case 2:
} // base.PlayerSingleAdjustMgr.EditSingleAdjust(msg.GetPlayerSingleAdjust())
score = append(score, (*list)[k].ChangeScore) // case 3:
} // psa := msg.PlayerSingleAdjust
item := &webapiproto.RoundInfo{ // if psa != nil {
Round: int32(k + 1), // base.PlayerSingleAdjustMgr.DeleteSingleAdjust(psa.Platform, psa.SnId, psa.GameFreeId)
Ts: d.RoundEndTime[k], // }
Score: score, // case 4:
LogId: v, // ps := msg.PlayerSingleAdjust
} // webp := base.PlayerSingleAdjustMgr.GetSingleAdjust(ps.Platform, ps.SnId, ps.GameFreeId)
pack.List = append(pack.List, item) // if webp == nil {
} // pack.Tag = webapi_proto.TagCode_FAILED
// pack.Msg = fmt.Sprintf("webp == nil %v %v %v", ps.Platform, ps.SnId, ps.GameFreeId)
default: // }
pack.Tag = webapiproto.TagCode_FAILED // pack.PlayerSingleAdjust = webp
pack.Msg = "未实现" // default:
} // pack.Tag = webapi_proto.TagCode_FAILED
return common.ResponseTag_Ok, pack // pack.Msg = "Opration param is error!"
})) // return common.ResponseTag_ParamError, pack
} // }
// return common.ResponseTag_Ok, pack
// }))
//}

View File

@ -1,315 +1,105 @@
package action package action
import ( import (
"bytes"
"fmt" "fmt"
"math"
"mongo.games.com/game/machine/machinedoll" "mongo.games.com/game/machine/machinedoll"
"mongo.games.com/game/protocol/machine" "mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/timer"
"sync"
"time" "time"
) )
type ConnMessageQueue struct {
queue chan []interface{}
conn *machinedoll.Conn
waitGroup *sync.WaitGroup
}
var connMessageQueues = make(map[*machinedoll.Conn]*ConnMessageQueue)
func Process(conn *machinedoll.Conn, f1 []func(), f2 []func()) {
// 获取或创建该 conn 对应的消息队列
queue, ok := connMessageQueues[conn]
if !ok {
queue = &ConnMessageQueue{
queue: make(chan []interface{}, 100),
conn: conn,
waitGroup: new(sync.WaitGroup),
}
connMessageQueues[conn] = queue
go processConnMessageQueue(queue)
}
// 将消息添加到队列中
queue.queue <- []interface{}{f1, f2}
}
func processConnMessageQueue(queue *ConnMessageQueue) {
for msg := range queue.queue {
f1 := msg[0].([]func())
f2 := msg[1].([]func())
queue.waitGroup.Add(len(f1))
for _, f := range f1 {
go func(f func()) {
defer queue.waitGroup.Done()
f()
}(f)
}
queue.waitGroup.Wait()
if len(f2) > 0 {
queue.waitGroup.Add(1)
go func() {
defer queue.waitGroup.Done()
timer.AfterTimer(func(h timer.TimerHandle, ud interface{}) bool {
for _, f := range f2 {
f()
}
return true
}, nil, 200*time.Millisecond)
}()
}
}
}
// 移动 // 移动
func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error { func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error {
fmt.Println("SMDollMachinePerateHandler %v", data)
msg, ok := data.(*machine.SMDollMachineoPerate) msg, ok := data.(*machine.SMDollMachineoPerate)
if !ok { if !ok {
return nil return nil
} }
conn := machinedoll.ConnMap[int(msg.Id)]
conn, ok := machinedoll.MachineMgr.ConnMap[int(msg.GetId())] if conn == nil {
if !ok || conn == nil {
return nil return nil
} }
if msg.Perate == 1 {
switch msg.Perate {
case 1:
//向前移动 //向前移动
f1 := []func(){ machinedoll.Backward(conn)
func() { machinedoll.Backward(conn) }, time.Sleep(200 * time.Millisecond)
} machinedoll.BackwardStop(conn)
f2 := []func(){ } else if msg.Perate == 2 {
func() { machinedoll.BackwardStop(conn) },
}
Process(conn, f1, f2)
case 2:
//向后移动 //向后移动
f1 := []func(){ machinedoll.Forward(conn)
func() { machinedoll.Forward(conn) }, time.Sleep(200 * time.Millisecond)
} machinedoll.ForwardStop(conn)
f2 := []func(){ } else if msg.Perate == 3 {
func() { machinedoll.ForwardStop(conn) },
}
Process(conn, f1, f2)
case 3:
//向左移动 //向左移动
f1 := []func(){ machinedoll.Left(conn)
func() { machinedoll.Left(conn) }, time.Sleep(200 * time.Millisecond)
} machinedoll.LeftStop(conn)
f2 := []func(){ } else if msg.Perate == 4 {
func() { machinedoll.LeftStop(conn) },
}
Process(conn, f1, f2)
case 4:
//向右移动 //向右移动
f1 := []func(){ machinedoll.Right(conn)
func() { machinedoll.Right(conn) }, time.Sleep(200 * time.Millisecond)
} machinedoll.RightStop(conn)
f2 := []func(){ } else if msg.Perate == 5 {
func() { machinedoll.RightStop(conn) },
}
Process(conn, f1, f2)
case 5:
//投币 //投币
fmt.Println("===========玩家投币===========")
go DollMachineGrabResult(session, conn, msg.Snid, msg.GetId())
machinedoll.Coin(conn) machinedoll.Coin(conn)
machinedoll.Backward(conn)
time.Sleep(200 * time.Millisecond)
machinedoll.BackwardStop(conn)
} }
return nil return nil
} }
// 下抓 // 下抓
func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error { func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("SMDollMachineGrabHandler %v", data)
msg, ok := data.(*machine.SMDollMachineGrab) msg, ok := data.(*machine.SMDollMachineGrab)
if !ok { if !ok {
return nil return nil
} }
conn := machinedoll.ConnMap[int(msg.Id)]
conn, ok := machinedoll.MachineMgr.ConnMap[int(msg.GetId())] if conn == nil {
if !ok || conn == nil {
return nil return nil
} }
typeId := msg.TypeId
switch msg.GetTypeId() { if typeId == 1 {
case 1:
//弱抓 //弱抓
/* f1 := []func(){
func() { machinedoll.WeakGrab(conn) },
}
f2 := []func(){}
Process(conn, f1, f2)*/
machinedoll.WeakGrab(conn) machinedoll.WeakGrab(conn)
case 2: } else if typeId == 2 {
//强力抓 //强力抓
/* f1 := []func(){ machinedoll.Grab(conn)
func() { machinedoll.Grab(conn) }, } else if typeId == 3 {
} //必中抓
f2 := []func(){} machinedoll.SetPower(conn)
Process(conn, f1, f2)*/ time.Sleep(200 * time.Millisecond)
machinedoll.Grab(conn) machinedoll.Grab(conn)
} }
//返回消息
session.Send(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.MSDollMachineGrab{
Snid: msg.Snid,
Id: msg.GetId(),
Result: 1,
})
return nil return nil
} }
// 监听抓取结果返回
func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid, id int32) {
num := int64(1)
for {
// 读取数据
//logger.Logger.Trace("监听抓取结果返回!")
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
logger.Logger.Error("Failed to read response from client:", err)
return
}
// 将读取到的数据按照 221 进行分割
parts := bytes.Split(buf[:n], []byte{221})
//fmt.Println("获取到的返回值:", parts)
instruction := []byte{0xAA, 0x05, 0x02, 0x50, 0x09, 0x00}
instruction1 := []byte{0xAA, 0x05, 0x02, 0x50, 0x09, 0x01}
// 遍历分割结果,打印出每个部分
for i, part := range parts {
if len(part) > 0 {
part = part[:len(part)-1] // 去除最后一个字节,该字节为分隔符
//fmt.Println("比较返回结果 part = ", part)
if bytes.Contains(part, instruction) && num != 1 {
//fmt.Printf("Part %d: %s\n", i+1, part)
//回应数据
_, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd})
if err != nil {
//fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("没有抓到礼品snid = ", snid, "num = ", num)
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
Snid: snid,
Id: id,
Result: 0,
TypeId: 2,
})
return
}
if bytes.Contains(part, instruction1) && num != 1 {
fmt.Printf("Part %d: %s\n", i+1, part)
//回应数据
_, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd})
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("抓到礼品了snid = ", snid, "num = ", num)
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
Snid: snid,
Id: id,
Result: 1,
TypeId: 2,
})
return
}
//上分成功
coinData := []byte{0xAA, 0x04, 0x02, 0x03, 0x01}
if bytes.Contains(part, coinData) {
//返回消息
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
Snid: snid,
Id: id,
Result: 1,
TypeId: 1,
})
fmt.Println("上分成功snid = ", snid, "num = ", num)
}
//上分失败
coinData = []byte{0xAA, 0x04, 0x02, 0x03, 0x00}
if bytes.Contains(part, coinData) {
//返回消息
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
Snid: snid,
Id: id,
Result: 0,
TypeId: 1,
})
fmt.Println("上分失败snid = ", snid, "num = ", num)
}
}
}
num++
if num >= math.MaxInt64 {
num = 2
}
}
}
// 与游戏服务器连接成功,向游戏服务器推送所有娃娃机连接 // 与游戏服务器连接成功,向游戏服务器推送所有娃娃机连接
func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interface{}) error { func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interface{}) error {
fmt.Println("与游戏服务器连接成功") logger.Logger.Trace("与游戏服务器连接成功!!\n")
fmt.Printf("与游戏服务器连接成功!!\n")
//开始向游戏服务器发送娃娃机连接信息 //开始向游戏服务器发送娃娃机连接信息
msg := &machine.MSDollMachineList{} msg := &machine.MSDollMachineList{}
for i, _ := range machinedoll.MachineMgr.ConnMap { for i, _ := range machinedoll.ConnMap {
info := &machine.DollMachine{} info := &machine.DollMachine{}
info.Id = int32(i) info.Id = int32(i)
info.VideoAddr = "www.baidu.com"
msg.Data = append(msg.Data, info) msg.Data = append(msg.Data, info)
} }
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg) session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
fmt.Println("向游戏服务器发送娃娃机连接信息:%v", msg) fmt.Printf("开始向游戏服务器发送娃娃机连接信息!\n", msg)
return nil return nil
} }
/*// 获取进入视频房间token
func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("SMGetTokenHandler %v", data)
msg, ok := data.(*machine.SMGetToken)
if !ok {
return nil
}
// 请将 appId 修改为你的 appIdappid 为数字,从即构控制台获取
// 举例1234567890
var appId uint32 = uint32(msg.GetAppId())
// 请修改为你的 serverSecretserverSecret 为字符串,从即构控制台获取
// 举例: "fa94dd0f974cf2e293728a526b028271"
serverSecret := msg.ServerSecret
// 请将 userId 修改为用户的 user_id
userId := msg.GetSnid()
// token 的有效时长,单位:秒
var effectiveTimeInSeconds int64 = 3600
// token业务认证扩展基础鉴权token此处填空字符串
var payload string = ""
//生成token
token, err := token04.GenerateToken04(appId, strconv.Itoa(int(userId)), serverSecret, effectiveTimeInSeconds, payload)
if err != nil {
logger.Logger.Error(err)
return err
}
logger.Logger.Trace(token)
info := &machine.MSSendToken{}
info.Snid = msg.Snid
info.Token = token
info.Appid = msg.AppId
info.StreamId = msg.StreamId
session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info)
fmt.Println("向游戏服务器发送娃娃机token%v", info)
return nil
}*/
func init() { func init() {
netlib.Register(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), &machine.SMDollMachineoPerate{}, SMDollMachinePerateHandler) netlib.Register(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), &machine.SMDollMachineoPerate{}, SMDollMachinePerateHandler)
netlib.Register(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.SMDollMachineGrab{}, SMDollMachineGrabHandler) netlib.Register(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.SMDollMachineGrab{}, SMDollMachineGrabHandler)
//链接成功 返回消息 //链接成功 返回消息
netlib.Register(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{}, SMGameLinkSucceedHandler) netlib.Register(int(machine.DollMachinePacketID_PACKET_SMGameLinkSucceed), &machine.SMGameLinkSucceed{}, SMGameLinkSucceedHandler)
//netlib.Register(int(machine.DollMachinePacketID_PACKET_SMGetToken), &machine.SMGetToken{}, SMGetTokenHandler)
} }

View File

@ -8,7 +8,7 @@ import (
// 向前aa 05 01 50 01 01 54 dd // 向前aa 05 01 50 01 01 54 dd
func Forward(conn net.Conn) { func Forward(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x01} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x01}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -19,7 +19,7 @@ func Forward(conn net.Conn) {
// 向前停止aa 05 01 50 01 00 55 dd // 向前停止aa 05 01 50 01 00 55 dd
func ForwardStop(conn net.Conn) { func ForwardStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x00} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x00}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -31,7 +31,7 @@ func ForwardStop(conn net.Conn) {
// aa 05 01 50 02 01 57 dd // aa 05 01 50 02 01 57 dd
func Backward(conn net.Conn) { func Backward(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x01} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x01}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -42,7 +42,7 @@ func Backward(conn net.Conn) {
// 向后停止aa 05 01 50 02 00 56 dd // 向后停止aa 05 01 50 02 00 56 dd
func BackwardStop(conn net.Conn) { func BackwardStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x00} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x00}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -53,7 +53,7 @@ func BackwardStop(conn net.Conn) {
// 向左aa 05 01 50 03 01 56 dd // 向左aa 05 01 50 03 01 56 dd
func Left(conn net.Conn) { func Left(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x01} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x01}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -64,7 +64,7 @@ func Left(conn net.Conn) {
// 向左停止aa 05 01 50 03 00 57 dd // 向左停止aa 05 01 50 03 00 57 dd
func LeftStop(conn net.Conn) { func LeftStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x00} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x00}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -75,7 +75,7 @@ func LeftStop(conn net.Conn) {
// 向右 // 向右
func Right(conn net.Conn) { func Right(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x01} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x01}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -86,7 +86,7 @@ func Right(conn net.Conn) {
// 向右停止aa 05 01 50 04 00 50 dd // 向右停止aa 05 01 50 04 00 50 dd
func RightStop(conn net.Conn) { func RightStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x00} instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x00}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -97,34 +97,7 @@ func RightStop(conn net.Conn) {
// 强抓下抓 // 强抓下抓
func Grab(conn net.Conn) { func Grab(conn net.Conn) {
instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x01} instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x01}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/*
// 读取服务端的响应
buf := make([]byte, 1024)
_, err = conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
instruction = []byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd}
_, err = conn.Write(instruction)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}*/
}
// 必中抓
func Grab2(conn net.Conn) {
//设置电压
instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x01}
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -142,7 +115,7 @@ func Grab2(conn net.Conn) {
// 弱抓aa 05 01 50 06 00 52 dd // 弱抓aa 05 01 50 06 00 52 dd
func WeakGrab(conn net.Conn) { func WeakGrab(conn net.Conn) {
instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x00} instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x00}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -153,14 +126,14 @@ func WeakGrab(conn net.Conn) {
// 投币 // 投币
func Coin(conn net.Conn) { func Coin(conn net.Conn) {
moveCommand := []byte{0xaa, 0x08, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00} moveCommand := []byte{0xaa, 0x08, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00}
moveCommand = CalculateChecksum(moveCommand) moveCommand = calculateChecksum(moveCommand)
// 发送指令到服务端 // 发送指令到服务端
_, err := conn.Write(moveCommand) _, err := conn.Write(moveCommand)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
return return
} }
/* // 读取服务端的响应 // 读取服务端的响应
buf := make([]byte, 1024) buf := make([]byte, 1024)
n, err := conn.Read(buf) n, err := conn.Read(buf)
if err != nil { if err != nil {
@ -172,192 +145,13 @@ func Coin(conn net.Conn) {
} }
if buf[4] == 0 { if buf[4] == 0 {
fmt.Println("上分失败!!!") fmt.Println("上分失败!!!")
}*/ }
} }
// 剩余局数清零 // 剩余局数清零
func ClearRemainingGames(conn net.Conn) { func ClearRemainingGames(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x32} instruction := []byte{0xAA, 0x03, 0x01, 0x32}
instruction = CalculateChecksum(instruction) instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 计算校验码
func CalculateChecksum(data []byte) []byte {
var value = byte(0)
for i, datum := range data {
if i > 0 {
value ^= datum
}
}
//fmt.Println("校验码 value = ", value)
data = append(data, value, 0xdd)
return data
}
// 开启音乐
func OpenMusic(conn net.Conn) {
data[43] = 0x01
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = CalculateChecksum(instruction)
//instruction[1] = byte(len(instruction) - 3)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
// 读取服务端的响应
/* buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 关闭音乐
func CloseMusic(conn net.Conn) {
data[43] = 0x00
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 恢复出厂设置
func RestoreFactorySettings(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x38}
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 重启主板
func Reboot(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x39}
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 暂停服务
func StopServer(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x37}
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
}
// 开启服务
func StartServer(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x36}
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
}
// 查询基础参数
func queryBaseParam(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x05}
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 设置出奖模式
func SetPower(conn net.Conn) {
data[3] = 0x01
fmt.Println("data.len = ", len(data))
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)*/
}
// 基础设置
func SetBaseParam(conn net.Conn) {
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
if err != nil { if err != nil {
fmt.Println("Failed to send command to server:", err) fmt.Println("Failed to send command to server:", err)
@ -371,64 +165,217 @@ func SetBaseParam(conn net.Conn) {
return return
} }
fmt.Println("n", n) fmt.Println("n", n)
if buf[4] == 1 { }
fmt.Println("设置成功!")
} else { // 计算校验码
fmt.Println("设置失败!") func calculateChecksum(data []byte) []byte {
var value = byte(0)
for i, datum := range data {
if i > 0 {
value ^= datum
}
}
fmt.Println("校验码 value = ", value)
data = append(data, value, 0xdd)
return data
}
// 开启音乐
func OpenMusic(conn net.Conn) {
data[43] = 0x01
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
// 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)
}
// 关闭音乐
func CloseMusic(conn net.Conn) {
data[43] = 0x00
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
// 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)
}
// 恢复出厂设置
func RestoreFactorySettings(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x38}
instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
// 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)
}
// 重启主板
func Reboot(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x39}
instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
}
// 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
fmt.Println("n", n)
}
// 暂停服务
func StopServer(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x37}
instruction = calculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
return
} }
} }
var data = []byte{ // 开启服务
0x65, //0 几币几玩 func StartServer(conn net.Conn) {
0x00, //1 几币几玩占用位 instruction := []byte{0xAA, 0x03, 0x01, 0x36}
0x2D, //2 游戏时间 instruction = calculateChecksum(instruction)
0x01, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式 _, err := conn.Write(instruction)
0x0F, //4 出奖概率 if err != nil {
0x00, //5 出奖概率占用位 fmt.Println("Failed to send command to server:", err)
0x00, //6 空中抓物 0关闭 1开启 return
0x00, //7 连续投币赠送 范围0~100 }
0x00, //8 保夹次数 范围06 6为无限次 }
0x01, //9 保夹赠送模式 0送游戏 1送中奖 2送游戏和中奖
// 查询基础参数
0x80, //10 强抓力电压 func queryBaseParam(conn net.Conn) {
0x01, //11 强抓力电压占用位 instruction := []byte{0xAA, 0x03, 0x01, 0x05}
0x80, //12 中抓力电压 instruction = calculateChecksum(instruction)
0x01, //13 中抓力电压占用位 _, err := conn.Write(instruction)
0x78, //14 弱抓力电压 if err != nil {
0x00, //15 弱抓力电压占用位 fmt.Println("Failed to send command to server:", err)
0xE0, //16 中奖电压 return
0x01, //17 中奖电压占用位 }
0xC8, //18 强抓力时间 // 读取服务端的响应
0x00, //19 强抓力时间占用位 buf := make([]byte, 1024)
n, err := conn.Read(buf)
0x14, //20 放抓时间 if err != nil {
0x32, //21 前后速度 fmt.Println("Failed to read response from server:", err)
0x32, //22 左右速度 return
0x50, //23 上下速度 }
0x9A, //24 放线长度
0x06, //25 放线长度占用位 fmt.Println("n", n)
0x00, //26 礼品下放高度 }
0x00, //27 礼品下放高度占用位
0x14, //28 甩抓长度 // 设置强力
0x00, //29 甩抓保护 func SetPower(conn net.Conn) {
data[3] = 0x00
0x78, //30 甩抓电压 data[16] = 0x01
0x00, //31 甩抓电压占用位 data[17] = 0xE0
0x32, //32 上拉保护 data[18] = 0x13
0x02, //33 天车自救时间 data[19] = 0x88
0x00, //34 下抓延时 fmt.Println("data.len = ", len(data))
0x00, //35 下抓延时占用位 instruction := []byte{0xAA, 0x33, 0x01, 0x06}
0xC8, //36 抓物延时 instruction = append(instruction, data...)
0x00, //37 抓物延时占用位 instruction = calculateChecksum(instruction)
0x96, //38 上停延时 _, err := conn.Write(instruction)
0x00, //39 上停延时占用位 if err != nil {
fmt.Println("Failed to send command to server:", err)
0x00, //40 摇杆延时 return
0x00, //41 摇杆延时占用位 }
0x00, //42 抓物二收 // 读取服务端的响应
0x00, //43 待机音乐开关 buf := make([]byte, 1024)
0x00, //44 音量大小调整 n, err := conn.Read(buf)
0x07, //45 待机音乐选择 if err != nil {
0x08, //46 游戏音乐选择 fmt.Println("Failed to read response from server:", err)
0x00, //47 概率队列自动 return
}
fmt.Println("n", n)
}
var data = []byte{
0x65,
0x00,
0x0F,
0x02,
0x0F,
0x00,
0x01,
0x00,
0x00,
0x01,
0xC8,
0x00,
0x7C,
0x01,
0x5A,
0x00,
0xE0,
0x01,
0xC8,
0x00,
0x14,
0x32,
0x32,
0x50,
0x34,
0x08,
0x00,
0x00,
0x00,
0x00,
0x78,
0x00,
0x32,
0x02,
0x00,
0x00,
0xC8,
0x00,
0x96,
0x00,
0x00,
0x00,
0x00,
0x00,
0x0F,
0x07,
0x08,
0x00,
} }

View File

@ -3,54 +3,47 @@ package machinedoll
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net" "mongo.games.com/goserver/core/timer"
"os"
"os/signal" "os/signal"
"path/filepath"
"syscall" "syscall"
"time"
"mongo.games.com/goserver/core/basic"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/module"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/task"
"mongo.games.com/goserver/srvlib"
"mongo.games.com/game/protocol/machine" "mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/srvlib"
"net"
"os"
"path/filepath"
"time"
) )
var GameConn *netlib.Session var GameConn *netlib.Session
var ConnMap = make(map[int]net.Conn)
var MachineMgr = &MachineManager{
ConnMap: map[int]*Conn{},
DelConnMap: make(map[int]string),
}
type Conn struct {
Id int
net.Conn
Addr string
}
type MachineManager struct { type MachineManager struct {
ConnMap map[int]*Conn
DelConnMap map[int]string DelConnMap map[int]string
} }
var MachineMgr = &MachineManager{
DelConnMap: make(map[int]string),
}
func (this *MachineManager) ModuleName() string { func (this *MachineManager) ModuleName() string {
return "MachineManager" return "MachineManager"
} }
// 心跳间隔时间(秒)
const heartbeatInterval = 1
func (this *MachineManager) Init() { func (this *MachineManager) Init() {
var serverAddrs []string var serverAddrs []string
programDir, err := os.Getwd() programDir, err := os.Getwd()
if err != nil { if err != nil {
logger.Logger.Error("Error getting working directory:", err) fmt.Println("Error getting working directory:", err)
return return
} }
configFile := filepath.Join(programDir, "machineIPConfig.json") configFile := filepath.Join(programDir, "machineIPConfig.json")
logger.Logger.Trace("构建配置文件的路径", configFile) fmt.Println("构建配置文件的路径", configFile)
fileData, err := os.ReadFile(configFile) fileData, err := os.ReadFile(configFile)
if err != nil { if err != nil {
logger.Logger.Error("Read robot account file error:", err) logger.Logger.Error("Read robot account file error:", err)
@ -66,93 +59,88 @@ func (this *MachineManager) Init() {
for i, addr := range serverAddrs { for i, addr := range serverAddrs {
conn, err := net.DialTimeout("tcp", addr, 5*time.Second) conn, err := net.DialTimeout("tcp", addr, 5*time.Second)
if err != nil { if err != nil {
logger.Logger.Error("Failed to connect to server:", err) fmt.Println("Failed to connect to server:", err)
continue continue
} }
this.ConnMap[i+1] = &Conn{ ConnMap[i+1] = conn
Id: i + 1, go this.StartHeartbeat(i+1, &conn, addr)
Conn: conn,
Addr: addr,
} }
SetBaseParam(conn) fmt.Println("Connected to server:\n", ConnMap[1].RemoteAddr())
logger.Logger.Trace("设置每台娃娃机基础配置!")
}
/* fmt.Println("Connected to server:\n", this.ConnMap[1].RemoteAddr())
fmt.Println("投币请按Q") fmt.Println("投币请按Q")
fmt.Println("w向前s向后a向左d向右 j强力抓取k弱力抓取") fmt.Println("w向前s向后a向左d向右 j强力抓取k弱力抓取")
// 监听 WASD 按键事件 // 监听 WASD 按键事件
go listenKeyboardEvents(this.ConnMap[1]) /* go listenKeyboardEvents(ConnMap[1])
// 监听中断信号,等待用户退出 // 监听中断信号,等待用户退出
waitForUserExit()*/ waitForUserExit()*/
}
func (this *MachineManager) StartHeartbeat(id int, conn *net.Conn, addr string) {
// 定期发送心跳包
ticker := time.NewTicker(heartbeatInterval * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
// 发送心跳包
_, err := (*conn).Write([]byte("heartbeat"))
if err != nil {
fmt.Println("Failed to send heartbeat:", err)
delete(ConnMap, id)
this.DelConnMap[id] = addr
//通知游戏服
this.UpdateToGameServer()
fmt.Println("删除链接addr = ", addr)
go timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool {
this.ReConnect()
return true
}), nil, time.Duration(5)*time.Second, 100)
return
}
}
}
} }
func (this *MachineManager) Update() { // 重连
var delConn []*Conn func (this *MachineManager) ReConnect() bool {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { fmt.Println("================重连============")
for _, v := range this.ConnMap { delIds := []int{}
_, err := v.Write([]byte("heartbeat")) status := false
if err != nil {
delConn = append(delConn, v)
v.Close()
logger.Logger.Tracef("断开连接:%v", v.Addr)
this.UpdateToGameServer(v, 0)
}
}
return nil
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
for _, v := range delConn {
delete(this.ConnMap, v.Id)
this.DelConnMap[v.Id] = v.Addr
}
// 重连
var delIds []*Conn
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
for id, addr := range this.DelConnMap { for id, addr := range this.DelConnMap {
conn, err := net.DialTimeout("tcp", addr, 5*time.Second) conn, err := net.DialTimeout("tcp", addr, 5*time.Second)
if err != nil { if err != nil {
continue continue
} }
logger.Logger.Tracef("娃娃机重连成功addr = %v", addr) ConnMap[id] = conn
delIds = append(delIds, &Conn{ delIds = append(delIds, id)
Id: id, status = true
Conn: conn,
Addr: addr,
})
} }
return nil for _, id := range delIds {
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) { delete(this.DelConnMap, id)
for _, v := range delIds { fmt.Println("重新链接成功id = ", id)
this.ConnMap[v.Id] = v
delete(this.DelConnMap, v.Id)
this.UpdateToGameServer(v, 1)
} }
})).StartByFixExecutor(this.ModuleName()) if status {
})).StartByFixExecutor(this.ModuleName()) this.UpdateToGameServer()
return true
}
return false
} }
func (this *MachineManager) Shutdown() { func (this *MachineManager) UpdateToGameServer() {
for _, v := range this.ConnMap { msg := &machine.MSDollMachineList{}
v.Close() for i, _ := range ConnMap {
this.UpdateToGameServer(v, 0) info := &machine.DollMachine{}
info.Id = int32(i)
info.VideoAddr = "www.baidu.com"
msg.Data = append(msg.Data, info)
} }
SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
module.UnregisteModule(this)
}
func (this *MachineManager) UpdateToGameServer(conn *Conn, status int32) {
msg := &machine.MSUpdateDollMachineStatus{}
msg.Id = int32(conn.Id)
msg.Status = status
msg.VideoAddr = conn.Addr
SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), msg)
} }
func SendToGameServer(pid int, msg interface{}) { func SendToGameServer(pid int, msg interface{}) {
GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 777) if GameConn == nil {
GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 701)
}
if GameConn != nil { if GameConn != nil {
GameConn.Send(pid, msg) GameConn.Send(pid, msg)
} else { } else {
@ -161,7 +149,7 @@ func SendToGameServer(pid int, msg interface{}) {
} }
func init() { func init() {
module.RegisteModule(MachineMgr, time.Second, 0) MachineMgr.Init()
} }
func listenKeyboardEvents(conn net.Conn) { func listenKeyboardEvents(conn net.Conn) {
@ -239,8 +227,6 @@ func listenKeyboardEvents(conn net.Conn) {
SetPower(conn) SetPower(conn)
case "8": case "8":
CloseMusic(conn) CloseMusic(conn)
case "9":
queryBaseParam(conn)
} }
} }
} }

View File

@ -9,7 +9,6 @@ import (
"mongo.games.com/game/common" "mongo.games.com/game/common"
"mongo.games.com/game/model" "mongo.games.com/game/model"
"mongo.games.com/goserver/core" "mongo.games.com/goserver/core"
"mongo.games.com/goserver/core/admin"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/transact" "mongo.games.com/goserver/core/transact"
@ -177,6 +176,14 @@ func init() {
return transact.TransExeResult(retCode) return transact.TransExeResult(retCode)
}), }),
}) })
// 对局详情 // //参数设置
admin.MyAdminApp.Route("/api/game/room_info", GameSrvWebAPI) // admin.MyAdminApp.Route("/api/Param/CommonTax", GameSrvWebAPI)
// //捕鱼金币池查询
// admin.MyAdminApp.Route("/api/CoinPool/FishingPool", GameSrvWebAPI)
// //通用金币池查询
// admin.MyAdminApp.Route("/api/CoinPool/GamePool", GameSrvWebAPI)
// //捕鱼渔场保留金币
// admin.MyAdminApp.Route("/api/CoinPool/GameFishsAllCoin", GameSrvWebAPI)
// //单控数据
//admin.MyAdminApp.Route("/api/game/SinglePlayerAdjust", GameSrvWebAPI)
} }

View File

@ -84,16 +84,3 @@ func SaveToDelBackupBagItem(args *BagInfo) error {
} }
return nil return nil
} }
type AddItemParam struct {
P *PlayerData
Change []*Item // 道具变化数量
Cost []*Item // 获得道具时消耗的道具数量
Add int64 // 加成数量
GainWay int32 // 记录类型
Operator, Remark string // 操作人,备注
GameId, GameFreeId int64 // 游戏id,场次id
NoLog bool // 是否不记录日志
LogId string // 撤销的id,道具兑换失败
RoomConfigId int32 // 房间配置id
}

View File

@ -5,6 +5,7 @@ import (
"mongo.games.com/game/protocol/server" "mongo.games.com/game/protocol/server"
"time" "time"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson" "github.com/globalsign/mgo/bson"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
) )
@ -124,3 +125,17 @@ func ManageCoinPoolSetting(dbSetting *CoinPoolSetting) {
} }
CoinPoolSettingDatas[key] = dbSetting CoinPoolSettingDatas[key] = dbSetting
} }
// 删除水池历史调控记录
func RemoveCoinPoolSettingHis(ts time.Time) (*mgo.ChangeInfo, error) {
if rpcCli == nil {
return nil, ErrRPClientNoConn
}
var ret mgo.ChangeInfo
err := rpcCli.CallWithTimeout("CoinPoolSettingSvc.RemoveCoinPoolSettingHis", ts, &ret, time.Second*30)
if err != nil {
logger.Logger.Warn("RemoveCoinPoolSettingHis error:", err)
return &ret, err
}
return &ret, err
}

View File

@ -1,13 +1,11 @@
package model package model
import ( import (
"slices"
"strconv" "strconv"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/game/common" "mongo.games.com/game/common"
"mongo.games.com/game/protocol/gamehall"
"mongo.games.com/game/protocol/shop" "mongo.games.com/game/protocol/shop"
"mongo.games.com/game/protocol/webapi" "mongo.games.com/game/protocol/webapi"
) )
@ -35,7 +33,7 @@ const (
type ShopInfo struct { type ShopInfo struct {
Id int32 // 商品ID Id int32 // 商品ID
Page int32 // 页面 1金币页面 2钻石页面 3道具页面 4,房卡 Page int32 // 页面 1金币页面 2钻石页面 3道具页面
Order int32 // 排序 页面内商品的位置排序 Order int32 // 排序 页面内商品的位置排序
Location []int32 // 显示位置 第1位竖版大厅 第2位Tienlen1级选场 第3位捕鱼1级选场 Location []int32 // 显示位置 第1位竖版大厅 第2位Tienlen1级选场 第3位捕鱼1级选场
Picture string // 图片id Picture string // 图片id
@ -45,7 +43,7 @@ type ShopInfo struct {
AdTime int32 // 观看几次广告 AdTime int32 // 观看几次广告
RepeatTimes int32 // 领取次数 RepeatTimes int32 // 领取次数
CoolingTime []int32 // 观看冷却时间 CoolingTime []int32 // 观看冷却时间
Type int32 // 获得类型 1金币 2钻石 3道具类型 4房卡 Type int32 // 获得类型 1金币 2钻石 3道具类型
Amount int64 // 获得数量 Amount int64 // 获得数量
AddArea []int32 // 加送百分比比如加送10%就配置110 AddArea []int32 // 加送百分比比如加送10%就配置110
ItemId int32 // 获得道具ID ItemId int32 // 获得道具ID
@ -77,7 +75,7 @@ func (this *ShopInfo) GetItems() []ItemInfo {
if this.ItemId > 0 { if this.ItemId > 0 {
ret = append(ret, ItemInfo{ ret = append(ret, ItemInfo{
ItemId: this.ItemId, ItemId: this.ItemId,
ItemNum: this.AmountFinal, ItemNum: this.Amount,
}) })
} }
for _, v := range this.AddItemInfo { for _, v := range this.AddItemInfo {
@ -140,8 +138,6 @@ type AllConfig struct {
*webapi.AwardLogConfig *webapi.AwardLogConfig
// 新手引导配置 // 新手引导配置
*webapi.GuideConfig *webapi.GuideConfig
//娃娃机配置
*webapi.MachineConfig
MatchAudience map[int32]*webapi.MatchAudience // 比赛观众列表 key: 玩家id MatchAudience map[int32]*webapi.MatchAudience // 比赛观众列表 key: 玩家id
// 小精灵配置 // 小精灵配置
*webapi.SpiritConfig *webapi.SpiritConfig
@ -149,7 +145,6 @@ type AllConfig struct {
RoomType map[int32]*webapi.RoomType // key: 房间类型id RoomType map[int32]*webapi.RoomType // key: 房间类型id
// 房卡场房间配置 // 房卡场房间配置
RoomConfig map[int32]*webapi.RoomConfig // key: 房间配置id RoomConfig map[int32]*webapi.RoomConfig // key: 房间配置id
RoomTypeMap map[int32][]*webapi.RoomConfig // key: 房间类型id:房间配置
} }
type GlobalConfig struct { type GlobalConfig struct {
@ -181,7 +176,6 @@ func (cm *ConfigMgr) GetConfig(platform string) *AllConfig {
MatchAudience: make(map[int32]*webapi.MatchAudience), MatchAudience: make(map[int32]*webapi.MatchAudience),
RoomType: make(map[int32]*webapi.RoomType), RoomType: make(map[int32]*webapi.RoomType),
RoomConfig: make(map[int32]*webapi.RoomConfig), RoomConfig: make(map[int32]*webapi.RoomConfig),
RoomTypeMap: make(map[int32][]*webapi.RoomConfig),
} }
cm.platform[platform] = c cm.platform[platform] = c
} }
@ -402,94 +396,8 @@ func (cm *ConfigMgr) DelRoomType(plt string, id int32) {
func (cm *ConfigMgr) UpdateRoomConfig(data *webapi.RoomConfig) { func (cm *ConfigMgr) UpdateRoomConfig(data *webapi.RoomConfig) {
cm.GetConfig(data.GetPlatform()).RoomConfig[data.GetId()] = data cm.GetConfig(data.GetPlatform()).RoomConfig[data.GetId()] = data
d := cm.GetConfig(data.GetPlatform()).RoomTypeMap[data.GetRoomType()]
if d == nil {
d = make([]*webapi.RoomConfig, 0)
}
has := false
for k, v := range d {
if v.GetId() == data.GetId() {
d[k] = data
has = true
break
}
}
if !has {
d = append(d, data)
}
cm.GetConfig(data.GetPlatform()).RoomTypeMap[data.GetRoomType()] = d
} }
func (cm *ConfigMgr) DelRoomConfig(plt string, id int32) { func (cm *ConfigMgr) DelRoomConfig(plt string, id int32) {
d := cm.GetConfig(plt).RoomConfig[id]
if d != nil {
b := cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()]
for i, v := range b {
if v.GetId() == id {
b = append(b[:i], b[i+1:]...)
cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()] = b
break
}
}
}
delete(cm.GetConfig(plt).RoomConfig, id) delete(cm.GetConfig(plt).RoomConfig, id)
} }
func (cm *ConfigMgr) GetRoomConfig(plt string, lastChannel string) *gamehall.SCRoomConfig {
pack := &gamehall.SCRoomConfig{}
for _, v := range cm.GetConfig(plt).RoomType {
if v.GetOn() != common.On {
continue
}
var list []*gamehall.RoomConfigInfo
for _, vv := range cm.GetConfig(plt).RoomTypeMap[v.GetId()] {
if vv.GetOn() != common.On {
continue
}
if lastChannel != "" && !slices.Contains(vv.GetOnChannelName(), lastChannel) {
continue
}
var cost, reward []*gamehall.ItemInfo
for _, item := range vv.GetCost() {
cost = append(cost, &gamehall.ItemInfo{
Id: item.GetItemId(),
Num: int32(item.GetItemNum()),
})
}
for _, item := range vv.GetReward() {
reward = append(reward, &gamehall.ItemInfo{
Id: item.GetItemId(),
Num: int32(item.GetItemNum()),
})
}
list = append(list, &gamehall.RoomConfigInfo{
Id: vv.GetId(),
Name: vv.GetName(),
RoomType: vv.GetRoomType(),
On: vv.GetOn(),
SortId: vv.GetSortId(),
Cost: cost,
Reward: reward,
OnChannelName: vv.GetOnChannelName(),
GameFreeId: vv.GetGameFreeId(),
Round: vv.GetRound(),
PlayerNum: vv.GetPlayerNum(),
NeedPassword: vv.GetNeedPassword(),
CostType: vv.GetCostType(),
Voice: vv.GetVoice(),
ImageURI: vv.GetImageURI(),
})
}
pack.List = append(pack.List, &gamehall.RoomTypeInfo{
Id: v.GetId(),
Name: v.GetName(),
On: v.GetOn(),
SortId: v.GetSortId(),
List: list,
})
}
return pack
}

View File

@ -1,35 +0,0 @@
package model
var (
DbCustomLogDBName = "log"
DbCustomLogCollName = "log_custom"
)
type PlayerInfo struct {
SnId int32 // 玩家id
Awards []*Item // 奖品
}
type RoundInfo struct {
Round int32 // 第几局
Ts int64 // 结算时间
Score []int64 // 分数
LogId string // 牌局记录id
}
type CustomLog struct {
Platform string `bson:"-"`
CycleId string // 本轮id多局游戏属于同一轮
RoomConfigId int32 // 房间配置id
GameFreeId int32 // 场次id
TotalRound int32 // 总局数
PlayerNum int32 // 最大人数
Password string // 密码
CostType int32 // 付费方式 1房主 2AA
Voice int32 // 是否开启语音 1开启
RoomId int32 // 房间id
SnId []PlayerInfo // 所有玩家
List []RoundInfo // 对局记录
StartTs, EndTs int64 // 开始,结束时间
State int32 // 0正常结束 1后台中途解散
}

View File

@ -35,15 +35,15 @@ type GameDetailedLogType struct {
type GameDetailedLog struct { type GameDetailedLog struct {
Id bson.ObjectId `bson:"_id"` //记录ID Id bson.ObjectId `bson:"_id"` //记录ID
LogId string //记录ID,每局游戏唯一 LogId string //记录ID
GameId int32 //游戏id GameId int32 //游戏id
ClubId int32 //俱乐部Id ClubId int32 //俱乐部Id
ClubRoom string //俱乐部包间 ClubRoom string //俱乐部包间
Platform string //平台id Platform string //平台id
Channel string //渠道 Channel string //渠道
Promoter string //推广员 Promoter string //推广员
MatchId int64 //比赛ID,应该用字符串的 MatchId int64 //比赛ID
SceneId int32 //房间id会重复 SceneId int32 //场景ID
GameMode int32 //游戏类型 GameMode int32 //游戏类型
GameFreeid int32 //游戏类型房间号 GameFreeid int32 //游戏类型房间号
PlayerCount int32 //玩家数量 PlayerCount int32 //玩家数量
@ -57,7 +57,6 @@ type GameDetailedLog struct {
Ts int64 //时间戳 Ts int64 //时间戳
CtrlType int // 1控赢 2控输 0不控 CtrlType int // 1控赢 2控输 0不控
PlayerPool map[int]int // 个人水池分 PlayerPool map[int]int // 个人水池分
CycleId string // 本轮id打一轮有多局
} }
func NewGameDetailedLog() *GameDetailedLog { func NewGameDetailedLog() *GameDetailedLog {
@ -66,8 +65,7 @@ func NewGameDetailedLog() *GameDetailedLog {
} }
func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32, func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, playercount, gametiming, gamebasebet int32,
gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, gamedetailednote string, platform string, clubId int32, clubRoom string, cpCtx CoinPoolCtx, ver int32, trend20Lately string, ctrlType int, playerPool map[int]int) *GameDetailedLog {
trend20Lately string, ctrlType int, playerPool map[int]int, cycleId string) *GameDetailedLog {
cl := NewGameDetailedLog() cl := NewGameDetailedLog()
cl.LogId = logid cl.LogId = logid
cl.GameId = gameid cl.GameId = gameid
@ -89,7 +87,6 @@ func NewGameDetailedLogEx(logid string, gameid, sceneid, gamemode, gamefreeid, p
cl.Ts = time.Now().Unix() cl.Ts = time.Now().Unix()
cl.CtrlType = ctrlType cl.CtrlType = ctrlType
cl.PlayerPool = playerPool cl.PlayerPool = playerPool
cl.CycleId = cycleId
return cl return cl
} }

View File

@ -55,7 +55,6 @@ type GamePlayerListLog struct {
IsFree bool //拉霸专用 是否免费 IsFree bool //拉霸专用 是否免费
WinSmallGame int64 //拉霸专用 小游戏奖励 WinSmallGame int64 //拉霸专用 小游戏奖励
WinTotal int64 //拉霸专用 输赢 WinTotal int64 //拉霸专用 输赢
CycleId string // 本轮id打一轮有多局
} }
func NewGamePlayerListLog() *GamePlayerListLog { func NewGamePlayerListLog() *GamePlayerListLog {
@ -65,7 +64,7 @@ func NewGamePlayerListLog() *GamePlayerListLog {
func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, channel, promoter, packageTag string, gameid, baseScore, func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, channel, promoter, packageTag string, gameid, baseScore,
sceneid, gamemode, gamefreeid int32, totalin, totalout int64, clubId int32, clubRoom string, taxCoin, pumpCoin int64, roomType int32, sceneid, gamemode, gamefreeid int32, totalin, totalout int64, clubId int32, clubRoom string, taxCoin, pumpCoin int64, roomType int32,
betAmount, winAmountNoAnyTax int64, key, name string, gameClass int32, isFirst bool, matchid, matchType int64, betAmount, winAmountNoAnyTax int64, key, name string, gameClass int32, isFirst bool, matchid, matchType int64,
isFree bool, winSmallGame, winTotal int64, cycleId string) *GamePlayerListLog { isFree bool, winSmallGame, winTotal int64) *GamePlayerListLog {
cl := NewGamePlayerListLog() cl := NewGamePlayerListLog()
cl.SnId = snid cl.SnId = snid
cl.GameDetailedLogId = gamedetailedlogid cl.GameDetailedLogId = gamedetailedlogid
@ -99,7 +98,6 @@ func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, chan
cl.Time = tNow cl.Time = tNow
cl.MatchId = matchid cl.MatchId = matchid
cl.MatchType = matchType cl.MatchType = matchType
cl.CycleId = cycleId
return cl return cl
} }

View File

@ -26,9 +26,8 @@ type ItemLog struct {
TypeId int32 // 变化类型 TypeId int32 // 变化类型
GameId int32 // 游戏id,游戏中获得时有值 GameId int32 // 游戏id,游戏中获得时有值
GameFreeId int32 // 场次id,游戏中获得时有值 GameFreeId int32 // 场次id,游戏中获得时有值
Cost []*Item // 消耗的道具 Cost []*ItemInfo // 消耗的道具
Id string // 撤销的id兑换失败 Id string // 撤销的id兑换失败
RoomConfigId int32 // 房间配置id
} }
func NewItemLog() *ItemLog { func NewItemLog() *ItemLog {
@ -47,9 +46,8 @@ type ItemParam struct {
TypeId int32 // 变化类型 TypeId int32 // 变化类型
GameId int64 // 游戏id,游戏中获得时有值 GameId int64 // 游戏id,游戏中获得时有值
GameFreeId int64 // 场次id,游戏中获得时有值 GameFreeId int64 // 场次id,游戏中获得时有值
Cost []*Item // 消耗的道具 Cost []*ItemInfo // 消耗的道具
LogId string // 撤销的id兑换失败 LogId string // 撤销的id兑换失败
RoomConfigId int32 // 房间配置id
} }
func NewItemLogEx(param ItemParam) *ItemLog { func NewItemLogEx(param ItemParam) *ItemLog {
@ -67,7 +65,6 @@ func NewItemLogEx(param ItemParam) *ItemLog {
itemLog.GameFreeId = int32(param.GameFreeId) itemLog.GameFreeId = int32(param.GameFreeId)
itemLog.Cost = param.Cost itemLog.Cost = param.Cost
itemLog.Id = param.LogId itemLog.Id = param.LogId
itemLog.RoomConfigId = param.RoomConfigId
return itemLog return itemLog
} }

View File

@ -53,7 +53,7 @@ type JybInfo struct {
JybId bson.ObjectId `bson:"_id"` // 礼包ID JybId bson.ObjectId `bson:"_id"` // 礼包ID
Platform string //平台 Platform string //平台
Name string // 礼包名称 Name string // 礼包名称
CodeType int32 // 礼包类型 1 通用 2专属(自动生成兑换码,每个玩家领一个) 3活动(自动生产兑换码,每个兑换码领一个) CodeType int32 // 礼包类型 1 通用 2 特殊
StartTime int64 // 开始时间 Unix StartTime int64 // 开始时间 Unix
EndTime int64 // 结束时间 EndTime int64 // 结束时间
Content string // 礼包内容 Content string // 礼包内容

View File

@ -344,13 +344,6 @@ type MatchFreeSignupRec struct {
UseTimes int32 //累计使用免费次数 UseTimes int32 //累计使用免费次数
} }
// WGPlayerInfo 游戏服玩家信息
// 大厅玩家信息发送给游戏服
type WGPlayerInfo struct {
*PlayerData
GameData map[string]*PlayerGameData // 游戏数据,只允许存储玩家对应某个游戏需要持久化的数据
}
type PlayerData struct { type PlayerData struct {
Id bson.ObjectId `bson:"_id"` Id bson.ObjectId `bson:"_id"`
AccountId string //账号id AccountId string //账号id
@ -981,7 +974,7 @@ func NewPlayerData(acc string, name string, id int32, channel, platform string,
} }
func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, platform string, params, tel string, func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, platform string, params, tel string,
packTag, ip string, tagkey, accountType int32, deviceOS, channelId string) *PlayerData { packTag, ip string, tagkey, accountType int32, deviceOS string) *PlayerData {
if len(name) == 0 { if len(name) == 0 {
logger.Logger.Trace("New player name is empty.") logger.Logger.Trace("New player name is empty.")
return nil return nil
@ -992,7 +985,6 @@ func NewPlayerDataThird(acc string, name, headUrl string, id int32, channel, pla
AccountId: acc, AccountId: acc,
Name: name, Name: name,
Channel: channel, Channel: channel,
ChannelId: channelId,
Platform: platform, Platform: platform,
SnId: id, SnId: id,
Head: rand.Int31n(common.HeadRange), Head: rand.Int31n(common.HeadRange),

View File

@ -1,56 +0,0 @@
package model
import (
"time"
"mongo.games.com/goserver/core/logger"
)
type PlayerGameData struct {
Platform string `bson:"-"`
SnId int32
Id string // 游戏id或场次id
Data interface{} // 数据
}
type PlayerGameSaveReq struct {
Platform string
Data []*PlayerGameData
}
func SavePlayerGameData(platform string, data []*PlayerGameData) error {
if rpcCli == nil {
logger.Logger.Error("model.SavePlayerGameData rpcCli == nil")
return nil
}
b := false
err := rpcCli.CallWithTimeout("PlayerGameDataSvc.Save", &PlayerGameSaveReq{Platform: platform, Data: data}, &b, time.Second*30)
if err != nil {
logger.Logger.Error("model.SavePlayerGameData err:%v", err)
return err
}
return nil
}
type PlayerGameDataFindReq struct {
Platform string
SnId int32
}
type PlayerGameDataFindRes struct {
Data []*PlayerGameData
}
func GetPlayerGameData(platform string, snid int32) ([]*PlayerGameData, error) {
if rpcCli == nil {
logger.Logger.Error("model.GetPlayerGameData rpcCli == nil")
return nil, nil
}
res := &PlayerGameDataFindRes{}
err := rpcCli.CallWithTimeout("PlayerGameDataSvc.Find", &PlayerGameDataFindReq{Platform: platform, SnId: snid}, res, time.Second*30)
if err != nil {
logger.Logger.Error("model.GetPlayerGameData err:%v", err)
return nil, err
}
return res.Data, nil
}

View File

@ -23,5 +23,4 @@ const (
const ( const (
DBVipGiftLog = "db_vipgift" DBVipGiftLog = "db_vipgift"
DBCustomLog = "db_customlog" // 房卡场对局记录
) )

View File

@ -24,55 +24,40 @@ const (
type CLAWDOLLPacketID int32 type CLAWDOLLPacketID int32
const ( const (
CLAWDOLLPacketID_PACKET_ZERO CLAWDOLLPacketID = 0 //弃用消息号 CLAWDOLLPacketID_PACKET_CLAWDOLL_ZERO CLAWDOLLPacketID = 0 //弃用消息号
CLAWDOLLPacketID_PACKET_SC_ROOMINFO CLAWDOLLPacketID = 5601 //房间信息 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMINFO CLAWDOLLPacketID = 5601 //房间信息
CLAWDOLLPacketID_PACKET_CS_PLAYEROP CLAWDOLLPacketID = 5602 //玩家操作(客户->服务) CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP CLAWDOLLPacketID = 5602 //玩家操作(客户->服务)
CLAWDOLLPacketID_PACKET_SC_PLAYEROP CLAWDOLLPacketID = 5603 //玩家操作(服务->客户) CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYEROP CLAWDOLLPacketID = 5603 //玩家操作(服务->客户)
CLAWDOLLPacketID_PACKET_SC_ROOMSTATE CLAWDOLLPacketID = 5604 //房间状态 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMSTATE CLAWDOLLPacketID = 5604 //房间状态
CLAWDOLLPacketID_PACKET_SC_GAMEBILLED CLAWDOLLPacketID = 5605 //游戏结算 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_GAMEBILLED CLAWDOLLPacketID = 5605 //游戏结算
CLAWDOLLPacketID_PACKET_SC_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入
CLAWDOLLPacketID_PACKET_SC_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开
CLAWDOLLPacketID_PACKET_SC_PLAYERINFO CLAWDOLLPacketID = 5608 // 玩家状态信息变化 CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYERINFO CLAWDOLLPacketID = 5608 // 玩家状态信息变化
CLAWDOLLPacketID_PACKET_CS_GETTOKEN CLAWDOLLPacketID = 5609 // 获取token
CLAWDOLLPacketID_PACKET_SC_SENDTOKEN CLAWDOLLPacketID = 5610 // 获取token
CLAWDOLLPacketID_PACKET_CS_WAITPLAYERS CLAWDOLLPacketID = 5611 // 获取等待玩家信息 (客户->服务)
CLAWDOLLPacketID_PACKET_SC_WAITPLAYERS CLAWDOLLPacketID = 5612 // 获取等待玩家信息 (服务->客户)
CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO CLAWDOLLPacketID = 5613 // 正在控制娃娃机的玩家信息 (服务->客户)
) )
// Enum value maps for CLAWDOLLPacketID. // Enum value maps for CLAWDOLLPacketID.
var ( var (
CLAWDOLLPacketID_name = map[int32]string{ CLAWDOLLPacketID_name = map[int32]string{
0: "PACKET_ZERO", 0: "PACKET_CLAWDOLL_ZERO",
5601: "PACKET_SC_ROOMINFO", 5601: "PACKET_SC_CLAWDOLL_ROOMINFO",
5602: "PACKET_CS_PLAYEROP", 5602: "PACKET_CS_CLAWDOLL_PLAYEROP",
5603: "PACKET_SC_PLAYEROP", 5603: "PACKET_SC_CLAWDOLL_PLAYEROP",
5604: "PACKET_SC_ROOMSTATE", 5604: "PACKET_SC_CLAWDOLL_ROOMSTATE",
5605: "PACKET_SC_GAMEBILLED", 5605: "PACKET_SC_CLAWDOLL_GAMEBILLED",
5606: "PACKET_SC_PlayerEnter", 5606: "PACKET_SC_CLAWDOLL_PlayerEnter",
5607: "PACKET_SC_PlayerLeave", 5607: "PACKET_SC_CLAWDOLL_PlayerLeave",
5608: "PACKET_SC_PLAYERINFO", 5608: "PACKET_SC_CLAWDOLL_PLAYERINFO",
5609: "PACKET_CS_GETTOKEN",
5610: "PACKET_SC_SENDTOKEN",
5611: "PACKET_CS_WAITPLAYERS",
5612: "PACKET_SC_WAITPLAYERS",
5613: "PACKET_SC_PLAYINGINFO",
} }
CLAWDOLLPacketID_value = map[string]int32{ CLAWDOLLPacketID_value = map[string]int32{
"PACKET_ZERO": 0, "PACKET_CLAWDOLL_ZERO": 0,
"PACKET_SC_ROOMINFO": 5601, "PACKET_SC_CLAWDOLL_ROOMINFO": 5601,
"PACKET_CS_PLAYEROP": 5602, "PACKET_CS_CLAWDOLL_PLAYEROP": 5602,
"PACKET_SC_PLAYEROP": 5603, "PACKET_SC_CLAWDOLL_PLAYEROP": 5603,
"PACKET_SC_ROOMSTATE": 5604, "PACKET_SC_CLAWDOLL_ROOMSTATE": 5604,
"PACKET_SC_GAMEBILLED": 5605, "PACKET_SC_CLAWDOLL_GAMEBILLED": 5605,
"PACKET_SC_PlayerEnter": 5606, "PACKET_SC_CLAWDOLL_PlayerEnter": 5606,
"PACKET_SC_PlayerLeave": 5607, "PACKET_SC_CLAWDOLL_PlayerLeave": 5607,
"PACKET_SC_PLAYERINFO": 5608, "PACKET_SC_CLAWDOLL_PLAYERINFO": 5608,
"PACKET_CS_GETTOKEN": 5609,
"PACKET_SC_SENDTOKEN": 5610,
"PACKET_CS_WAITPLAYERS": 5611,
"PACKET_SC_WAITPLAYERS": 5612,
"PACKET_SC_PLAYINGINFO": 5613,
} }
) )
@ -170,7 +155,6 @@ type CLAWDOLLPlayerData struct {
VIP int32 `protobuf:"varint,7,opt,name=VIP,proto3" json:"VIP,omitempty"` VIP int32 `protobuf:"varint,7,opt,name=VIP,proto3" json:"VIP,omitempty"`
Flag int32 `protobuf:"varint,8,opt,name=Flag,proto3" json:"Flag,omitempty"` //二进制标记 第一位:是否掉线(0:在线 1:掉线) 第二位:是否准备(0:未准备 1:已准备) Flag int32 `protobuf:"varint,8,opt,name=Flag,proto3" json:"Flag,omitempty"` //二进制标记 第一位:是否掉线(0:在线 1:掉线) 第二位:是否准备(0:未准备 1:已准备)
WinCoin int64 `protobuf:"varint,9,opt,name=WinCoin,proto3" json:"WinCoin,omitempty"` // 本局赢分 WinCoin int64 `protobuf:"varint,9,opt,name=WinCoin,proto3" json:"WinCoin,omitempty"` // 本局赢分
ClawDollState int32 `protobuf:"varint,10,opt,name=clawDollState,proto3" json:"clawDollState,omitempty"` // 玩家状态
} }
func (x *CLAWDOLLPlayerData) Reset() { func (x *CLAWDOLLPlayerData) Reset() {
@ -268,13 +252,6 @@ func (x *CLAWDOLLPlayerData) GetWinCoin() int64 {
return 0 return 0
} }
func (x *CLAWDOLLPlayerData) GetClawDollState() int32 {
if x != nil {
return x.ClawDollState
}
return 0
}
//房间信息 //房间信息
type SCCLAWDOLLRoomInfo struct { type SCCLAWDOLLRoomInfo struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -417,8 +394,8 @@ type CSCLAWDOLLOp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` //操作码 1:上分 投币 2:下抓 3:玩家操控动作 OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"`
Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"` //操作参数 1:无 Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"`
} }
func (x *CSCLAWDOLLOp) Reset() { func (x *CSCLAWDOLLOp) Reset() {
@ -545,8 +522,8 @@ type SCCLAWDOLLRoundGameBilled struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //局ID RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //局ID
ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果 0: 没有抓住, 1抓住娃娃 ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果
Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额 Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额
Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额 Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额
} }
@ -673,10 +650,9 @@ type SCCLAWDOLLPlayerInfo struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` // 玩家ID SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //玩家ID
ClawDollState int32 `protobuf:"varint,2,opt,name=clawDollState,proto3" json:"clawDollState,omitempty"` // 玩家状态 GainCoin int64 `protobuf:"varint,2,opt,name=gainCoin,proto3" json:"gainCoin,omitempty"` //本局赢取
GainCoin int64 `protobuf:"varint,3,opt,name=gainCoin,proto3" json:"gainCoin,omitempty"` // 本局赢取 Coin int64 `protobuf:"varint,3,opt,name=Coin,proto3" json:"Coin,omitempty"` // 玩家
Coin int64 `protobuf:"varint,4,opt,name=Coin,proto3" json:"Coin,omitempty"` // 玩家
} }
func (x *SCCLAWDOLLPlayerInfo) Reset() { func (x *SCCLAWDOLLPlayerInfo) Reset() {
@ -718,13 +694,6 @@ func (x *SCCLAWDOLLPlayerInfo) GetSnId() int32 {
return 0 return 0
} }
func (x *SCCLAWDOLLPlayerInfo) GetClawDollState() int32 {
if x != nil {
return x.ClawDollState
}
return 0
}
func (x *SCCLAWDOLLPlayerInfo) GetGainCoin() int64 { func (x *SCCLAWDOLLPlayerInfo) GetGainCoin() int64 {
if x != nil { if x != nil {
return x.GainCoin return x.GainCoin
@ -746,7 +715,7 @@ type SCCLAWDOLLPlayerEnter struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Data *CLAWDOLLPlayerDigestInfo `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` Data *CLAWDOLLPlayerData `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"`
} }
func (x *SCCLAWDOLLPlayerEnter) Reset() { func (x *SCCLAWDOLLPlayerEnter) Reset() {
@ -781,7 +750,7 @@ func (*SCCLAWDOLLPlayerEnter) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{7} return file_clawdoll_proto_rawDescGZIP(), []int{7}
} }
func (x *SCCLAWDOLLPlayerEnter) GetData() *CLAWDOLLPlayerDigestInfo { func (x *SCCLAWDOLLPlayerEnter) GetData() *CLAWDOLLPlayerData {
if x != nil { if x != nil {
return x.Data return x.Data
} }
@ -795,7 +764,7 @@ type SCCLAWDOLLPlayerLeave struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //玩家id Pos int32 `protobuf:"varint,1,opt,name=Pos,proto3" json:"Pos,omitempty"` //玩家位置
} }
func (x *SCCLAWDOLLPlayerLeave) Reset() { func (x *SCCLAWDOLLPlayerLeave) Reset() {
@ -830,246 +799,9 @@ func (*SCCLAWDOLLPlayerLeave) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{8} return file_clawdoll_proto_rawDescGZIP(), []int{8}
} }
func (x *SCCLAWDOLLPlayerLeave) GetSnId() int32 { func (x *SCCLAWDOLLPlayerLeave) GetPos() int32 {
if x != nil { if x != nil {
return x.SnId return x.Pos
}
return 0
}
//玩家请求进入视频地址token
type CSCLAWDOLLGetToken struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *CSCLAWDOLLGetToken) Reset() {
*x = CSCLAWDOLLGetToken{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CSCLAWDOLLGetToken) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CSCLAWDOLLGetToken) ProtoMessage() {}
func (x *CSCLAWDOLLGetToken) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[9]
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 CSCLAWDOLLGetToken.ProtoReflect.Descriptor instead.
func (*CSCLAWDOLLGetToken) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{9}
}
type SCCLAWDOLLSendToken struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
LogicId int32 `protobuf:"varint,1,opt,name=LogicId,proto3" json:"LogicId,omitempty"`
Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"`
StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"`
}
func (x *SCCLAWDOLLSendToken) Reset() {
*x = SCCLAWDOLLSendToken{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SCCLAWDOLLSendToken) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SCCLAWDOLLSendToken) ProtoMessage() {}
func (x *SCCLAWDOLLSendToken) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[10]
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 SCCLAWDOLLSendToken.ProtoReflect.Descriptor instead.
func (*SCCLAWDOLLSendToken) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{10}
}
func (x *SCCLAWDOLLSendToken) GetLogicId() int32 {
if x != nil {
return x.LogicId
}
return 0
}
func (x *SCCLAWDOLLSendToken) GetAppid() int64 {
if x != nil {
return x.Appid
}
return 0
}
func (x *SCCLAWDOLLSendToken) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
func (x *SCCLAWDOLLSendToken) GetStreamId() string {
if x != nil {
return x.StreamId
}
return ""
}
type CLAWDOLLWaitPlayers struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
WaitPlayersInfo []*CLAWDOLLPlayerDigestInfo `protobuf:"bytes,1,rep,name=WaitPlayersInfo,proto3" json:"WaitPlayersInfo,omitempty"`
}
func (x *CLAWDOLLWaitPlayers) Reset() {
*x = CLAWDOLLWaitPlayers{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CLAWDOLLWaitPlayers) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CLAWDOLLWaitPlayers) ProtoMessage() {}
func (x *CLAWDOLLWaitPlayers) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[11]
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 CLAWDOLLWaitPlayers.ProtoReflect.Descriptor instead.
func (*CLAWDOLLWaitPlayers) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{11}
}
func (x *CLAWDOLLWaitPlayers) GetWaitPlayersInfo() []*CLAWDOLLPlayerDigestInfo {
if x != nil {
return x.WaitPlayersInfo
}
return nil
}
// 玩家摘要信息
type CLAWDOLLPlayerDigestInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //账号
Head int32 `protobuf:"varint,2,opt,name=Head,proto3" json:"Head,omitempty"` //头像
HeadUrl string `protobuf:"bytes,3,opt,name=HeadUrl,proto3" json:"HeadUrl,omitempty"` //头像
Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` //名字
Stat int32 `protobuf:"varint,5,opt,name=Stat,proto3" json:"Stat,omitempty"` //玩家状态 0排队状态 5:大厅观众状态
}
func (x *CLAWDOLLPlayerDigestInfo) Reset() {
*x = CLAWDOLLPlayerDigestInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CLAWDOLLPlayerDigestInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CLAWDOLLPlayerDigestInfo) ProtoMessage() {}
func (x *CLAWDOLLPlayerDigestInfo) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[12]
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 CLAWDOLLPlayerDigestInfo.ProtoReflect.Descriptor instead.
func (*CLAWDOLLPlayerDigestInfo) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{12}
}
func (x *CLAWDOLLPlayerDigestInfo) GetSnId() int32 {
if x != nil {
return x.SnId
}
return 0
}
func (x *CLAWDOLLPlayerDigestInfo) GetHead() int32 {
if x != nil {
return x.Head
}
return 0
}
func (x *CLAWDOLLPlayerDigestInfo) GetHeadUrl() string {
if x != nil {
return x.HeadUrl
}
return ""
}
func (x *CLAWDOLLPlayerDigestInfo) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CLAWDOLLPlayerDigestInfo) GetStat() int32 {
if x != nil {
return x.Stat
} }
return 0 return 0
} }
@ -1078,7 +810,7 @@ var File_clawdoll_proto protoreflect.FileDescriptor
var file_clawdoll_proto_rawDesc = []byte{ var file_clawdoll_proto_rawDesc = []byte{
0x0a, 0x0e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x0e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x08, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x22, 0xfe, 0x01, 0x0a, 0x12, 0x43, 0x12, 0x08, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x22, 0xd8, 0x01, 0x0a, 0x12, 0x43,
0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74,
0x61, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20,
@ -1092,131 +824,99 @@ var file_clawdoll_proto_rawDesc = []byte{
0x28, 0x05, 0x52, 0x03, 0x56, 0x49, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x18, 0x28, 0x05, 0x52, 0x03, 0x56, 0x49, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x18,
0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x57, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x57,
0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x57, 0x69, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x57, 0x69,
0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x77, 0x44, 0x6f, 0x6c, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x22, 0xf6, 0x02, 0x0a, 0x12, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57,
0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6c, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06,
0x61, 0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xf6, 0x02, 0x0a, 0x12, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x6f,
0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x02,
0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x28, 0x05, 0x52, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x61, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x6d, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61,
0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x12, 0x36, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x54, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41,
0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x12, 0x36, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52,
0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61,
0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x54,
0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x20, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f,
0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x08, 0x20, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75,
0x01, 0x28, 0x05, 0x52, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78,
0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78,
0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x18, 0x0f,
0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64,
0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x10, 0x20,
0x65, 0x65, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3e,
0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x0a, 0x0c, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x16,
0x6f, 0x72, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x63, 0x6f, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x0c, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x88,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x01, 0x0a, 0x0c, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53,
0x72, 0x61, 0x6d, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50,
0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x72,
0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c,
0x03, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x09, 0x4f, 0x70, 0x52, 0x6c, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x09,
0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x53, 0x43,
0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x61, 0x6d,
0x43, 0x6f, 0x64, 0x65, 0x52, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x65, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64,
0x85, 0x01, 0x0a, 0x19, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49,
0x75, 0x6e, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18,
0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c,
0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x43, 0x6c, 0x6f, 0x52, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e,
0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x65, 0x22, 0x43, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52,
0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6f, 0x6f, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74,
0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x43, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16,
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x02, 0x52, 0x06,
0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5a, 0x0a, 0x14, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57,
0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
0x20, 0x03, 0x28, 0x02, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x80, 0x01, 0x0a,
0x14, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c, 0x61,
0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x0d, 0x63, 0x6c, 0x61, 0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,
0x03, 0x52, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x43,
0x6f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f, 0x69, 0x6e, 0x22,
0x4f, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c,
0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61,
0x22, 0x2b, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x22, 0x14, 0x0a,
0x12, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x47, 0x65, 0x74, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x22, 0x77, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c,
0x4c, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x6f,
0x67, 0x69, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4c, 0x6f, 0x67,
0x69, 0x63, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x63, 0x0a, 0x13,
0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x72, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63,
0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66,
0x6f, 0x22, 0x84, 0x01, 0x0a, 0x18, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e,
0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x02,
0x52, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x12,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x0a, 0x04, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f,
0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x6e, 0x22, 0x49, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x04, 0x44,
0x28, 0x05, 0x52, 0x04, 0x53, 0x74, 0x61, 0x74, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x6c, 0x61, 0x77,
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61,
0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x29, 0x0a,
0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x50, 0x6f, 0x73, 0x18, 0x01, 0x20,
0x54, 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x01, 0x28, 0x05, 0x52, 0x03, 0x50, 0x6f, 0x73, 0x2a, 0xc7, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41,
0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a,
0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x10, 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x52, 0x4f,
0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a, 0x4f, 0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43,
0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f,
0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, 0x20, 0x0a, 0x1b, 0x50,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c,
0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x21, 0x0a,
0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8, 0x1c, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44,
0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47, 0x4f, 0x4c, 0x4c, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xe4, 0x2b,
0x45, 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x12, 0x22, 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45,
0x4e, 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x53, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43,
0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f,
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x22,
0x47, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57,
0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10,
0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0xe8, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f,
0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65,
0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72,
0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69,
0x52, 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16,
0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x50,
0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67,
0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f,
0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1232,7 +932,7 @@ func file_clawdoll_proto_rawDescGZIP() []byte {
} }
var file_clawdoll_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_clawdoll_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_clawdoll_proto_goTypes = []interface{}{ var file_clawdoll_proto_goTypes = []interface{}{
(CLAWDOLLPacketID)(0), // 0: clawdoll.CLAWDOLLPacketID (CLAWDOLLPacketID)(0), // 0: clawdoll.CLAWDOLLPacketID
(OpResultCode)(0), // 1: clawdoll.OpResultCode (OpResultCode)(0), // 1: clawdoll.OpResultCode
@ -1245,21 +945,16 @@ var file_clawdoll_proto_goTypes = []interface{}{
(*SCCLAWDOLLPlayerInfo)(nil), // 8: clawdoll.SCCLAWDOLLPlayerInfo (*SCCLAWDOLLPlayerInfo)(nil), // 8: clawdoll.SCCLAWDOLLPlayerInfo
(*SCCLAWDOLLPlayerEnter)(nil), // 9: clawdoll.SCCLAWDOLLPlayerEnter (*SCCLAWDOLLPlayerEnter)(nil), // 9: clawdoll.SCCLAWDOLLPlayerEnter
(*SCCLAWDOLLPlayerLeave)(nil), // 10: clawdoll.SCCLAWDOLLPlayerLeave (*SCCLAWDOLLPlayerLeave)(nil), // 10: clawdoll.SCCLAWDOLLPlayerLeave
(*CSCLAWDOLLGetToken)(nil), // 11: clawdoll.CSCLAWDOLLGetToken
(*SCCLAWDOLLSendToken)(nil), // 12: clawdoll.SCCLAWDOLLSendToken
(*CLAWDOLLWaitPlayers)(nil), // 13: clawdoll.CLAWDOLLWaitPlayers
(*CLAWDOLLPlayerDigestInfo)(nil), // 14: clawdoll.CLAWDOLLPlayerDigestInfo
} }
var file_clawdoll_proto_depIdxs = []int32{ var file_clawdoll_proto_depIdxs = []int32{
2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData 2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData
1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode 1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode
14, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo 2, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerData
14, // 3: clawdoll.CLAWDOLLWaitPlayers.WaitPlayersInfo:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo 3, // [3:3] is the sub-list for method output_type
4, // [4:4] is the sub-list for method output_type 3, // [3:3] is the sub-list for method input_type
4, // [4:4] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee
4, // [4:4] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name
0, // [0:4] is the sub-list for field type_name
} }
func init() { file_clawdoll_proto_init() } func init() { file_clawdoll_proto_init() }
@ -1376,54 +1071,6 @@ func file_clawdoll_proto_init() {
return nil return nil
} }
} }
file_clawdoll_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CSCLAWDOLLGetToken); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_clawdoll_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SCCLAWDOLLSendToken); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_clawdoll_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CLAWDOLLWaitPlayers); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_clawdoll_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CLAWDOLLPlayerDigestInfo); 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{
@ -1431,7 +1078,7 @@ func file_clawdoll_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_clawdoll_proto_rawDesc, RawDescriptor: file_clawdoll_proto_rawDesc,
NumEnums: 2, NumEnums: 2,
NumMessages: 13, NumMessages: 9,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -4,20 +4,15 @@ option go_package = "mongo.games.com/game/protocol/clawdoll";
// //
enum CLAWDOLLPacketID { enum CLAWDOLLPacketID {
PACKET_ZERO = 0; // PACKET_CLAWDOLL_ZERO = 0; //
PACKET_SC_ROOMINFO = 5601; // PACKET_SC_CLAWDOLL_ROOMINFO = 5601; //
PACKET_CS_PLAYEROP = 5602; //-> PACKET_CS_CLAWDOLL_PLAYEROP = 5602; //->
PACKET_SC_PLAYEROP = 5603; //-> PACKET_SC_CLAWDOLL_PLAYEROP = 5603; //->
PACKET_SC_ROOMSTATE = 5604; // PACKET_SC_CLAWDOLL_ROOMSTATE = 5604; //
PACKET_SC_GAMEBILLED = 5605; // PACKET_SC_CLAWDOLL_GAMEBILLED = 5605; //
PACKET_SC_PlayerEnter = 5606; // PACKET_SC_CLAWDOLL_PlayerEnter = 5606; //
PACKET_SC_PlayerLeave = 5607; // PACKET_SC_CLAWDOLL_PlayerLeave = 5607; //
PACKET_SC_PLAYERINFO = 5608; // PACKET_SC_CLAWDOLL_PLAYERINFO = 5608; //
PACKET_CS_GETTOKEN = 5609; // token
PACKET_SC_SENDTOKEN = 5610; // token
PACKET_CS_WAITPLAYERS = 5611; // ->
PACKET_SC_WAITPLAYERS = 5612; // ->
PACKET_SC_PLAYINGINFO = 5613; // ->
} }
// //
@ -39,7 +34,7 @@ message CLAWDOLLPlayerData {
int32 Flag = 8; // :线(0:线 1:线) :(0: 1:) int32 Flag = 8; // :线(0:线 1:线) :(0: 1:)
int64 WinCoin = 9; // int64 WinCoin = 9; //
int32 clawDollState = 10; //
} }
// //
@ -61,10 +56,8 @@ message SCCLAWDOLLRoomInfo {
// //
message CSCLAWDOLLOp { message CSCLAWDOLLOp {
int32 OpCode = 1; // 1: 2: 3: int32 OpCode = 1;
repeated int64 Params = 2; // 1: repeated int64 Params = 2;
// 2:
// 3Params[0] 1- 2- 3- 4-
} }
// //
@ -77,8 +70,8 @@ message SCCLAWDOLLOp {
// //
message SCCLAWDOLLRoundGameBilled { message SCCLAWDOLLRoundGameBilled {
int32 RoundId = 1; //ID int32 RoundId = 1; //ID
int32 ClowResult = 2; // 0: 1 int32 ClowResult = 2; //
int64 Award = 3; // int64 Award = 3; //
int64 Balance = 4; // int64 Balance = 4; //
} }
@ -91,44 +84,20 @@ message SCCLAWDOLLRoomState {
// //
message SCCLAWDOLLPlayerInfo { message SCCLAWDOLLPlayerInfo {
int32 SnId = 1; // ID int32 SnId = 1; //ID
int32 clawDollState = 2; // int64 gainCoin = 2; //
int64 gainCoin = 3; // int64 Coin = 3; //
int64 Coin = 4; //
} }
// //
//PACKET_SCCLAWDOLLPlayerEnter //PACKET_SCCLAWDOLLPlayerEnter
message SCCLAWDOLLPlayerEnter { message SCCLAWDOLLPlayerEnter {
CLAWDOLLPlayerDigestInfo Data = 1; CLAWDOLLPlayerData Data = 1;
} }
// //
//PACKET_SCCLAWDOLLPlayerLeave //PACKET_SCCLAWDOLLPlayerLeave
message SCCLAWDOLLPlayerLeave { message SCCLAWDOLLPlayerLeave {
int32 SnId = 1; //id int32 Pos = 1; //
}
//token
message CSCLAWDOLLGetToken {
}
message SCCLAWDOLLSendToken {
int32 LogicId = 1;
int64 Appid = 2;
string Token = 3;
string StreamId = 4;
}
message CLAWDOLLWaitPlayers {
repeated CLAWDOLLPlayerDigestInfo WaitPlayersInfo = 1;
}
//
message CLAWDOLLPlayerDigestInfo {
int32 SnId = 1; //
int32 Head = 2; //
string HeadUrl = 3; //
string Name = 4; //
int32 Stat = 5; // 0 5:
} }

View File

@ -0,0 +1,537 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1-devel
// protoc v3.19.4
// source: dollmachine.proto
package dollmachine
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//S-GAME M-娃娃机主机
//娃娃机协议
type DollMachinePacketID int32
const (
DollMachinePacketID_PACKET_SMDollMachineZero DollMachinePacketID = 0
DollMachinePacketID_PACKET_SMDollMachineMove DollMachinePacketID = 3001
DollMachinePacketID_PACKET_SMDollMachineGrab DollMachinePacketID = 3002
DollMachinePacketID_PACKET_MSDollMachineGrab DollMachinePacketID = 3003
DollMachinePacketID_PACKET_MSDollMachineList DollMachinePacketID = 3004
)
// Enum value maps for DollMachinePacketID.
var (
DollMachinePacketID_name = map[int32]string{
0: "PACKET_SMDollMachineZero",
3001: "PACKET_SMDollMachineMove",
3002: "PACKET_SMDollMachineGrab",
3003: "PACKET_MSDollMachineGrab",
3004: "PACKET_MSDollMachineList",
}
DollMachinePacketID_value = map[string]int32{
"PACKET_SMDollMachineZero": 0,
"PACKET_SMDollMachineMove": 3001,
"PACKET_SMDollMachineGrab": 3002,
"PACKET_MSDollMachineGrab": 3003,
"PACKET_MSDollMachineList": 3004,
}
)
func (x DollMachinePacketID) Enum() *DollMachinePacketID {
p := new(DollMachinePacketID)
*p = x
return p
}
func (x DollMachinePacketID) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (DollMachinePacketID) Descriptor() protoreflect.EnumDescriptor {
return file_dollmachine_proto_enumTypes[0].Descriptor()
}
func (DollMachinePacketID) Type() protoreflect.EnumType {
return &file_dollmachine_proto_enumTypes[0]
}
func (x DollMachinePacketID) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use DollMachinePacketID.Descriptor instead.
func (DollMachinePacketID) EnumDescriptor() ([]byte, []int) {
return file_dollmachine_proto_rawDescGZIP(), []int{0}
}
//移动
type SMDollMachineMove struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"`
Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识
Direction int32 `protobuf:"varint,3,opt,name=Direction,proto3" json:"Direction,omitempty"` // 1-前 2-后 3-左 4-右
}
func (x *SMDollMachineMove) Reset() {
*x = SMDollMachineMove{}
if protoimpl.UnsafeEnabled {
mi := &file_dollmachine_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SMDollMachineMove) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SMDollMachineMove) ProtoMessage() {}
func (x *SMDollMachineMove) ProtoReflect() protoreflect.Message {
mi := &file_dollmachine_proto_msgTypes[0]
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 SMDollMachineMove.ProtoReflect.Descriptor instead.
func (*SMDollMachineMove) Descriptor() ([]byte, []int) {
return file_dollmachine_proto_rawDescGZIP(), []int{0}
}
func (x *SMDollMachineMove) GetSnid() int32 {
if x != nil {
return x.Snid
}
return 0
}
func (x *SMDollMachineMove) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *SMDollMachineMove) GetDirection() int32 {
if x != nil {
return x.Direction
}
return 0
}
//下抓
type SMDollMachineGrab struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TypeId int32 `protobuf:"varint,1,opt,name=TypeId,proto3" json:"TypeId,omitempty"` //1-弱力抓 2 -强力抓 3-必出抓
Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识
Snid int32 `protobuf:"varint,3,opt,name=Snid,proto3" json:"Snid,omitempty"`
}
func (x *SMDollMachineGrab) Reset() {
*x = SMDollMachineGrab{}
if protoimpl.UnsafeEnabled {
mi := &file_dollmachine_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SMDollMachineGrab) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SMDollMachineGrab) ProtoMessage() {}
func (x *SMDollMachineGrab) ProtoReflect() protoreflect.Message {
mi := &file_dollmachine_proto_msgTypes[1]
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 SMDollMachineGrab.ProtoReflect.Descriptor instead.
func (*SMDollMachineGrab) Descriptor() ([]byte, []int) {
return file_dollmachine_proto_rawDescGZIP(), []int{1}
}
func (x *SMDollMachineGrab) GetTypeId() int32 {
if x != nil {
return x.TypeId
}
return 0
}
func (x *SMDollMachineGrab) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *SMDollMachineGrab) GetSnid() int32 {
if x != nil {
return x.Snid
}
return 0
}
//返回下抓结果
type MSDollMachineGrab struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"`
Id int32 `protobuf:"varint,2,opt,name=Id,proto3" json:"Id,omitempty"` //娃娃机标识
Result int32 `protobuf:"varint,3,opt,name=Result,proto3" json:"Result,omitempty"` //1-中奖 其他未中奖
}
func (x *MSDollMachineGrab) Reset() {
*x = MSDollMachineGrab{}
if protoimpl.UnsafeEnabled {
mi := &file_dollmachine_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MSDollMachineGrab) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MSDollMachineGrab) ProtoMessage() {}
func (x *MSDollMachineGrab) ProtoReflect() protoreflect.Message {
mi := &file_dollmachine_proto_msgTypes[2]
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 MSDollMachineGrab.ProtoReflect.Descriptor instead.
func (*MSDollMachineGrab) Descriptor() ([]byte, []int) {
return file_dollmachine_proto_rawDescGZIP(), []int{2}
}
func (x *MSDollMachineGrab) GetSnid() int32 {
if x != nil {
return x.Snid
}
return 0
}
func (x *MSDollMachineGrab) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *MSDollMachineGrab) GetResult() int32 {
if x != nil {
return x.Result
}
return 0
}
//返回所有娃娃机连接
type MSDollMachineList struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*DollMachine `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *MSDollMachineList) Reset() {
*x = MSDollMachineList{}
if protoimpl.UnsafeEnabled {
mi := &file_dollmachine_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MSDollMachineList) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MSDollMachineList) ProtoMessage() {}
func (x *MSDollMachineList) ProtoReflect() protoreflect.Message {
mi := &file_dollmachine_proto_msgTypes[3]
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 MSDollMachineList.ProtoReflect.Descriptor instead.
func (*MSDollMachineList) Descriptor() ([]byte, []int) {
return file_dollmachine_proto_rawDescGZIP(), []int{3}
}
func (x *MSDollMachineList) GetData() []*DollMachine {
if x != nil {
return x.Data
}
return nil
}
type DollMachine struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` //1-空闲 2-无法使用
}
func (x *DollMachine) Reset() {
*x = DollMachine{}
if protoimpl.UnsafeEnabled {
mi := &file_dollmachine_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DollMachine) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DollMachine) ProtoMessage() {}
func (x *DollMachine) ProtoReflect() protoreflect.Message {
mi := &file_dollmachine_proto_msgTypes[4]
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 DollMachine.ProtoReflect.Descriptor instead.
func (*DollMachine) Descriptor() ([]byte, []int) {
return file_dollmachine_proto_rawDescGZIP(), []int{4}
}
func (x *DollMachine) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *DollMachine) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
var File_dollmachine_proto protoreflect.FileDescriptor
var file_dollmachine_proto_rawDesc = []byte{
0x0a, 0x11, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
0x22, 0x55, 0x0a, 0x11, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e,
0x65, 0x4d, 0x6f, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x69, 0x72,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x44, 0x69,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4f, 0x0a, 0x11, 0x53, 0x4d, 0x44, 0x6f, 0x6c,
0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x16, 0x0a, 0x06,
0x54, 0x79, 0x70, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x54, 0x79,
0x70, 0x65, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x11, 0x4d, 0x53, 0x44, 0x6f,
0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x12, 0x12, 0x0a,
0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69,
0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49,
0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x05, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x41, 0x0a, 0x11, 0x4d, 0x53, 0x44,
0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2c,
0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64,
0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2e, 0x44, 0x6f, 0x6c, 0x6c, 0x4d,
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x35, 0x0a, 0x0b,
0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x2a, 0xaf, 0x01, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68,
0x69, 0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50,
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68,
0x69, 0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e,
0x65, 0x4d, 0x6f, 0x76, 0x65, 0x10, 0xb9, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b,
0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
0x47, 0x72, 0x61, 0x62, 0x10, 0xba, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47,
0x72, 0x61, 0x62, 0x10, 0xbb, 0x17, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69,
0x73, 0x74, 0x10, 0xbc, 0x17, 0x42, 0x2b, 0x5a, 0x29, 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, 0x64, 0x6f, 0x6c, 0x6c, 0x6d, 0x61, 0x63, 0x68, 0x69,
0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_dollmachine_proto_rawDescOnce sync.Once
file_dollmachine_proto_rawDescData = file_dollmachine_proto_rawDesc
)
func file_dollmachine_proto_rawDescGZIP() []byte {
file_dollmachine_proto_rawDescOnce.Do(func() {
file_dollmachine_proto_rawDescData = protoimpl.X.CompressGZIP(file_dollmachine_proto_rawDescData)
})
return file_dollmachine_proto_rawDescData
}
var file_dollmachine_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_dollmachine_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_dollmachine_proto_goTypes = []interface{}{
(DollMachinePacketID)(0), // 0: dollmachine.DollMachinePacketID
(*SMDollMachineMove)(nil), // 1: dollmachine.SMDollMachineMove
(*SMDollMachineGrab)(nil), // 2: dollmachine.SMDollMachineGrab
(*MSDollMachineGrab)(nil), // 3: dollmachine.MSDollMachineGrab
(*MSDollMachineList)(nil), // 4: dollmachine.MSDollMachineList
(*DollMachine)(nil), // 5: dollmachine.DollMachine
}
var file_dollmachine_proto_depIdxs = []int32{
5, // 0: dollmachine.MSDollMachineList.data:type_name -> dollmachine.DollMachine
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_dollmachine_proto_init() }
func file_dollmachine_proto_init() {
if File_dollmachine_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_dollmachine_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SMDollMachineMove); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dollmachine_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SMDollMachineGrab); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dollmachine_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MSDollMachineGrab); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dollmachine_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MSDollMachineList); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_dollmachine_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DollMachine); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_dollmachine_proto_rawDesc,
NumEnums: 1,
NumMessages: 5,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_dollmachine_proto_goTypes,
DependencyIndexes: file_dollmachine_proto_depIdxs,
EnumInfos: file_dollmachine_proto_enumTypes,
MessageInfos: file_dollmachine_proto_msgTypes,
}.Build()
File_dollmachine_proto = out.File
file_dollmachine_proto_rawDesc = nil
file_dollmachine_proto_goTypes = nil
file_dollmachine_proto_depIdxs = nil
}

Some files were not shown because too many files have changed in this diff Show More