@takaro/modules 0.0.0-next.0da151e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/README.md +3 -0
  2. package/dist/BuiltinModule.d.ts +62 -0
  3. package/dist/BuiltinModule.d.ts.map +1 -0
  4. package/dist/BuiltinModule.js +245 -0
  5. package/dist/BuiltinModule.js.map +1 -0
  6. package/dist/community-modules.json +21 -0
  7. package/dist/dto/base.d.ts +7 -0
  8. package/dist/dto/base.d.ts.map +1 -0
  9. package/dist/dto/base.js +28 -0
  10. package/dist/dto/base.js.map +1 -0
  11. package/dist/dto/discordEvents.d.ts +32 -0
  12. package/dist/dto/discordEvents.d.ts.map +1 -0
  13. package/dist/dto/discordEvents.js +92 -0
  14. package/dist/dto/discordEvents.js.map +1 -0
  15. package/dist/dto/gameEvents.d.ts +83 -0
  16. package/dist/dto/gameEvents.d.ts.map +1 -0
  17. package/dist/dto/gameEvents.js +205 -0
  18. package/dist/dto/gameEvents.js.map +1 -0
  19. package/dist/dto/index.d.ts +54 -0
  20. package/dist/dto/index.d.ts.map +1 -0
  21. package/dist/dto/index.js +18 -0
  22. package/dist/dto/index.js.map +1 -0
  23. package/dist/dto/takaroEvents.d.ts +276 -0
  24. package/dist/dto/takaroEvents.d.ts.map +1 -0
  25. package/dist/dto/takaroEvents.js +794 -0
  26. package/dist/dto/takaroEvents.js.map +1 -0
  27. package/dist/main.d.ts +5 -0
  28. package/dist/main.d.ts.map +1 -0
  29. package/dist/main.js +35 -0
  30. package/dist/main.js.map +1 -0
  31. package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +2 -0
  32. package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts.map +1 -0
  33. package/dist/modules/chatBridge/hooks/DiscordToGame.js +18 -0
  34. package/dist/modules/chatBridge/hooks/DiscordToGame.js.map +1 -0
  35. package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +2 -0
  36. package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts.map +1 -0
  37. package/dist/modules/chatBridge/hooks/GameToDiscord.js +14 -0
  38. package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -0
  39. package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +2 -0
  40. package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts.map +1 -0
  41. package/dist/modules/chatBridge/hooks/PlayerConnected.js +9 -0
  42. package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -0
  43. package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +2 -0
  44. package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts.map +1 -0
  45. package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +9 -0
  46. package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -0
  47. package/dist/modules/chatBridge/index.d.ts +5 -0
  48. package/dist/modules/chatBridge/index.d.ts.map +1 -0
  49. package/dist/modules/chatBridge/index.js +64 -0
  50. package/dist/modules/chatBridge/index.js.map +1 -0
  51. package/dist/modules/dailyRewards/commands/daily.d.ts +2 -0
  52. package/dist/modules/dailyRewards/commands/daily.d.ts.map +1 -0
  53. package/dist/modules/dailyRewards/commands/daily.js +103 -0
  54. package/dist/modules/dailyRewards/commands/daily.js.map +1 -0
  55. package/dist/modules/dailyRewards/commands/streak.d.ts +2 -0
  56. package/dist/modules/dailyRewards/commands/streak.d.ts.map +1 -0
  57. package/dist/modules/dailyRewards/commands/streak.js +34 -0
  58. package/dist/modules/dailyRewards/commands/streak.js.map +1 -0
  59. package/dist/modules/dailyRewards/commands/topstreak.d.ts +2 -0
  60. package/dist/modules/dailyRewards/commands/topstreak.d.ts.map +1 -0
  61. package/dist/modules/dailyRewards/commands/topstreak.js +44 -0
  62. package/dist/modules/dailyRewards/commands/topstreak.js.map +1 -0
  63. package/dist/modules/dailyRewards/functions/utils.d.ts +6 -0
  64. package/dist/modules/dailyRewards/functions/utils.d.ts.map +1 -0
  65. package/dist/modules/dailyRewards/functions/utils.js +32 -0
  66. package/dist/modules/dailyRewards/functions/utils.js.map +1 -0
  67. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts +2 -0
  68. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts.map +1 -0
  69. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js +19 -0
  70. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js.map +1 -0
  71. package/dist/modules/dailyRewards/index.d.ts +5 -0
  72. package/dist/modules/dailyRewards/index.d.ts.map +1 -0
  73. package/dist/modules/dailyRewards/index.js +127 -0
  74. package/dist/modules/dailyRewards/index.js.map +1 -0
  75. package/dist/modules/economyUtils/commands/balance.d.ts +2 -0
  76. package/dist/modules/economyUtils/commands/balance.d.ts.map +1 -0
  77. package/dist/modules/economyUtils/commands/balance.js +7 -0
  78. package/dist/modules/economyUtils/commands/balance.js.map +1 -0
  79. package/dist/modules/economyUtils/commands/claim.d.ts +2 -0
  80. package/dist/modules/economyUtils/commands/claim.d.ts.map +1 -0
  81. package/dist/modules/economyUtils/commands/claim.js +35 -0
  82. package/dist/modules/economyUtils/commands/claim.js.map +1 -0
  83. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +2 -0
  84. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts.map +1 -0
  85. package/dist/modules/economyUtils/commands/confirmTransfer.js +38 -0
  86. package/dist/modules/economyUtils/commands/confirmTransfer.js.map +1 -0
  87. package/dist/modules/economyUtils/commands/grantCurrency.d.ts +2 -0
  88. package/dist/modules/economyUtils/commands/grantCurrency.d.ts.map +1 -0
  89. package/dist/modules/economyUtils/commands/grantCurrency.js +28 -0
  90. package/dist/modules/economyUtils/commands/grantCurrency.js.map +1 -0
  91. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +2 -0
  92. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts.map +1 -0
  93. package/dist/modules/economyUtils/commands/revokeCurrency.js +28 -0
  94. package/dist/modules/economyUtils/commands/revokeCurrency.js.map +1 -0
  95. package/dist/modules/economyUtils/commands/shop.d.ts +2 -0
  96. package/dist/modules/economyUtils/commands/shop.d.ts.map +1 -0
  97. package/dist/modules/economyUtils/commands/shop.js +69 -0
  98. package/dist/modules/economyUtils/commands/shop.js.map +1 -0
  99. package/dist/modules/economyUtils/commands/topCurrency.d.ts +2 -0
  100. package/dist/modules/economyUtils/commands/topCurrency.d.ts.map +1 -0
  101. package/dist/modules/economyUtils/commands/topCurrency.js +22 -0
  102. package/dist/modules/economyUtils/commands/topCurrency.js.map +1 -0
  103. package/dist/modules/economyUtils/commands/transfer.d.ts +2 -0
  104. package/dist/modules/economyUtils/commands/transfer.d.ts.map +1 -0
  105. package/dist/modules/economyUtils/commands/transfer.js +55 -0
  106. package/dist/modules/economyUtils/commands/transfer.js.map +1 -0
  107. package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts +2 -0
  108. package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts.map +1 -0
  109. package/dist/modules/economyUtils/cronJobs/zombieKillReward.js +66 -0
  110. package/dist/modules/economyUtils/cronJobs/zombieKillReward.js.map +1 -0
  111. package/dist/modules/economyUtils/index.d.ts +5 -0
  112. package/dist/modules/economyUtils/index.d.ts.map +1 -0
  113. package/dist/modules/economyUtils/index.js +192 -0
  114. package/dist/modules/economyUtils/index.js.map +1 -0
  115. package/dist/modules/geoBlock/hooks/IPDetected.d.ts +2 -0
  116. package/dist/modules/geoBlock/hooks/IPDetected.d.ts.map +1 -0
  117. package/dist/modules/geoBlock/hooks/IPDetected.js +50 -0
  118. package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -0
  119. package/dist/modules/geoBlock/index.d.ts +9 -0
  120. package/dist/modules/geoBlock/index.d.ts.map +1 -0
  121. package/dist/modules/geoBlock/index.js +329 -0
  122. package/dist/modules/geoBlock/index.js.map +1 -0
  123. package/dist/modules/gimme/commands/gimme.d.ts +2 -0
  124. package/dist/modules/gimme/commands/gimme.d.ts.map +1 -0
  125. package/dist/modules/gimme/commands/gimme.js +25 -0
  126. package/dist/modules/gimme/commands/gimme.js.map +1 -0
  127. package/dist/modules/gimme/index.d.ts +5 -0
  128. package/dist/modules/gimme/index.d.ts.map +1 -0
  129. package/dist/modules/gimme/index.js +75 -0
  130. package/dist/modules/gimme/index.js.map +1 -0
  131. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +2 -0
  132. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts.map +1 -0
  133. package/dist/modules/highPingKicker/cronJobs/Ping check.js +59 -0
  134. package/dist/modules/highPingKicker/cronJobs/Ping check.js.map +1 -0
  135. package/dist/modules/highPingKicker/index.d.ts +5 -0
  136. package/dist/modules/highPingKicker/index.d.ts.map +1 -0
  137. package/dist/modules/highPingKicker/index.js +44 -0
  138. package/dist/modules/highPingKicker/index.js.map +1 -0
  139. package/dist/modules/lottery/commands/buyTicket.d.ts +2 -0
  140. package/dist/modules/lottery/commands/buyTicket.d.ts.map +1 -0
  141. package/dist/modules/lottery/commands/buyTicket.js +51 -0
  142. package/dist/modules/lottery/commands/buyTicket.js.map +1 -0
  143. package/dist/modules/lottery/commands/nextDraw.d.ts +2 -0
  144. package/dist/modules/lottery/commands/nextDraw.d.ts.map +1 -0
  145. package/dist/modules/lottery/commands/nextDraw.js +34 -0
  146. package/dist/modules/lottery/commands/nextDraw.js.map +1 -0
  147. package/dist/modules/lottery/commands/viewTickets.d.ts +2 -0
  148. package/dist/modules/lottery/commands/viewTickets.d.ts.map +1 -0
  149. package/dist/modules/lottery/commands/viewTickets.js +20 -0
  150. package/dist/modules/lottery/commands/viewTickets.js.map +1 -0
  151. package/dist/modules/lottery/cronJobs/drawLottery.d.ts +2 -0
  152. package/dist/modules/lottery/cronJobs/drawLottery.d.ts.map +1 -0
  153. package/dist/modules/lottery/cronJobs/drawLottery.js +96 -0
  154. package/dist/modules/lottery/cronJobs/drawLottery.js.map +1 -0
  155. package/dist/modules/lottery/index.d.ts +5 -0
  156. package/dist/modules/lottery/index.d.ts.map +1 -0
  157. package/dist/modules/lottery/index.js +85 -0
  158. package/dist/modules/lottery/index.js.map +1 -0
  159. package/dist/modules/playerOnboarding/commands/starterkit.d.ts +2 -0
  160. package/dist/modules/playerOnboarding/commands/starterkit.d.ts.map +1 -0
  161. package/dist/modules/playerOnboarding/commands/starterkit.js +47 -0
  162. package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -0
  163. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +2 -0
  164. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts.map +1 -0
  165. package/dist/modules/playerOnboarding/hooks/playerConnected.js +11 -0
  166. package/dist/modules/playerOnboarding/hooks/playerConnected.js.map +1 -0
  167. package/dist/modules/playerOnboarding/index.d.ts +5 -0
  168. package/dist/modules/playerOnboarding/index.d.ts.map +1 -0
  169. package/dist/modules/playerOnboarding/index.js +83 -0
  170. package/dist/modules/playerOnboarding/index.js.map +1 -0
  171. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +2 -0
  172. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts.map +1 -0
  173. package/dist/modules/serverMessages/cronJobs/Automated message.js +41 -0
  174. package/dist/modules/serverMessages/cronJobs/Automated message.js.map +1 -0
  175. package/dist/modules/serverMessages/index.d.ts +5 -0
  176. package/dist/modules/serverMessages/index.d.ts.map +1 -0
  177. package/dist/modules/serverMessages/index.js +45 -0
  178. package/dist/modules/serverMessages/index.js.map +1 -0
  179. package/dist/modules/teleports/commands/deletetp.d.ts +2 -0
  180. package/dist/modules/teleports/commands/deletetp.d.ts.map +1 -0
  181. package/dist/modules/teleports/commands/deletetp.js +20 -0
  182. package/dist/modules/teleports/commands/deletetp.js.map +1 -0
  183. package/dist/modules/teleports/commands/deletewaypoint.d.ts +2 -0
  184. package/dist/modules/teleports/commands/deletewaypoint.d.ts.map +1 -0
  185. package/dist/modules/teleports/commands/deletewaypoint.js +20 -0
  186. package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -0
  187. package/dist/modules/teleports/commands/listwaypoints.d.ts +2 -0
  188. package/dist/modules/teleports/commands/listwaypoints.d.ts.map +1 -0
  189. package/dist/modules/teleports/commands/listwaypoints.js +17 -0
  190. package/dist/modules/teleports/commands/listwaypoints.js.map +1 -0
  191. package/dist/modules/teleports/commands/setprivate.d.ts +2 -0
  192. package/dist/modules/teleports/commands/setprivate.d.ts.map +1 -0
  193. package/dist/modules/teleports/commands/setprivate.js +29 -0
  194. package/dist/modules/teleports/commands/setprivate.js.map +1 -0
  195. package/dist/modules/teleports/commands/setpublic.d.ts +2 -0
  196. package/dist/modules/teleports/commands/setpublic.d.ts.map +1 -0
  197. package/dist/modules/teleports/commands/setpublic.js +45 -0
  198. package/dist/modules/teleports/commands/setpublic.js.map +1 -0
  199. package/dist/modules/teleports/commands/settp.d.ts +2 -0
  200. package/dist/modules/teleports/commands/settp.d.ts.map +1 -0
  201. package/dist/modules/teleports/commands/settp.js +40 -0
  202. package/dist/modules/teleports/commands/settp.js.map +1 -0
  203. package/dist/modules/teleports/commands/setwaypoint.d.ts +2 -0
  204. package/dist/modules/teleports/commands/setwaypoint.d.ts.map +1 -0
  205. package/dist/modules/teleports/commands/setwaypoint.js +28 -0
  206. package/dist/modules/teleports/commands/setwaypoint.js.map +1 -0
  207. package/dist/modules/teleports/commands/teleport.d.ts +2 -0
  208. package/dist/modules/teleports/commands/teleport.d.ts.map +1 -0
  209. package/dist/modules/teleports/commands/teleport.js +68 -0
  210. package/dist/modules/teleports/commands/teleport.js.map +1 -0
  211. package/dist/modules/teleports/commands/teleportwaypoint.d.ts +2 -0
  212. package/dist/modules/teleports/commands/teleportwaypoint.d.ts.map +1 -0
  213. package/dist/modules/teleports/commands/teleportwaypoint.js +43 -0
  214. package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -0
  215. package/dist/modules/teleports/commands/tplist.d.ts +2 -0
  216. package/dist/modules/teleports/commands/tplist.d.ts.map +1 -0
  217. package/dist/modules/teleports/commands/tplist.js +46 -0
  218. package/dist/modules/teleports/commands/tplist.js.map +1 -0
  219. package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts +2 -0
  220. package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts.map +1 -0
  221. package/dist/modules/teleports/cronJobs/Waypoint reconciler.js +6 -0
  222. package/dist/modules/teleports/cronJobs/Waypoint reconciler.js.map +1 -0
  223. package/dist/modules/teleports/functions/utils.d.ts +14 -0
  224. package/dist/modules/teleports/functions/utils.d.ts.map +1 -0
  225. package/dist/modules/teleports/functions/utils.js +156 -0
  226. package/dist/modules/teleports/functions/utils.js.map +1 -0
  227. package/dist/modules/teleports/index.d.ts +5 -0
  228. package/dist/modules/teleports/index.d.ts.map +1 -0
  229. package/dist/modules/teleports/index.js +208 -0
  230. package/dist/modules/teleports/index.js.map +1 -0
  231. package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts +2 -0
  232. package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts.map +1 -0
  233. package/dist/modules/timedShutdown/cronJobs/Shutdown.js +7 -0
  234. package/dist/modules/timedShutdown/cronJobs/Shutdown.js.map +1 -0
  235. package/dist/modules/timedShutdown/cronJobs/warning.d.ts +2 -0
  236. package/dist/modules/timedShutdown/cronJobs/warning.d.ts.map +1 -0
  237. package/dist/modules/timedShutdown/cronJobs/warning.js +10 -0
  238. package/dist/modules/timedShutdown/cronJobs/warning.js.map +1 -0
  239. package/dist/modules/timedShutdown/index.d.ts +5 -0
  240. package/dist/modules/timedShutdown/index.d.ts.map +1 -0
  241. package/dist/modules/timedShutdown/index.js +43 -0
  242. package/dist/modules/timedShutdown/index.js.map +1 -0
  243. package/dist/modules/utils/commands/help.d.ts +2 -0
  244. package/dist/modules/utils/commands/help.d.ts.map +1 -0
  245. package/dist/modules/utils/commands/help.js +84 -0
  246. package/dist/modules/utils/commands/help.js.map +1 -0
  247. package/dist/modules/utils/commands/ping.d.ts +2 -0
  248. package/dist/modules/utils/commands/ping.d.ts.map +1 -0
  249. package/dist/modules/utils/commands/ping.js +6 -0
  250. package/dist/modules/utils/commands/ping.js.map +1 -0
  251. package/dist/modules/utils/index.d.ts +5 -0
  252. package/dist/modules/utils/index.d.ts.map +1 -0
  253. package/dist/modules/utils/index.js +52 -0
  254. package/dist/modules/utils/index.js.map +1 -0
  255. package/dist/modules.json +757 -0
  256. package/package.json +17 -0
  257. package/scripts/buildBuiltinJson.ts +81 -0
  258. package/src/BuiltinModule.ts +159 -0
  259. package/src/__tests__/aliases.integration.test.ts +90 -0
  260. package/src/__tests__/bugRepros.integration.test.ts +485 -0
  261. package/src/__tests__/builtinmodule.unit.test.ts +15 -0
  262. package/src/__tests__/commandArgs.integration.test.ts +291 -0
  263. package/src/__tests__/crossServerPlayer.integration.test.ts +176 -0
  264. package/src/__tests__/economy/claim.integration.test.ts +250 -0
  265. package/src/__tests__/economy/economyUtils.integration.test.ts +495 -0
  266. package/src/__tests__/economy/shop.integration.test.ts +177 -0
  267. package/src/__tests__/economy/zombieKillReward.integration.test.ts +293 -0
  268. package/src/__tests__/geoblock.integration.test.ts +322 -0
  269. package/src/__tests__/gimme.integration.test.ts +106 -0
  270. package/src/__tests__/help.integration.test.ts +314 -0
  271. package/src/__tests__/highPingKicker.integration.test.ts +618 -0
  272. package/src/__tests__/lottery.integration.test.ts +344 -0
  273. package/src/__tests__/modulePermission.integration.test.ts +387 -0
  274. package/src/__tests__/onboarding.integration.test.ts +122 -0
  275. package/src/__tests__/ping.integration.test.ts +36 -0
  276. package/src/__tests__/roleExpiry.integration.test.ts +78 -0
  277. package/src/__tests__/serverMessages.integration.test.ts +116 -0
  278. package/src/__tests__/systemConfigCooldown.integration.test.ts +84 -0
  279. package/src/__tests__/systemConfigCost.integration.test.ts +194 -0
  280. package/src/__tests__/teleports/listtp.integration.test.ts +189 -0
  281. package/src/__tests__/teleports/publicteleports.integration.test.ts +345 -0
  282. package/src/__tests__/teleports/teleport.integration.test.ts +153 -0
  283. package/src/__tests__/teleports/tpManagement.integration.test.ts +175 -0
  284. package/src/__tests__/teleports/waypoints.integration.test.ts +832 -0
  285. package/src/community-modules/README.md +5 -0
  286. package/src/community-modules/modules/vote.json +19 -0
  287. package/src/dto/base.ts +13 -0
  288. package/src/dto/discordEvents.ts +69 -0
  289. package/src/dto/gameEvents.ts +159 -0
  290. package/src/dto/index.ts +25 -0
  291. package/src/dto/takaroEvents.ts +525 -0
  292. package/src/main.ts +47 -0
  293. package/src/modules/.eslintrc +5 -0
  294. package/src/modules/chatBridge/hooks/DiscordToGame.js +18 -0
  295. package/src/modules/chatBridge/hooks/GameToDiscord.js +18 -0
  296. package/src/modules/chatBridge/hooks/PlayerConnected.js +11 -0
  297. package/src/modules/chatBridge/hooks/PlayerDisconnected.js +11 -0
  298. package/src/modules/chatBridge/index.ts +64 -0
  299. package/src/modules/dailyRewards/commands/daily.js +114 -0
  300. package/src/modules/dailyRewards/commands/streak.js +42 -0
  301. package/src/modules/dailyRewards/commands/topstreak.js +54 -0
  302. package/src/modules/dailyRewards/functions/utils.js +36 -0
  303. package/src/modules/dailyRewards/hooks/dailyLoginCheck.js +24 -0
  304. package/src/modules/dailyRewards/index.ts +138 -0
  305. package/src/modules/economyUtils/commands/balance.js +8 -0
  306. package/src/modules/economyUtils/commands/claim.js +42 -0
  307. package/src/modules/economyUtils/commands/confirmTransfer.js +55 -0
  308. package/src/modules/economyUtils/commands/grantCurrency.js +34 -0
  309. package/src/modules/economyUtils/commands/revokeCurrency.js +34 -0
  310. package/src/modules/economyUtils/commands/shop.js +87 -0
  311. package/src/modules/economyUtils/commands/topCurrency.js +29 -0
  312. package/src/modules/economyUtils/commands/transfer.js +73 -0
  313. package/src/modules/economyUtils/cronJobs/zombieKillReward.js +82 -0
  314. package/src/modules/economyUtils/index.ts +197 -0
  315. package/src/modules/geoBlock/hooks/IPDetected.js +53 -0
  316. package/src/modules/geoBlock/index.ts +333 -0
  317. package/src/modules/gimme/commands/gimme.js +30 -0
  318. package/src/modules/gimme/index.ts +76 -0
  319. package/src/modules/highPingKicker/cronJobs/Ping check.js +68 -0
  320. package/src/modules/highPingKicker/index.ts +44 -0
  321. package/src/modules/lottery/commands/buyTicket.js +64 -0
  322. package/src/modules/lottery/commands/nextDraw.js +47 -0
  323. package/src/modules/lottery/commands/viewTickets.js +28 -0
  324. package/src/modules/lottery/cronJobs/drawLottery.js +124 -0
  325. package/src/modules/lottery/index.ts +86 -0
  326. package/src/modules/playerOnboarding/commands/starterkit.js +61 -0
  327. package/src/modules/playerOnboarding/hooks/playerConnected.js +14 -0
  328. package/src/modules/playerOnboarding/index.ts +86 -0
  329. package/src/modules/serverMessages/cronJobs/Automated message.js +47 -0
  330. package/src/modules/serverMessages/index.ts +46 -0
  331. package/src/modules/teleports/commands/deletetp.js +25 -0
  332. package/src/modules/teleports/commands/deletewaypoint.js +24 -0
  333. package/src/modules/teleports/commands/listwaypoints.js +23 -0
  334. package/src/modules/teleports/commands/setprivate.js +39 -0
  335. package/src/modules/teleports/commands/setpublic.js +60 -0
  336. package/src/modules/teleports/commands/settp.js +50 -0
  337. package/src/modules/teleports/commands/setwaypoint.js +31 -0
  338. package/src/modules/teleports/commands/teleport.js +84 -0
  339. package/src/modules/teleports/commands/teleportwaypoint.js +57 -0
  340. package/src/modules/teleports/commands/tplist.js +62 -0
  341. package/src/modules/teleports/cronJobs/Waypoint reconciler.js +7 -0
  342. package/src/modules/teleports/functions/utils.js +189 -0
  343. package/src/modules/teleports/index.ts +217 -0
  344. package/src/modules/timedShutdown/cronJobs/Shutdown.js +8 -0
  345. package/src/modules/timedShutdown/cronJobs/warning.js +13 -0
  346. package/src/modules/timedShutdown/index.ts +45 -0
  347. package/src/modules/utils/commands/help.js +100 -0
  348. package/src/modules/utils/commands/ping.js +7 -0
  349. package/src/modules/utils/index.ts +53 -0
  350. package/tsconfig.build.json +10 -0
  351. package/tsconfig.json +9 -0
  352. package/typedoc.json +3 -0
