Compare commits

...

199 Commits

Author SHA1 Message Date
sk c5610f58dc 解决冲突 2024-09-09 14:09:11 +08:00
sk 4cfd64dbed Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-09 14:05:16 +08:00
sk 18fe6403b7 邀请活动增加绑定手机号积分 2024-09-09 14:04:53 +08:00
by 6c65a442db 娃娃机修改 2024-09-09 11:24:14 +08:00
sk d27a04020e 好友进房问题 2024-09-09 10:40:26 +08:00
sk eb791c364e Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-09 10:25:54 +08:00
sk ea6ef0be41 房卡扣除问题 2024-09-09 10:24:37 +08:00
by 18f67b7d22 屏蔽自动向前走一步 2024-09-09 09:45:15 +08:00
by 1a14a35da9 下抓不走消息队列 2024-09-09 09:29:51 +08:00
sk 07b985693e 代码优化 2024-09-07 18:06:05 +08:00
kxdd 13042959c9 Merge branch 'ma' into develop 2024-09-07 17:37:50 +08:00
kxdd 7991a8044d 娃娃机状态调整 2024-09-07 17:37:22 +08:00
kxdd b46db9b36b Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-07 16:59:19 +08:00
kxdd e690d8da76 Merge branch 'develop' into ma
# Conflicts:
#	gamesrv/clawdoll/action_clawdoll.go
2024-09-07 16:58:17 +08:00
sk 152c60e35f Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-07 16:58:08 +08:00
sk 4eee248f20 竞技馆房间解散问题 2024-09-07 16:58:01 +08:00
by d61a153948 投币后向前移动一下 2024-09-07 16:22:12 +08:00
kxdd f26cb4d2ff 娃娃机playing判定修改 2024-09-07 16:08:46 +08:00
by 7099975e9e 客户端请求token 2024-09-07 14:48:44 +08:00
by 0b91f46fd8 Merge branch 'develop' of https://git.pogorockgames.com/mango-games/server/game into develop 2024-09-07 14:29:50 +08:00
by 1d98a31bf4 token修改 2024-09-07 14:29:34 +08:00
sk d769605d09 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-07 14:16:31 +08:00
sk 8174e6c406 商店购买备注 2024-09-07 14:15:56 +08:00
by 83d5ec05fb 生成token修改 2024-09-07 14:04:44 +08:00
kxdd de339225d2 娃娃机获取token修改 2024-09-07 11:58:40 +08:00
by d34473c688 token 2024-09-07 11:40:04 +08:00
by 59eb4ecc22 token 2024-09-07 11:17:33 +08:00
sk 053db5b83a Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-07 10:46:47 +08:00
sk 1b67a44d63 竞技馆牌局记录 2024-09-07 10:46:34 +08:00
by 759c989719 获取token 2024-09-07 10:43:36 +08:00
by 9b5dff5f96 上分不走消息隊列 2024-09-07 10:22:55 +08:00
sk cb4b51b4aa 竞技馆游戏记录 2024-09-07 10:03:50 +08:00
sk 1cc5d4f226 添加水池配置 2024-09-07 09:19:51 +08:00
sk ad3e8d4b9f Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-06 18:33:42 +08:00
sk 4da55c9588 游戏中同步实时金币 2024-09-06 18:33:28 +08:00
lihailiang f467753242 Merge branch 'develop' into ma
# Conflicts:
#	.gitmodules
2024-09-06 18:22:21 +08:00
kxdd 8c8ee30ef8 Merge branch 'develop' into ma
# Conflicts:
#	public
2024-09-06 18:20:54 +08:00
by 7889c982ea 娃娃機修改 2024-09-06 18:06:40 +08:00
by 895c673e65 Merge branch 'develop' of https://git.pogorockgames.com/mango-games/server/game into develop 2024-09-06 17:30:39 +08:00
by 892a61aa47 log 2024-09-06 17:30:28 +08:00
sk 67a85f6535 竞技房间没人解散 2024-09-06 17:28:10 +08:00
sk 5bdf3d78df 商店购买 2024-09-06 16:23:57 +08:00
sk b4bab0de1e 删除public子模块 2024-09-06 15:58:06 +08:00
sk 2f74e5bfab Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-06 15:39:57 +08:00
sk c20f0fa69c 商城购买参数 2024-09-06 15:39:30 +08:00
kxdd 770b9b084a public 2024-09-06 15:39:17 +08:00
kxdd 8a19cd642f 娃娃机通知状态修改 2024-09-06 15:36:59 +08:00
by 83f643a789 Merge branch 'ma' into develop 2024-09-06 14:56:51 +08:00
by 98a834b357 public 2024-09-06 14:56:40 +08:00
by 09dc4f4588 public 2024-09-06 14:55:44 +08:00
kxdd 9a34e32841 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-06 14:50:50 +08:00
kxdd 4bd2cee327 public 2024-09-06 14:49:51 +08:00
sk 63387ba9b4 商城购买房卡 2024-09-06 14:46:30 +08:00
sk 4b7c552524 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-06 14:01:34 +08:00
sk fc2db94c86 竞技馆列表刷新 2024-09-06 14:00:34 +08:00
kxdd 19dde360d6 Merge branch 'ma' into develop 2024-09-06 11:58:07 +08:00
kxdd 3ac3f2dea1 娃娃机获取视频token修改 2024-09-06 11:57:45 +08:00
sk 0fc4b33aa4 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-06 11:25:31 +08:00
sk 82486dd427 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-06 11:25:15 +08:00
by 3cd2dd06e1 Merge branch 'develop' of https://git.pogorockgames.com/mango-games/server/game into develop 2024-09-06 11:25:14 +08:00
by 82aee49eda 生成token修改 2024-09-06 11:24:35 +08:00
sk 32e8b2f22e 房卡默认加成 2024-09-06 11:22:29 +08:00
kxdd 979645567e 合并代码 2024-09-06 10:08:29 +08:00
kxdd b74f284654 Merge branch 'ma' into develop
# Conflicts:
#	gamesrv/clawdoll/scenepolicy_clawdoll.go
2024-09-06 10:08:05 +08:00
sk 40966b52cb 竞技馆房间配置 2024-09-06 09:50:19 +08:00
kxdd 9963ef130a public 2024-09-06 09:43:14 +08:00
kxdd 8f59f4d03a 娃娃机抓取后结果通知修改 2024-09-06 09:41:41 +08:00
sk fccb385f79 竞技馆房间配置包类型校验 2024-09-05 18:47:21 +08:00
sk c4bea18f9f 道具交易市场 2024-09-05 18:31:04 +08:00
sk 33380d1bf8 查询房间信息 2024-09-05 16:02:50 +08:00
sk 58fe35c90f Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-05 14:51:52 +08:00
sk 3b15a84df3 查询房间信息 2024-09-05 14:46:43 +08:00
kxdd 2869fb7e3f Merge branch 'ma' into develop 2024-09-05 14:46:34 +08:00
sk a126fb81ae 修改排位赛奖励 2024-09-05 14:31:12 +08:00
kxdd e1e805f9d8 娃娃机添加流禁止流恢复功能 2024-09-05 14:23:36 +08:00
sk e33fe64bca 房间列表查询 2024-09-05 14:20:36 +08:00
sk bcac7f06d3 update public 2024-09-05 11:26:52 +08:00
sk 1948560a03 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-05 11:25:13 +08:00
sk f056014c50 玩家游戏数据保存 2024-09-05 11:24:46 +08:00
by 68a8e010cf scene只能绑定对应的娃娃机编号 2024-09-05 10:28:43 +08:00
sk 88bbca47f1 推广渠道 2024-09-04 17:24:29 +08:00
sk 4a32df4ecf 竞技馆 2024-09-04 15:31:35 +08:00
sk 54a13fe8ae Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-04 15:08:22 +08:00
sk 9c1fed84e9 竞技馆读取后台配置 2024-09-04 14:53:29 +08:00
sk ac86a5e294 删除竞技馆测试配置 2024-09-04 14:21:21 +08:00
by fb8bfbde87 刪除log 2024-09-04 14:03:37 +08:00
sk f4143ad6d3 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-04 13:58:30 +08:00
by 12623d7b94 增加log 2024-09-04 13:46:10 +08:00
sk 5b6a5ad5d3 竞技馆房间信息 2024-09-04 11:54:59 +08:00
kxdd 4ab95e058e Merge branch 'ma' into develop
# Conflicts:
#	data/DB_PropExchange.dat
#	data/DB_Task.dat
#	public
#	xlsx/DB_GameFree.xlsx
2024-09-04 11:21:13 +08:00
kxdd 8514f22fc6 娃娃机修改 2024-09-04 11:18:04 +08:00
kxdd d8f01f39ea 娃娃机配置 2024-09-04 10:52:45 +08:00
kxdd 9cdc0f24c7 娃娃机配置更新 2024-09-04 10:49:37 +08:00
kxdd 27eb944329 娃娃机配置更新 2024-09-04 10:49:16 +08:00
kxdd c4a0a31df8 添加娃娃机ID 2024-09-04 10:01:50 +08:00
kxdd e23f33c569 public 2024-09-04 10:01:15 +08:00
sk 7c00ec5067 道具修改失败返回错误码 2024-09-03 18:42:49 +08:00
sk 92bf5fe16e review 2024-09-03 18:09:09 +08:00
kxdd c4d58262de 娃娃机添加流ID 2024-09-03 17:50:19 +08:00
by c226024401 Merge branch 'develop' of https://git.pogorockgames.com/mango-games/server/game into develop 2024-09-03 17:15:26 +08:00
by d16c1a1887 修改log 2024-09-03 17:15:05 +08:00
kxdd 85a115809c 添加娃娃机配置 2024-09-03 16:48:21 +08:00
sk 6c4e49ef44 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-03 16:40:53 +08:00
by 89aefd480a Merge branch 'ma' into develop 2024-09-03 16:36:25 +08:00
sk c3f0f0d9fe Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-03 16:33:59 +08:00
by 36edf8ba7b Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-09-03 16:22:59 +08:00
by fe375fb15f 删除无用代码 2024-09-03 16:22:47 +08:00
kxdd 9ef1f9d896 娃娃机报错修改 2024-09-03 16:09:43 +08:00
by 429c5e0a31 Merge branch 'develop' of https://git.pogorockgames.com/mango-games/server/game into develop
# Conflicts:
#	public
2024-09-03 15:54:22 +08:00
by df04ede671 public 2024-09-03 15:53:09 +08:00
kxdd da83b674d2 public 提交 2024-09-03 15:48:23 +08:00
by 59535c2015 更新配置 2024-09-03 15:46:54 +08:00
by 981c3860d1 Merge remote-tracking branch 'origin/develop' into ma
# Conflicts:
#	data/DB_GameFree.dat
#	data/DB_PropExchange.dat
#	data/DB_Task.dat
#	etcd/keyconf.go
#	model/config.go
#	protocol/webapi/common.pb.go
#	protocol/webapi/common.proto
#	protocol/webapi/webapi.proto
#	public
#	xlsx/DB_GameFree.xlsx
2024-09-03 15:46:11 +08:00
by e7a6049341 娃娃机后台配置 增加StreamId字段 2024-09-03 15:12:24 +08:00
kxdd ddcaa62f13 娃娃机修改 2024-09-03 15:10:41 +08:00
sk 034abb64e2 牌局回放 2024-09-03 11:20:49 +08:00
sk 5c6dce2f4d 房卡场中途不能离开房间 2024-09-03 10:57:05 +08:00
sk d292cbc118 Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-03 10:04:13 +08:00
sk 05a54af2db 活动礼包 2024-09-03 10:02:26 +08:00
sk d2c5c4f159 活动礼包 2024-09-02 17:31:45 +08:00
sk 151a739dab 创建房间参数初始化 2024-09-02 16:26:05 +08:00
kxdd 6a9c6a988b 娃娃机获取token修改 2024-09-02 16:23:45 +08:00
sk 00dcc3199f 竞技馆房主付费 2024-09-02 16:13:23 +08:00
sk 26db8f4b21 竞技馆 2024-09-02 14:55:18 +08:00
sk 04a0772415 竞技馆 2024-09-02 14:35:10 +08:00
sk 9f490a7aca 竞技馆 2024-09-02 11:44:12 +08:00
sk 03cd5dda2b Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-02 10:08:35 +08:00
sk 1d9bfd5802 竞技馆 2024-09-02 10:08:23 +08:00
tomas 77748f066f Merge branch 'develop' into dev_slots 2024-09-02 09:32:56 +08:00
sk b7d4efb7a6 代码优化 2024-08-30 18:52:11 +08:00
kxdd fe26aa3d37 娃娃机获取视频流修改 2024-08-30 18:15:44 +08:00
sk 89bdfac420 新增拉霸游戏 2024-08-30 17:53:42 +08:00
sk 0ba53df8ec 新增拉霸游戏 2024-08-30 17:29:11 +08:00
sk 74efab000e 新增拉霸游戏 2024-08-30 17:19:03 +08:00
sk 9ab3da69a4 新增拉霸游戏 2024-08-30 17:18:06 +08:00
by ece16ac947 获取token 2024-08-30 16:45:07 +08:00
tomas 18a884da43 11 2024-08-30 15:59:55 +08:00
by 3a6e420e98 token测试数据 2024-08-30 15:34:28 +08:00
sk fa57f5e8e6 保存玩家游戏数据 2024-08-30 14:49:55 +08:00
kxdd 958a3b1ba4 娃娃机等待玩家添加 2024-08-30 11:56:15 +08:00
sk a77cfa41dd 离开房间返回错误码 2024-08-29 16:54:30 +08:00
sk 33eab3f5bc 竞技馆房间列表变更通知 2024-08-29 16:35:57 +08:00
sk 94ca1562e5 解决冲突 2024-08-29 14:51:32 +08:00
sk 3bff2c17f3 review 2024-08-29 14:28:54 +08:00
by ccc0e97635 娃娃机etcd配置 2024-08-29 11:55:57 +08:00
by 6bd95be413 娃娃机etcd配置 2024-08-29 11:33:52 +08:00
by 94d7e4f45f Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma
# Conflicts:
#	protocol/clawdoll/clawdoll.pb.go
2024-08-29 11:33:26 +08:00
by 46c68b9785 娃娃机etcd配置 2024-08-29 11:32:55 +08:00
sk 49c2d8baac 房卡场房间id范围 2024-08-29 09:00:58 +08:00
sk 9ea57766a4 房卡场对局记录 2024-08-28 18:18:36 +08:00
kxdd ebe7b1c4c8 娃娃机协议修改 2024-08-28 17:00:31 +08:00
sk bfdf500eec 创建房间参数优化 2024-08-28 16:08:55 +08:00
sk cae5536ed3 房卡消耗记录 2024-08-28 09:12:01 +08:00
sk 17c0817dab 游戏服道具变化同步到大厅 2024-08-27 17:05:00 +08:00
by 14b78495f6 Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-27 16:03:34 +08:00
by 0792e35863 开启甩抓 2024-08-27 16:03:07 +08:00
kxdd cbd00bf0f8 娃娃机状态修改 2024-08-27 15:13:32 +08:00
sk 1db69f8df3 update excel 2024-08-27 14:51:30 +08:00
sk 904982158a 房卡场游戏 2024-08-26 16:54:07 +08:00
by dcc68130d2 log修改 2024-08-26 10:53:25 +08:00
by 377482ce6d 娃娃机log打印修改 2024-08-26 10:50:03 +08:00
sk 4e6b92cd33 review 2024-08-24 18:26:31 +08:00
sk 7222426469 竞技馆后台配置 2024-08-24 18:25:03 +08:00
sk 1db62f9d90 gameconfig 2024-08-24 18:23:47 +08:00
sk f4434bd945 去掉ParamsEx,agentor 2024-08-24 18:22:06 +08:00
by ba9dde2005 Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-24 16:11:03 +08:00
by 4580f69514 请求token注册协议修改 2024-08-24 16:10:28 +08:00
sk a040d30354 道具出售金额用int64 2024-08-24 15:49:07 +08:00
kxdd aed283b37e Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-24 15:17:17 +08:00
kxdd 87486f1a48 娃娃机状态流程修改 2024-08-24 15:13:22 +08:00
by c6ee48573b 电压设置 2024-08-24 12:03:54 +08:00
sk 4c0c6f7c2b 竞技馆后台协议 2024-08-23 18:11:54 +08:00
by b98b2246eb 娃娃机获取token 2024-08-23 16:35:58 +08:00
by 88db5712d8 娃娃机获取token 2024-08-22 15:43:28 +08:00
by b5e23404c0 设置音乐关闭 2024-08-16 18:24:05 +08:00
by 33e82b0095 娃娃机 2024-08-16 18:05:45 +08:00
by 3b2c207627 娃娃机基础配置 2024-08-16 10:58:45 +08:00
by 7a2c11d92e 娃娃机数据清理 2024-08-16 09:10:15 +08:00
by 37f6b4163e 娃娃机数据清理 2024-08-15 18:35:22 +08:00
by 6b8e24cba3 娃娃机投币消息加入消息队列 2024-08-15 16:07:50 +08:00
by 5e60434b60 娃娃机代码整理 2024-08-15 14:38:21 +08:00
by afe8d3f0b1 娃娃机使用消息队列处理消息 2024-08-15 14:37:08 +08:00
by 154a037e08 娃娃机监听消息 2024-08-15 11:31:45 +08:00
kxdd f23cfda629 Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-14 16:24:31 +08:00
by 4dc78ff468 娃娃机返回操作结果 2024-08-14 16:23:59 +08:00
kxdd a4b4a0b2a0 封装移动投币操作 2024-08-14 16:23:58 +08:00
by 8ff978db72 娃娃机返回操作结果 2024-08-14 16:22:57 +08:00
kxdd ae4ab17075 Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-14 15:54:38 +08:00
kxdd 2c8ce6a467 添加上分投币 2024-08-14 15:53:27 +08:00
by db82eabb7c 娃娃机 2024-08-14 14:48:28 +08:00
by 4a86c552f5 配置文件 2024-08-14 14:42:20 +08:00
kxdd ac608b4a44 Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-14 14:25:46 +08:00
kxdd 1fff8b2ebb 添加移动响应 2024-08-14 14:09:05 +08:00
by b9191e0538 娃娃机 2024-08-14 13:43:42 +08:00
by d2a8b0e618 娃娃机修改 2024-08-14 12:06:15 +08:00
by 6ea5fb3943 娃娃机投币 2024-08-14 11:37:03 +08:00
by 775280e03f 娃娃机 2024-08-14 11:33:03 +08:00
kxdd 49b0c6cc00 下抓通知添加 2024-08-13 15:33:44 +08:00
by d703046f63 娃娃机 2024-08-13 14:47:12 +08:00
174 changed files with 13909 additions and 62527 deletions

