requests.hrl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. -include("basic_types.hrl").
  2. -include("types.hrl").
  3. -record(session_attach, {
  4. token :: string() %% shared secret, stored in auth_server
  5. }).
  6. -record(session_attach_debug, {
  7. token :: string(), %% shared secret, stored in auth_server
  8. id :: string()
  9. }).
  10. -record(login, {
  11. username :: string(),
  12. password :: string()
  13. }).
  14. -record(logout, {}).
  15. -record(join_game, {
  16. game :: 'GameId'()
  17. }).
  18. -record(rematch, {
  19. game :: 'GameId'()
  20. }).
  21. -record(get_game_info, {
  22. game :: 'GameId'()
  23. }).
  24. -record(get_player_info, {
  25. player_id :: 'PlayerId'() | 0 %% 0 stands for currently logged in user
  26. }).
  27. -record(get_player_stats, {
  28. player_id :: 'PlayerId'() | 0, %% 0 stands for currently logged in user
  29. game_type :: binary()
  30. }).
  31. -record(subscribe_player_rels, {
  32. players :: list()
  33. }).
  34. -record(unsubscribe_player_rels, {
  35. players :: list()
  36. }).
  37. -record(chat, {
  38. chat_id :: 'GameId'(),
  39. message :: string()
  40. }).
  41. -record(game_action, {
  42. game :: 'GameId'(),
  43. action :: any(),
  44. args = [] :: proplist()
  45. }).
  46. %%%
  47. %%% Events, passed via #KakaMessage
  48. %%%
  49. -record(game_event, {
  50. game :: 'GameId'(),
  51. event :: any(),
  52. args = [] :: proplist()
  53. }).
  54. -record(dummy_player_change, {
  55. player :: 'PlayerId'()
  56. }).
  57. -record(chat_msg, {
  58. chat :: 'GameId'(),
  59. content :: string(),
  60. author_id :: 'PlayerId'(),
  61. author_nick :: string()
  62. }).
  63. -record(social_action, {
  64. game :: 'GameId'(),
  65. type :: 'SocialActionEnum'(),
  66. recipient :: 'PlayerId'() | null
  67. }).
  68. -record(social_action_msg, {
  69. type :: 'SocialActionEnum'(),
  70. game :: 'GameId'(),
  71. initiator :: 'PlayerId'(),
  72. recipient :: 'PlayerId'() | null
  73. }).
  74. -record(pause_game, {
  75. table_id :: integer(),
  76. game :: 'GameId'(),
  77. action :: string()
  78. }).
  79. -record(game_paused, {
  80. table_id :: integer(),
  81. game :: 'GameId'(),
  82. action :: string(),
  83. who :: 'PlayerId'(),
  84. retries :: integer()
  85. }).
  86. -record(disconnect, {
  87. reason_id = null :: null | string(),
  88. reason = null :: null | string()
  89. }).
  90. %% packet as game_event:
  91. -record(player_left, {
  92. player :: 'PlayerId'(),
  93. bot_replaced = false :: boolean(), %% will be replaced by bot?
  94. human_replaced = false :: boolean(), %% will be replaced by human?
  95. replacement = null :: 'PlayerId'() | null %% id of replacement player/bot
  96. }).
  97. -record('TableInfo', {
  98. chat = [] :: list(any()),
  99. viewers = [] :: list('PlayerId'()),
  100. players = [] :: list('PlayerId'()),
  101. game :: atom(),
  102. game_status :: atom()
  103. }).