@@ -0,0 +1,832 @@
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
2
+ import { GameEvents, HookEvents } from '../../dto/index.js';
3
+ import { PlayerOutputDTO, RoleOutputDTO } from '@takaro/apiclient';
4
+ import { describe } from 'node:test';
5
+ import { randomUUID } from 'crypto';
6
+ import { getMockServer } from '@takaro/mock-gameserver';
7
+
8
+ const group = 'Teleports - waypoints';
9
+
10
+ interface WaypointsSetup extends IModuleTestsSetupData {
11
+ playerRole: RoleOutputDTO;
12
+ manageWaypointsRole: RoleOutputDTO;
13
+ player: PlayerOutputDTO;
14
+ moderator: PlayerOutputDTO;
15
+ }
16
+
17
+ const waypointsSetup = async function (this: IntegrationTest<WaypointsSetup>): Promise<WaypointsSetup> {
18
+ const setupData = await modulesTestSetup.bind(this as unknown as IntegrationTest<IModuleTestsSetupData>)();
19
+
20
+ await this.client.module.moduleInstallationsControllerInstallModule({
21
+ gameServerId: setupData.gameserver.id,
22
+ versionId: setupData.teleportsModule.latestVersion.id,
23
+ userConfig: JSON.stringify({
24
+ allowPublicTeleports: true,
25
+ }),
26
+ });
27
+
28
+ const playersRes = await this.client.player.playerControllerSearch();
29
+
30
+ await Promise.all(
31
+ playersRes.data.data.map(async (player) => {
32
+ await this.client.player.playerControllerRemoveRole(player.id, setupData.role.id);
33
+ }),
34
+ );
35
+
36
+ const manageWaypointsPermission = await this.client.permissionCodesToInputs(['TELEPORTS_MANAGE_WAYPOINTS']);
37
+ const teleportsPermission = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
38
+ const publicTeleportsPermission = await this.client.permissionCodesToInputs(['TELEPORTS_CREATE_PUBLIC']);
39
+ const manageWaypointsRole = (
40
+ await this.client.role.roleControllerCreate({
41
+ name: 'ManageWaypoints',
42
+ permissions: [
43
+ ...manageWaypointsPermission,
44
+ { permissionId: teleportsPermission[0].permissionId, count: 5 },
45
+ { permissionId: publicTeleportsPermission[0].permissionId, count: 5 },
46
+ ],
47
+ })
48
+ ).data.data;
49
+
50
+ const playerRole = (await this.client.role.roleControllerSearch({ filters: { name: ['Player'] } })).data.data[0];
51
+
52
+ const player = setupData.players[0];
53
+ const moderator = setupData.players[1];
54
+
55
+ await this.client.player.playerControllerAssignRole(moderator.id, manageWaypointsRole.id);
56
+
57
+ return {
58
+ ...setupData,
59
+ manageWaypointsRole: manageWaypointsRole,
60
+ player,
61
+ moderator,
62
+ playerRole,
63
+ };
64
+ };
65
+
66
+ async function setupSecondServer(this: IntegrationTest<WaypointsSetup>) {
67
+ if (!this.domainRegistrationToken) throw new Error('Domain registration token not set');
68
+ const identityToken = randomUUID();
69
+ const mockserver = await getMockServer({
70
+ mockserver: { registrationToken: this.domainRegistrationToken, identityToken },
71
+ });
72
+ this.setupData.mockservers.push(mockserver);
73
+ const gameserverRes = await this.client.gameserver.gameServerControllerSearch({
74
+ filters: { identityToken: [identityToken] },
75
+ });
76
+ const newGameServer = gameserverRes.data.data[0];
77
+ if (!newGameServer) throw new Error('Game server not found');
78
+
79
+ await this.client.module.moduleInstallationsControllerInstallModule({
80
+ gameServerId: newGameServer.id,
81
+ versionId: this.setupData.teleportsModule.latestVersion.id,
82
+ });
83
+
84
+ const connectedEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
85
+ GameEvents.PLAYER_CONNECTED,
86
+ 5,
87
+ );
88
+
89
+ await this.client.gameserver.gameServerControllerExecuteCommand(newGameServer.id, {
90
+ command: 'connectAll',
91
+ });
92
+
93
+ await connectedEvents;
94
+
95
+ const newServerPlayers = (
96
+ await this.client.playerOnGameserver.playerOnGameServerControllerSearch({
97
+ filters: { gameServerId: [newGameServer.id] },
98
+ })
99
+ ).data.data;
100
+ const newServerModerator = newServerPlayers[0];
101
+ const newServerPlayer = newServerPlayers[1];
102
+
103
+ await this.client.player.playerControllerAssignRole(
104
+ newServerModerator.playerId,
105
+ this.setupData.manageWaypointsRole.id,
106
+ );
107
+
108
+ return {
109
+ newGameServer,
110
+ newServerModerator,
111
+ newServerPlayer,
112
+ };
113
+ }
114
+
115
+ const tests = [
116
+ new IntegrationTest<WaypointsSetup>({
117
+ group,
118
+ snapshot: false,
119
+ setup: waypointsSetup,
120
+ name: 'Can create a waypoint with /setwaypoint',
121
+ test: async function () {
122
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
123
+
124
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
125
+ msg: '/setwaypoint A',
126
+ playerId: this.setupData.moderator.id,
127
+ });
128
+
129
+ expect((await events).length).to.be.eq(1);
130
+ expect((await events)[0].data.meta.msg).to.be.eq('Waypoint A set.');
131
+ },
132
+ }),
133
+ new IntegrationTest<WaypointsSetup>({
134
+ group,
135
+ snapshot: false,
136
+ setup: waypointsSetup,
137
+ name: 'Errors when creating duplicate waypoints',
138
+ test: async function () {
139
+ const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
140
+
141
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
142
+ msg: '/setwaypoint A',
143
+ playerId: this.setupData.moderator.id,
144
+ });
145
+
146
+ expect((await firstEvents).length).to.be.eq(1);
147
+ expect((await firstEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
148
+
149
+ const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
150
+
151
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
152
+ msg: '/setwaypoint A',
153
+ playerId: this.setupData.moderator.id,
154
+ });
155
+
156
+ expect((await secondEvents).length).to.be.eq(1);
157
+ expect((await secondEvents)[0].data.meta.msg).to.be.eq('Waypoint A already exists.');
158
+ },
159
+ }),
160
+ new IntegrationTest<WaypointsSetup>({
161
+ group,
162
+ snapshot: false,
163
+ setup: waypointsSetup,
164
+ name: '/setwaypoint requires TELEPORTS_MANAGE_WAYPOINTS permission',
165
+ test: async function () {
166
+ const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
167
+
168
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
169
+ msg: '/setwaypoint A',
170
+ playerId: this.setupData.player.id,
171
+ });
172
+
173
+ expect((await firstEvents).length).to.be.eq(1);
174
+ expect((await firstEvents)[0].data.meta.msg).to.be.eq(
175
+ "⚠️ You need the 'Teleports Manage Waypoints' permission to use this command. Please contact an admin if you need access.",
176
+ );
177
+
178
+ await this.client.player.playerControllerAssignRole(
179
+ this.setupData.player.id,
180
+ this.setupData.manageWaypointsRole.id,
181
+ );
182
+
183
+ const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
184
+
185
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
186
+ msg: '/setwaypoint A',
187
+ playerId: this.setupData.moderator.id,
188
+ });
189
+
190
+ expect((await secondEvents).length).to.be.eq(1);
191
+ expect((await secondEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
192
+ },
193
+ }),
194
+ new IntegrationTest<WaypointsSetup>({
195
+ group,
196
+ snapshot: false,
197
+ setup: waypointsSetup,
198
+ name: 'Can delete a waypoint with /deletewaypoint',
199
+ test: async function () {
200
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
201
+
202
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
203
+ msg: '/setwaypoint A',
204
+ playerId: this.setupData.moderator.id,
205
+ });
206
+
207
+ expect((await events).length).to.be.eq(1);
208
+ expect((await events)[0].data.meta.msg).to.be.eq('Waypoint A set.');
209
+
210
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
211
+
212
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
213
+ `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
214
+ ]);
215
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
216
+ permissions: useWaypointPermission,
217
+ });
218
+
219
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
220
+ msg: '/A',
221
+ playerId: this.setupData.player.id,
222
+ });
223
+
224
+ expect((await teleportEvents).length).to.be.eq(1);
225
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
226
+
227
+ const deleteEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
228
+
229
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
230
+ msg: '/deletewaypoint A',
231
+ playerId: this.setupData.moderator.id,
232
+ });
233
+
234
+ expect((await deleteEvents).length).to.be.eq(1);
235
+ expect((await deleteEvents)[0].data.meta.msg).to.be.eq('Waypoint A deleted.');
236
+ },
237
+ }),
238
+ new IntegrationTest<WaypointsSetup>({
239
+ group,
240
+ snapshot: false,
241
+ setup: waypointsSetup,
242
+ name: 'Errors when trying to delete a waypoint that does not exist',
243
+ test: async function () {
244
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
245
+
246
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
247
+ msg: '/deletewaypoint A',
248
+ playerId: this.setupData.moderator.id,
249
+ });
250
+
251
+ expect((await events).length).to.be.eq(1);
252
+ expect((await events)[0].data.meta.msg).to.be.eq("Waypoint A doesn't exist.");
253
+ },
254
+ }),
255
+ new IntegrationTest<WaypointsSetup>({
256
+ group,
257
+ snapshot: false,
258
+ setup: waypointsSetup,
259
+ name: '/deletewaypoint requires TELEPORTS_MANAGE_WAYPOINTS permission',
260
+ test: async function () {
261
+ // First set waypoint
262
+ // Then try to delete as player -> error
263
+ // Then try to delete as moderator -> success
264
+
265
+ const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
266
+
267
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
268
+ msg: '/setwaypoint A',
269
+ playerId: this.setupData.moderator.id,
270
+ });
271
+
272
+ expect((await firstEvents).length).to.be.eq(1);
273
+ expect((await firstEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
274
+
275
+ const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
276
+
277
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
278
+ msg: '/deletewaypoint A',
279
+ playerId: this.setupData.player.id,
280
+ });
281
+
282
+ expect((await secondEvents).length).to.be.eq(1);
283
+ expect((await secondEvents)[0].data.meta.msg).to.be.eq(
284
+ "⚠️ You need the 'Teleports Manage Waypoints' permission to use this command. Please contact an admin if you need access.",
285
+ );
286
+
287
+ const thirdEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
288
+
289
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
290
+ msg: '/deletewaypoint A',
291
+ playerId: this.setupData.moderator.id,
292
+ });
293
+
294
+ expect((await thirdEvents).length).to.be.eq(1);
295
+ expect((await thirdEvents)[0].data.meta.msg).to.be.eq('Waypoint A deleted.');
296
+ },
297
+ }),
298
+ new IntegrationTest<WaypointsSetup>({
299
+ group,
300
+ snapshot: false,
301
+ setup: waypointsSetup,
302
+ name: 'Can list waypoints (and shows only waypoints you have permission for)',
303
+ test: async function () {
304
+ // Create waypoint A & B
305
+ // Give players access to both
306
+ // /waypoints -> shows A & B
307
+ // Remove access to B
308
+ // /waypoints -> shows only A
309
+
310
+ const setWaypointAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
311
+ GameEvents.CHAT_MESSAGE,
312
+ );
313
+
314
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
315
+ msg: '/setwaypoint A',
316
+ playerId: this.setupData.moderator.id,
317
+ });
318
+
319
+ expect((await setWaypointAEvents).length).to.be.eq(1);
320
+ expect((await setWaypointAEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
321
+
322
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
323
+ msg: '/setwaypoint B',
324
+ playerId: this.setupData.moderator.id,
325
+ });
326
+
327
+ const setWaypointBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
328
+ GameEvents.CHAT_MESSAGE,
329
+ );
330
+ expect((await setWaypointBEvents).length).to.be.eq(1);
331
+ expect((await setWaypointBEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
332
+
333
+ const useWaypointAPermission = await this.client.permissionCodesToInputs([
334
+ `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
335
+ ]);
336
+ const useWaypointBPermission = await this.client.permissionCodesToInputs([
337
+ `WAYPOINTS_USE_B_${this.setupData.gameserver.id}`,
338
+ ]);
339
+
340
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
341
+ permissions: [...useWaypointAPermission, ...useWaypointBPermission],
342
+ });
343
+
344
+ const listEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
345
+
346
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
347
+ msg: '/waypoints',
348
+ playerId: this.setupData.player.id,
349
+ });
350
+
351
+ expect((await listEvents).length).to.be.eq(1);
352
+ expect((await listEvents)[0].data.meta.msg).to.be.eq('Available waypoints: A, B');
353
+
354
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
355
+ permissions: useWaypointAPermission,
356
+ });
357
+
358
+ const listEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
359
+
360
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
361
+ msg: '/waypoints',
362
+ playerId: this.setupData.player.id,
363
+ });
364
+
365
+ expect((await listEvents2).length).to.be.eq(1);
366
+ expect((await listEvents2)[0].data.meta.msg).to.be.eq('Available waypoints: A');
367
+ },
368
+ }),
369
+ new IntegrationTest<WaypointsSetup>({
370
+ group,
371
+ snapshot: false,
372
+ setup: waypointsSetup,
373
+ name: 'Has a user friendly message when listing waypoints and there are none',
374
+ test: async function () {
375
+ const listEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
376
+
377
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
378
+ msg: '/waypoints',
379
+ playerId: this.setupData.player.id,
380
+ });
381
+
382
+ expect((await listEvents).length).to.be.eq(1);
383
+ expect((await listEvents)[0].data.meta.msg).to.be.eq('There are no waypoints available.');
384
+ },
385
+ }),
386
+ new IntegrationTest<WaypointsSetup>({
387
+ group,
388
+ snapshot: false,
389
+ setup: waypointsSetup,
390
+ name: 'Players can teleport to a waypoint',
391
+ test: async function () {
392
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
393
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
394
+ msg: '/setwaypoint trader',
395
+ playerId: this.setupData.moderator.id,
396
+ });
397
+ expect((await events).length).to.be.eq(1);
398
+ expect((await events)[0].data.meta.msg).to.be.eq('Waypoint trader set.');
399
+
400
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
401
+ `WAYPOINTS_USE_TRADER_${this.setupData.gameserver.id}`,
402
+ ]);
403
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
404
+ permissions: useWaypointPermission,
405
+ });
406
+
407
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
408
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
409
+ msg: '/trader',
410
+ playerId: this.setupData.player.id,
411
+ });
412
+ expect((await teleportEvents).length).to.be.eq(1);
413
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint trader.');
414
+ },
415
+ }),
416
+ new IntegrationTest<WaypointsSetup>({
417
+ group,
418
+ snapshot: false,
419
+ setup: waypointsSetup,
420
+ name: 'Can set multiple waypoints and teleport to them',
421
+ test: async function () {
422
+ const setWaypointAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
423
+ GameEvents.CHAT_MESSAGE,
424
+ );
425
+
426
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
427
+ msg: '/setwaypoint A',
428
+ playerId: this.setupData.moderator.id,
429
+ });
430
+
431
+ expect((await setWaypointAEvents).length).to.be.eq(1);
432
+ expect((await setWaypointAEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
433
+
434
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
435
+ msg: '/setwaypoint B',
436
+ playerId: this.setupData.moderator.id,
437
+ });
438
+
439
+ const setWaypointBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
440
+ GameEvents.CHAT_MESSAGE,
441
+ );
442
+ expect((await setWaypointBEvents).length).to.be.eq(1);
443
+ expect((await setWaypointBEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
444
+
445
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
446
+ `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
447
+ `WAYPOINTS_USE_B_${this.setupData.gameserver.id}`,
448
+ ]);
449
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
450
+ permissions: useWaypointPermission,
451
+ });
452
+
453
+ const teleportAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
454
+
455
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
456
+ msg: '/A',
457
+ playerId: this.setupData.player.id,
458
+ });
459
+
460
+ expect((await teleportAEvents).length).to.be.eq(1);
461
+ expect((await teleportAEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
462
+
463
+ const teleportBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
464
+
465
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
466
+ msg: '/B',
467
+ playerId: this.setupData.player.id,
468
+ });
469
+
470
+ expect((await teleportBEvents).length).to.be.eq(1);
471
+ expect((await teleportBEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint B.');
472
+ },
473
+ }),
474
+ new IntegrationTest<WaypointsSetup>({
475
+ group,
476
+ snapshot: false,
477
+ setup: waypointsSetup,
478
+ name: 'Can control who can use which waypoints using permissions (Player can use waypoint A but not waypoint B)',
479
+ test: async function () {
480
+ // Create 2 waypoints A and B
481
+ // Give player permission to use A
482
+ // Player uses A -> success
483
+ // Player uses B -> error
484
+
485
+ const setWaypointAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
486
+ GameEvents.CHAT_MESSAGE,
487
+ );
488
+
489
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
490
+ msg: '/setwaypoint A',
491
+ playerId: this.setupData.moderator.id,
492
+ });
493
+
494
+ expect((await setWaypointAEvents).length).to.be.eq(1);
495
+ expect((await setWaypointAEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
496
+
497
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
498
+ msg: '/setwaypoint B',
499
+ playerId: this.setupData.moderator.id,
500
+ });
501
+
502
+ const setWaypointBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
503
+ GameEvents.CHAT_MESSAGE,
504
+ );
505
+ expect((await setWaypointBEvents).length).to.be.eq(1);
506
+ expect((await setWaypointBEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
507
+
508
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
509
+ `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
510
+ ]);
511
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
512
+ permissions: useWaypointPermission,
513
+ });
514
+
515
+ const teleportAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
516
+
517
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
518
+ msg: '/A',
519
+ playerId: this.setupData.player.id,
520
+ });
521
+
522
+ expect((await teleportAEvents).length).to.be.eq(1);
523
+ expect((await teleportAEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
524
+
525
+ const teleportBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
526
+
527
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
528
+ msg: '/B',
529
+ playerId: this.setupData.player.id,
530
+ });
531
+
532
+ expect((await teleportBEvents).length).to.be.eq(1);
533
+ expect((await teleportBEvents)[0].data.meta.msg).to.be.eq('You are not allowed to use the waypoint B.');
534
+ },
535
+ }),
536
+ new IntegrationTest<WaypointsSetup>({
537
+ group,
538
+ snapshot: false,
539
+ setup: waypointsSetup,
540
+ name: 'Cannot use a waypoint from a different gameserver',
541
+ test: async function () {
542
+ // Add a new gameserver first
543
+ // Create a waypoint on the new gameserver
544
+ // Try to use the waypoint from the new gameserver -> success
545
+ // Try to use the waypoint from the original gameserver -> "waypoint does not exist"
546
+ const { newGameServer, newServerModerator, newServerPlayer } = await setupSecondServer.bind(this)();
547
+
548
+ // Make a waypoint on the new gameserver
549
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
550
+ await this.client.command.commandControllerTrigger(newGameServer.id, {
551
+ msg: '/setwaypoint A',
552
+ playerId: newServerModerator.playerId,
553
+ });
554
+ expect((await setEvents).length).to.be.eq(1);
555
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
556
+
557
+ // Make a waypoint on the original gameserver
558
+ const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
559
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
560
+ msg: '/setwaypoint notused',
561
+ playerId: this.setupData.moderator.id,
562
+ });
563
+ expect((await setEvents2).length).to.be.eq(1);
564
+ expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint notused set.');
565
+
566
+ const useWaypointPermission = await this.client.permissionCodesToInputs([`WAYPOINTS_USE_A_${newGameServer.id}`]);
567
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
568
+ permissions: useWaypointPermission,
569
+ });
570
+
571
+ // Use the waypoint from the new gameserver -> success
572
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
573
+ await this.client.command.commandControllerTrigger(newGameServer.id, {
574
+ msg: '/A',
575
+ playerId: newServerPlayer.playerId,
576
+ });
577
+ expect((await teleportEvents).length).to.be.eq(1);
578
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
579
+
580
+ // Use the waypoint from the original gameserver -> "waypoint does not exist"
581
+ const teleportEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(
582
+ HookEvents.COMMAND_EXECUTED,
583
+ );
584
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
585
+ msg: '/A',
586
+ playerId: this.setupData.player.id,
587
+ });
588
+ expect((await teleportEvents2).length).to.be.eq(1);
589
+ expect((await teleportEvents2)[0].data.meta.result.logs[0].msg).to.be.eq('Waypoint A is not for this server.');
590
+ },
591
+ }),
592
+ new IntegrationTest<WaypointsSetup>({
593
+ group,
594
+ snapshot: false,
595
+ setup: waypointsSetup,
596
+ name: 'Creating waypoint with same name on 2 different gameservers does not conflict',
597
+ test: async function () {
598
+ // Create new gameserver
599
+ // Create waypoint A on original gameserver
600
+ // Create waypoint A on new gameserver
601
+ // Allow player to use waypoint A on original gameserver but not new gameserver
602
+ // Player uses A on original gameserver -> success
603
+ // Player uses A on new gameserver -> error
604
+
605
+ const { newGameServer, newServerModerator, newServerPlayer } = await setupSecondServer.bind(this)();
606
+
607
+ // Make a waypoint on the original gameserver
608
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
609
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
610
+ msg: '/setwaypoint A',
611
+ playerId: this.setupData.moderator.id,
612
+ });
613
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
614
+
615
+ // Make a waypoint on the new gameserver
616
+ const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
617
+ await this.client.command.commandControllerTrigger(newGameServer.id, {
618
+ msg: '/setwaypoint A',
619
+ playerId: newServerModerator.playerId,
620
+ });
621
+ expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint A set.');
622
+
623
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
624
+ `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
625
+ ]);
626
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
627
+ permissions: useWaypointPermission,
628
+ });
629
+
630
+ // Use the waypoint from the original gameserver -> success
631
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
632
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
633
+ msg: '/A',
634
+ playerId: this.setupData.player.id,
635
+ });
636
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
637
+
638
+ // Use the waypoint from the new gameserver -> error
639
+ const teleportEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(
640
+ GameEvents.CHAT_MESSAGE,
641
+ 1,
642
+ );
643
+ await this.client.command.commandControllerTrigger(newGameServer.id, {
644
+ msg: '/A',
645
+ playerId: newServerPlayer.playerId,
646
+ });
647
+ expect((await teleportEvents2)[0].data.meta.msg).to.be.eq('You are not allowed to use the waypoint A.');
648
+ },
649
+ }),
650
+ new IntegrationTest<WaypointsSetup>({
651
+ group,
652
+ snapshot: false,
653
+ setup: waypointsSetup,
654
+ name: 'Reconciler recreates waypoints when deleting the waypoints module',
655
+ test: async function () {
656
+ // Create a waypoint
657
+ // Delete the waypoints module
658
+ // Create another waypoint
659
+ // Both should be present in the waypoints module
660
+
661
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
662
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
663
+ msg: '/setwaypoint A',
664
+ playerId: this.setupData.moderator.id,
665
+ });
666
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
667
+
668
+ const waypointsModuleToRemove = await this.client.module.moduleControllerSearch({
669
+ filters: { name: ['Waypoints'] },
670
+ });
671
+ if (!waypointsModuleToRemove.data.data.length) {
672
+ throw new Error('Waypoints module not found');
673
+ }
674
+
675
+ await this.client.module.moduleControllerRemove(waypointsModuleToRemove.data.data[0].id);
676
+
677
+ const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
678
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
679
+ msg: '/setwaypoint B',
680
+ playerId: this.setupData.moderator.id,
681
+ });
682
+ expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint B set.');
683
+
684
+ const waypointsModule = await this.client.module.moduleControllerSearch({ filters: { name: ['Waypoints'] } });
685
+ if (!waypointsModule.data.data.length) {
686
+ throw new Error('Waypoints module not found');
687
+ }
688
+
689
+ expect(waypointsModule.data.data[0].latestVersion.commands).to.be.lengthOf(2);
690
+ },
691
+ }),
692
+ new IntegrationTest<WaypointsSetup>({
693
+ group,
694
+ snapshot: false,
695
+ setup: waypointsSetup,
696
+ name: 'Reconciler does not pick up public teleports as waypoints',
697
+ test: async function () {
698
+ // Create a public teleport
699
+ // Create a waypoint
700
+ // One should be in the waypoints module, the other should not
701
+
702
+ const setTeleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
703
+ GameEvents.CHAT_MESSAGE,
704
+ 1,
705
+ );
706
+
707
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
708
+ msg: '/settp A',
709
+ playerId: this.setupData.moderator.id,
710
+ });
711
+ expect((await setTeleportEvents)[0].data.meta.msg).to.be.eq('Teleport A set.');
712
+
713
+ const setPublicTeleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
714
+ GameEvents.CHAT_MESSAGE,
715
+ 1,
716
+ );
717
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
718
+ msg: '/setpublic A',
719
+ playerId: this.setupData.moderator.id,
720
+ });
721
+
722
+ expect((await setPublicTeleportEvents)[0].data.meta.msg).to.be.eq('Teleport A is now public.');
723
+
724
+ const setWaypointEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
725
+ GameEvents.CHAT_MESSAGE,
726
+ 1,
727
+ );
728
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
729
+ msg: '/setwaypoint B',
730
+ playerId: this.setupData.moderator.id,
731
+ });
732
+
733
+ expect((await setWaypointEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
734
+ const waypointsModule = await this.client.module.moduleControllerSearch({ filters: { name: ['Waypoints'] } });
735
+ if (!waypointsModule.data.data.length) {
736
+ throw new Error('Waypoints module not found');
737
+ }
738
+ expect(waypointsModule.data.data[0].latestVersion.commands).to.be.lengthOf(1);
739
+ expect(waypointsModule.data.data[0].latestVersion.commands[0].name).to.be.eq(
740
+ `waypoint B server ${this.setupData.gameserver.id}`,
741
+ );
742
+ },
743
+ }),
744
+ new IntegrationTest<WaypointsSetup>({
745
+ group,
746
+ snapshot: false,
747
+ setup: waypointsSetup,
748
+ name: 'Waypoints store and use dimension information correctly',
749
+ test: async function () {
750
+ // Create a waypoint with dimension data via setwaypoint command
751
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
752
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
753
+ msg: '/setwaypoint dimension_waypoint',
754
+ playerId: this.setupData.moderator.id,
755
+ });
756
+
757
+ expect((await setEvents).length).to.be.eq(1);
758
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint dimension_waypoint set.');
759
+
760
+ // Give player permission to use the waypoint
761
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
762
+ `WAYPOINTS_USE_DIMENSION_WAYPOINT_${this.setupData.gameserver.id}`,
763
+ ]);
764
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
765
+ permissions: useWaypointPermission,
766
+ });
767
+
768
+ // Teleport to the waypoint - should include dimension data
769
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
770
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
771
+ msg: '/dimension_waypoint',
772
+ playerId: this.setupData.player.id,
773
+ });
774
+
775
+ expect((await teleportEvents).length).to.be.eq(1);
776
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint dimension_waypoint.');
777
+ },
778
+ }),
779
+ new IntegrationTest<WaypointsSetup>({
780
+ group,
781
+ snapshot: false,
782
+ setup: waypointsSetup,
783
+ name: 'Waypoints work with API teleport endpoint including dimension parameter',
784
+ test: async function () {
785
+ // Create a waypoint
786
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
787
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
788
+ msg: '/setwaypoint api_test_waypoint',
789
+ playerId: this.setupData.moderator.id,
790
+ });
791
+
792
+ expect((await setEvents).length).to.be.eq(1);
793
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint api_test_waypoint set.');
794
+
795
+ // Test direct API teleport with dimension
796
+ await this.client.gameserver.gameServerControllerTeleportPlayer(
797
+ this.setupData.gameserver.id,
798
+ this.setupData.player.id,
799
+ {
800
+ x: 500,
801
+ y: 600,
802
+ z: 700,
803
+ dimension: 'end',
804
+ },
805
+ );
806
+
807
+ // Give player permission to use the waypoint
808
+ const useWaypointPermission = await this.client.permissionCodesToInputs([
809
+ `WAYPOINTS_USE_API_TEST_WAYPOINT_${this.setupData.gameserver.id}`,
810
+ ]);
811
+ await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
812
+ permissions: useWaypointPermission,
813
+ });
814
+
815
+ // Teleport using waypoint command - should work with stored dimension
816
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
817
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
818
+ msg: '/api_test_waypoint',
819
+ playerId: this.setupData.player.id,
820
+ });
821
+
822
+ expect((await teleportEvents).length).to.be.eq(1);
823
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint api_test_waypoint.');
824
+ },
825
+ }),
826
+ ];
827
+
828
+ describe(group, function () {
829
+ tests.forEach((test) => {
830
+ test.run();
831
+ });
832
+ });