protocol.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. package fishcommon
  2. import (
  3. "bet24.com/servers/games/fish/fish"
  4. )
  5. const (
  6. PING = "ping"
  7. LOGIN = "login"
  8. JOIN = "join"
  9. CHANGE_TABLE = "change_table"
  10. EXIT = "exit"
  11. USER_ENTER = "user_enter"
  12. USER_EXIT = "user_exit"
  13. GAME_SCENE = "game_scene"
  14. ADD_BULLET = "add_bullet"
  15. BULLET_FAILED = "bullet_failed"
  16. ADD_FISH = "add_fish"
  17. CATCH_FISH = "catch_fish"
  18. CATCH_FAILED = "catch_failed"
  19. SET_BULLET = "user_set_bullet"
  20. SET_CANNON = "user_set_cannon"
  21. UPDATE_USER_INFO = "update_user_info"
  22. USE_ITEM = "use_item"
  23. USE_ITEM_FAILED = "use_item_failed"
  24. EFFECTING = "effecting" // 广播全局道具状态,这里为空,表示取消状态
  25. BATCH_CATCH = "batch_catch" // 范围攻击,主动使用道具或者击中特殊鱼产生
  26. SPECIAL_CATCH = "special_catch" // 触发特殊鱼后,可以使用特殊攻击
  27. SPECIAL_CATCH_END = "special_catch_end" // 特效结束
  28. SPECIAL_SHOOT = "special_shoot" // 特殊鱼发射
  29. // 服务器下发的配置
  30. CONFIG_BULLET = "conf_bullet"
  31. CONFIG_FISH = "conf_fish"
  32. CONFIG_ROUTE = "conf_route"
  33. GROUP_COME = "group_come" // 鱼群来了
  34. ITEM_REFRESH = "item_refresh"
  35. UPGRADE_BULLET = "upgrade_bullet" // 升级子弹倍数
  36. POOL_VALUE = "pool_value"
  37. POOL_DRAW = "pool_draw"
  38. POOL_ENERGY = "pool_energy"
  39. IDLE_KICK = "idle_kick"
  40. )
  41. type GameScene_User struct {
  42. UserId int
  43. CannonId int
  44. Bullet int
  45. }
  46. type GameScene struct {
  47. RoomID int
  48. BossAfter int // 还有多少秒刷Boss,小于等于0不显示
  49. Users []GameScene_User
  50. Fishes []*fish.Fish
  51. Effecting []int // 当前效果
  52. }
  53. type AddBullet struct {
  54. BulletID int // 子弹类型
  55. FishKey int // 是否瞄准
  56. Angle int // 角度
  57. ClientID int // 客户端ID,失败时自行删除
  58. }
  59. type CatchFish struct {
  60. BulletKey int
  61. FishKey int
  62. }
  63. // 使用特殊鱼的效果捕获
  64. type SpecialCatch struct {
  65. OriginFishKey int // 获得炮弹的鱼的fishkey或道具ID
  66. TargetFishKeys []int // 目标鱼的fishkey
  67. }
  68. type SpecialCatchEnd struct {
  69. OriginFishKey int // 获得炮弹的鱼的fishkey或道具ID
  70. UserId int // 用户ID,下行才有
  71. TotalEarn int // 总共获取的金币数量,下行才有
  72. }
  73. type CatchFishFailed struct {
  74. CatchFish
  75. BulletID int
  76. }
  77. type CatchFishRet struct {
  78. CatchFish
  79. IsCatch bool // 是否击落
  80. Coin int // 奖励
  81. UserId int
  82. BulletID int
  83. SlotMultiple int `json:",omitempty"` // 如果击中slot鱼,会产生一个倍数奖励
  84. ItemId int `json:",omitempty"` // 如果产生道具
  85. ItemCount int `json:",omitempty"` // 如果产生道具
  86. PrizeWheelItemId int `json:",omitempty"` // 如果击中转盘鱼,产生转盘的结果
  87. PrizeWheelItemCount int `json:",omitempty"` // 如果击中转盘鱼,产生转盘的结果
  88. }
  89. type SetBullet struct {
  90. BulletID int
  91. }
  92. type SetCannon struct {
  93. Cannon int
  94. }
  95. type UpdateUserInfo struct {
  96. UserId int
  97. Gold int
  98. BulletID int
  99. Cannon int
  100. Essence int
  101. }
  102. // 当存入时,不需要加密码
  103. type BankOperation struct {
  104. Amount int
  105. Password string
  106. }
  107. type BankOpeReturn struct {
  108. CashAmount int
  109. BankAmount int
  110. Errmsg string
  111. }
  112. /*
  113. 使用道具
  114. use_item
  115. 上下行: UseItem 上行不需要传UserId
  116. */
  117. type UseItem struct {
  118. UserId int // 上行不用填
  119. ItemId int
  120. }
  121. /*
  122. 使用道具失败
  123. use_item_failed
  124. 下行: 失败原因
  125. */
  126. type UseItemFailed struct {
  127. ItemId int
  128. ErrMsg string
  129. }
  130. /*
  131. 房间效果广播
  132. effecting
  133. 广播全局道具状态,这里为空,表示取消状态
  134. []int,可以有多个效果同时生效
  135. 场景数据添加
  136. Effecting []int // 当前效果
  137. */
  138. type UpgradeBullet_resp struct {
  139. Succeeded bool
  140. ErrorMsg string
  141. }
  142. type PrizePoolDraw_resp struct {
  143. UserId int // 谁中奖了
  144. Pool int // 奖池剩余数量
  145. Bingo bool // 是否中奖
  146. Point int // 如果中奖,则为奖金,如果不中,则为能量点
  147. }