3
.gitmodules vendored
View File

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

View File

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

View File

@ -1,27 +1,26 @@
package main
package common
import (
"time"
"mongo.games.com/game/common"
"mongo.games.com/goserver/core/module"
)
var ClockMgrSington = &ClockMgr{
var ClockMgrSingleton = &ClockMgr{
LastHour: -1,
LastDay: -1,
Notifying: false,
}
const (
CLOCK_EVENT_SECOND int = iota
CLOCK_EVENT_MINUTE
CLOCK_EVENT_HOUR
CLOCK_EVENT_DAY
CLOCK_EVENT_WEEK
CLOCK_EVENT_MONTH
CLOCK_EVENT_SHUTDOWN
CLOCK_EVENT_MAX
ClockEventSecond int = iota
ClockEventMinute
ClockEventHour
ClockEventDay
ClockEventWeek
ClockEventMonth
ClockEventShutdown
ClockEventMax
)
type ClockSinker interface {
@ -38,7 +37,7 @@ type ClockSinker interface {
type BaseClockSinker struct {
}
func (s *BaseClockSinker) InterestClockEvent() int { return (1 << CLOCK_EVENT_MAX) - 1 }
func (s *BaseClockSinker) InterestClockEvent() int { return (1 << ClockEventMax) - 1 }
func (s *BaseClockSinker) OnSecTimer() {}
func (s *BaseClockSinker) OnMiniTimer() {}
func (s *BaseClockSinker) OnHourTimer() {}
@ -48,7 +47,7 @@ func (s *BaseClockSinker) OnMonthTimer() {}
func (s *BaseClockSinker) OnShutdown() {}
type ClockMgr struct {
sinkers [CLOCK_EVENT_MAX][]ClockSinker
sinkers [ClockEventMax][]ClockSinker
LastTickTime time.Time
LastMonth time.Month
LastWeek int
@ -60,9 +59,9 @@ type ClockMgr struct {
LastFiveMin int
}
func (this *ClockMgr) RegisteSinker(sinker ClockSinker) {
func (this *ClockMgr) RegisterSinker(sinker ClockSinker) {
interest := sinker.InterestClockEvent()
for i := 0; i < CLOCK_EVENT_MAX; i++ {
for i := 0; i < ClockEventMax; i++ {
if (1<<i)&interest != 0 {
found := false
ss := this.sinkers[i]
@ -115,7 +114,7 @@ func (this *ClockMgr) Update() {
this.LastDay = day
this.fireDayEvent()
week := common.GetWeekStartTs(tNow.Unix())
week := GetWeekStartTs(tNow.Unix())
if week != int64(this.LastWeek) {
this.LastWeek = int(week)
this.fireWeekEvent()
@ -138,43 +137,43 @@ func (this *ClockMgr) Shutdown() {
}
func (this *ClockMgr) fireSecondEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_SECOND] {
for _, s := range this.sinkers[ClockEventSecond] {
s.OnSecTimer()
}
}
func (this *ClockMgr) fireMinuteEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_MINUTE] {
for _, s := range this.sinkers[ClockEventMinute] {
s.OnMiniTimer()
}
}
func (this *ClockMgr) fireHourEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_HOUR] {
for _, s := range this.sinkers[ClockEventHour] {
s.OnHourTimer()
}
}
func (this *ClockMgr) fireDayEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_DAY] {
for _, s := range this.sinkers[ClockEventDay] {
s.OnDayTimer()
}
}
func (this *ClockMgr) fireWeekEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_WEEK] {
for _, s := range this.sinkers[ClockEventWeek] {
s.OnWeekTimer()
}
}
func (this *ClockMgr) fireMonthEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_MONTH] {
for _, s := range this.sinkers[ClockEventMonth] {
s.OnMonthTimer()
}
}
func (this *ClockMgr) fireShutdownEvent() {
for _, s := range this.sinkers[CLOCK_EVENT_SHUTDOWN] {
for _, s := range this.sinkers[ClockEventShutdown] {
s.OnShutdown()
}
}
@ -184,5 +183,5 @@ func (this *ClockMgr) GetLast() (int, int, int, int, int, int) {
}
func init() {
module.RegisteModule(ClockMgrSington, time.Millisecond*500, 0)
module.RegisteModule(ClockMgrSingleton, time.Millisecond*500, 0)
}

View File

@ -77,7 +77,12 @@ const (
GameId_IceAge = 304 // 冰河世纪
GameId_TamQuoc = 305 // 百战成神
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_HFishing = 401 //欢乐捕鱼
GameId_TFishing = 402 //天天捕鱼
@ -93,7 +98,7 @@ const (
GameId_Clawdoll = 608 // 娃娃机
__GameId_ThrGame_Min__ = 700 //################三方类################
GameId_Thr_Dg = 701 //DG Game
GameId_Thr_XHJ = 901 //DG Game
GameId_Thr_XHJ = 901 ///DG Game
)
const (
@ -171,27 +176,24 @@ func IsDaZhong(gameId int) bool {
// 房间编号区间
const (
PrivateSceneStartId = 10000000
PrivateSceneMaxId = 99999999
MatchSceneStartId = 100000000
MatchSceneMaxId = 199999999
HundredSceneStartId = 200000000
HundredSceneMaxId = 299999999
HallSceneStartId = 300000000
HallSceneMaxId = 399999999
MiniGameSceneStartId = 400000000
MiniGameSceneMaxId = 409999999
CoinSceneStartId = 1000000000 //区间预留大点,因为队列匹配比较耗id,假定一天100w牌局,那么这个id区间够用1000天
CoinSceneMaxId = 1999999999
DgSceneId = 99
PrivateSceneStartId = 100000
PrivateSceneMaxId = 999999
MatchSceneStartId = 100000000
MatchSceneMaxId = 199999999
HundredSceneStartId = 200000000
HundredSceneMaxId = 299999999
CoinSceneStartId = 1000000000
CoinSceneMaxId = 1999999999
DgSceneId = 99
)
// 房间模式
const (
SceneMode_Public = 0 //公共房间
SceneMode_Private = 2 //私人房间
SceneMode_Match = 3 //赛事房间
SceneMode_Thr = 4 //三方房间
SceneModePublic = 0 // 公共房间
SceneModePrivate = 2 // 私人房间
SceneModeMatch = 3 // 赛事房间
SceneModeThr = 4 // 三方房间
SceneModePrivateMatch = 5 // 竞技馆房间
)
const (
@ -309,6 +311,9 @@ const (
GainWayItemFenGain = 103 // 道具分解获得
GainWayGuide = 104 //新手引导奖励
GainWayVipGift9 = 105 //vip等级礼包
GainWayRoomCost = 106 //房费消耗
GainWayRoomGain = 107 //房卡场获得
GainWayItemShop = 108 // 交易市场道具交易
)
// 后台选择 金币变化类型 的充值 类型id号起始
@ -351,30 +356,6 @@ const (
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 (
RobotServerType int = 9
RobotServerId = 901
@ -457,12 +438,6 @@ const (
MatchTrueMan_Priority = 1 //优先匹配真人
)
const (
SingleAdjustModeNormal = 0
SingleAdjustModeWin = 1
SingleAdjustModeLose = 2
)
// 自动化标签(程序里产生的全部<0)
const (
AutomaticTag_QZNN_Smart int32 = -1
@ -507,35 +482,6 @@ const (
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 (
MatchMode_Normal int32 = iota //普通匹配
@ -755,6 +701,7 @@ const (
InviteScoreTypePay = 2 // 充值
InviteScoreTypeRecharge = 3 // 充值完成
InviteScoreTypePayMe = 4 // 充值(给自己)
InviteScoreTypeBindTel = 5 // 绑定手机号
)
func InMatchChannel(ls []string, n string) bool {
@ -867,3 +814,36 @@ const (
DataConfigSprite = 1 // 精灵配置
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,6 +452,22 @@ func SliceValueWeight(sl []int, index int) float64 {
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
func (p Int32Slice) Len() int { return len(p) }

View File

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

View File

@ -1065,6 +1065,46 @@
"UpperLimit": 2000000000,
"CtrlRate": 200,
"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,10 +6491,175 @@
"PlayerWaterRate": 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,
"Name": "娃娃机",
"Title": "1",
"Title": "大娃娃场",
"GameId": 608,
"GameRule": 60800,
"GameType": 1,
@ -6523,6 +6688,105 @@
],
"PlayerWaterRate": 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,6 +435,72 @@
"Location": "0",
"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,
"Name": "碎片礼盒",

Binary file not shown.

View File

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

Binary file not shown.

View File

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

View File

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

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

36
dbproxy/mq/c_customlog.go Normal file
View File

@ -0,0 +1,36 @@
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 {
case common.InviteScoreTypeBind:
case common.InviteScoreTypeBind, common.InviteScoreTypeBindTel:
// 更新绑定数量
// 更新邀请积分
// 1.邀请人增加积分

View File

@ -0,0 +1,25 @@
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,6 +28,8 @@ 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{"-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", "cycleid"}, Background: true, Sparse: true})
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
}
return c_gamedetailed
}

View File

@ -41,6 +41,8 @@ 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", "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", "cycleid"}, Background: true, Sparse: true})
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
}
return c_gameplayerlistlog
}

View File

@ -26,6 +26,8 @@ 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{"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{"roomconfigid"}, Background: true, Sparse: true})
c_itemlog.EnsureIndex(mgo.Index{Key: []string{"typeid", "roomconfigid"}, Background: true, Sparse: true})
}
return c_itemlog
}

View File

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

View File

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

View File

@ -227,7 +227,7 @@ func (svc *PlayerDataSvc) CreatePlayerDataByThird(args *model.CreatePlayer, ret
var dataParams model.PlayerParams
json.Unmarshal([]byte(a.Params), &dataParams)
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.Tel, a.PackegeTag, dataParams.Ip, a.TagKey, a.AccountType, a.DeviceOs, a.ChannelId)
if pd != nil {
err = cplayerdata.Insert(pd)
if err != nil {

View File

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

View File

@ -8,18 +8,70 @@ const (
ClawDollSceneStateStart //开始倒计时
ClawDollSceneStatePlayGame //游戏中
ClawDollSceneStateBilled //结算
ClawDollSceneWaitPayCoin //等待下一局投币
ClawDollSceneStateMax
)
// 玩家状态
const (
ClawDollSceneWaitTimeout = time.Second * 2 //等待倒计时
ClawDollSceneStartTimeout = time.Second * 6 //开始倒计时
ClawDollSceneBilledTimeout = time.Second * 2 //结算
ClawDollPlayerStateWait int32 = iota //等待状态
ClawDollPlayerStateStart //开始倒计时
ClawDollPlayerStatePlayGame //游戏中
ClawDollPlayerStateBilled //结算
ClawDollPlayerWaitPayCoin //等待下一局投币
ClawDollPlayerAudience //观众状态
ClawDollPlayerStateMax
)
const (
ClawDollSceneWaitTimeout = time.Second * 6 //等待倒计时
ClawDollSceneStartTimeout = time.Second * 1 //开始倒计时
ClawDollScenePlayTimeout = time.Second * 30 //娃娃机下抓倒计时
ClawDollSceneBilledTimeout = time.Second * 2 //结算
ClawDollSceneWaitPayCoinimeout = time.Second * 10 //等待下一局投币
)
// 玩家操作
const (
ClawDollPlayerOpScore = iota + 1 // 上分
ClawDollPlayerOpGo // 下抓
ClawDollPlayerOpMove // 移动方向
ClawDollPlayerOpPayCoin = iota + 1 // 上分 投币
ClawDollPlayerOpGo // 下抓
ClawDollPlayerOpMove // 玩家操控动作 // 1-前 2-后 3-左 4-右
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,3 +2,11 @@ package clawdoll
type Logic struct {
}
type ZegoForbidRTCResp struct {
Code int64
Message string
RequestId string
Data any
Error int
}

221
gamerule/clawdoll/queue.go Normal file
View File

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

View File

@ -13,39 +13,6 @@ import (
"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 CSLeaveRoomHandler struct {
@ -79,7 +46,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)
pack := &gamehall.SCLeaveRoom{
OpRetCode: gamehall.OpResultCode_Game_OPRC_YourAreGamingCannotLeave_Game,
RoomId: proto.Int(scene.SceneId),
RoomId: scene.SceneId,
}
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
@ -96,7 +63,7 @@ func (this *CSLeaveRoomHandler) Process(s *netlib.Session, packetid int, data in
Reason: proto.Int(0),
OpRetCode: gamehall.OpResultCode_Game_OPRC_Sucess_Game,
Mode: msg.Mode,
RoomId: proto.Int(scene.SceneId),
RoomId: scene.SceneId,
}
proto.SetDefaults(pack)
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_LEAVEROOM), pack)
@ -289,10 +256,55 @@ func CSRoomEvent(s *netlib.Session, packetid int, data interface{}, sid int64) e
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() {
// 房间创建者解散房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_DESTROYROOM), &CSDestroyRoomHandler{})
netlib.RegisterFactory(int(gamehall.GameHallPacketID_PACKET_CS_DESTROYROOM), &CSDestroyRoomPacketFactory{})
common.Register(int(gamehall.GameHallPacketID_PACKET_CS_DESTROYROOM), &gamehall.CSDestroyRoom{}, CSDestroyRoom)
// 离开或暂离房间
common.RegisterHandler(int(gamehall.GameHallPacketID_PACKET_CS_LEAVEROOM), &CSLeaveRoomHandler{})

View File

@ -4,22 +4,73 @@ import (
"mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"sync"
)
var MachineMap = make(map[int]string)
var MachineMap = make(map[int]*DollMachine)
var MachineMapLock = sync.Mutex{}
func MSDollMachineList(session *netlib.Session, packetId int, data interface{}) error {
type DollMachine struct {
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)
MachineMap = make(map[int]string)
MachineMap = make(map[int]*DollMachine)
if msg, ok := data.(*machine.MSDollMachineList); ok {
for i, info := range msg.Data {
MachineMap[i+1] = info.VideoAddr
MachineMap[i+1] = &DollMachine{
Id: i + 1,
Status: false,
VideoAddr: info.VideoAddr,
MachineStatus: 1,
}
logger.Logger.Tracef("MachineMap[%v] = %v", i, info.VideoAddr)
}
}
return nil
}
func init() {
netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineList)
// 获取空闲娃娃机标识
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() {
netlib.Register(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), &machine.MSDollMachineList{}, MSDollMachineListHandler)
//更新娃娃机链接状态
netlib.Register(int(machine.DollMachinePacketID_PACKET_MSUpdateDollMachineStatus), &machine.MSUpdateDollMachineStatus{}, MSUpdateDollMachineStatusHandler)
}

View File

@ -38,118 +38,101 @@ func HandleWGBuyRecTimeItem(session *netlib.Session, packetId int, data interfac
return nil
}
func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Trace("receive WGPlayerLeaveGame")
if msg, ok := data.(*server.WGPlayerLeave); ok {
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
if p != nil {
scene := p.GetScene()
if scene != nil {
scene.PlayerLeave(p, common.PlayerLeaveReason_DropLine, false)
//func HandleWGPlayerLeave(session *netlib.Session, packetId int, data interface{}) error {
// logger.Logger.Trace("receive WGPlayerLeaveGame")
// if msg, ok := data.(*server.WGPlayerLeave); ok {
// p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnId())
// if p != nil {
// scene := p.GetScene()
// if scene != nil {
// 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
}
func init() {
//创建场景
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_CREATESCENE), netlib.PacketFactoryWrapper(func() interface{} {
return &server.WGCreateScene{}
}))
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.Register(int(server.SSPacketID_PACKET_WG_CREATESCENE), &server.WGCreateScene{}, CreateScene)
// 删除房间
netlib.Register(int(server.SSPacketID_PACKET_WG_DESTROYSCENE), &server.WGDestroyScene{}, DestroyScene)
//玩家进入
netlib.RegisterFactory(int(server.SSPacketID_PACKET_WG_PLAYERENTER), netlib.PacketFactoryWrapper(func() interface{} {
@ -256,7 +239,7 @@ func init() {
}
if scene.Testing {
p.Coin = int64(scene.DbGameFree.GetTestTakeCoin())
p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin())
}
base.PlayerMgrSington.ManagePlayer(p)
scene.PlayerEnter(p, isload)
@ -373,7 +356,7 @@ func init() {
//p.coin = msg.GetTakeCoin()
//p.takeCoin = msg.GetTakeCoin()
if scene.Testing {
p.Coin = int64(scene.DbGameFree.GetTestTakeCoin())
p.Coin = int64(scene.GetDBGameFree().GetTestTakeCoin())
}
p.LastSyncCoin = p.Coin
scene.AudienceSit(p)
@ -579,10 +562,12 @@ func init() {
}))
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_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 {
if this.DbGameFree == nil {
if this.GetDBGameFree() == nil {
return false
}
params := this.DbGameFree.GetJackpot()
params := this.GetDBGameFree().GetJackpot()
this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 {
this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
}
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" {
@ -100,7 +100,7 @@ type AvengersSpinResult struct {
}
func (this *AvengersSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes AvengersSpinResult) {
taxRate := this.DbGameFree.GetTaxRate()
taxRate := this.GetDBGameFree().GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil {
@ -188,7 +188,7 @@ func (this *AvengersSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id),
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
}
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) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start()
@ -223,7 +223,7 @@ func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int
func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*avengers.AvengersBurstHistoryInfo
if data != nil {
@ -251,7 +251,7 @@ func (this *AvengersSceneData) GetLastBurstJackPot() time.Time {
}
func (this *AvengersSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType {
switch this.GetDBGameFree().SceneType {
case 1:
randT = rand.Intn(25200-7200+1) + 7200
case 2:
@ -267,7 +267,7 @@ func (this *AvengersSceneData) SetLastBurstJackPot() {
func (this *AvengersSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType {
switch this.GetDBGameFree().SceneType {
case 1:
randT = rand.Intn(3) + 1
case 2:
@ -280,20 +280,20 @@ func (this *AvengersSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1
}
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val
}
}
func (this *AvengersSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖
val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet)
}
}
@ -314,11 +314,11 @@ func (this *AvengersSceneData) KickPlayerByTime() {
}
//for _, p := range this.players {
// //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob &&
// todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// }
//}

View File

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

View File

@ -2,5 +2,5 @@ package base
// 提供税收和流水,根据代理需求后台进行分账
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.DbGameFree.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.GetDBGameFree().GetId(), p.PromoterTree))
}

View File

@ -24,6 +24,8 @@ func init() {
etcd.Register(etcd.ETCDKEY_ChannelSwitch, webapi.ChannelSwitchConfig{}, 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{}) {
@ -41,6 +43,8 @@ func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, ev
ConfigMgrInst.GetConfig(d.Platform).ChannelSwitch[d.GetTp()] = d
case *webapi.SkinConfig:
ConfigMgrInst.GetConfig(d.Platform).SkinConfig = d
case *webapi.MachineConfig:
ConfigMgrInst.GetConfig(d.Platform).MachineConfig = d
default:
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
}

View File

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

View File

@ -68,8 +68,8 @@ const (
)
type Player struct {
model.PlayerData //po 持久化对象
ExtraData interface{} //扩展接口
model.WGPlayerInfo
ExtraData interface{} //具体游戏对局中的玩家扩展信息
gateSess *netlib.Session //所在GateServer的session
worldSess *netlib.Session //所在WorldServer的session
scene *Scene //当前所在个Scene
@ -113,7 +113,7 @@ type Player struct {
Iparams map[int]int64 //整形参数
sparams map[int]string //字符参数
IsLocal bool //是否本地player
Items map[int32]int64 //背包数据
Items map[int32]int64 //背包数据, 不可直接修改,使用 AddItems 方法
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色、假皮肤
MatchRobotGrades []MatchRobotGrade
TestLog []string // 调试日志
@ -141,13 +141,15 @@ func NewPlayer(sid int64, data []byte, ws, gs *netlib.Session) *Player {
RankScore: make(map[int32]int64),
}
// 需要make的统一在这里初始化默认值别的地方就不用再初始化了
p.PlayerData = model.PlayerData{
//TotalGameData: make(map[int][]*model.PlayerGameTotal),
GDatas: make(map[string]*model.PlayerGameInfo),
ShopTotal: make(map[int32]*model.ShopTotal),
ShopLastLookTime: make(map[int32]int64),
IsFoolPlayer: make(map[string]bool),
//todo 初始化
p.WGPlayerInfo = model.WGPlayerInfo{
PlayerData: &model.PlayerData{
GDatas: make(map[string]*model.PlayerGameInfo),
ShopTotal: make(map[int32]*model.ShopTotal),
ShopLastLookTime: make(map[int32]int64),
IsFoolPlayer: make(map[string]bool),
},
GameData: make(map[string]*model.PlayerGameData),
}
if p.init(data) {
@ -246,7 +248,7 @@ func (this *Player) SyncFlagToWorld() {
}
pack := &server.GWPlayerFlag{
SnId: proto.Int32(this.SnId),
RoomId: proto.Int(this.scene.SceneId),
RoomId: this.scene.SceneId,
Flag: proto.Int(this.flag),
}
proto.SetDefaults(pack)
@ -373,7 +375,20 @@ func (this *Player) OnAudienceLeave(reason int) {
}
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)")
return
}
@ -382,7 +397,7 @@ func (this *Player) UnmarshalData(data []byte) bool {
if len(data) == 0 {
return true
}
err := netlib.Gob.Unmarshal(data, &this.PlayerData)
err := netlib.Gob.Unmarshal(data, &this.WGPlayerInfo)
if err == nil {
this.dirty = true
return true
@ -439,7 +454,6 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
return
}
this.Coin += num
this.Items[common.ItemIDCoin] = this.Coin
if this.scene != nil {
if !this.IsRob && !this.scene.Testing { //机器人log排除掉
log := model.NewCoinLogEx(&model.CoinLogParam{
@ -467,9 +481,6 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
if this.Coin < 0 {
this.Coin = 0
}
if this.scene.IsHundredScene() {
this.scene.NewBigCoinNotice(this, int64(num), 5)
}
}
//增加玩家经验
if num > 0 {
@ -524,7 +535,6 @@ func (this *Player) AddCoinAsync(num int64, gainWay int32, notifyC, broadcast bo
return
}
this.Coin += num
this.Items[common.ItemIDCoin] = this.Coin
if this.scene != nil {
if !this.IsRob && !this.scene.Testing && writeLog { //机器人log排除掉
log := model.NewCoinLogEx(&model.CoinLogParam{
@ -607,62 +617,6 @@ 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) {
// 记录玩家 首次参与该场次的游戏时间 游戏次数
var gameFirstTime, gameFreeFirstTime time.Time
@ -682,25 +636,12 @@ func (this *Player) ReportGameEvent(tax, taxex, changeCoin, validbet, validFlow,
gamingTime := int32(time.Now().Sub(this.scene.GameNowTime).Seconds())
LogChannelSingleton.WriteMQData(model.GenerateGameEvent(model.CreatePlayerGameRecEvent(this.SnId, tax, taxex, changeCoin, validbet, validFlow, in, out,
int32(this.scene.GameId), this.scene.DbGameFree.GetId(), int32(this.scene.GameMode),
int32(this.scene.GameId), this.scene.GetGameFreeId(), int32(this.scene.GameMode),
this.scene.GetRecordId(), this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS,
this.CreateTime, gamingTime, gameFirstTime, gameFreeFirstTime, gameTimes, gameFreeTimes, this.LastLoginTime,
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)
// }
// }
//}
}
// 汇总玩家该次游戏总产生的税收
// 数据用途: 平台和推广间分账用,确保数据计算无误,
// 注意:该税收不包含俱乐部的抽水
@ -714,30 +655,6 @@ 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 方法
// 个人投入产出汇总以游戏id为key存储
// 数据用途:计算玩家赔率用,数据确保计算无误,否则可能影响玩家手牌的调控
@ -851,61 +768,18 @@ 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) {
for _, p := range params {
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) {
for _, p := range params {
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) {
for _, p := range params {
this.cparams[p.GetStrKey()] = p.GetStrVal()
@ -1219,17 +1093,6 @@ func (this *Player) NoviceOdds(gameId int) (int32, bool) {
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 {
this.Exp += exp
@ -1395,3 +1258,71 @@ func (this *Player) PetUseSkill() bool {
func (this *Player) GetSkillAdd(id int32) int32 {
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)
testFlag = true
if oldPlayer.scene != nil {
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
if SceneMgrSington.GetScene(oldPlayer.scene.SceneId) != nil {
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found snid=%v in sceneid=%v SceneMgrSington.GetScene(oldPlayer.scene.sceneId) != nil", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
logger.Logger.Warnf("(this *PlayerMgr) AddPlayer found id=%v snid=%v in sceneid=%v", id, oldPlayer.SnId, oldPlayer.scene.SceneId)
if SceneMgrSington.GetScene(int(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)
}
}
this.DelPlayer(id)

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -21,136 +21,82 @@ var SceneMgrSington = &SceneMgr{
}
type SceneMgr struct {
scenes map[int]*Scene
scenesByGame map[int]map[int]*Scene
scenesByGameFree map[int32]map[int]*Scene
lastSendJackPot time.Time
PlatformScene map[string]bool
scenes map[int]*Scene // 房间id
scenesByGame map[int]map[int]*Scene // 游戏id:房间id
scenesByGameFree map[int32]map[int]*Scene // 场次id:房间id
lastSendJackPot time.Time //
PlatformScene map[string]bool //
}
func (this *SceneMgr) makeKey(gameid, gamemode int) int {
return int(gameid*10000 + gamemode)
type CreateSceneParam struct {
Session *netlib.Session
*server.WGCreateScene
}
func (this *SceneMgr) CreateScene(s *netlib.Session, sceneId, gameMode, sceneMode, gameId int, platform string,
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...)
func (this *SceneMgr) CreateScene(args *CreateSceneParam) *Scene {
scene := NewScene(args)
if scene == nil {
logger.Logger.Error("(this *SceneMgr) CreateScene, scene == 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 {
this.PlatformScene[platform] = true
}
//
key := this.makeKey(gameId, gameMode)
if ss, exist := this.scenesByGame[key]; exist {
ss[scene.SceneId] = scene
// 游戏id索引
if ss, exist := this.scenesByGame[int(gameId)]; exist {
ss[int(scene.SceneId)] = scene
} else {
ss = make(map[int]*Scene)
ss[scene.SceneId] = scene
this.scenesByGame[key] = ss
ss[int(scene.SceneId)] = scene
this.scenesByGame[int(gameId)] = ss
}
//
if ss, exist := this.scenesByGameFree[dbGameFree.GetId()]; exist {
ss[scene.SceneId] = scene
// 场次id索引
if ss, exist := this.scenesByGameFree[gameFreeId]; exist {
ss[int(scene.SceneId)] = scene
} else {
ss = make(map[int]*Scene)
ss[scene.SceneId] = scene
this.scenesByGameFree[dbGameFree.GetId()] = ss
ss[int(scene.SceneId)] = scene
this.scenesByGameFree[gameFreeId] = ss
}
scene.OnStart()
logger.Logger.Infof("(this *SceneMgr) CreateScene,New scene,id:[%d] replaycode:[%v]", scene.SceneId, replayCode)
logger.Logger.Infof("(this *SceneMgr) CreateScene,New scene,id:[%d] replaycode:[%v]", scene.SceneId, args.GetReplayCode())
return scene
}
func (this *SceneMgr) DestroyScene(sceneId int) {
if scene, exist := this.scenes[sceneId]; exist {
scene.OnStop()
//
key := this.makeKey(scene.GameId, scene.GameMode)
if ss, exist := this.scenesByGame[key]; exist {
delete(ss, scene.SceneId)
// 游戏id
if ss, exist := this.scenesByGame[scene.GetGameId()]; exist {
delete(ss, int(scene.SceneId))
}
//
// 场次id
if ss, exist := this.scenesByGameFree[scene.GetGameFreeId()]; exist {
delete(ss, scene.SceneId)
delete(ss, int(scene.SceneId))
}
// 房间id
delete(this.scenes, 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 {
if s, exist := this.scenes[sceneId]; exist {
return s
}
return nil
}
func (this *SceneMgr) GetSceneByGameId(platform string, gameId int32) []*Scene {
key := this.makeKey(int(gameId), 0)
var ss []*Scene
if data, ok := this.scenesByGame[key]; ok {
if data, ok := this.scenesByGame[int(gameId)]; ok {
for _, scene := range data {
if scene.Platform == platform {
ss = append(ss, scene)
@ -159,6 +105,7 @@ func (this *SceneMgr) GetSceneByGameId(platform string, gameId int32) []*Scene {
}
return ss
}
func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
for _, gameId := range gameIds {
ss := this.GetSceneByGameId(platform, gameId)
@ -169,7 +116,7 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
val := s.sp.GetJackPotVal(s)
if val > 0 {
jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(s.DbGameFree.Id),
GameFreeId: proto.Int32(s.GetGameFreeId()),
JackPotFund: proto.Int64(val),
}
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
@ -205,16 +152,13 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
}
}
}
func (this *SceneMgr) OnMiniTimer() {
for _, scene := range this.scenes {
scene.SyncPlayerCoin()
}
}
func (this *SceneMgr) OnHourTimer() {
// for _, scene := range this.scenes {
// scene.OnHourTimer()
// }
}
func (this *SceneMgr) OnDayTimer() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,15 @@
package clawdoll
import (
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
"mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"strconv"
)
type CSPlayerOpPacketFactory struct {
@ -48,8 +52,126 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf
}
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() {
common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpHandler{})
netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP), &CSPlayerOpPacketFactory{})
common.RegisterHandler(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_PLAYEROP), &CSPlayerOpHandler{})
netlib.RegisterFactory(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_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,16 +1,22 @@
package clawdoll
import (
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/srvdata"
"mongo.games.com/goserver/core/logger"
)
type PlayerEx struct {
*base.Player //玩家信息
gainCoin int64 // 本局赢的金币
taxCoin int64 // 本局税收
odds int32
clawDollState int32 // 抓娃娃状态
dollCardsCnt int32 // 娃娃卡数量
winDollCardType int32 // 本局赢取娃娃的类型
gainCoin int64 // 本局赢的金币
taxCoin int64 // 本局税收
odds int32
}
func (this *PlayerEx) Clear(baseScore int32) {
@ -31,14 +37,68 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
return true
}
func (this *PlayerEx) CanPayCoinByPos() bool {
// 能否投币
func (this *PlayerEx) CanPayCoin() bool {
return false
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
}
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() {
this.ReDataStartGame()
this.UnmarkFlag(base.PlayerState_WaitNext)
this.UnmarkFlag(base.PlayerState_GameBreak)
this.MarkFlag(base.PlayerState_Ready)
this.gainCoin = 0
this.taxCoin = 0
this.odds = 0
@ -49,7 +109,7 @@ func (this *PlayerEx) InitData(baseScore int32) {
}
// 重置下注数据
// 重置数据
func (this *PlayerEx) ResetData() {
}
@ -69,3 +129,26 @@ func (this *PlayerEx) CanLeaveScene(sceneState int) bool {
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,13 +1,29 @@
package clawdoll
import (
"mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/goserver/core/logger"
"container/list"
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base"
"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 {
@ -41,15 +57,21 @@ type SceneEx struct {
PlayerBackup map[int32]*PlayerData // 本局离场玩家数据备份
seats []*PlayerEx // 本局游戏中的玩家状态数据
RoundId int // 局数,第几局
robotNum int // 参与游戏的机器人数量
logid string
waitPlayers *list.List
playingSnid int32 // 正在玩的玩家snid
RoundId int // 局数,第几局
robotNum int // 参与游戏的机器人数量
logid string
machineId int //娃娃机ID
machineConn *netlib.Session //娃娃机链接
machineStatus int32 //娃娃机链接状态 0:离线 1:在线
}
// 游戏是否能开始
func (this *SceneEx) CanStart() bool {
//人数>=1自动开始
if len(this.players) >= 0 && (this.GetRealPlayerNum() >= 0 || this.IsPreCreateScene()) {
if len(this.players) >= 1 && (this.GetRealPlayerNum() >= 1 || this.IsPreCreateScene() || this.IsHasPlaying()) {
return true
}
return false
@ -58,25 +80,74 @@ func (this *SceneEx) CanStart() bool {
// 从房间删除玩家
func (this *SceneEx) delPlayer(p *base.Player) {
if p, exist := this.players[p.SnId]; exist {
this.seats[p.GetPos()] = nil
//this.seats[p.GetPos()] = nil
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) {
scLeavePack := &clawdoll.SCCLAWDOLLPlayerLeave{
Pos: proto.Int(p.GetPos()),
SnId: proto.Int32(p.SnId),
}
proto.SetDefaults(scLeavePack)
this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave), scLeavePack, p.GetSid())
this.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_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) {
this.delPlayer(p)
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) {
//销毁房间
@ -88,7 +159,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu
SnId: proto.Int32(snId),
OpCode: proto.Int32(int32(opcode)),
Params: params,
OpRetCode: clawdoll.OpResultCode_OPRC_Success,
OpRetCode: opRetCode,
}
proto.SetDefaults(pack)
@ -98,7 +169,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu
// OnPlayerSCOp 发送玩家操作情况
func (e *SceneEx) OnPlayerSCOp(p *base.Player, opcode int, opRetCode clawdoll.OpResultCode, params []int64) {
pack := e.playerOpPack(p.SnId, opcode, opRetCode, params)
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYEROP), pack)
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_PLAYEROP), pack)
logger.Logger.Tracef("OnPlayerSCOp %s", pack)
}
@ -132,7 +203,8 @@ func (this *SceneEx) ClawdollCreateRoomInfoPacket(s *base.Scene, p *base.Player)
HeadOutLine: proto.Int32(playerEx.HeadOutLine),
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)
@ -152,8 +224,8 @@ func NewClawdollSceneData(s *base.Scene) *SceneEx {
Scene: s,
logic: new(rule.Logic),
players: make(map[int32]*PlayerEx),
seats: make([]*PlayerEx, s.GetPlayerNum()),
PlayerBackup: make(map[int32]*PlayerData),
waitPlayers: list.New(),
}
return sceneEx
@ -164,9 +236,40 @@ func (this *SceneEx) init() bool {
return true
}
// 检查上分是否合法
func (this *SceneEx) CheckPayOp(betVal int64, takeMul int64) bool { //游戏底分
return true
// 检查上分投币是否合法
func (this *SceneEx) CheckPayCoinOp(p *PlayerEx) bool {
if p == nil {
return false
}
if p.SnId == this.playingSnid {
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() {
@ -174,13 +277,29 @@ func (this *SceneEx) Clear() {
this.PlayerBackup = make(map[int32]*PlayerData)
this.RoundId = 0
for i := 0; i < this.GetPlayerNum(); i++ {
if this.seats[i] != nil {
this.seats[i].Clear(this.GetBaseScore())
for e := this.waitPlayers.Front(); e != nil; e = e.Next() {
if e != nil {
p := e.Value.(*PlayerEx)
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) {
this.PlayerBackup[p.SnId] = &PlayerData{
SnId: p.SnId,
@ -203,3 +322,218 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
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,7 +1,10 @@
package clawdoll
import (
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
"mongo.games.com/game/gamesrv/action"
"mongo.games.com/game/protocol/clawdoll"
"strconv"
"time"
"mongo.games.com/goserver/core"
@ -61,6 +64,32 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) {
if s.SceneState != nil {
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) {
@ -69,35 +98,28 @@ func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) {
}
logger.Logger.Trace("(this *PolicyClawdoll) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.SnId)
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}
sceneEx.seats[pos] = playerEx
sceneEx.players[p.SnId] = playerEx
playerEx := &PlayerEx{Player: p}
sceneEx.players[p.SnId] = playerEx
baseScore := sceneEx.GetBaseScore()
p.ExtraData = playerEx
playerEx.Clear(baseScore)
//playerEx.clawDollState = rule.ClawDollPlayerAudience
baseScore := sceneEx.GetBaseScore()
p.MarkFlag(base.PlayerState_WaitNext)
p.UnmarkFlag(base.PlayerState_Ready)
p.Pos = pos
p.ExtraData = playerEx
playerEx.Clear(baseScore)
//给自己发送房间信息
this.SendRoomInfo(s, p, sceneEx)
if sceneEx.Gaming {
p.MarkFlag(base.PlayerState_WaitNext)
p.UnmarkFlag(base.PlayerState_Ready)
}
ClawdollSendRoomWaitPlayers(s, p)
ClawdollBroadcastPlayingInfo(s)
//给自己发送房间信息
this.SendRoomInfo(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventEnter, nil)
}
// 玩家数据发送
sceneEx.OnPlayerEnter(p, 0)
this.SendGetVideoToken(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventEnter, nil)
}
}
@ -151,6 +173,10 @@ func (this *PolicyClawdoll) OnPlayerRehold(s *base.Scene, p *base.Player) {
p.MarkFlag(base.PlayerState_Ready)
}
this.SendRoomInfo(s, p, sceneEx)
ClawdollSendRoomWaitPlayers(s, p)
ClawdollBroadcastPlayingInfo(s)
this.SendGetVideoToken(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
}
}
@ -168,6 +194,10 @@ func (this *PolicyClawdoll) OnPlayerReturn(s *base.Scene, p *base.Player) {
p.MarkFlag(base.PlayerState_Ready)
}
this.SendRoomInfo(s, p, sceneEx)
ClawdollSendRoomWaitPlayers(s, p)
ClawdollBroadcastPlayingInfo(s)
this.SendGetVideoToken(s, p, sceneEx)
s.FirePlayerEvent(p, base.PlayerEventReturn, nil)
}
}
@ -207,9 +237,6 @@ func (this *PolicyClawdoll) IsCompleted(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
}
@ -234,8 +261,49 @@ func (this *PolicyClawdoll) CanChangeCoinScene(s *base.Scene, p *base.Player) bo
}
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)
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)
}
// 广播房间状态
@ -244,7 +312,80 @@ func ClawdollBroadcastRoomState(s *base.Scene, params ...float32) {
State: proto.Int(s.SceneState.GetState()),
Params: params,
}
s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMSTATE), pack, 0)
s.Broadcast(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_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)
}
}
}
//=====================================
@ -267,14 +408,14 @@ func (this *BaseState) CanChangeTo(s base.SceneState) bool {
func (this *BaseState) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
//playerEx, ok := p.ExtraData.(*PlayerEx)
//if !ok {
// return false
//}
//
//if !playerEx.CanLeaveScene(s.GetSceneState().GetState()) {
// return false
//}
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return false
}
if !playerEx.CanLeaveScene(s.GetSceneState().GetState()) {
return false
}
return true
}
@ -288,6 +429,7 @@ func (this *BaseState) OnEnter(s *base.Scene) {
func (this *BaseState) OnLeave(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 {
@ -318,23 +460,19 @@ func (this *StateWait) CanChangeTo(s base.SceneState) bool {
}
func (this *StateWait) GetTimeout(s *base.Scene) int {
return this.BaseState.GetTimeout(s)
}
func (this *StateWait) OnEnter(s *base.Scene) {
this.BaseState.OnEnter(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if _, ok := s.ExtraData.(*SceneEx); ok {
if s.Gaming {
s.NotifySceneRoundPause()
}
s.Gaming = false
ClawdollBroadcastRoomState(s, float32(0), float32(0))
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStateStart)
}
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
}
}
@ -361,13 +499,44 @@ func (this *StateWait) OnTick(s *base.Scene) {
sceneEx.SceneDestroy(true)
return
}
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneWaitTimeout {
//切换到准备开局状态
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStateStart)
}
}
}
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() {
sceneEx.playingSnid = playerEx.SnId
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
}
}
return false
}
//=====================================
@ -386,6 +555,8 @@ func (this *StateStart) CanChangeTo(s base.SceneState) bool {
switch s.GetState() {
case rule.ClawDollSceneStatePlayGame:
return true
case rule.ClawDollSceneStateWait:
return true
}
return false
}
@ -393,11 +564,12 @@ func (this *StateStart) CanChangeTo(s base.SceneState) bool {
func (this *StateStart) OnEnter(s *base.Scene) {
this.BaseState.OnEnter(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
ClawdollBroadcastRoomState(s, float32(0), float32(0))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
s.Gaming = false
sceneEx.GameNowTime = time.Now()
sceneEx.NumOfGames++
}
}
@ -406,32 +578,24 @@ func (this *StateStart) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneStartTimeout {
//切换到等待操作状态
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStatePlayGame)
} else {
s.ChangeSceneState(rule.ClawDollSceneStateWait)
}
s.ChangeSceneState(rule.ClawDollSceneStatePlayGame)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStatePlayGame))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
}
}
}
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
}
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)
this.BaseState.OnPlayerEvent(s, p, evtcode, params)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if _, ok := s.ExtraData.(*SceneEx); ok {
switch evtcode {
case base.PlayerEventLeave:
if !sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStateWait)
}
case base.PlayerEventEnter:
if !p.IsReady() {
p.MarkFlag(base.PlayerState_Ready)
@ -467,7 +631,8 @@ func (this *PlayGame) OnEnter(s *base.Scene) {
s.Gaming = true
ClawdollBroadcastRoomState(s, float32(0), float32(0))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
}
@ -479,11 +644,68 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
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
}
func (this *PlayGame) OnTick(s *base.Scene) {
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
}
}
}
//=====================================
@ -500,7 +722,7 @@ func (this *StateBilled) GetState() int {
func (this *StateBilled) CanChangeTo(s base.SceneState) bool {
switch s.GetState() {
case rule.ClawDollSceneStateStart:
case rule.ClawDollSceneWaitPayCoin:
return true
}
return false
@ -513,6 +735,26 @@ func (this *StateBilled) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, p
func (this *StateBilled) OnEnter(s *base.Scene) {
logger.Logger.Trace("(this *StateBilled) 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 *StateBilled) OnLeave(s *base.Scene) {
@ -532,11 +774,158 @@ func (this *StateBilled) OnTick(s *base.Scene) {
this.BaseState.OnTick(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollSceneBilledTimeout {
if sceneEx.CanStart() {
s.ChangeSceneState(rule.ClawDollSceneStateStart)
} else {
s.ChangeSceneState(rule.ClawDollSceneStateWait)
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)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
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)
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
}
}
@ -567,6 +956,7 @@ func init() {
PolicyClawdollSingleton.RegisteSceneState(&StateStart{})
PolicyClawdollSingleton.RegisteSceneState(&PlayGame{})
PolicyClawdollSingleton.RegisteSceneState(&StateBilled{})
PolicyClawdollSingleton.RegisteSceneState(&StateWaitPayCoin{})
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
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 {
if this.DbGameFree == nil {
if this.GetDBGameFree() == nil {
return false
}
params := this.DbGameFree.GetJackpot()
params := this.GetDBGameFree().GetJackpot()
this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 {
this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
}
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
if str != "" {
@ -101,7 +101,7 @@ type EasterIslandSpinResult struct {
}
func (this *EasterIslandSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes EasterIslandSpinResult) {
taxRate := this.DbGameFree.GetTaxRate()
taxRate := this.GetDBGameFree().GetTaxRate()
calcTaxScore := func(score int64, taxScore *int64) int64 {
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
if taxScore != nil {
@ -192,7 +192,7 @@ func (this *EasterIslandSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id),
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
}
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) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start()
@ -226,7 +226,7 @@ func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet
func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*easterisland.EasterIslandBurstHistoryInfo
if data != nil {
@ -254,7 +254,7 @@ func (this *EasterIslandSceneData) GetLastBurstJackPot() time.Time {
}
func (this *EasterIslandSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType {
switch this.GetDBGameFree().SceneType {
case 1:
randT = rand.Intn(25200-7200+1) + 7200
case 2:
@ -269,7 +269,7 @@ func (this *EasterIslandSceneData) SetLastBurstJackPot() {
func (this *EasterIslandSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType {
switch this.GetDBGameFree().SceneType {
case 1:
randT = rand.Intn(3) + 1
case 2:
@ -282,20 +282,20 @@ func (this *EasterIslandSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1
}
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val
}
}
func (this *EasterIslandSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖
val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet)
}
}
@ -316,11 +316,11 @@ func (this *EasterIslandSceneData) KickPlayerByTime() {
}
//for _, p := range this.players {
// //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob &&
// todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
// }
//}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ func NewFruitsSceneData(s *base.Scene) *FruitsSceneData {
func (s *FruitsSceneData) Init() {
s.LoadJackPotData()
//for _, data := range srvdata.PBDB_SlotRateWeightMgr.Datas.Arr {
// if data.Id == s.DbGameFree.Id {
// if data.Id == s.GetDBGameFree().Id {
// //s.levelRate = append(s.levelRate, data.EleWeight1)
// //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) {
val := playerEx.betCoin
tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000))
tax := int64(math.Ceil(float64(val) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//playerEx.taxCoin = tax
//playerEx.AddServiceFee(tax)
val -= tax
addPrizeCoin := int64(math.Floor(float64(val*fruits.NowByte*int64(s.DbGameFree.GetJackpotRatio())) / 1000)) //扩大10000倍
addPrizeCoin := int64(math.Floor(float64(val*fruits.NowByte*int64(s.GetDBGameFree().GetJackpotRatio())) / 1000)) //扩大10000倍
s.jackpot.AddToSmall(playerEx.IsRob, addPrizeCoin)
logger.Logger.Tracef("奖池增加...AddPrizeCoin... %f", float64(addPrizeCoin)/float64(fruits.NowByte))
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 {
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false)
//tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//playerEx.taxCoin = tax
//playerEx.winCoin -= tax
//p.AddServiceFee(tax)
@ -140,7 +140,7 @@ func (s *FruitsSceneData) Win(p *FruitsPlayerData) {
p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//p.taxCoin = tax
//p.winCoin -= tax
//p.AddServiceFee(tax)
@ -210,7 +210,7 @@ func (s *FruitsSceneData) LoadJackPotData() {
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
} else {
s.jackpot = &base.SlotJackpotPool{}
jp := s.DbGameFree.GetJackpot()
jp := s.GetDBGameFree().GetJackpot()
if len(jp) > 0 {
s.jackpot.Small += int64(jp[0] * 10000)
}
@ -244,7 +244,7 @@ func (s *FruitsSceneData) SaveLog(p *FruitsPlayerData, isOffline int) {
}
}
FruitsType := model.FruitsType{
RoomId: s.SceneId,
RoomId: int(s.SceneId),
BasicScore: int32(p.oneBetCoin),
PlayerSnId: p.SnId,
BeforeCoin: p.startCoin,
@ -372,7 +372,7 @@ func (s *FruitsSceneData) SendPlayerBet(p *FruitsPlayerData) {
Tax: proto.Int64(p.taxCoin),
}
gwPlayerBet := &server.GWPlayerData{
GameFreeId: proto.Int32(s.DbGameFree.GetId()),
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
}
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
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 = int64(math.Floor(float64(curCoin) / float64(fruits.NowByte)))
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
balance := s.DbGameFree.BalanceLine[i]
for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- {
balance := s.GetDBGameFree().BalanceLine[i]
if curCoin >= int64(balance) {
key = int32(i)
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{} {
//房间信息
pack := &protocol.SCFruitsRoomInfo{
RoomId: proto.Int(s.SceneId),
GameId: proto.Int(s.GameId),
RoomMode: proto.Int(s.SceneMode),
SceneType: proto.Int(s.SceneType),
RoomId: s.SceneId,
GameId: s.GameId,
RoomMode: s.SceneMode,
SceneType: s.GetSceneType(),
Params: common.CopySliceInt64ToInt32(s.Params),
NumOfGames: proto.Int(sceneEx.NumOfGames),
State: proto.Int(s.SceneState.GetState()),
ParamsEx: s.DbGameFree.OtherIntParams,
GameFreeId: proto.Int32(s.DbGameFree.Id),
//BetLimit: s.DbGameFree.BetLimit,
ParamsEx: s.GetDBGameFree().OtherIntParams,
GameFreeId: proto.Int32(s.GetDBGameFree().Id),
//BetLimit: s.GetDBGameFree().BetLimit,
}
//自己的信息
@ -299,11 +299,11 @@ func (this *SceneBaseStateFruits) OnTick(s *base.Scene) {
if sceneEx, ok := s.ExtraData.(*FruitsSceneData); ok {
//for _, p := range sceneEx.players {
// //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId()))
// if !p.IsRob &&
// todayGamefreeIDSceneData != nil &&
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
// sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) {
// 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()
idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx {
pack := &protocol.SCFruitsOp{
OpCode: proto.Int(opcode),
OpRetCode: proto.Int(3),
@ -419,12 +419,12 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
if playerEx.gameState == fruits.Normal {
playerEx.freeTotal = 0
playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / 9
//playerEx.isReportGameEvent = true
playerEx.noWinTimes++
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) {
//押注限制(低于该值不能押注)
pack := &protocol.SCFruitsOp{
OpCode: proto.Int(opcode),
@ -486,9 +486,9 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
case fruits.FruitsPlayerOpSwitch:
if len(params) > 0 && playerEx.freeTimes == 0 && playerEx.maryFreeTimes == 0 {
idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx {
playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / 9
}
}

View File

@ -67,7 +67,7 @@ func (this *IceAgeSceneData) init() bool {
this.jackpot = &base.SlotJackpotPool{}
if this.jackpot.Small <= 0 {
this.jackpot.Small = 0
this.jackpot.VirtualJK = int64(params[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore())
this.jackpot.VirtualJK = int64(params[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore())
}
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.GetPlatform())
@ -238,7 +238,7 @@ func (this *IceAgeSceneData) BroadcastJackpot(sync bool) {
this.lastJackpotValue = this.jackpot.VirtualJK
pack := &gamehall.SCHundredSceneGetGameJackpot{}
jpfi := &gamehall.GameJackpotFundInfo{
GameFreeId: proto.Int32(this.DbGameFree.Id),
GameFreeId: proto.Int32(this.GetDBGameFree().Id),
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
}
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) {
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
log := model.NewBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId, this.GetGameFreeId(), name, wincoin, totalbet)
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.InsertBurstJackpotLogs(log)
}), nil, "InsertBurstJackpotLogs").Start()
@ -272,7 +272,7 @@ func (this *IceAgeSceneData) RecordBurstLog(name string, wincoin, totalbet int64
func (this *IceAgeSceneData) BurstHistory(player *IceAgePlayerData) {
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
return model.GetBurstJackpotLog(this.Platform, this.GetDBGameFree().GameId)
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
var logsp []*iceage.IceAgeBurstHistoryInfo
if data != nil {
@ -300,7 +300,7 @@ func (this *IceAgeSceneData) GetLastBurstJackPot() time.Time {
}
func (this *IceAgeSceneData) SetLastBurstJackPot() {
var randT = rand.Intn(25200-7200+1) + 7200
switch this.DbGameFree.SceneType {
switch this.GetDBGameFree().SceneType {
case 1:
randT = rand.Intn(25200-7200+1) + 7200
case 2:
@ -313,7 +313,7 @@ func (this *IceAgeSceneData) SetLastBurstJackPot() {
func (this *IceAgeSceneData) AIAddJackPot() {
if time.Now().Sub(this.lastJackPot) > 0 {
var randT = rand.Intn(3) + 1
switch this.DbGameFree.SceneType {
switch this.GetDBGameFree().SceneType {
case 1:
randT = rand.Intn(3) + 1
case 2:
@ -324,20 +324,20 @@ func (this *IceAgeSceneData) AIAddJackPot() {
randT = rand.Intn(3) + 1
}
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
val := int64(math.Floor(float64(this.GetDBGameFree().GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
this.jackpot.VirtualJK += val
}
}
func (this *IceAgeSceneData) AIBurstJackPot() {
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
this.SetLastBurstJackPot()
jackpotParams := this.DbGameFree.GetJackpot()
var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.DbGameFree.GetBaseScore()) //奖池初始值
jackpotParams := this.GetDBGameFree().GetJackpot()
var jackpotInit = int64(jackpotParams[rule.ICEAGE_JACKPOT_InitJackpot]) * int64(this.GetDBGameFree().GetBaseScore()) //奖池初始值
//AI机器人爆奖
val := this.jackpot.VirtualJK
this.jackpot.VirtualJK = jackpotInit
bet := int64(this.DbGameFree.GetBaseScore()) * int64(rule.LINENUM)
bet := int64(this.GetDBGameFree().GetBaseScore()) * int64(rule.LINENUM)
this.RecordBurstLog(this.RandNickName(), val, bet)
}
}
@ -358,11 +358,11 @@ func (this *IceAgeSceneData) KickPlayerByTime() {
}
//for _, p := range this.players {
// //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.GetDBGameFree().GetId()))
// if !p.IsRob &&
// todayGamefreeIDSceneData != nil &&
// this.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
// this.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(this.GetDBGameFree().GetPlayNumLimit()) {
// 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.BetLines = playerEx.betLines
pack.FreeTimes = proto.Int32(playerEx.freeTimes)
pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
pack.Chip = proto.Int32(s.GetDBGameFree().BaseScore)
pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus)
pack.SpinID = proto.Int64(playerEx.spinID)
}
@ -681,7 +681,7 @@ func (this *SceneStateIceAgeStart) OnPlayerOp(s *base.Scene, p *base.Player, opc
case IceAgePlayerHistory:
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GetGameId())
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.GetDBGameFree().GetGameClass(), s.GetGameId())
pack := &iceage.SCIceAgePlayerHistory{}
for _, v := range gpl.Data {
//if v.GameDetailedLogId == "" {
@ -982,7 +982,7 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData)
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
}
gwPlayerBet := &server.GWPlayerData{
SceneId: proto.Int(sceneEx.SceneId),
SceneId: sceneEx.SceneId,
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
}
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)

View File

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

View File

@ -58,13 +58,13 @@ func (s *RichBlessedSceneData) SceneDestroy(force bool) {
}
func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) {
val := playerEx.betCoin
tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000))
tax := int64(math.Ceil(float64(val) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//playerEx.taxCoin = tax
//playerEx.AddServiceFee(tax)
val -= tax
addPrizeCoin := val * richblessed.NowByte * int64(s.DbGameFree.GetJackpotRatio()) //扩大10000倍
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
addPrizeCoin := val * richblessed.NowByte * int64(s.GetDBGameFree().GetJackpotRatio()) //扩大10000倍
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
s.jackpot.AddToGrand(playerEx.IsRob, jk1)
s.jackpot.AddToBig(playerEx.IsRob, jk1)
s.jackpot.AddToMiddle(playerEx.IsRob, jk1)
@ -177,7 +177,7 @@ func (s *RichBlessedSceneData) Win(p *RichBlessedPlayerData) {
p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//p.taxCoin = tax
//p.winCoin -= tax
//p.AddServiceFee(tax)
@ -198,7 +198,7 @@ func (s *RichBlessedSceneData) JACKPOTWin(p *RichBlessedPlayerData) {
p.noWinTimes = 0
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin)
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.JackwinCoin, false)
//tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
//tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.GetDBGameFree().GetTaxRate()) / 10000))
//p.taxCoin = tax
//p.JackwinCoin -= tax
//p.AddServiceFee(tax)
@ -271,7 +271,7 @@ func (s *RichBlessedSceneData) LoadJackPotData() {
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
} else {
s.jackpot = &base.SlotJackpotPool{}
jp := s.DbGameFree.GetJackpot()
jp := s.GetDBGameFree().GetJackpot()
if len(jp) > 0 {
s.jackpot.Small += int64(jp[0] * 10000)
}
@ -300,7 +300,7 @@ func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int)
}
RichBlessed := model.RichBlessedType{
RoomId: s.SceneId,
RoomId: int(s.SceneId),
BasicScore: int32(p.oneBetCoin),
PlayerSnId: p.SnId,
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 = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte)))
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
balance := s.DbGameFree.BalanceLine[i]
for i := len(s.GetDBGameFree().BalanceLine) - 1; i >= 0; i-- {
balance := s.GetDBGameFree().BalanceLine[i]
if curCoin >= int64(balance) {
key = int32(i)
break
@ -426,7 +426,7 @@ func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int
}
func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) {
//if s.DbGameFree.GetId() == 3070004 {
//if s.GetDBGameFree().GetId() == 3070004 {
// playerEx.TestCode(eleLineAppearRate)
//} else {
playerEx.result.CreateLine(eleLineAppearRate)
@ -448,7 +448,7 @@ func (s *RichBlessedSceneData) SendPlayerBet(p *RichBlessedPlayerData) {
GameCoinTs: p.GameCoinTs,
}
gwPlayerBet := &server.GWPlayerData{
GameFreeId: proto.Int32(s.DbGameFree.GetId()),
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
SceneId: int32(s.SceneId),
}
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 {
return
}
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.DbGameFree.GetOtherIntParams())
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.GetDBGameFree().GetOtherIntParams())
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
playerEx := &RichBlessedPlayerData{Player: p}
playerEx.init()
@ -148,15 +148,15 @@ func RichBlessedSendRoomInfo(s *base.Scene, sceneEx *RichBlessedSceneData, playe
func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} {
//房间信息
pack := &protocol.SCRBRoomInfo{
RoomId: proto.Int(s.SceneId),
GameId: proto.Int(s.GameId),
RoomMode: proto.Int(s.SceneMode),
SceneType: proto.Int(s.SceneType),
RoomId: s.SceneId,
GameId: s.GameId,
RoomMode: s.SceneMode,
SceneType: s.GetSceneType(),
Params: common.CopySliceInt64ToInt32(s.Params),
NumOfGames: proto.Int(sceneEx.NumOfGames),
State: proto.Int(s.SceneState.GetState()),
ParamsEx: common.Int64ToInt32(s.DbGameFree.OtherIntParams), //s.GetParamsEx(),
//BetLimit: s.DbGameFree.BetLimit,
ParamsEx: common.Int64ToInt32(s.GetDBGameFree().OtherIntParams), //s.GetParamsEx(),
//BetLimit: s.GetDBGameFree().BetLimit,
NowGameState: proto.Int(playerEx.gameState),
BetIdx: proto.Int(playerEx.betIdx),
@ -172,11 +172,11 @@ func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneDat
WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)),
JackpotEle: proto.Int32(playerEx.result.JackpotEle),
WinJackpot: proto.Int64(playerEx.JackwinCoin),
GameFreeId: proto.Int32(s.DbGameFree.Id),
GameFreeId: proto.Int32(s.GetDBGameFree().Id),
}
if playerEx.oneBetCoin == 0 && len(s.DbGameFree.GetOtherIntParams()) != 0 { // 初始化客户端jack显示
oneBetCoin := int64(s.DbGameFree.GetOtherIntParams()[0] / richblessed.LineNum)
if playerEx.oneBetCoin == 0 && len(s.GetDBGameFree().GetOtherIntParams()) != 0 { // 初始化客户端jack显示
oneBetCoin := int64(s.GetDBGameFree().GetOtherIntParams()[0] / richblessed.LineNum)
pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl]
pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy]
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 {
//for _, p := range sceneEx.players {
// //游戏次数达到目标值
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.GetDBGameFree().GetId()))
// if !p.IsRob &&
// todayGamefreeIDSceneData != nil &&
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
// sceneEx.GetDBGameFree().GetPlayNumLimit() != 0 &&
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.GetDBGameFree().GetPlayNumLimit()) {
// 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()
idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) <= idx {
pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode),
OpRetCode: proto.Int(3),
@ -423,13 +423,13 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
if playerEx.gameState == richblessed.Normal {
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin)
playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
maxidx := len(sceneEx.DbGameFree.GetOtherIntParams()) - 1
playerEx.maxbetCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[maxidx])
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
maxidx := len(sceneEx.GetDBGameFree().GetOtherIntParams()) - 1
playerEx.maxbetCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[maxidx])
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注
playerEx.noWinTimes++
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
if playerEx.Coin < int64(s.GetDBGameFree().GetBetLimit()) {
//押注限制(低于该值不能押注)
pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode),
@ -495,9 +495,9 @@ func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player
case richblessed.RichBlessedPlayerOpSwitch:
if len(params) > 0 && playerEx.freeTimes == 0 {
idx := int(params[0])
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
if len(sceneEx.GetDBGameFree().GetOtherIntParams()) > idx {
playerEx.betIdx = idx
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
playerEx.betCoin = int64(sceneEx.GetDBGameFree().GetOtherIntParams()[idx])
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum
pack := &protocol.SCRichBlessedOp{
OpCode: proto.Int(opcode),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,17 @@ import (
"mongo.games.com/game/srvdata"
)
type BilledInfo struct {
Round int32 // 第几局
ChangeScore int64 // 积分变化
Score int64 // 结算后积分
}
type Item struct {
Id int32
Num int64
}
// 房间上的额外数据
type TienLenSceneData struct {
*base.Scene //场景
@ -56,13 +67,20 @@ type TienLenSceneData struct {
isCardsKu bool //是否是牌库
cardsKuId int32 //牌库ID
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 {
sceneEx := &TienLenSceneData{
Scene: s,
poker: rule.NewPoker(),
players: make(map[int32]*TienLenPlayerData),
Scene: s,
poker: rule.NewPoker(),
players: make(map[int32]*TienLenPlayerData),
BilledList: map[int32]*[]*BilledInfo{},
PlayerAward: make(map[int32]*[]*model.Item),
}
sceneEx.Clear()
return sceneEx
@ -143,6 +161,11 @@ func (this *TienLenSceneData) CanStart() bool {
return false
}
}
if this.IsCustom() {
return this.IsAllReady() && this.GetPlayerCnt() >= this.GetPlayerNum()
}
// 房间人数>=2开始,并且有真人或者是预创建房间,并且有房主
if nPlayerCount >= 2 && (this.GetRealPlayerNum() > 0 || this.IsPreCreateScene()) { //人数>=2开始
return true
@ -264,9 +287,13 @@ 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) {
this.SaveCustomLog()
//销毁房间
this.Scene.Destroy(force)
}
@ -371,7 +398,7 @@ func (this *TienLenSceneData) BroadcastOpPos() {
for _, seat := range this.seats {
if seat != nil && seat.IsGameing() {
if !seat.IsRob {
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotGamingNum > 0)
if seat.odds < 0 {
B -= seat.odds
}
@ -523,7 +550,7 @@ func (this *TienLenSceneData) IsTienLenToEnd() bool {
return common.IsTienLenToEnd(this.GetGameId())
}
func (this *TienLenSceneData) GetFreeGameSceneType() int32 {
return int32(this.SceneType)
return this.GetSceneType()
}
// 比赛场发牌
@ -1061,7 +1088,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
if seat.IsRob {
robotPlayers = append(robotPlayers, seat)
} else {
seat.odds = this.GetPlayerOdds(seat.Player, this.GameId, this.robotGamingNum > 0)
seat.odds = this.GetPlayerOdds(seat.Player, int(this.GameId), this.robotGamingNum > 0)
seat.playerPool = int(this.PlayerPoolOdds(seat.Player))
if seat.odds > 0 {
realPlayersGood = append(realPlayersGood, seat)
@ -1072,7 +1099,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
} else {
realPlayers = append(realPlayers, seat)
}
_, isNovice := seat.NoviceOdds(this.GameId)
_, isNovice := seat.NoviceOdds(int(this.GameId))
if isNovice {
novicePlayers = append(novicePlayers, seat)
} else {
@ -1952,7 +1979,7 @@ func (this *TienLenSceneData) TrySmallGameBilled() {
logger.Logger.Trace("宠物技能抵挡炸弹生效,发送消息 SCTienLenPetSkillRes: ", pack)
}
if score != 0 {
taxRate := this.DbGameFree.GetTaxRate() //万分比
taxRate := this.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(score) * float64(10000-taxRate) / 10000.0) //税后
bombTaxScore := score - gainScore
// win
@ -2078,3 +2105,62 @@ func (this *TienLenSceneData) SendFirstGiveTimeItem(p *base.Player) {
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())),
TimeOut: proto.Int(s.GetSceneState().GetTimeout(s)),
NumOfGames: proto.Int(sceneEx.NumOfGames),
TotalOfGames: proto.Int(sceneEx.TotalOfGames),
TotalOfGames: sceneEx.TotalOfGames,
CurOpIdx: proto.Int(-1),
MasterSnid: proto.Int32(sceneEx.masterSnid),
AudienceNum: proto.Int(s.GetAudiencesNum()),
@ -432,19 +432,27 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
RankType: s.GetDBGameFree().GetRankType(),
SceneAdd: s.GetDBGameFree().GetSceneAdd(),
// 比赛场相关
Round: int32(s.MatchRound),
CurPlayerNum: int32(s.MatchCurPlayerNum),
NextNeed: int32(s.MatchNextNeed),
Round: s.GetMatch().GetCurrRound(),
CurPlayerNum: s.GetMatch().GetCurrPlayerNum(),
NextNeed: s.GetMatch().GetNextPlayerNum(),
RecordId: sceneEx.recordId,
TMInfoId: sceneEx.MatchInfoId,
TMInfoId: s.GetMatch().GetMatchId(),
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)
// 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
if s.IsMatchScene() {
pack.IsMatch = int32(s.MatchType)
pack.IsMatch = s.GetMatch().GetMatchType()
}
pack.MatchFinals = 0
if s.MatchFinals {
if s.GetMatch().GetIsFinals() {
pack.MatchFinals = 1
if s.NumOfGames >= 2 {
pack.MatchFinals = 2
@ -814,7 +822,7 @@ func (this *SceneWaitStartStateTienLen) OnEnter(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
sceneEx.Clear()
sceneEx.SetGaming(false)
this.BroadcastRoomState(s, this.GetState())
this.BroadcastRoomState(s, this.GetState(), int64(sceneEx.NumOfGames))
logger.Logger.Trace("(this *SceneWaitStartStateTienLen) OnEnter", this.GetState())
}
}
@ -880,7 +888,7 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
if sceneEx, ok := s.GetExtraData().(*TienLenSceneData); ok {
if sceneEx.IsMatchScene() {
delayT := time.Second * 2
if sceneEx.MatchRound != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画
if sceneEx.GetMatch().GetCurrRound() != 1 { //第一轮延迟2s其他延迟3s 配合客户端播放动画
delayT = time.Second * 4
}
if time.Now().Sub(sceneEx.StateStartTime) > delayT {
@ -888,14 +896,23 @@ func (this *SceneWaitStartStateTienLen) OnTick(s *base.Scene) {
return
}
}
if sceneEx.SceneMode == common.SceneMode_Public {
if sceneEx.SceneMode == common.SceneModePublic {
if time.Now().Sub(sceneEx.StateStartTime) > rule.TienLenWaitStartTimeout {
if sceneEx.Creator != 0 && sceneEx.GetRealPlayerNum() == 0 {
sceneEx.Destroy(true)
return
}
//开始前再次检查开始条件
if sceneEx.CanStart() == true {
if sceneEx.CanStart() {
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)
} else {
s.ChangeSceneState(rule.TienLenSceneStateWaitPlayer)
@ -954,13 +971,17 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
s.NotifySceneRoundStart(s.NumOfGames)
this.BroadcastRoomState(s, this.GetState(), int64(s.NumOfGames))
if s.IsCustom() && s.NumOfGames == 1 {
s.SyncSceneState(common.SceneStateStart)
}
//同步防伙牌数据
sceneEx.SyncScenePlayer()
//发牌
if rule.TestOpen {
sceneEx.SendHandCardTest()
} else {
if sceneEx.IsMatchScene() {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
sceneEx.SendHandCard_Match()
} else {
sceneEx.SendHandCardOdds()
@ -982,7 +1003,7 @@ func (this *SceneHandCardStateTienLen) OnEnter(s *base.Scene) {
seat.tianHu = rule.TianHu12Straight
}
if seat.tianHu > 0 {
keyNovice := common.GetKeyNoviceGameId(sceneEx.GameId)
keyNovice := common.GetKeyNoviceGameId(int(sceneEx.GameId))
data, ok := seat.GDatas[keyNovice]
if !ok {
data = &model.PlayerGameInfo{FirstTime: time.Now()}
@ -1637,14 +1658,14 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
winRankScore := int64(0)
pack := &tienlen.SCTienLenGameBilled{}
tienlenType := model.TienLenType{
GameId: sceneEx.GameId,
GameId: int(sceneEx.GameId),
RoomId: int32(sceneEx.GetSceneId()),
RoomType: sceneEx.GetFreeGameSceneType(),
NumOfGames: int32(sceneEx.Scene.NumOfGames),
BankId: sceneEx.masterSnid,
PlayerCount: sceneEx.curGamingPlayerNum,
BaseScore: s.GetBaseScore(),
TaxRate: s.DbGameFree.GetTaxRate(),
TaxRate: s.GetDBGameFree().GetTaxRate(),
RoomMode: s.GetSceneMode(),
PlayerPool: make(map[int]int),
}
@ -1773,7 +1794,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
gainScore = losePlayerCoin
}
losePlayerScore = gainScore
if sceneEx.IsMatchScene() { //比赛场是积分,不应该增加账变
if sceneEx.IsMatchScene() || sceneEx.IsCustom() { //比赛场是积分,不应该增加账变
losePlayer.AddCoinNoLog(int64(-gainScore), 0)
} else {
losePlayer.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
@ -1788,7 +1809,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分
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))
//周卡加成
if losePlayer.GetWeekCardPrivilege(2) {
@ -1915,7 +1936,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
astWinGainScore = lastWinPlayerCoin
}
lastWinPlayerScore = astWinGainScore
if sceneEx.IsMatchScene() {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
lastWinPlayer.AddCoinNoLog(int64(-astWinGainScore), 0)
} else {
lastWinPlayer.AddCoin(int64(-astWinGainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
@ -1930,7 +1951,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分
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))
//周卡加成
if lastWinPlayer.GetWeekCardPrivilege(2) {
@ -2020,7 +2041,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
rankScore = loseRankScore
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(losePlayerScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := losePlayerScore - gainScore // 税收
if playerNum == 3 {
@ -2028,7 +2049,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
gainTaxScore = losePlayerScore + lastWinPlayerScore - gainScore
rankScore = loseRankScore + lastWinPlayerRankScore
}
if sceneEx.IsMatchScene() {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
playerEx.AddCoinNoLog(int64(gainScore), 0)
} else {
playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName())
@ -2041,7 +2062,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分
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))
//周卡加成
if playerEx.GetWeekCardPrivilege(2) {
@ -2130,10 +2151,10 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分
oldRankScore := playerEx.GetRankScore(sceneEx.GetDBGameFree().GetRankType())
rankScore = lastWinPlayerRankScore
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(lastWinPlayerScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := lastWinPlayerScore - gainScore
if sceneEx.IsMatchScene() {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
playerEx.AddCoinNoLog(int64(gainScore), 0)
} else {
playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName())
@ -2146,7 +2167,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分
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))
//周卡加成
if playerEx.GetWeekCardPrivilege(2) {
@ -2275,7 +2296,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
gainScore = losePlayerCoin
}
winScore += gainScore
if sceneEx.IsMatchScene() {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
playerEx.AddCoinNoLog(int64(-gainScore), 0)
} else {
playerEx.AddCoin(int64(-gainScore), common.GainWay_CoinSceneLost, 0, "system", s.GetSceneName())
@ -2295,7 +2316,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分
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))
//周卡加成
if playerEx.GetWeekCardPrivilege(2) {
@ -2411,10 +2432,10 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
var otherScore int64 // 额外总加分
playerEx := sceneEx.players[winSnid]
if playerEx != nil {
taxRate := sceneEx.DbGameFree.GetTaxRate() //万分比
taxRate := sceneEx.GetDBGameFree().GetTaxRate() //万分比
gainScore := int64(float64(winScore) * float64(10000-taxRate) / 10000.0) //税后
gainTaxScore := winScore - gainScore
if sceneEx.IsMatchScene() {
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
playerEx.AddCoinNoLog(int64(gainScore), 0)
} else {
playerEx.AddCoin(gainScore, common.GainWay_CoinSceneWin, 0, "system", s.GetSceneName())
@ -2427,7 +2448,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
// vip加成分
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))
//周卡加成
if playerEx.GetWeekCardPrivilege(2) {
@ -2531,6 +2552,92 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
s.Broadcast(int(tienlen.TienLenPacketID_PACKET_SCTienLenGameBilled), pack, 0)
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)
if err == nil {
@ -2579,10 +2686,11 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
})
// 保存玩家游戏记录
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,
0, 0, o_player.GainCoin+o_player.BombCoin, validBet, validFlow, o_player.IsFirst, o_player.IsLeave))
param := base.GetSaveGamePlayerListLogParam(o_player.Platform, o_player.Channel, o_player.Promoter,
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)
param.CycleId = sceneEx.CycleID
sceneEx.SaveGamePlayerListLog(o_player.UserId, param)
}
}
if isSave {
@ -2591,6 +2699,7 @@ func (this *SceneBilledStateTienLen) OnEnter(s *base.Scene) {
Trend20Lately: "",
CtrlType: sceneEx.ctrlType,
PlayerPool: tienlenType.PlayerPool,
CycleId: sceneEx.CycleID,
})
}
}
@ -2653,7 +2762,10 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) {
continue
}
player_data.Clear()
if sceneEx.IsMatchScene() {
if sceneEx.IsCustom() {
player_data.UnmarkFlag(base.PlayerState_WaitNext)
}
if sceneEx.IsMatchScene() || sceneEx.IsCustom() {
continue
}
if !player_data.IsOnLine() {
@ -2694,7 +2806,10 @@ func (this *SceneBilledStateTienLen) OnLeave(s *base.Scene) {
s.TryDismissRob()
}
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.MatchFinals || (s.MatchFinals && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
if s.CheckNeedDestroy() || (s.IsMatchScene() && (!s.GetMatch().GetIsFinals() || (s.GetMatch().GetIsFinals() && s.NumOfGames >= 2))) { // 非决赛打一场 决赛打两场
sceneEx.SceneDestroy(true)
}
if s.TotalOfGames > 0 && s.NumOfGames >= int(s.TotalOfGames) {
sceneEx.SceneDestroy(true)
}
s.RankMatchDestroy()
@ -2781,6 +2896,11 @@ func init() {
base.RegisteScenePolicy(common.GameId_TienLenRank_toend, 0, ScenePolicyTienLenSingleton)
base.RegisteScenePolicy(common.GameId_TienLenRank_yl, 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
})
}

View File

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

View File

@ -1,105 +1,315 @@
package action
import (
"bytes"
"fmt"
"math"
"mongo.games.com/game/machine/machinedoll"
"mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/timer"
"sync"
"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 {
fmt.Println("SMDollMachinePerateHandler %v", data)
msg, ok := data.(*machine.SMDollMachineoPerate)
if !ok {
return nil
}
conn := machinedoll.ConnMap[int(msg.Id)]
if conn == nil {
conn, ok := machinedoll.MachineMgr.ConnMap[int(msg.GetId())]
if !ok || conn == nil {
return nil
}
if msg.Perate == 1 {
switch msg.Perate {
case 1:
//向前移动
machinedoll.Backward(conn)
time.Sleep(200 * time.Millisecond)
machinedoll.BackwardStop(conn)
} else if msg.Perate == 2 {
f1 := []func(){
func() { machinedoll.Backward(conn) },
}
f2 := []func(){
func() { machinedoll.BackwardStop(conn) },
}
Process(conn, f1, f2)
case 2:
//向后移动
machinedoll.Forward(conn)
time.Sleep(200 * time.Millisecond)
machinedoll.ForwardStop(conn)
} else if msg.Perate == 3 {
f1 := []func(){
func() { machinedoll.Forward(conn) },
}
f2 := []func(){
func() { machinedoll.ForwardStop(conn) },
}
Process(conn, f1, f2)
case 3:
//向左移动
machinedoll.Left(conn)
time.Sleep(200 * time.Millisecond)
machinedoll.LeftStop(conn)
} else if msg.Perate == 4 {
f1 := []func(){
func() { machinedoll.Left(conn) },
}
f2 := []func(){
func() { machinedoll.LeftStop(conn) },
}
Process(conn, f1, f2)
case 4:
//向右移动
machinedoll.Right(conn)
time.Sleep(200 * time.Millisecond)
machinedoll.RightStop(conn)
} else if msg.Perate == 5 {
f1 := []func(){
func() { machinedoll.Right(conn) },
}
f2 := []func(){
func() { machinedoll.RightStop(conn) },
}
Process(conn, f1, f2)
case 5:
//投币
fmt.Println("===========玩家投币===========")
go DollMachineGrabResult(session, conn, msg.Snid, msg.GetId())
machinedoll.Coin(conn)
machinedoll.Backward(conn)
time.Sleep(200 * time.Millisecond)
machinedoll.BackwardStop(conn)
}
return nil
}
// 下抓
func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error {
logger.Logger.Tracef("SMDollMachineGrabHandler %v", data)
msg, ok := data.(*machine.SMDollMachineGrab)
if !ok {
return nil
}
conn := machinedoll.ConnMap[int(msg.Id)]
if conn == nil {
conn, ok := machinedoll.MachineMgr.ConnMap[int(msg.GetId())]
if !ok || conn == nil {
return nil
}
typeId := msg.TypeId
if typeId == 1 {
switch msg.GetTypeId() {
case 1:
//弱抓
/* f1 := []func(){
func() { machinedoll.WeakGrab(conn) },
}
f2 := []func(){}
Process(conn, f1, f2)*/
machinedoll.WeakGrab(conn)
} else if typeId == 2 {
case 2:
//强力抓
machinedoll.Grab(conn)
} else if typeId == 3 {
//必中抓
machinedoll.SetPower(conn)
time.Sleep(200 * time.Millisecond)
/* f1 := []func(){
func() { machinedoll.Grab(conn) },
}
f2 := []func(){}
Process(conn, f1, f2)*/
machinedoll.Grab(conn)
}
//返回消息
session.Send(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), &machine.MSDollMachineGrab{
Snid: msg.Snid,
Id: msg.GetId(),
Result: 1,
})
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 {
logger.Logger.Trace("与游戏服务器连接成功!!\n")
fmt.Printf("与游戏服务器连接成功!!\n")
fmt.Println("与游戏服务器连接成功")
//开始向游戏服务器发送娃娃机连接信息
msg := &machine.MSDollMachineList{}
for i, _ := range machinedoll.ConnMap {
for i, _ := range machinedoll.MachineMgr.ConnMap {
info := &machine.DollMachine{}
info.Id = int32(i)
info.VideoAddr = "www.baidu.com"
msg.Data = append(msg.Data, info)
}
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
fmt.Printf("开始向游戏服务器发送娃娃机连接信息!\n", msg)
fmt.Println("向游戏服务器发送娃娃机连接信息:%v", msg)
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() {
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_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
func Forward(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x01}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
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
func ForwardStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x01, 0x00}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
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
func Backward(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x01}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
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
func BackwardStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x02, 0x00}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
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
func Left(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x01}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
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
func LeftStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x03, 0x00}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
@ -75,7 +75,7 @@ func LeftStop(conn net.Conn) {
// 向右
func Right(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x01}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
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
func RightStop(conn net.Conn) {
instruction := []byte{0xaa, 0x05, 0x01, 0x50, 0x04, 0x00}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
@ -97,7 +97,34 @@ func RightStop(conn net.Conn) {
// 强抓下抓
func Grab(conn net.Conn) {
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)
if err != nil {
fmt.Println("Failed to send command to server:", err)
@ -115,7 +142,7 @@ func Grab(conn net.Conn) {
// 弱抓aa 05 01 50 06 00 52 dd
func WeakGrab(conn net.Conn) {
instruction := []byte{0xAA, 0x05, 0x01, 0x50, 0x06, 0x00}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
@ -126,56 +153,56 @@ func WeakGrab(conn net.Conn) {
// 投币
func Coin(conn net.Conn) {
moveCommand := []byte{0xaa, 0x08, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00}
moveCommand = calculateChecksum(moveCommand)
moveCommand = CalculateChecksum(moveCommand)
// 发送指令到服务端
_, err := conn.Write(moveCommand)
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
}
if buf[4] == 1 {
fmt.Println("上分成功n = ", n)
}
if buf[4] == 0 {
fmt.Println("上分失败!!!")
}
/* // 读取服务端的响应
buf := make([]byte, 1024)
n, err := conn.Read(buf)
if err != nil {
fmt.Println("Failed to read response from server:", err)
return
}
if buf[4] == 1 {
fmt.Println("上分成功n = ", n)
}
if buf[4] == 0 {
fmt.Println("上分失败!!!")
}*/
}
// 剩余局数清零
func ClearRemainingGames(conn net.Conn) {
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)
/* // 读取服务端的响应
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 {
func CalculateChecksum(data []byte) []byte {
var value = byte(0)
for i, datum := range data {
if i > 0 {
value ^= datum
}
}
fmt.Println("校验码 value = ", value)
//fmt.Println("校验码 value = ", value)
data = append(data, value, 0xdd)
return data
@ -186,20 +213,21 @@ func OpenMusic(conn net.Conn) {
data[43] = 0x01
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
instruction = calculateChecksum(instruction)
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)
/* 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)*/
}
// 关闭音乐
@ -207,64 +235,64 @@ func CloseMusic(conn net.Conn) {
data[43] = 0x00
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
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)
/* // 读取服务端的响应
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)
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)
/* // 读取服务端的响应
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)
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)
/* // 读取服务端的响应
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)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
@ -275,7 +303,7 @@ func StopServer(conn net.Conn) {
// 开启服务
func StartServer(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x36}
instruction = calculateChecksum(instruction)
instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction)
if err != nil {
fmt.Println("Failed to send command to server:", err)
@ -286,34 +314,50 @@ func StartServer(conn net.Conn) {
// 查询基础参数
func queryBaseParam(conn net.Conn) {
instruction := []byte{0xAA, 0x03, 0x01, 0x05}
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
}
/* // 读取服务端的响应
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)
fmt.Println("n", n)*/
}
// 设置强力
// 设置出奖模式
func SetPower(conn net.Conn) {
data[3] = 0x00
data[16] = 0x01
data[17] = 0xE0
data[18] = 0x13
data[19] = 0x88
data[3] = 0x01
fmt.Println("data.len = ", len(data))
instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...)
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 SetBaseParam(conn net.Conn) {
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)
@ -327,55 +371,64 @@ func SetPower(conn net.Conn) {
return
}
fmt.Println("n", n)
if buf[4] == 1 {
fmt.Println("设置成功!")
} else {
fmt.Println("设置失败!")
}
}
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,
0x65, //0 几币几玩
0x00, //1 几币几玩占用位
0x2D, //2 游戏时间
0x01, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式
0x0F, //4 出奖概率
0x00, //5 出奖概率占用位
0x00, //6 空中抓物 0关闭 1开启
0x00, //7 连续投币赠送 范围0~100
0x00, //8 保夹次数 范围06 6为无限次
0x01, //9 保夹赠送模式 0送游戏 1送中奖 2送游戏和中奖
0x80, //10 强抓力电压
0x01, //11 强抓力电压占用位
0x80, //12 中抓力电压
0x01, //13 中抓力电压占用位
0x78, //14 弱抓力电压
0x00, //15 弱抓力电压占用位
0xE0, //16 中奖电压
0x01, //17 中奖电压占用位
0xC8, //18 强抓力时间
0x00, //19 强抓力时间占用位
0x14, //20 放抓时间
0x32, //21 前后速度
0x32, //22 左右速度
0x50, //23 上下速度
0x9A, //24 放线长度
0x06, //25 放线长度占用位
0x00, //26 礼品下放高度
0x00, //27 礼品下放高度占用位
0x14, //28 甩抓长度
0x00, //29 甩抓保护
0x78, //30 甩抓电压
0x00, //31 甩抓电压占用位
0x32, //32 上拉保护
0x02, //33 天车自救时间
0x00, //34 下抓延时
0x00, //35 下抓延时占用位
0xC8, //36 抓物延时
0x00, //37 抓物延时占用位
0x96, //38 上停延时
0x00, //39 上停延时占用位
0x00, //40 摇杆延时
0x00, //41 摇杆延时占用位
0x00, //42 抓物二收
0x00, //43 待机音乐开关
0x00, //44 音量大小调整
0x07, //45 待机音乐选择
0x08, //46 游戏音乐选择
0x00, //47 概率队列自动
}

View File

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

View File

@ -9,6 +9,7 @@ import (
"mongo.games.com/game/common"
"mongo.games.com/game/model"
"mongo.games.com/goserver/core"
"mongo.games.com/goserver/core/admin"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/transact"
@ -176,14 +177,6 @@ func init() {
return transact.TransExeResult(retCode)
}),
})
// //参数设置
// 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)
// 对局详情
admin.MyAdminApp.Route("/api/game/room_info", GameSrvWebAPI)
}

View File

@ -84,3 +84,16 @@ func SaveToDelBackupBagItem(args *BagInfo) error {
}
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,7 +5,6 @@ import (
"mongo.games.com/game/protocol/server"
"time"
"github.com/globalsign/mgo"
"github.com/globalsign/mgo/bson"
"mongo.games.com/goserver/core/logger"
)
@ -125,17 +124,3 @@ func ManageCoinPoolSetting(dbSetting *CoinPoolSetting) {
}
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,11 +1,13 @@
package model
import (
"slices"
"strconv"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/game/common"
"mongo.games.com/game/protocol/gamehall"
"mongo.games.com/game/protocol/shop"
"mongo.games.com/game/protocol/webapi"
)
@ -33,7 +35,7 @@ const (
type ShopInfo struct {
Id int32 // 商品ID
Page int32 // 页面 1金币页面 2钻石页面 3道具页面
Page int32 // 页面 1金币页面 2钻石页面 3道具页面 4,房卡
Order int32 // 排序 页面内商品的位置排序
Location []int32 // 显示位置 第1位竖版大厅 第2位Tienlen1级选场 第3位捕鱼1级选场
Picture string // 图片id
@ -43,7 +45,7 @@ type ShopInfo struct {
AdTime int32 // 观看几次广告
RepeatTimes int32 // 领取次数
CoolingTime []int32 // 观看冷却时间
Type int32 // 获得类型 1金币 2钻石 3道具类型
Type int32 // 获得类型 1金币 2钻石 3道具类型 4房卡
Amount int64 // 获得数量
AddArea []int32 // 加送百分比比如加送10%就配置110
ItemId int32 // 获得道具ID
@ -75,7 +77,7 @@ func (this *ShopInfo) GetItems() []ItemInfo {
if this.ItemId > 0 {
ret = append(ret, ItemInfo{
ItemId: this.ItemId,
ItemNum: this.Amount,
ItemNum: this.AmountFinal,
})
}
for _, v := range this.AddItemInfo {
@ -138,13 +140,16 @@ type AllConfig struct {
*webapi.AwardLogConfig
// 新手引导配置
*webapi.GuideConfig
//娃娃机配置
*webapi.MachineConfig
MatchAudience map[int32]*webapi.MatchAudience // 比赛观众列表 key: 玩家id
// 小精灵配置
*webapi.SpiritConfig
// 房卡场房间类型
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 {
@ -176,6 +181,7 @@ func (cm *ConfigMgr) GetConfig(platform string) *AllConfig {
MatchAudience: make(map[int32]*webapi.MatchAudience),
RoomType: make(map[int32]*webapi.RoomType),
RoomConfig: make(map[int32]*webapi.RoomConfig),
RoomTypeMap: make(map[int32][]*webapi.RoomConfig),
}
cm.platform[platform] = c
}
@ -396,8 +402,94 @@ func (cm *ConfigMgr) DelRoomType(plt string, id int32) {
func (cm *ConfigMgr) UpdateRoomConfig(data *webapi.RoomConfig) {
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) {
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)
}
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
}

35
model/customlog.go Normal file
View File

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

View File

@ -52,9 +52,10 @@ type GamePlayerListLog struct {
MatchId int64
MatchType int64 //0.普通场 1.锦标赛 2.冠军赛 3.vip专属
Ts int32
IsFree bool //拉霸专用 是否免费
WinSmallGame int64 //拉霸专用 小游戏奖励
WinTotal int64 //拉霸专用 输赢
IsFree bool //拉霸专用 是否免费
WinSmallGame int64 //拉霸专用 小游戏奖励
WinTotal int64 //拉霸专用 输赢
CycleId string // 本轮id打一轮有多局
}
func NewGamePlayerListLog() *GamePlayerListLog {
@ -64,7 +65,7 @@ func NewGamePlayerListLog() *GamePlayerListLog {
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,
betAmount, winAmountNoAnyTax int64, key, name string, gameClass int32, isFirst bool, matchid, matchType int64,
isFree bool, winSmallGame, winTotal int64) *GamePlayerListLog {
isFree bool, winSmallGame, winTotal int64, cycleId string) *GamePlayerListLog {
cl := NewGamePlayerListLog()
cl.SnId = snid
cl.GameDetailedLogId = gamedetailedlogid
@ -98,6 +99,7 @@ func NewGamePlayerListLogEx(snid int32, gamedetailedlogid string, platform, chan
cl.Time = tNow
cl.MatchId = matchid
cl.MatchType = matchType
cl.CycleId = cycleId
return cl
}

View File

@ -14,20 +14,21 @@ var (
)
type ItemLog struct {
LogId bson.ObjectId `bson:"_id"`
Platform string //平台
SnId int32 //玩家id
LogType int32 //记录类型 0.获取 1.消耗
ItemId int32 //道具id
ItemName string //道具名称
Count int64 //个数
CreateTs int64 //记录时间
Remark string //备注
TypeId int32 // 变化类型
GameId int32 // 游戏id,游戏中获得时有值
GameFreeId int32 // 场次id,游戏中获得时有值
Cost []*ItemInfo // 消耗的道具
Id string // 撤销的id兑换失败
LogId bson.ObjectId `bson:"_id"`
Platform string //平台
SnId int32 //玩家id
LogType int32 //记录类型 0.获取 1.消耗
ItemId int32 //道具id
ItemName string //道具名称
Count int64 //个数
CreateTs int64 //记录时间
Remark string //备注
TypeId int32 // 变化类型
GameId int32 // 游戏id,游戏中获得时有值
GameFreeId int32 // 场次id,游戏中获得时有值
Cost []*Item // 消耗的道具
Id string // 撤销的id兑换失败
RoomConfigId int32 // 房间配置id
}
func NewItemLog() *ItemLog {
@ -36,18 +37,19 @@ func NewItemLog() *ItemLog {
}
type ItemParam struct {
Platform string // 平台
SnId int32 // 玩家id
LogType int32 // 记录类型 0.获取 1.消耗
ItemId int32 // 道具id
ItemName string // 道具名称
Count int64 // 个数
Remark string // 备注
TypeId int32 // 变化类型
GameId int64 // 游戏id,游戏中获得时有值
GameFreeId int64 // 场次id,游戏中获得时有值
Cost []*ItemInfo // 消耗的道具
LogId string // 撤销的id兑换失败
Platform string // 平台
SnId int32 // 玩家id
LogType int32 // 记录类型 0.获取 1.消耗
ItemId int32 // 道具id
ItemName string // 道具名称
Count int64 // 个数
Remark string // 备注
TypeId int32 // 变化类型
GameId int64 // 游戏id,游戏中获得时有值
GameFreeId int64 // 场次id,游戏中获得时有值
Cost []*Item // 消耗的道具
LogId string // 撤销的id兑换失败
RoomConfigId int32 // 房间配置id
}
func NewItemLogEx(param ItemParam) *ItemLog {
@ -65,6 +67,7 @@ func NewItemLogEx(param ItemParam) *ItemLog {
itemLog.GameFreeId = int32(param.GameFreeId)
itemLog.Cost = param.Cost
itemLog.Id = param.LogId
itemLog.RoomConfigId = param.RoomConfigId
return itemLog
}

View File

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

View File

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

56
model/playergamedata.go Normal file
View File

@ -0,0 +1,56 @@
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,4 +23,5 @@ const (
const (
DBVipGiftLog = "db_vipgift"
DBCustomLog = "db_customlog" // 房卡场对局记录
)

View File

@ -24,40 +24,55 @@ const (
type CLAWDOLLPacketID int32
const (
CLAWDOLLPacketID_PACKET_CLAWDOLL_ZERO CLAWDOLLPacketID = 0 //弃用消息号
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMINFO CLAWDOLLPacketID = 5601 //房间信息
CLAWDOLLPacketID_PACKET_CS_CLAWDOLL_PLAYEROP CLAWDOLLPacketID = 5602 //玩家操作(客户->服务)
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYEROP CLAWDOLLPacketID = 5603 //玩家操作(服务->客户)
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_ROOMSTATE CLAWDOLLPacketID = 5604 //房间状态
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_GAMEBILLED CLAWDOLLPacketID = 5605 //游戏结算
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开
CLAWDOLLPacketID_PACKET_SC_CLAWDOLL_PLAYERINFO CLAWDOLLPacketID = 5608 // 玩家状态信息变化
CLAWDOLLPacketID_PACKET_ZERO CLAWDOLLPacketID = 0 //弃用消息号
CLAWDOLLPacketID_PACKET_SC_ROOMINFO CLAWDOLLPacketID = 5601 //房间信息
CLAWDOLLPacketID_PACKET_CS_PLAYEROP CLAWDOLLPacketID = 5602 //玩家操作(客户->服务)
CLAWDOLLPacketID_PACKET_SC_PLAYEROP CLAWDOLLPacketID = 5603 //玩家操作(服务->客户)
CLAWDOLLPacketID_PACKET_SC_ROOMSTATE CLAWDOLLPacketID = 5604 //房间状态
CLAWDOLLPacketID_PACKET_SC_GAMEBILLED CLAWDOLLPacketID = 5605 //游戏结算
CLAWDOLLPacketID_PACKET_SC_PlayerEnter CLAWDOLLPacketID = 5606 // 玩家进入
CLAWDOLLPacketID_PACKET_SC_PlayerLeave CLAWDOLLPacketID = 5607 // 玩家离开
CLAWDOLLPacketID_PACKET_SC_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.
var (
CLAWDOLLPacketID_name = map[int32]string{
0: "PACKET_CLAWDOLL_ZERO",
5601: "PACKET_SC_CLAWDOLL_ROOMINFO",
5602: "PACKET_CS_CLAWDOLL_PLAYEROP",
5603: "PACKET_SC_CLAWDOLL_PLAYEROP",
5604: "PACKET_SC_CLAWDOLL_ROOMSTATE",
5605: "PACKET_SC_CLAWDOLL_GAMEBILLED",
5606: "PACKET_SC_CLAWDOLL_PlayerEnter",
5607: "PACKET_SC_CLAWDOLL_PlayerLeave",
5608: "PACKET_SC_CLAWDOLL_PLAYERINFO",
0: "PACKET_ZERO",
5601: "PACKET_SC_ROOMINFO",
5602: "PACKET_CS_PLAYEROP",
5603: "PACKET_SC_PLAYEROP",
5604: "PACKET_SC_ROOMSTATE",
5605: "PACKET_SC_GAMEBILLED",
5606: "PACKET_SC_PlayerEnter",
5607: "PACKET_SC_PlayerLeave",
5608: "PACKET_SC_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{
"PACKET_CLAWDOLL_ZERO": 0,
"PACKET_SC_CLAWDOLL_ROOMINFO": 5601,
"PACKET_CS_CLAWDOLL_PLAYEROP": 5602,
"PACKET_SC_CLAWDOLL_PLAYEROP": 5603,
"PACKET_SC_CLAWDOLL_ROOMSTATE": 5604,
"PACKET_SC_CLAWDOLL_GAMEBILLED": 5605,
"PACKET_SC_CLAWDOLL_PlayerEnter": 5606,
"PACKET_SC_CLAWDOLL_PlayerLeave": 5607,
"PACKET_SC_CLAWDOLL_PLAYERINFO": 5608,
"PACKET_ZERO": 0,
"PACKET_SC_ROOMINFO": 5601,
"PACKET_CS_PLAYEROP": 5602,
"PACKET_SC_PLAYEROP": 5603,
"PACKET_SC_ROOMSTATE": 5604,
"PACKET_SC_GAMEBILLED": 5605,
"PACKET_SC_PlayerEnter": 5606,
"PACKET_SC_PlayerLeave": 5607,
"PACKET_SC_PLAYERINFO": 5608,
"PACKET_CS_GETTOKEN": 5609,
"PACKET_SC_SENDTOKEN": 5610,
"PACKET_CS_WAITPLAYERS": 5611,
"PACKET_SC_WAITPLAYERS": 5612,
"PACKET_SC_PLAYINGINFO": 5613,
}
)
@ -146,15 +161,16 @@ type CLAWDOLLPlayerData struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` //名字
SnId int32 `protobuf:"varint,2,opt,name=SnId,proto3" json:"SnId,omitempty"` //账号
Head int32 `protobuf:"varint,3,opt,name=Head,proto3" json:"Head,omitempty"` //头像
Sex int32 `protobuf:"varint,4,opt,name=Sex,proto3" json:"Sex,omitempty"` //性别
Coin int64 `protobuf:"varint,5,opt,name=Coin,proto3" json:"Coin,omitempty"` //金币
HeadOutLine int32 `protobuf:"varint,6,opt,name=HeadOutLine,proto3" json:"HeadOutLine,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:已准备)
WinCoin int64 `protobuf:"varint,9,opt,name=WinCoin,proto3" json:"WinCoin,omitempty"` // 本局赢分
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` //名字
SnId int32 `protobuf:"varint,2,opt,name=SnId,proto3" json:"SnId,omitempty"` //账号
Head int32 `protobuf:"varint,3,opt,name=Head,proto3" json:"Head,omitempty"` //头像
Sex int32 `protobuf:"varint,4,opt,name=Sex,proto3" json:"Sex,omitempty"` //性别
Coin int64 `protobuf:"varint,5,opt,name=Coin,proto3" json:"Coin,omitempty"` //金币
HeadOutLine int32 `protobuf:"varint,6,opt,name=HeadOutLine,proto3" json:"HeadOutLine,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:已准备)
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() {
@ -252,6 +268,13 @@ func (x *CLAWDOLLPlayerData) GetWinCoin() int64 {
return 0
}
func (x *CLAWDOLLPlayerData) GetClawDollState() int32 {
if x != nil {
return x.ClawDollState
}
return 0
}
//房间信息
type SCCLAWDOLLRoomInfo struct {
state protoimpl.MessageState
@ -394,8 +417,8 @@ type CSCLAWDOLLOp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"`
OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` //操作码 1:上分 投币 2:下抓 3:玩家操控动作
Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"` //操作参数 1:无
}
func (x *CSCLAWDOLLOp) Reset() {
@ -522,8 +545,8 @@ type SCCLAWDOLLRoundGameBilled struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
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"` //抓取结果
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抓住娃娃
Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额
Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额
}
@ -650,9 +673,10 @@ type SCCLAWDOLLPlayerInfo struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //玩家ID
GainCoin int64 `protobuf:"varint,2,opt,name=gainCoin,proto3" json:"gainCoin,omitempty"` //本局赢取
Coin int64 `protobuf:"varint,3,opt,name=Coin,proto3" json:"Coin,omitempty"` // 玩家
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,3,opt,name=gainCoin,proto3" json:"gainCoin,omitempty"` // 本局赢取
Coin int64 `protobuf:"varint,4,opt,name=Coin,proto3" json:"Coin,omitempty"` // 玩家
}
func (x *SCCLAWDOLLPlayerInfo) Reset() {
@ -694,6 +718,13 @@ func (x *SCCLAWDOLLPlayerInfo) GetSnId() int32 {
return 0
}
func (x *SCCLAWDOLLPlayerInfo) GetClawDollState() int32 {
if x != nil {
return x.ClawDollState
}
return 0
}
func (x *SCCLAWDOLLPlayerInfo) GetGainCoin() int64 {
if x != nil {
return x.GainCoin
@ -715,7 +746,7 @@ type SCCLAWDOLLPlayerEnter struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *CLAWDOLLPlayerData `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"`
Data *CLAWDOLLPlayerDigestInfo `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"`
}
func (x *SCCLAWDOLLPlayerEnter) Reset() {
@ -750,7 +781,7 @@ func (*SCCLAWDOLLPlayerEnter) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{7}
}
func (x *SCCLAWDOLLPlayerEnter) GetData() *CLAWDOLLPlayerData {
func (x *SCCLAWDOLLPlayerEnter) GetData() *CLAWDOLLPlayerDigestInfo {
if x != nil {
return x.Data
}
@ -764,7 +795,7 @@ type SCCLAWDOLLPlayerLeave struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Pos int32 `protobuf:"varint,1,opt,name=Pos,proto3" json:"Pos,omitempty"` //玩家位置
SnId int32 `protobuf:"varint,1,opt,name=SnId,proto3" json:"SnId,omitempty"` //玩家id
}
func (x *SCCLAWDOLLPlayerLeave) Reset() {
@ -799,9 +830,246 @@ func (*SCCLAWDOLLPlayerLeave) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{8}
}
func (x *SCCLAWDOLLPlayerLeave) GetPos() int32 {
func (x *SCCLAWDOLLPlayerLeave) GetSnId() int32 {
if x != nil {
return x.Pos
return x.SnId
}
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
}
@ -810,7 +1078,7 @@ var File_clawdoll_proto protoreflect.FileDescriptor
var file_clawdoll_proto_rawDesc = []byte{
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, 0xd8, 0x01, 0x0a, 0x12, 0x43,
0x12, 0x08, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x22, 0xfe, 0x01, 0x0a, 0x12, 0x43,
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,
0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20,
@ -824,99 +1092,131 @@ var file_clawdoll_proto_rawDesc = []byte{
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,
0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x57, 0x69,
0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x22, 0xf6, 0x02, 0x0a, 0x12, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57,
0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06,
0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x52, 0x6f,
0x6f, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75,
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74,
0x12, 0x36, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x1c, 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, 0x61, 0x74, 0x61, 0x52,
0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61,
0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x54,
0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f,
0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75,
0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78,
0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x78,
0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x18, 0x0f,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x65, 0x65, 0x49, 0x64,
0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x10, 0x20,
0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x3e,
0x0a, 0x0c, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x16,
0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x88,
0x01, 0x0a, 0x0c, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12,
0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53,
0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c,
0x6c, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x09,
0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x19, 0x53, 0x43,
0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x61, 0x6d,
0x65, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49,
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x73, 0x75, 0x6c,
0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x52, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e,
0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
0x65, 0x22, 0x43, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52,
0x6f, 0x6f, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x02, 0x52, 0x06,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5a, 0x0a, 0x14, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57,
0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6c, 0x61, 0x77, 0x44, 0x6f, 0x6c,
0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x63, 0x6c,
0x61, 0x77, 0x44, 0x6f, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xf6, 0x02, 0x0a, 0x12,
0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e,
0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x61,
0x6d, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x47, 0x61, 0x6d, 0x65,
0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x52, 0x6f, 0x6f, 0x6d, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16,
0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07,
0x54, 0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x54,
0x69, 0x6d, 0x65, 0x4f, 0x75, 0x74, 0x12, 0x36, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 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, 0x61, 0x74, 0x61, 0x52, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x20,
0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x08, 0x20,
0x01, 0x28, 0x05, 0x52, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x12, 0x18, 0x0a, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28,
0x05, 0x52, 0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x73, 0x45, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x72,
0x65, 0x65, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x47, 0x61, 0x6d, 0x65,
0x46, 0x72, 0x65, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53, 0x63,
0x6f, 0x72, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x42, 0x61, 0x73, 0x65, 0x53,
0x63, 0x6f, 0x72, 0x65, 0x22, 0x3e, 0x0a, 0x0c, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f,
0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x73, 0x22, 0x88, 0x01, 0x0a, 0x0c, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44,
0x4f, 0x4c, 0x4c, 0x4f, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x43,
0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x70, 0x43, 0x6f, 0x64,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
0x03, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x34, 0x0a, 0x09, 0x4f, 0x70, 0x52,
0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x63,
0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
0x43, 0x6f, 0x64, 0x65, 0x52, 0x09, 0x4f, 0x70, 0x52, 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22,
0x85, 0x01, 0x0a, 0x19, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f,
0x75, 0x6e, 0x64, 0x47, 0x61, 0x6d, 0x65, 0x42, 0x69, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x52, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x6f, 0x77, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x43, 0x6c, 0x6f,
0x77, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x77, 0x61, 0x72, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07,
0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x43, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41,
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x52, 0x6f, 0x6f, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14,
0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53,
0x74, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02,
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,
0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x02,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x67, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x43, 0x6f,
0x69, 0x6e, 0x22, 0x49, 0x0a, 0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x04, 0x44,
0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 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, 0x61, 0x74, 0x61, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x29, 0x0a,
0x15, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x50, 0x6f, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x03, 0x50, 0x6f, 0x73, 0x2a, 0xc7, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41,
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a,
0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x52, 0x4f,
0x4f, 0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f,
0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, 0x20, 0x0a, 0x1b, 0x50,
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c,
0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x21, 0x0a,
0x1c, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44,
0x4f, 0x4c, 0x4c, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xe4, 0x2b,
0x12, 0x22, 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c,
0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45,
0x44, 0x10, 0xe5, 0x2b, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65,
0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x5f,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x22,
0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x4c, 0x41, 0x57,
0x44, 0x4f, 0x4c, 0x4c, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10,
0xe8, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f,
0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72,
0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69,
0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16,
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x50,
0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, 0x26, 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, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f,
0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72,
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c,
0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x53, 0x74, 0x61, 0x74, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41,
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a,
0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17,
0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d,
0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b,
0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c,
0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45,
0x10, 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a,
0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65,
0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8,
0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47,
0x45, 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45,
0x4e, 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43,
0x53, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b,
0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41,
0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15,
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e,
0x47, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43,
0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50,
0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50,
0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68,
0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c,
0x52, 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28,
0x5a, 0x26, 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,
0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -932,7 +1232,7 @@ func file_clawdoll_proto_rawDescGZIP() []byte {
}
var file_clawdoll_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_clawdoll_proto_goTypes = []interface{}{
(CLAWDOLLPacketID)(0), // 0: clawdoll.CLAWDOLLPacketID
(OpResultCode)(0), // 1: clawdoll.OpResultCode
@ -945,16 +1245,21 @@ var file_clawdoll_proto_goTypes = []interface{}{
(*SCCLAWDOLLPlayerInfo)(nil), // 8: clawdoll.SCCLAWDOLLPlayerInfo
(*SCCLAWDOLLPlayerEnter)(nil), // 9: clawdoll.SCCLAWDOLLPlayerEnter
(*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{
2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData
1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode
2, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerData
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData
1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode
14, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo
14, // 3: clawdoll.CLAWDOLLWaitPlayers.WaitPlayersInfo:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_clawdoll_proto_init() }
@ -1071,6 +1376,54 @@ func file_clawdoll_proto_init() {
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{}
out := protoimpl.TypeBuilder{
@ -1078,7 +1431,7 @@ func file_clawdoll_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_clawdoll_proto_rawDesc,
NumEnums: 2,
NumMessages: 9,
NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
},

View File

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

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