@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,25 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const items = data.module.userConfig.items;
4
+ const commands = data.module.userConfig.commands;
5
+ if (items.length + commands.length === 0) {
6
+ throw new TakaroUserError('No items or commands configured, please ask your server administrator to configure this module.');
7
+ }
8
+ // pick a random item between 0 and the length of both the items and commands arrays
9
+ const randomIndex = Math.floor(Math.random() * (items.length + commands.length));
10
+ const randomOption = items.concat(commands)[randomIndex];
11
+ if (randomIndex < items.length) {
12
+ const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;
13
+ await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
14
+ name: randomOption.item,
15
+ amount: randomOption.amount,
16
+ quality: randomOption.quality ?? '',
17
+ });
18
+ await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);
19
+ }
20
+ else {
21
+ await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: randomOption });
22
+ }
23
+ }
24
+ await main();
25
+ //# sourceMappingURL=gimme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gimme.js","sourceRoot":"","sources":["../../../../src/modules/gimme/commands/gimme.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;IAEjD,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,eAAe,CACvB,iGAAiG,CAClG,CAAC;IACJ,CAAC;IAED,oFAAoF;IACpF,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC;IAEzD,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACpF,MAAM,MAAM,CAAC,UAAU,CAAC,4BAA4B,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YACtF,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,EAAE;SACpC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,YAAY,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IAC3G,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class Gimme extends ModuleTransferDTO<Gimme> {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/gimme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAsC,MAAM,wBAAwB,CAAC;AAE/F,qBAAa,KAAM,SAAQ,iBAAiB,CAAC,KAAK,CAAC;;CAyElD"}
@@ -0,0 +1,75 @@
1
+ import { ModuleTransferDTO, ICommand, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
2
+ export class Gimme extends ModuleTransferDTO {
3
+ constructor() {
4
+ super();
5
+ this.name = 'gimme';
6
+ this.author = 'Takaro';
7
+ this.supportedGames = ['7 days to die', 'rust', 'minecraft'];
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ tag: '0.0.3',
11
+ description: 'Randomly selects item from a list of items and entities. Fixed issue with item identifiers.',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ properties: {
16
+ items: {
17
+ 'x-component': 'item',
18
+ type: 'array',
19
+ title: 'Items',
20
+ description: 'List of items that a player can receive.',
21
+ uniqueItems: true,
22
+ items: {
23
+ type: 'object',
24
+ title: 'Item',
25
+ properties: {
26
+ item: {
27
+ type: 'string',
28
+ title: 'Item',
29
+ },
30
+ amount: {
31
+ type: 'number',
32
+ title: 'Amount',
33
+ },
34
+ quality: {
35
+ type: 'string',
36
+ title: 'Quality',
37
+ },
38
+ },
39
+ },
40
+ },
41
+ commands: {
42
+ title: 'Commands',
43
+ type: 'array',
44
+ default: ['say hello from gimme'],
45
+ items: {
46
+ type: 'string',
47
+ },
48
+ },
49
+ },
50
+ required: ['items'],
51
+ additionalProperties: false,
52
+ }),
53
+ uiSchema: JSON.stringify({
54
+ items: {
55
+ items: {
56
+ item: {
57
+ 'ui:widget': 'item',
58
+ },
59
+ },
60
+ },
61
+ }),
62
+ commands: [
63
+ new ICommand({
64
+ function: this.loadFn('commands', 'gimme'),
65
+ name: 'gimme',
66
+ trigger: 'gimme',
67
+ helpText: 'Randomly selects item from a list of items and entities.',
68
+ arguments: [],
69
+ }),
70
+ ],
71
+ }),
72
+ ];
73
+ }
74
+ }
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/gimme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,E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AAC;gBACF,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,KAAK,EAAE;wBACL,KAAK,EAAE;4BACL,IAAI,EAAE;gCACJ,WAAW,EAAE,MAAM;6BACpB;yBACF;qBACF;iBACF,CAAC;gBACF,QAAQ,EAAE;oBACR,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC;wBAC1C,IAAI,EAAE,OAAO;wBACb,OAAO,EAAE,OAAO;wBAChB,QAAQ,EAAE,0DAA0D;wBACpE,SAAS,EAAE,EAAE;qBACd,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Ping%20check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ping check.d.ts","sourceRoot":"","sources":["../../../../src/modules/highPingKicker/cronJobs/Ping check.js"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ const VARIABLE_KEY = 'highPingKicker:warnings';
3
+ async function main() {
4
+ const currentPlayers = await takaro.gameserver.gameServerControllerGetPlayers(data.gameServerId);
5
+ await Promise.all(currentPlayers.data.data.map(async (player) => {
6
+ if (player.ping > data.module.userConfig.pingThreshold) {
7
+ const takaroPlayerRes = await takaro.player.playerControllerSearch({
8
+ filters: {
9
+ steamId: [player.steamId],
10
+ },
11
+ });
12
+ const takaroPlayer = takaroPlayerRes.data.data[0];
13
+ const currentWarningsRes = await takaro.variable.variableControllerSearch({
14
+ filters: {
15
+ playerId: [takaroPlayer.id],
16
+ key: [VARIABLE_KEY],
17
+ },
18
+ });
19
+ const currentWarningsRecords = currentWarningsRes.data.data;
20
+ let currentWarnings = 1;
21
+ if (!currentWarningsRecords.length) {
22
+ await takaro.variable.variableControllerCreate({
23
+ playerId: takaroPlayer.id,
24
+ key: VARIABLE_KEY,
25
+ value: '1',
26
+ });
27
+ }
28
+ else {
29
+ currentWarnings = parseInt(currentWarningsRecords[0].value, 10) + 1;
30
+ await takaro.variable.variableControllerUpdate(currentWarningsRecords[0].id, {
31
+ value: currentWarnings.toString(),
32
+ });
33
+ }
34
+ // Check if player should be kicked before sending warning
35
+ if (currentWarnings >= data.module.userConfig.warningsBeforeKick) {
36
+ await takaro.gameserver.gameServerControllerKickPlayer(data.gameServerId, takaroPlayer.id, {
37
+ reason: `Your ping (${player.ping}) is too high, please try again later.`,
38
+ });
39
+ // Delete the warning record after kicking
40
+ if (currentWarningsRecords.length > 0) {
41
+ await takaro.variable.variableControllerDelete(currentWarningsRecords[0].id);
42
+ }
43
+ }
44
+ else {
45
+ // Only send warning if player won't be kicked
46
+ await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
47
+ message: `Your ping (${player.ping}) is too high. Warning ${currentWarnings}/${data.module.userConfig.warningsBeforeKick}`,
48
+ opts: {
49
+ recipient: {
50
+ gameId: player.gameId,
51
+ },
52
+ },
53
+ });
54
+ }
55
+ }
56
+ }));
57
+ }
58
+ await main();
59
+ //# sourceMappingURL=Ping%20check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ping check.js","sourceRoot":"","sources":["../../../../src/modules/highPingKicker/cronJobs/Ping check.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAEjG,MAAM,OAAO,CAAC,GAAG,CACf,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5C,IAAI,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,EAA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,EAAE,YAAY,CAAC,EAAE,EAAE;oBACzF,MAAM,EAAE,cAAc,MAAM,CAAC,IAAI,wCAAwC;iBAC1E,CAAC,CAAC;gBAEH,0CAA0C;gBAC1C,IAAI,sBAAsB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC/E,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,8CAA8C;gBAC9C,MAAM,MAAM,CAAC,UAAU,CAAC,+BAA+B,CAAC,IAAI,CAAC,YAAY,EAAE;oBACzE,OAAO,EAAE,cAAc,MAAM,CAAC,IAAI,0BAA0B,eAAe,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAkB,EAAE;oBAC1H,IAAI,EAAE;wBACJ,SAAS,EAAE;4BACT,MAAM,EAAE,MAAM,CAAC,MAAM;yBACtB;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class HighPingKicker extends ModuleTransferDTO<HighPingKicker> {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/highPingKicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAsC,MAAM,wBAAwB,CAAC;AAE/F,qBAAa,cAAe,SAAQ,iBAAiB,CAAC,cAAc,CAAC;;CAyCpE"}
@@ -0,0 +1,44 @@
1
+ import { ModuleTransferDTO, ICronJob, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
2
+ export class HighPingKicker extends ModuleTransferDTO {
3
+ constructor() {
4
+ super();
5
+ this.name = 'highPingKicker';
6
+ this.author = 'Takaro';
7
+ this.supportedGames = ['7 days to die', 'rust', 'minecraft'];
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ tag: '0.0.2',
11
+ description: 'Automatically kick players with high ping, with warnings and configurable thresholds.',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ properties: {
16
+ pingThreshold: {
17
+ type: 'number',
18
+ title: 'Ping threshold',
19
+ description: 'A ping value that is deemed too high and prompts a warning.',
20
+ default: 200,
21
+ minimum: 0,
22
+ },
23
+ warningsBeforeKick: {
24
+ type: 'number',
25
+ title: 'Kick warnings',
26
+ description: 'Number of warnings before a player is kicked.',
27
+ default: 3,
28
+ minimum: 0,
29
+ },
30
+ },
31
+ required: [],
32
+ }),
33
+ cronJobs: [
34
+ new ICronJob({
35
+ name: 'Ping check',
36
+ temporalValue: '*/5 * * * *',
37
+ function: this.loadFn('cronJobs', 'Ping check'),
38
+ }),
39
+ ],
40
+ }),
41
+ ];
42
+ }
43
+ }
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/highPingKicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAE/F,MAAM,OAAO,cAAe,SAAQ,iBAAiC;IACnE;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,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,uFAAuF;gBACpG,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAC3B,OAAO,EAAE,yCAAyC;oBAClD,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,aAAa,EAAE;4BACb,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,gBAAgB;4BACvB,WAAW,EAAE,6DAA6D;4BAC1E,OAAO,EAAE,GAAG;4BACZ,OAAO,EAAE,CAAC;yBACX;wBACD,kBAAkB,EAAE;4BAClB,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,eAAe;4BACtB,WAAW,EAAE,+CAA+C;4BAC5D,OAAO,EAAE,CAAC;4BACV,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,EAAE,EAAE;iBACb,CAAC;gBACF,QAAQ,EAAE;oBACR,IAAI,QAAQ,CAAC;wBACX,IAAI,EAAE,YAAY;wBAClB,aAAa,EAAE,aAAa;wBAC5B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;qBAChD,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=buyTicket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buyTicket.d.ts","sourceRoot":"","sources":["../../../../src/modules/lottery/commands/buyTicket.js"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const { pog, gameServerId, arguments: args, module: mod } = data;
4
+ const varKey = 'lottery_tickets_bought';
5
+ if (args.amount < 1) {
6
+ throw new TakaroUserError('You must buy at least 1 ticket.');
7
+ }
8
+ const tickets = (await takaro.variable.variableControllerSearch({
9
+ filters: {
10
+ gameServerId: [gameServerId],
11
+ key: [varKey],
12
+ moduleId: [mod.moduleId],
13
+ playerId: [pog.playerId],
14
+ },
15
+ })).data.data;
16
+ // Player already has some tickets bought
17
+ if (tickets.length > 0) {
18
+ const ticketsBought = tickets[0];
19
+ const ticketsBoughtAmount = parseInt(JSON.parse(ticketsBought.value).amount, 10);
20
+ await takaro.variable.variableControllerUpdate(ticketsBought.id, {
21
+ key: varKey,
22
+ playerId: pog.playerId,
23
+ moduleId: mod.moduleId,
24
+ gameServerId,
25
+ value: JSON.stringify({ amount: ticketsBoughtAmount + args.amount }),
26
+ });
27
+ }
28
+ // Player has no tickets bought
29
+ else {
30
+ await takaro.variable.variableControllerCreate({
31
+ key: varKey,
32
+ value: JSON.stringify({
33
+ amount: args.amount,
34
+ }),
35
+ gameServerId,
36
+ moduleId: mod.moduleId,
37
+ playerId: pog.playerId,
38
+ });
39
+ }
40
+ const ticketPrice = args.amount * mod.systemConfig.commands.buyTicket.cost;
41
+ // The price of the first ticket is deducted by the command execution itself.
42
+ if (args.amount > 1) {
43
+ await takaro.playerOnGameserver.playerOnGameServerControllerDeductCurrency(gameServerId, pog.playerId, {
44
+ currency: ticketPrice - 1,
45
+ });
46
+ }
47
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
48
+ await pog.pm(`You have successfully bought ${args.amount} tickets for ${ticketPrice} ${currencyName}. Good luck!`);
49
+ }
50
+ await main();
51
+ //# sourceMappingURL=buyTicket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buyTicket.js","sourceRoot":"","sources":["../../../../src/modules/lottery/commands/buyTicket.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEjE,MAAM,MAAM,GAAG,wBAAwB,CAAC;IAExC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,eAAe,CAAC,iCAAiC,CAAC,CA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,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;IAE3E,6EAA6E;IAC7E,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,kBAAkB,CAAC,0CAA0C,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE;YACrG,QAAQ,EAAE,WAAW,GAAG,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAEpH,MAAM,GAAG,CAAC,EAAE,CAAC,gCAAgC,IAAI,CAAC,MAAM,gBAAgB,WAAW,IAAI,YAAY,cAAc,CAAC,CAAC;AACrH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nextDraw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextDraw.d.ts","sourceRoot":"","sources":["../../../../src/modules/lottery/commands/nextDraw.js"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import { nextCronJobRun, data } from '@takaro/helpers';
2
+ function formatTimeToReach(cronJob) {
3
+ const targetDate = nextCronJobRun(cronJob);
4
+ // Get the current date and time
5
+ const currentDate = new Date();
6
+ // Calculate the time difference in milliseconds
7
+ const delta = targetDate - currentDate;
8
+ // Calculate days, hours, minutes, and seconds
9
+ const days = Math.floor(delta / (1000 * 60 * 60 * 24));
10
+ const hours = Math.floor((delta % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
11
+ const minutes = Math.floor((delta % (1000 * 60 * 60)) / (1000 * 60));
12
+ const seconds = Math.floor((delta % (1000 * 60)) / 1000);
13
+ // Build the formatted string
14
+ let formattedString = '';
15
+ if (days > 0) {
16
+ formattedString += `${days} day${days > 1 ? 's' : ''} `;
17
+ }
18
+ if (hours > 0) {
19
+ formattedString += `${hours} hour${hours > 1 ? 's' : ''} `;
20
+ }
21
+ if (minutes > 0) {
22
+ formattedString += `${minutes} minute${minutes > 1 ? 's' : ''} `;
23
+ }
24
+ if (seconds > 0) {
25
+ formattedString += `${seconds} second${seconds > 1 ? 's' : ''} `;
26
+ }
27
+ return formattedString.trim();
28
+ }
29
+ async function main() {
30
+ const { player, module: mod } = data;
31
+ await player.pm(`The next lottery draw is in about ${formatTimeToReach(mod.systemConfig.cronJobs.drawLottery.temporalValue)}`);
32
+ }
33
+ await main();
34
+ //# sourceMappingURL=nextDraw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextDraw.js","sourceRoot":"","sources":["../../../../src/modules/lottery/commands/nextDraw.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvD,SAAS,iBAAiB,CAAC,OAAO;IAChC,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE3C,gCAAgC;IAChC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC;IAE/B,gDAAgD;IAChD,MAAM,KAAK,GAAG,UAAU,GAAG,WAAW,CAAC;IAEvC,8CAA8C;IAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,GAA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AED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=viewTickets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewTickets.d.ts","sourceRoot":"","sources":["../../../../src/modules/lottery/commands/viewTickets.js"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ async function main() {
3
+ const { pog, gameServerId, module: mod } = data;
4
+ const varKey = 'lottery_tickets_bought';
5
+ const tickets = (await takaro.variable.variableControllerSearch({
6
+ filters: {
7
+ gameServerId: [gameServerId],
8
+ key: [varKey],
9
+ moduleId: [mod.moduleId],
10
+ playerId: [pog.playerId],
11
+ },
12
+ })).data.data;
13
+ let ticketsBought = 0;
14
+ if (tickets.length === 1) {
15
+ ticketsBought = parseInt(JSON.parse(tickets[0].value).amount, 10);
16
+ }
17
+ await pog.pm(`You have bought ${ticketsBought} tickets.`);
18
+ }
19
+ await main();
20
+ //# sourceMappingURL=viewTickets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewTickets.js","sourceRoot":"","sources":["../../../../src/modules/lottery/commands/viewTickets.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEhD,MAAM,MAAM,GAAG,wBAAwB,CAAC;IAExC,MAAM,OAAO,GAAG,CACd,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,OAAO,EAAE;YACP,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,GAAG,EAAE,CAAC,MAAM,CAAC;YACb,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;SACzB;KACF,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC;IAEZ,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,GAAG,CAAC,EAAE,CAAC,mBAAmB,aAAa,WAAW,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=drawLottery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawLottery.d.ts","sourceRoot":"","sources":["../../../../src/modules/lottery/cronJobs/drawLottery.js"],"names":[],"mappings":""}
@@ -0,0 +1,96 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ function getTotalPrize(tickets, ticketPrice, profitMargin) {
3
+ const amount = tickets.reduce((acc, ticket) => {
4
+ const ticketAmount = parseInt(JSON.parse(ticket.value).amount, 10);
5
+ return acc + ticketAmount;
6
+ }, 0);
7
+ const rawTotal = amount * ticketPrice;
8
+ const profit = rawTotal * profitMargin;
9
+ const totalPrize = rawTotal - profit;
10
+ return totalPrize;
11
+ }
12
+ async function drawWinner(takaro, gameServerId, tickets) {
13
+ const randomIndex = Math.floor(Math.random() * tickets.length);
14
+ const winnerTicket = tickets[randomIndex];
15
+ const winner = (await takaro.player.playerControllerGetOne(winnerTicket.playerId)).data.data;
16
+ const pog = await takaro.playerOnGameserver.playerOnGameServerControllerSearch({
17
+ filters: {
18
+ gameServerId: [gameServerId],
19
+ playerId: [winner.id],
20
+ },
21
+ });
22
+ return {
23
+ name: winner.name,
24
+ playerId: pog.data.data[0].playerId,
25
+ };
26
+ }
27
+ async function refundPlayer(takaro, gameServerId, playerId, amount, currencyName) {
28
+ const pog = (await takaro.playerOnGameserver.playerOnGameServerControllerSearch({
29
+ filters: {
30
+ gameServerId: [gameServerId],
31
+ playerId: [playerId],
32
+ },
33
+ })).data.data[0];
34
+ await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, pog.playerId, {
35
+ currency: amount,
36
+ });
37
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
38
+ message: `You have been refunded ${amount} ${currencyName} because the lottery has been cancelled.`,
39
+ opts: {
40
+ recipient: {
41
+ gameId: pog.gameId,
42
+ },
43
+ },
44
+ });
45
+ }
46
+ async function cleanUp(takaro, tickets) {
47
+ const deleteTasks = tickets.map((ticket) => takaro.variable.variableControllerDelete(ticket.id));
48
+ await Promise.allSettled(deleteTasks);
49
+ }
50
+ async function main() {
51
+ const { gameServerId, module: mod } = data;
52
+ let tickets = [];
53
+ try {
54
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
55
+ const ticketCost = mod.systemConfig.commands.buyTicket.cost;
56
+ tickets = (await takaro.variable.variableControllerSearch({
57
+ filters: {
58
+ gameServerId: [gameServerId],
59
+ moduleId: [mod.moduleId],
60
+ key: ['lottery_tickets_bought'],
61
+ },
62
+ })).data.data;
63
+ if (tickets.length === 0) {
64
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
65
+ message: 'No one has bought any tickets. The lottery has been cancelled.',
66
+ });
67
+ return;
68
+ }
69
+ if (tickets.length === 1) {
70
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
71
+ message: 'Only one person has bought a ticket. The lottery has been cancelled.',
72
+ });
73
+ const amount = parseInt(JSON.parse(tickets[0].value).amount, 10) * ticketCost;
74
+ await refundPlayer(takaro, gameServerId, tickets[0].playerId, amount, currencyName);
75
+ return;
76
+ }
77
+ const totalPrize = getTotalPrize(tickets, ticketCost, mod.userConfig.profitMargin);
78
+ const { name: winnerName, playerId } = await drawWinner(takaro, gameServerId, tickets);
79
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
80
+ message: 'The lottery raffle is about to start!',
81
+ });
82
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, { message: 'drumrolls please...' });
83
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, { message: 'The winner is...' });
84
+ await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerId, {
85
+ currency: totalPrize,
86
+ });
87
+ await takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
88
+ message: `${winnerName}! Congratulations! You have won ${totalPrize} ${currencyName}!`,
89
+ });
90
+ }
91
+ finally {
92
+ await cleanUp(takaro, tickets);
93
+ }
94
+ }
95
+ await main();
96
+ //# sourceMappingURL=drawLottery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drawLottery.js","sourceRoot":"","sources":["../../../../src/modules/lottery/cronJobs/drawLottery.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,SAAS,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QAC5C,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEnE,OAAO,GAAG,GAAG,YAAY,CAAC;IAC5B,CAAC,EAAE,CAAC,CAAC,CAAC;IAEN,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,MAAM,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;IACvC,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;IAErC,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO;IACrD,MAAM,WAAW,GAAG,IAAI,CAAC,KA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AC;QACT,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class Lottery extends ModuleTransferDTO<Lottery> {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/lottery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6D,MAAM,wBAAwB,CAAC;AAEtH,qBAAa,OAAQ,SAAQ,iBAAiB,CAAC,OAAO,CAAC;;CAmFtD"}
@@ -0,0 +1,85 @@
1
+ import { ModuleTransferDTO, ICommand, ICronJob, IPermission, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
2
+ export class Lottery extends ModuleTransferDTO {
3
+ constructor() {
4
+ super();
5
+ this.name = 'lottery';
6
+ this.author = 'Takaro';
7
+ this.supportedGames = ['all'];
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ tag: '0.0.2',
11
+ description: 'Players can buy tickets for a lottery, and the winner is chosen at random.',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ properties: {
16
+ profitMargin: {
17
+ type: 'number',
18
+ maximum: 1,
19
+ minimum: 0,
20
+ description: 'The profit margin the server takes from the lottery.',
21
+ default: 0.1,
22
+ },
23
+ },
24
+ required: [],
25
+ additionalProperties: false,
26
+ }),
27
+ permissions: [
28
+ new IPermission({
29
+ permission: 'LOTTERY_BUY',
30
+ friendlyName: 'Buy Lottery Tickets',
31
+ canHaveCount: false,
32
+ description: 'Allows the player to buy lottery tickets.',
33
+ }),
34
+ new IPermission({
35
+ permission: 'LOTTERY_VIEW_TICKETS',
36
+ friendlyName: 'View Lottery Tickets',
37
+ description: 'Allows the player to view his lottery tickets.',
38
+ canHaveCount: false,
39
+ }),
40
+ ],
41
+ cronJobs: [
42
+ new ICronJob({
43
+ name: 'drawLottery',
44
+ temporalValue: '0 0 * * *',
45
+ function: this.loadFn('cronJobs', 'drawLottery'),
46
+ }),
47
+ ],
48
+ commands: [
49
+ new ICommand({
50
+ function: this.loadFn('commands', 'buyTicket'),
51
+ name: 'buyTicket',
52
+ trigger: 'buyTicket',
53
+ helpText: 'Buy a lottery ticket.',
54
+ requiredPermissions: ['LOTTERY_BUY'],
55
+ arguments: [
56
+ {
57
+ name: 'amount',
58
+ type: 'number',
59
+ helpText: 'The amount of tickets to buy.',
60
+ position: 0,
61
+ defaultValue: null,
62
+ },
63
+ ],
64
+ }),
65
+ new ICommand({
66
+ function: this.loadFn('commands', 'viewTickets'),
67
+ name: 'viewTickets',
68
+ trigger: 'viewTickets',
69
+ helpText: 'View your lottery tickets.',
70
+ requiredPermissions: ['LOTTERY_VIEW_TICKETS'],
71
+ arguments: [],
72
+ }),
73
+ new ICommand({
74
+ function: this.loadFn('commands', 'nextDraw'),
75
+ name: 'nextDraw',
76
+ trigger: 'nextDraw',
77
+ helpText: 'View when the next draw is.',
78
+ arguments: [],
79
+ }),
80
+ ],
81
+ }),
82
+ ];
83
+ }
84
+ }
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/lottery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEtH,MAAM,OAAO,OAAQ,SAAQ,iBAA0B;IACrD;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC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AQ;gCACd,QAAQ,EAAE,+BAA+B;gCACzC,QAAQ,EAAE,CAAC;gCACX,YAAY,EAAE,IAAI;6BACnB;yBACF;qBACF,CAAC;oBACF,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC;wBAChD,IAAI,EAAE,aAAa;wBACnB,OAAO,EAAE,aAAa;wBACtB,QAAQ,EAAE,4BAA4B;wBACtC,mBAAmB,EAAE,CAAC,sBAAsB,CAAC;wBAC7C,SAAS,EAAE,EAAE;qBACd,CAAC;oBACF,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC;wBAC7C,IAAI,EAAE,UAAU;wBAChB,OAAO,EAAE,UAAU;wBACnB,QAAQ,EAAE,6BAA6B;wBACvC,SAAS,EAAE,EAAE;qBACd,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=starterkit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starterkit.d.ts","sourceRoot":"","sources":["../../../../src/modules/playerOnboarding/commands/starterkit.js"],"names":[],"mappings":""}