@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,68 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ import { findTp } from './utils.js';
3
+ async function main() {
4
+ const { pog, gameServerId, arguments: args, module: mod } = data;
5
+ const ownedTeleportRes = await findTp(args.tp, pog.playerId);
6
+ let teleports = ownedTeleportRes.data.data;
7
+ if (mod.userConfig.allowPublicTeleports) {
8
+ const publicTeleportRes = await findTp(args.tp, null, true);
9
+ teleports = teleports.concat(publicTeleportRes.data.data);
10
+ }
11
+ if (teleports.length === 0) {
12
+ throw new TakaroUserError(`Teleport ${args.tp} does not exist.`);
13
+ }
14
+ const timeout = mod.userConfig.timeout;
15
+ if (timeout > 0) {
16
+ const lastExecuted = await takaro.variable.variableControllerSearch({
17
+ filters: {
18
+ key: ['lastExecuted'],
19
+ gameServerId: [gameServerId],
20
+ playerId: [pog.playerId],
21
+ moduleId: [mod.moduleId],
22
+ },
23
+ });
24
+ let lastExecutedRecord = lastExecuted.data.data[0];
25
+ if (!lastExecutedRecord) {
26
+ const createRes = await takaro.variable.variableControllerCreate({
27
+ key: 'lastExecuted',
28
+ gameServerId,
29
+ playerId: pog.playerId,
30
+ moduleId: mod.moduleId,
31
+ value: new Date().toISOString(),
32
+ });
33
+ lastExecutedRecord = createRes.data.data;
34
+ }
35
+ else {
36
+ const lastExecutedTime = new Date(lastExecutedRecord.value);
37
+ const now = new Date();
38
+ const diff = now.getTime() - lastExecutedTime.getTime();
39
+ if (diff < timeout) {
40
+ throw new TakaroUserError('You cannot teleport yet. Please wait before trying again.');
41
+ }
42
+ }
43
+ const teleport = JSON.parse(teleports[0].value);
44
+ await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
45
+ x: teleport.x,
46
+ y: teleport.y,
47
+ z: teleport.z,
48
+ dimension: teleport.dimension,
49
+ });
50
+ await data.player.pm(`Teleported to ${teleport.name}.`);
51
+ if (timeout !== 0 && lastExecutedRecord) {
52
+ await takaro.variable.variableControllerUpdate(lastExecutedRecord.id, {
53
+ value: new Date().toISOString(),
54
+ });
55
+ }
56
+ return;
57
+ }
58
+ const teleport = JSON.parse(teleports[0].value);
59
+ await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
60
+ x: teleport.x,
61
+ y: teleport.y,
62
+ z: teleport.z,
63
+ dimension: teleport.dimension,
64
+ });
65
+ await data.player.pm(`Teleported to ${teleport.name}.`);
66
+ }
67
+ await main();
68
+ //# sourceMappingURL=teleport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teleport.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/teleport.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEjE,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE7D,IAAI,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;IAE3C,IAAI,GAAG,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACxC,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC5D,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,eAAe,CAAC,YAAY,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;IAEvC,IAAI,OAAO,GAAG,CAAC,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C,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE;YACrF,CAAC,EAAE,QAAQ,CAAC,CAAC;YACb,CAAC,EAAE,QAAQ,CAAC,CAAC;YACb,CAAC,EAAE,QAAQ,CAAC,CAAC;YACb,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC9B,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;QAExD,IAAI,OAAO,KAAK,CAAC,IAAI,kBAAkB,EAAE,CAAC;YACxC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,kBAAkB,CAAC,EAAE,EAAE;gBACpE,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aAChC,CAAC,CAAC;QACL,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEhD,MAAM,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE;QACrF,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,iBAAiB,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=teleportwaypoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teleportwaypoint.d.ts","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/teleportwaypoint.js"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ import { takaro, data, TakaroUserError, checkPermission } from '@takaro/helpers';
2
+ function getWaypointName(name) {
3
+ return `waypoint ${name}`;
4
+ }
5
+ async function main() {
6
+ const { pog, gameServerId, trigger, module, itemId } = data;
7
+ const triggeredCommand = module.version.commands.find((command) => command.id === itemId);
8
+ if (!triggeredCommand) {
9
+ throw new Error('Waypoint not found.');
10
+ }
11
+ if (!triggeredCommand.name.includes(`server ${gameServerId}`)) {
12
+ console.log(`Waypoint ${trigger} is not for this server.`);
13
+ return;
14
+ }
15
+ if (!checkPermission(pog, `WAYPOINTS_USE_${trigger.toUpperCase()}_${gameServerId}`)) {
16
+ throw new TakaroUserError(`You are not allowed to use the waypoint ${trigger}.`);
17
+ }
18
+ const teleportsModule = (await takaro.module.moduleControllerSearch({
19
+ filters: {
20
+ builtin: ['teleports'],
21
+ },
22
+ })).data.data[0];
23
+ const variable = await takaro.variable.variableControllerSearch({
24
+ filters: {
25
+ key: [getWaypointName(trigger)],
26
+ gameServerId: [gameServerId],
27
+ moduleId: [teleportsModule.id],
28
+ },
29
+ });
30
+ if (variable.data.data.length === 0) {
31
+ throw new TakaroUserError(`Waypoint ${trigger} does not exist.`);
32
+ }
33
+ const waypoint = JSON.parse(variable.data.data[0].value);
34
+ await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
35
+ x: waypoint.x,
36
+ y: waypoint.y,
37
+ z: waypoint.z,
38
+ dimension: waypoint.dimension,
39
+ });
40
+ await pog.pm(`Teleported to waypoint ${trigger}.`);
41
+ }
42
+ await main();
43
+ //# sourceMappingURL=teleportwaypoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teleportwaypoint.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/teleportwaypoint.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjF,SAAS,eAAe,CAAC,IAAI;IAC3B,OAA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IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,eAAe,CAAC,YAAY,OAAO,kBAAkB,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzD,MAAM,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE;QACrF,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,EAAE,CAAC,0BAA0B,OAAO,GAAG,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tplist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tplist.d.ts","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/tplist.js"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ import { getVariableKey } from './utils.js';
3
+ async function main() {
4
+ const { pog, gameServerId, module: mod } = data;
5
+ const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
6
+ const ownedTeleports = (await takaro.variable.variableControllerSearch({
7
+ filters: {
8
+ gameServerId: [gameServerId],
9
+ playerId: [pog.playerId],
10
+ moduleId: [mod.moduleId],
11
+ },
12
+ search: {
13
+ key: [getVariableKey(undefined, false)],
14
+ },
15
+ sortBy: 'key',
16
+ sortDirection: 'asc',
17
+ })).data.data;
18
+ const publicTeleports = (await takaro.variable.variableControllerSearch({
19
+ filters: {
20
+ gameServerId: [gameServerId],
21
+ moduleId: [mod.moduleId],
22
+ },
23
+ search: {
24
+ key: [getVariableKey(undefined, true)],
25
+ },
26
+ sortBy: 'key',
27
+ sortDirection: 'asc',
28
+ })).data.data
29
+ // Filter out public teleports that are owned by the player
30
+ // Since we'll be showing them in the owned teleports list
31
+ .filter((teleport) => {
32
+ return teleport.playerId !== pog.playerId;
33
+ });
34
+ const teleports = [...ownedTeleports, ...publicTeleports];
35
+ if (teleports.length === 0) {
36
+ await data.player.pm(`You have no teleports available, use ${prefix}settp <name> to set one.`);
37
+ return;
38
+ }
39
+ await data.player.pm(`You have ${teleports.length} teleport${teleports.length === 1 ? '' : 's'} available`);
40
+ for (const rawTeleport of teleports) {
41
+ const teleport = JSON.parse(rawTeleport.value);
42
+ await data.player.pm(`${teleport.name}: (${teleport.x},${teleport.y},${teleport.z}) ${rawTeleport.key.startsWith('pub') ? '(public)' : ''}`);
43
+ }
44
+ }
45
+ await main();
46
+ //# sourceMappingURL=tplist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tplist.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/tplist.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEhD,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAE/G,MAAM,cAAc,GAAG,CACrB,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,OAAO,EAAE;YACP,YAAY,EAAE,CAAC,YAAY,CAAC;YAC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MAAM,WAAW,IAAI,SAAS,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAClB,GAAG,QAAQ,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,KAC1D,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EACnD,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Waypoint%20reconciler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Waypoint reconciler.d.ts","sourceRoot":"","sources":["../../../../src/modules/teleports/cronJobs/Waypoint reconciler.js"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { waypointReconciler } from './utils.js';
2
+ async function main() {
3
+ await waypointReconciler();
4
+ }
5
+ await main();
6
+ //# sourceMappingURL=Waypoint%20reconciler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Waypoint reconciler.js","sourceRoot":"","sources":["../../../../src/modules/teleports/cronJobs/Waypoint reconciler.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,UAAU,IAAI;IACjB,MAAM,kBAAkB,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ export function getVariableKey(tpName: any, pub?: boolean): string;
2
+ export function findTp(tpName: any, playerId: any, pub?: boolean): Promise<any>;
3
+ export function ensureWaypointsModule(): Promise<{
4
+ waypointsInstallation: any;
5
+ waypointsDefinition: any;
6
+ }>;
7
+ export function getWaypointName(name: any): string;
8
+ export function getWaypointId(varName: any): any;
9
+ /**
10
+ * This function is responsible to read all the configured waypoints (vars)
11
+ * and then ensuring that the waypoints module has the correct config
12
+ */
13
+ export function waypointReconciler(): Promise<void>;
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/modules/teleports/functions/utils.js"],"names":[],"mappings":"AAEA,mEAKC;AAED,gFA0BC;AAED;;;GAoCC;AAED,mDAEC;AAED,iDAIC;AAED;;;GAGG;AACH,oDAmGC"}
@@ -0,0 +1,156 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ export function getVariableKey(tpName, pub = false) {
3
+ if (pub && tpName)
4
+ return `pubtp_${tpName}`;
5
+ if (pub && !tpName)
6
+ return 'pubtp_';
7
+ if (tpName)
8
+ return `tp_${tpName}`;
9
+ return 'tp_';
10
+ }
11
+ export async function findTp(tpName, playerId, pub = false) {
12
+ const { gameServerId, module: mod } = data;
13
+ if (pub) {
14
+ return takaro.variable.variableControllerSearch({
15
+ filters: {
16
+ key: [getVariableKey(tpName, true)],
17
+ gameServerId: [gameServerId],
18
+ playerId: [playerId].filter(Boolean),
19
+ moduleId: [mod.moduleId],
20
+ },
21
+ sortBy: 'key',
22
+ sortDirection: 'asc',
23
+ });
24
+ }
25
+ return takaro.variable.variableControllerSearch({
26
+ filters: {
27
+ key: [getVariableKey(tpName)],
28
+ gameServerId: [gameServerId],
29
+ playerId: [playerId].filter(Boolean),
30
+ moduleId: [mod.moduleId],
31
+ },
32
+ sortBy: 'key',
33
+ sortDirection: 'asc',
34
+ });
35
+ }
36
+ export async function ensureWaypointsModule() {
37
+ const { gameServerId } = data;
38
+ let waypointsDefinition = (await takaro.module.moduleControllerSearch({
39
+ filters: {
40
+ name: ['Waypoints'],
41
+ },
42
+ })).data.data[0];
43
+ if (!waypointsDefinition) {
44
+ console.log('Waypoints module definition not found, creating it.');
45
+ waypointsDefinition = (await takaro.module.moduleControllerCreate({
46
+ name: 'Waypoints',
47
+ })).data.data;
48
+ }
49
+ let waypointsInstallation = (await takaro.module.moduleInstallationsControllerGetInstalledModules({
50
+ filters: { gameserverId: [gameServerId] },
51
+ })).data.data.find((module) => module.module.name === 'Waypoints');
52
+ if (!waypointsInstallation) {
53
+ console.log('Waypoints installation not found, installing it.');
54
+ waypointsInstallation = (await takaro.module.moduleInstallationsControllerInstallModule({
55
+ gameServerId,
56
+ versionId: waypointsDefinition.latestVersion.id,
57
+ })).data.data;
58
+ }
59
+ return { waypointsInstallation, waypointsDefinition };
60
+ }
61
+ export function getWaypointName(name) {
62
+ return `waypoint ${name}`;
63
+ }
64
+ export function getWaypointId(varName) {
65
+ const split = varName.split(' ')[1];
66
+ if (split)
67
+ return split;
68
+ return varName;
69
+ }
70
+ /**
71
+ * This function is responsible to read all the configured waypoints (vars)
72
+ * and then ensuring that the waypoints module has the correct config
73
+ */
74
+ export async function waypointReconciler() {
75
+ console.log('Reconciling waypoints');
76
+ const { waypointsInstallation, waypointsDefinition } = await ensureWaypointsModule();
77
+ const { gameServerId, module: mod } = data;
78
+ // Get all the installed waypoints
79
+ const waypointVars = (await takaro.variable.variableControllerSearch({
80
+ filters: {
81
+ moduleId: [mod.moduleId],
82
+ gameServerId: [gameServerId],
83
+ },
84
+ search: {
85
+ key: [getWaypointName('')],
86
+ },
87
+ })).data.data;
88
+ const waypointsInModule = waypointsDefinition.latestVersion.commands;
89
+ // Check if any waypoints are missing in module
90
+ const missingWaypoints = waypointVars.filter((waypointVar) => {
91
+ const existingWaypointsForServer = waypointsInModule.filter((waypoint) => waypoint.name.includes(gameServerId));
92
+ return !existingWaypointsForServer.some((waypoint) => waypoint.trigger === getWaypointId(waypointVar.key));
93
+ });
94
+ // Check if there are waypoints too many in module compared to our vars
95
+ const toDeleteWaypoints = waypointsInModule.filter((waypoint) => {
96
+ // We ignore any commands that are not for this game server
97
+ if (!waypoint.name.includes(gameServerId))
98
+ return false;
99
+ return !waypointVars.some((waypointVar) => getWaypointId(waypointVar.key) === waypoint.trigger);
100
+ });
101
+ if (!missingWaypoints.length && !toDeleteWaypoints.length) {
102
+ // No changes in waypoints, exit
103
+ return;
104
+ }
105
+ console.log('Missing waypoints:', missingWaypoints.map((waypoint) => waypoint.key));
106
+ console.log('To delete waypoints:', toDeleteWaypoints.map((waypoint) => waypoint.trigger));
107
+ // Fetch the teleporting code template
108
+ const teleportCommand = await takaro.command.commandControllerSearch({
109
+ filters: {
110
+ moduleId: [mod.moduleId],
111
+ name: ['teleportwaypoint'],
112
+ },
113
+ });
114
+ // Edit the module accordingly
115
+ await Promise.all([
116
+ ...missingWaypoints.map((waypoint) => {
117
+ return takaro.command.commandControllerCreate({
118
+ name: `waypoint ${getWaypointId(waypoint.key)} server ${gameServerId}`,
119
+ trigger: getWaypointId(waypoint.key),
120
+ helpText: `Teleport to waypoint ${getWaypointId(waypoint.key)}.`,
121
+ function: teleportCommand.data.data[0].function.code,
122
+ versionId: waypointsInstallation.versionId,
123
+ });
124
+ }),
125
+ ...toDeleteWaypoints.map((waypointVar) => {
126
+ return takaro.command.commandControllerRemove(waypointVar.id);
127
+ }),
128
+ ]);
129
+ // Update permissions
130
+ const existingPermissions = waypointsDefinition.latestVersion.permissions || [];
131
+ const permissionInputDTOs = existingPermissions.map((permission) => ({
132
+ permission: permission.permission,
133
+ description: permission.description,
134
+ friendlyName: permission.friendlyName,
135
+ canHaveCount: permission.canHaveCount,
136
+ }));
137
+ // We need to filter out the permissions we deleted in the above lines
138
+ const filteredPermissionsInputs = permissionInputDTOs.filter((permission) => {
139
+ return !toDeleteWaypoints.some((waypoint) => permission.permission === `WAYPOINTS_USE_${waypoint.trigger.toUpperCase()}_${gameServerId}`);
140
+ });
141
+ const gameServer = (await takaro.gameserver.gameServerControllerGetOne(gameServerId)).data.data;
142
+ await takaro.module.moduleControllerUpdate(waypointsInstallation.moduleId, {
143
+ latestVersion: {
144
+ permissions: [
145
+ ...filteredPermissionsInputs,
146
+ ...missingWaypoints.map((waypoint) => ({
147
+ permission: `WAYPOINTS_USE_${getWaypointId(waypoint.key).toUpperCase()}_${gameServerId}`,
148
+ description: `Use the waypoint ${getWaypointId(waypoint.key)} on ${gameServer.name}.`,
149
+ friendlyName: `Use waypoint ${getWaypointId(waypoint.key)} on ${gameServer.name}`,
150
+ canHaveCount: false,
151
+ })),
152
+ ],
153
+ },
154
+ });
155
+ }
156
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/modules/teleports/functions/utils.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK;IAChD,IAAI,GAAG,IAAI,MAAM;QAAE,OAAO,SAAS,MAAM,EAAE,CAAC;IAC5C,IAAI,GAAG,IAAI,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IACpC,IAAI,MAAM;QAAE,OAAO,MAAM,MAAM,EAAE,CAAC;IAClC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,KAAK;IACxD,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3C,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;YAC9C,OAAO,EAAE;gBACP,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBACnC,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;gBACpC,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;aACzB;YACD,MAAM,EAAE,KAAK;YACb,aAAa,EAA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C,CAAC,CAAC,CAAC;IACJ,sEAAsE;IACtE,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;QAC1E,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC5B,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,KAAK,iBAAiB,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,YAAY,EAAE,CAC1G,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,0BAA0B,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAChG,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,QAAQ,EAAE;QACzE,aAAa,EAAE;YACb,WAAW,EAAE;gBACX,GAAG,yBAAyB;gBAC5B,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;oBACrC,UAAU,EAAE,iBAAiB,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,YAAY,EAAE;oBACxF,WAAW,EAAE,oBAAoB,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,UAAU,CAAC,IAAI,GAAG;oBACrF,YAAY,EAAE,gBAAgB,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,UAAU,CAAC,IAAI,EAAE;oBACjF,YAAY,EAAE,KAAK;iBACpB,CAAC,CAAC;aACJ;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class Teleports extends ModuleTransferDTO<Teleports> {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/teleports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAMlB,MAAM,wBAAwB,CAAC;AAGhC,qBAAa,SAAU,SAAQ,iBAAiB,CAAC,SAAS,CAAC;;CA8M1D"}
@@ -0,0 +1,208 @@
1
+ import { ModuleTransferDTO, ICommand, IFunction, IPermission, ModuleTransferVersionDTO, ICronJob, } from '../../BuiltinModule.js';
2
+ import { Duration } from 'luxon';
3
+ export class Teleports extends ModuleTransferDTO {
4
+ constructor() {
5
+ super();
6
+ this.name = 'teleports';
7
+ this.author = 'Takaro';
8
+ this.supportedGames = ['7 days to die', 'rust', 'minecraft'];
9
+ this.versions = [
10
+ new ModuleTransferVersionDTO({
11
+ tag: '0.0.4',
12
+ description: 'A set of commands to allow players to set their own teleport points and teleport to them.',
13
+ configSchema: JSON.stringify({
14
+ $schema: 'http://json-schema.org/draft-07/schema#',
15
+ type: 'object',
16
+ properties: {
17
+ timeout: {
18
+ title: 'Timeout',
19
+ description: 'The time one has to wait before teleporting again.',
20
+ 'x-component': 'duration',
21
+ type: 'number',
22
+ minimum: 0,
23
+ default: Duration.fromObject({ second: 1 }).as('milliseconds'),
24
+ },
25
+ allowPublicTeleports: {
26
+ type: 'boolean',
27
+ description: 'Players can create public teleports.',
28
+ default: false,
29
+ },
30
+ },
31
+ required: [],
32
+ additionalProperties: false,
33
+ }),
34
+ uiSchema: JSON.stringify({
35
+ timeout: { 'ui:widget': 'duration' },
36
+ }),
37
+ functions: [
38
+ new IFunction({
39
+ name: 'utils',
40
+ function: this.loadFn('functions', 'utils'),
41
+ }),
42
+ ],
43
+ permissions: [
44
+ new IPermission({
45
+ permission: 'TELEPORTS_CREATE_PUBLIC',
46
+ friendlyName: 'Create Public Teleports',
47
+ description: 'Allows the player to create public teleports.',
48
+ canHaveCount: true,
49
+ }),
50
+ new IPermission({
51
+ permission: 'TELEPORTS_USE',
52
+ friendlyName: 'Use Teleports',
53
+ description: 'Allows the player to use teleports modules.',
54
+ canHaveCount: true,
55
+ }),
56
+ new IPermission({
57
+ permission: 'TELEPORTS_MANAGE_WAYPOINTS',
58
+ friendlyName: 'Manage waypoints',
59
+ description: 'Allows creating, deleting, and managing waypoints.',
60
+ canHaveCount: false,
61
+ }),
62
+ ],
63
+ commands: [
64
+ new ICommand({
65
+ function: this.loadFn('commands', 'teleport'),
66
+ name: 'teleport',
67
+ trigger: 'tp',
68
+ helpText: 'Teleports to one of your set locations.',
69
+ requiredPermissions: ['TELEPORTS_USE'],
70
+ arguments: [
71
+ {
72
+ name: 'tp',
73
+ type: 'string',
74
+ defaultValue: null,
75
+ helpText: 'The location to teleport to.',
76
+ position: 0,
77
+ },
78
+ ],
79
+ }),
80
+ new ICommand({
81
+ function: this.loadFn('commands', 'tplist'),
82
+ name: 'tplist',
83
+ trigger: 'tplist',
84
+ helpText: 'Lists all your set locations.',
85
+ requiredPermissions: ['TELEPORTS_USE'],
86
+ arguments: [],
87
+ }),
88
+ new ICommand({
89
+ function: this.loadFn('commands', 'settp'),
90
+ name: 'settp',
91
+ trigger: 'settp',
92
+ helpText: 'Sets a location to teleport to.',
93
+ requiredPermissions: ['TELEPORTS_USE'],
94
+ arguments: [
95
+ {
96
+ name: 'tp',
97
+ type: 'string',
98
+ defaultValue: null,
99
+ helpText: 'The location name.',
100
+ position: 0,
101
+ },
102
+ ],
103
+ }),
104
+ new ICommand({
105
+ function: this.loadFn('commands', 'deletetp'),
106
+ name: 'deletetp',
107
+ trigger: 'deletetp',
108
+ helpText: 'Deletes a location.',
109
+ arguments: [
110
+ {
111
+ name: 'tp',
112
+ type: 'string',
113
+ defaultValue: null,
114
+ helpText: 'The location name.',
115
+ position: 0,
116
+ },
117
+ ],
118
+ }),
119
+ new ICommand({
120
+ function: this.loadFn('commands', 'setpublic'),
121
+ name: 'setpublic',
122
+ trigger: 'setpublic',
123
+ helpText: 'Sets a teleport to be public, allowing other players to teleport to it.',
124
+ requiredPermissions: ['TELEPORTS_CREATE_PUBLIC'],
125
+ arguments: [
126
+ {
127
+ name: 'tp',
128
+ type: 'string',
129
+ defaultValue: null,
130
+ helpText: 'The location name.',
131
+ position: 0,
132
+ },
133
+ ],
134
+ }),
135
+ new ICommand({
136
+ function: this.loadFn('commands', 'setprivate'),
137
+ name: 'setprivate',
138
+ trigger: 'setprivate',
139
+ helpText: 'Sets a teleport to be private, only the teleport owner can teleport to it.',
140
+ arguments: [
141
+ {
142
+ name: 'tp',
143
+ type: 'string',
144
+ defaultValue: null,
145
+ helpText: 'The location name.',
146
+ position: 0,
147
+ },
148
+ ],
149
+ }),
150
+ new ICommand({
151
+ function: this.loadFn('commands', 'setwaypoint'),
152
+ name: 'setwaypoint',
153
+ trigger: 'setwaypoint',
154
+ helpText: 'Creates a new waypoint.',
155
+ requiredPermissions: ['TELEPORTS_MANAGE_WAYPOINTS'],
156
+ arguments: [
157
+ {
158
+ name: 'waypoint',
159
+ type: 'string',
160
+ defaultValue: null,
161
+ helpText: 'The location name.',
162
+ position: 0,
163
+ },
164
+ ],
165
+ }),
166
+ new ICommand({
167
+ function: this.loadFn('commands', 'deletewaypoint'),
168
+ name: 'deletewaypoint',
169
+ trigger: 'deletewaypoint',
170
+ helpText: 'Deletes a waypoint.',
171
+ requiredPermissions: ['TELEPORTS_MANAGE_WAYPOINTS'],
172
+ arguments: [
173
+ {
174
+ name: 'waypoint',
175
+ type: 'string',
176
+ defaultValue: null,
177
+ helpText: 'The location name.',
178
+ position: 0,
179
+ },
180
+ ],
181
+ }),
182
+ new ICommand({
183
+ function: this.loadFn('commands', 'listwaypoints'),
184
+ name: 'listwaypoints',
185
+ trigger: 'waypoints',
186
+ helpText: 'Lists all waypoints.',
187
+ arguments: [],
188
+ }),
189
+ new ICommand({
190
+ function: this.loadFn('commands', 'teleportwaypoint'),
191
+ name: 'teleportwaypoint',
192
+ trigger: 'teleportwaypoint',
193
+ arguments: [],
194
+ helpText: 'Placeholder command, this will not be used directly. The module will install aliases for this command corresponding to the waypoint names.',
195
+ }),
196
+ ],
197
+ cronJobs: [
198
+ new ICronJob({
199
+ name: 'Waypoint reconciler',
200
+ temporalValue: '*/30 * * * *',
201
+ function: this.loadFn('cronJobs', 'Waypoint reconciler'),
202
+ }),
203
+ ],
204
+ }),
205
+ ];
206
+ }
207
+ }
208
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/teleports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,WAAW,EACX,wBAAwB,EACxB,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,OAAO,SAAU,SAAQ,iBAA4B;IACzD;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,wBAAwB,CAAC;gBAC3B,GAAG,EAAE,OAAO;gBACZ,WAAW,EAAE,2FAA2F;gBACxG,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAC3B,OAAO,EAAE,yCAAyC;oBAClD,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,OAAO,EAAE;4BACP,KAAK,EAAE,SAAS;4BAChB,WAAW,EAAE,oDAAoD;4BACjE,aAAa,EAAE,UAAU;4BACzB,IAAI,EAAE,QAAQ;4BACd,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC;yBAC/D;wBACD,oBAAoB,EAAE;4BACpB,IAAI,EAAE,SAAS;4BACf,WAAW,EAAE,sCAAsC;4BAC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I;gCAClB,QAAQ,EAAE,oBAAoB;gCAC9B,QAAQ,EAAE,CAAC;6BACZ;yBACF;qBACF,CAAC;oBACF,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC;wBAClD,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE,WAAW;wBACpB,QAAQ,EAAE,sBAAsB;wBAChC,SAAS,EAAE,EAAE;qBACd,CAAC;oBACF,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC;wBACrD,IAAI,EAAE,kBAAkB;wBACxB,OAAO,EAAE,kBAAkB;wBAC3B,SAAS,EAAE,EAAE;wBACb,QAAQ,EACN,4IAA4I;qBAC/I,CAAC;iBACH;gBACD,QAAQ,EAAE;oBACR,IAAI,QAAQ,CAAC;wBACX,IAAI,EAAE,qBAAqB;wBAC3B,aAAa,EAAE,cAAc;wBAC7B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,qBAAqB,CAAC;qBACzD,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Shutdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Shutdown.d.ts","sourceRoot":"","sources":["../../../../src/modules/timedShutdown/cronJobs/Shutdown.js"],"names":[],"mappings":""}