@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,127 @@
1
+ import { ModuleTransferDTO, ICommand, IFunction, IHook, IPermission, ModuleTransferVersionDTO, } from '../../BuiltinModule.js';
2
+ export class DailyRewards extends ModuleTransferDTO {
3
+ constructor() {
4
+ super();
5
+ this.name = 'dailyRewards';
6
+ this.author = 'Takaro';
7
+ this.supportedGames = ['all'];
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ description: 'Provides daily login rewards with streak tracking',
11
+ tag: '0.0.2',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ properties: {
16
+ baseReward: {
17
+ type: 'number',
18
+ title: 'Base Reward',
19
+ description: 'Base amount of currency given for daily rewards. This is multiplied by streak level.',
20
+ default: 100,
21
+ minimum: 1,
22
+ },
23
+ maxStreak: {
24
+ type: 'number',
25
+ title: 'Maximum Streak',
26
+ description: 'Maximum streak level a player can reach',
27
+ default: 365,
28
+ minimum: 1,
29
+ },
30
+ milestoneRewards: {
31
+ type: 'array',
32
+ title: 'Milestone Rewards',
33
+ description: 'Additional rewards for reaching certain streak milestones',
34
+ items: {
35
+ type: 'object',
36
+ properties: {
37
+ days: {
38
+ type: 'number',
39
+ description: 'Days needed to reach milestone',
40
+ minimum: 1,
41
+ },
42
+ reward: {
43
+ type: 'number',
44
+ description: 'Bonus reward amount',
45
+ },
46
+ message: {
47
+ type: 'string',
48
+ description: 'Message to show when milestone is reached',
49
+ },
50
+ },
51
+ },
52
+ default: [
53
+ { days: 7, reward: 1000, message: 'You did it! 7 days in a row!' },
54
+ { days: 30, reward: 5000, message: "A whole month! You're on fire!" },
55
+ { days: 90, reward: 20000, message: "90 days! You're unstoppable!" },
56
+ { days: 180, reward: 50000, message: "Half a year! You're a legend!" },
57
+ { days: 365, reward: 150000, message: "365 days! You're a true champion!" },
58
+ ],
59
+ },
60
+ },
61
+ required: ['baseReward', 'maxStreak', 'milestoneRewards'],
62
+ additionalProperties: false,
63
+ }),
64
+ functions: [
65
+ new IFunction({
66
+ name: 'utils',
67
+ function: this.loadFn('functions', 'utils'),
68
+ }),
69
+ ],
70
+ permissions: [
71
+ new IPermission({
72
+ permission: 'DAILY_CLAIM',
73
+ friendlyName: 'Claim Daily Rewards',
74
+ description: 'Allows the player to claim daily rewards',
75
+ canHaveCount: false,
76
+ }),
77
+ new IPermission({
78
+ permission: 'DAILY_REWARD_MULTIPLIER',
79
+ friendlyName: 'Multiplier',
80
+ description: 'Control the multiplier per role. This is useful to give your donors a little extra. Count is an integer multiplier.',
81
+ canHaveCount: true,
82
+ }),
83
+ ],
84
+ commands: [
85
+ new ICommand({
86
+ function: this.loadFn('commands', 'daily'),
87
+ name: 'daily',
88
+ trigger: 'daily',
89
+ helpText: 'Claim your daily reward',
90
+ requiredPermissions: ['DAILY_CLAIM'],
91
+ arguments: [],
92
+ }),
93
+ new ICommand({
94
+ function: this.loadFn('commands', 'streak'),
95
+ name: 'streak',
96
+ trigger: 'streak',
97
+ helpText: 'Check your current daily reward streak and next claim time',
98
+ arguments: [],
99
+ }),
100
+ new ICommand({
101
+ function: this.loadFn('commands', 'topstreak'),
102
+ name: 'topstreak',
103
+ trigger: 'topstreak',
104
+ helpText: 'Shows the players with highest daily reward streaks',
105
+ arguments: [
106
+ {
107
+ name: 'count',
108
+ type: 'number',
109
+ defaultValue: '5',
110
+ helpText: 'Number of players to show (max 25)',
111
+ position: 0,
112
+ },
113
+ ],
114
+ }),
115
+ ],
116
+ hooks: [
117
+ new IHook({
118
+ eventType: 'player-connected',
119
+ name: 'dailyLoginCheck',
120
+ function: this.loadFn('hooks', 'dailyLoginCheck'),
121
+ }),
122
+ ],
123
+ }),
124
+ ];
125
+ }
126
+ }
127
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/dailyRewards/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO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ACd,CAAC;oBACF,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC;wBAC3C,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,QAAQ;wBACjB,QAAQ,EAAE,4DAA4D;wBACtE,SAAS,EAAE,EAAE;qBACd,CAAC;oBACF,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC;wBAC9C,IAAI,EAAE,WAAW;wBACjB,OAAO,EAAE,WAAW;wBACpB,QAAQ,EAAE,qDAAqD;wBAC/D,SAAS,EAAE;4BACT;gCACE,IAAI,EAAE,OAAO;gCACb,IAAI,EAAE,QAAQ;gCACd,YAAY,EAAE,GAAG;gCACjB,QAAQ,EAAE,oCAAoC;gCAC9C,QAAQ,EAAE,CAAC;6BACZ;yBACF;qBACF,CAAC;iBACH;gBAED,KAAK,EAAE;oBACL,IAAI,KAAK,CAAC;wBACR,SAAS,EAAE,kBAAkB;wBAC7B,IAAI,EAAE,iBAAiB;wBACvB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC;qBAClD,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=balance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/balance.js"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ async function main() {
3
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', data.gameServerId)).data.data;
4
+ await data.player.pm(`balance: ${data.pog.currency} ${currencyName.value}`);
5
+ }
6
+ await main();
7
+ //# sourceMappingURL=balance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"balance.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/balance.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACnH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/claim.js"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const { user, player, arguments: args, gameServerId } = data;
4
+ if (!user)
5
+ throw new TakaroUserError('You must link your account to Takaro to use this command.');
6
+ const filters = {
7
+ userId: [user.id],
8
+ status: ['PAID'],
9
+ };
10
+ // Only filter by gameServerId if it's available (should always be present in command context)
11
+ if (gameServerId) {
12
+ filters.gameServerId = [gameServerId];
13
+ }
14
+ const pendingOrdersRes = await takaro.shopOrder.shopOrderControllerSearch({
15
+ filters,
16
+ sortBy: 'createdAt',
17
+ sortDirection: 'asc',
18
+ });
19
+ if (pendingOrdersRes.data.data.length === 0) {
20
+ await player.pm('You have no pending orders.');
21
+ return;
22
+ }
23
+ let ordersToClaim = [];
24
+ if (args.all) {
25
+ ordersToClaim = pendingOrdersRes.data.data;
26
+ }
27
+ else {
28
+ ordersToClaim.push(pendingOrdersRes.data.data[0]);
29
+ }
30
+ for (const order of ordersToClaim) {
31
+ await takaro.shopOrder.shopOrderControllerClaim(order.id);
32
+ }
33
+ }
34
+ await main();
35
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/claim.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAE7D,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,eAAe,CAAC,2DAA2D,CAAC,CAAC;IAElG,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB,MAAM,EAAE,CAAC,MAAM,CAAC;KACjB,CAAC;IAEF,8FAA8F;IAC9F,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,YAAY,GAAG,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC;QACxE,OAAO;QACP,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,MAAM,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IAED,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=confirmTransfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmTransfer.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/confirmTransfer.js"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const { gameServerId, pog: sender, module: mod } = data;
4
+ // try to find a variable with key "confirmTransfer"
5
+ const variables = (await takaro.variable.variableControllerSearch({
6
+ filters: {
7
+ key: ['confirmTransfer'],
8
+ gameServerId: [gameServerId],
9
+ moduleId: [mod.moduleId],
10
+ playerId: [sender.playerId],
11
+ },
12
+ })).data.data;
13
+ if (variables.length === 0) {
14
+ throw new TakaroUserError('You have no pending transfer.');
15
+ }
16
+ // Remove the variable before potentially executing the transaction.
17
+ await takaro.variable.variableControllerDelete(variables[0].id);
18
+ const pendingTransfer = JSON.parse(variables[0].value);
19
+ await takaro.playerOnGameserver.playerOnGameServerControllerTransactBetweenPlayers(sender.gameServerId, sender.id, pendingTransfer.receiver.id, {
20
+ currency: pendingTransfer.amount,
21
+ });
22
+ const receiverName = (await takaro.player.playerControllerGetOne(pendingTransfer.receiver.playerId)).data.data.name;
23
+ const senderName = (await takaro.player.playerControllerGetOne(sender.playerId)).data.data.name;
24
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
25
+ const messageToSender = sender.pm(`You successfully transferred ${pendingTransfer.amount} ${currencyName} to ${receiverName}`);
26
+ const messageToReceiver = takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
27
+ message: `You received ${pendingTransfer.amount} ${currencyName} from ${senderName}`,
28
+ opts: {
29
+ recipient: {
30
+ gameId: pendingTransfer.receiver.gameId,
31
+ },
32
+ },
33
+ });
34
+ await Promise.all([messageToSender, messageToReceiver]);
35
+ return;
36
+ }
37
+ await main();
38
+ //# sourceMappingURL=confirmTransfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmTransfer.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/confirmTransfer.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAExD,oDAAoD;IACpD,MAAM,SAAS,GAAG,CAChB,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,iBAAiB,CAAC;YACxB,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,QAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;SAC5B;KACF,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC;IAEZ,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,eAAe,CAAC,+BAA+B,CAAC,CAAC;IAC7D,CAAC;IAED,oEAAoE;IACpE,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChE,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEvD,MAAM,MAAM,CAAC,kBAAkB,CAAC,kDAAk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ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/grantCurrency.js"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ async function main() {
3
+ const { pog: granter, arguments: args, gameServerId } = data;
4
+ // args.receiver has an argument type of "player". Arguments of this type are automatically resolved to the player's id.
5
+ // If the player doesn't exist or multiple players with the same name where found, it will have thrown an error before this command is executed.
6
+ const receiver = args.receiver;
7
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
8
+ const granterName = (await takaro.player.playerControllerGetOne(granter.playerId)).data.data.name;
9
+ const receiverName = (await takaro.player.playerControllerGetOne(receiver.playerId)).data.data.name;
10
+ await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(receiver.gameServerId, receiver.playerId, {
11
+ currency: args.amount,
12
+ });
13
+ const messageToReceiver = takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
14
+ message: `Granted ${args.amount} ${currencyName} by ${granterName}`,
15
+ opts: {
16
+ recipient: {
17
+ gameId: receiver.gameId,
18
+ },
19
+ },
20
+ });
21
+ await Promise.all([
22
+ granter.pm(`You successfully granted ${args.amount} ${currencyName} to ${receiverName}`),
23
+ messageToReceiver,
24
+ ]);
25
+ return;
26
+ }
27
+ await main();
28
+ //# sourceMappingURL=grantCurrency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grantCurrency.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/grantCurrency.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAE7D,wHAAwH;IACxH,gJAAgJ;IAChJ,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAE/B,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACpH,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAClG,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACpG,MAAM,MAAM,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,EAAE;QAChH,QAAQ,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,+BAA+B,CAAC,YAAY,EAAE;QACxF,OAAO,EAAE,WAAW,IAAI,CAAC,MAAM,IAAI,YAAY,OAAO,WAAW,EAAE;QACnE,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,OAAO,CAAC,EAAE,CAAC,4BAA4B,IAAI,CAAC,MAAM,IAAI,YAAY,OAAO,YAAY,EAAE,CAAC;QACxF,iBAAiB;KAClB,CAAC,CAAC;IAEH,OAAO;AACT,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=revokeCurrency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revokeCurrency.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/revokeCurrency.js"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ async function main() {
3
+ const { pog: revoker, arguments: args, gameServerId } = data;
4
+ // args.receiver has an argument type of "player". Arguments of this type are automatically resolved to the player's id.
5
+ // If the player doesn't exist or multiple players with the same name where found, it will have thrown an error before this command is executed.
6
+ const receiver = args.receiver;
7
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
8
+ const revokerName = (await takaro.player.playerControllerGetOne(revoker.playerId)).data.data.name;
9
+ const receiverName = (await takaro.player.playerControllerGetOne(receiver.playerId)).data.data.name;
10
+ await takaro.playerOnGameserver.playerOnGameServerControllerDeductCurrency(receiver.gameServerId, receiver.playerId, {
11
+ currency: args.amount,
12
+ });
13
+ const messageToReceiver = takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
14
+ message: `${args.amount} ${currencyName} were revoked by ${revokerName}`,
15
+ opts: {
16
+ recipient: {
17
+ gameId: receiver.gameId,
18
+ },
19
+ },
20
+ });
21
+ await Promise.all([
22
+ revoker.pm(`You successfully revoked ${args.amount} ${currencyName} of ${receiverName}'s balance`),
23
+ messageToReceiver,
24
+ ]);
25
+ return;
26
+ }
27
+ await main();
28
+ //# sourceMappingURL=revokeCurrency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revokeCurrency.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/revokeCurrency.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAE7D,wHAAwH;IACxH,gJAAgJ;IAChJ,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAE/B,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IACpH,MAAM,WAAW,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAClG,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACpG,MAAM,MAAM,CAAC,kBAAkB,CAAC,0CAA0C,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,EAAE;QACnH,QAAQ,EAAE,IAAI,CAAC,MAAM;KACtB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,+BAA+B,CAAC,YAAY,EAAE;QACxF,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,YAAY,oBAAoB,WAAW,EAAE;QACxE,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,OAAO,CAAC,EAAE,CAAC,4BAA4B,IAAI,CAAC,MAAM,IAAI,YAAY,OAAO,YAAY,YAAY,CAAC;QAClG,iBAAiB;KAClB,CAAC,CAAC;IAEH,OAAO;AACT,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shop.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/shop.js"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const { arguments: args, player, gameServerId } = data;
4
+ const { page, item, action } = args;
5
+ const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
6
+ // If command is called without any arguments
7
+ const messageWithoutPrefix = data.chatMessage.msg.slice(prefix.length).trim();
8
+ if (!messageWithoutPrefix.includes(' ')) {
9
+ await player.pm('This command allows you to browse the shop and view available items.');
10
+ await player.pm(`Usage: ${prefix}shop [page] [item] [action]`);
11
+ await player.pm(`${prefix}shop 2 - View the second page of shop items`);
12
+ await player.pm(`${prefix}shop 1 3 - View details about the third item on the first page`);
13
+ await player.pm(`${prefix}shop 1 3 buy - Purchase the third item on the first page`);
14
+ return;
15
+ }
16
+ const shopItems = await takaro.shopListing.shopListingControllerSearch({
17
+ limit: 5,
18
+ page: page - 1,
19
+ sortBy: 'name',
20
+ sortDirection: 'asc',
21
+ filters: {
22
+ gameServerId: [gameServerId],
23
+ draft: false,
24
+ },
25
+ });
26
+ if (shopItems.data.data.length === 0) {
27
+ await player.pm('No items found.');
28
+ return;
29
+ }
30
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', data.gameServerId)).data.data;
31
+ if (!item) {
32
+ // List the shop items with index
33
+ let index = 1;
34
+ for (const listing of shopItems.data.data) {
35
+ const items = listing.items.slice(0, 3).map((item) => {
36
+ return `${item.amount}x ${item.item.name}`;
37
+ });
38
+ await player.pm(`${index} - ${listing.name} - ${listing.price} ${currencyName.value}. ${items.join(', ')}`);
39
+ index++;
40
+ }
41
+ return;
42
+ }
43
+ const selectedItem = shopItems.data.data[item - 1];
44
+ if (!selectedItem)
45
+ throw new TakaroUserError(`Item not found. Please select an item from the list, valid options are 1-${shopItems.data.data.length}.`);
46
+ if (action === 'none') {
47
+ // Display more info about the item
48
+ await player.pm(`Listing ${selectedItem.name} - ${selectedItem.price} ${currencyName.value}`);
49
+ await Promise.all(selectedItem.items.map((item) => {
50
+ const quality = item.quality ? `Quality: ${item.quality}` : '';
51
+ const description = (item.item.description ? `Description: ${item.item.description}` : '').replaceAll('\\n', ' ');
52
+ return player.pm(`- ${item.amount}x ${item.item.name}. ${quality} ${description}`);
53
+ }));
54
+ return;
55
+ }
56
+ if (action === 'buy') {
57
+ const orderRes = await takaro.shopOrder.shopOrderControllerCreate({
58
+ amount: 1,
59
+ listingId: selectedItem.id,
60
+ playerId: player.id,
61
+ });
62
+ await player.pm(`You have purchased ${selectedItem.name} for ${selectedItem.price} ${currencyName.value}.`);
63
+ await takaro.shopOrder.shopOrderControllerClaim(orderRes.data.data.id);
64
+ return;
65
+ }
66
+ throw new TakaroUserError('Invalid action. Valid actions are "buy".');
67
+ }
68
+ await main();
69
+ //# sourceMappingURL=shop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shop.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/shop.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACvD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACpC,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,6CAA6C;IAC7C,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,MAAM,MAAM,CAAC,EAAE,CAAC,sEAAsE,CAAC,CAAC;QACxF,MAAM,MAAM,CAAC,EAAE,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,OAAO;IACT,CAAC;IAED,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC;YAChE,MAAM,EAAE,CAAC;YACT,SAAS,EAAE,YAAY,CAAC,EAAE;YAC1B,QAAQ,EAAE,MAAM,CAAC,EAAE;SACpB,CAAC,CAAC;QACH,MAAM,MAAM,CAAC,EAAE,CAAC,sBAAsB,YAAY,CAAC,IAAI,QAAQ,YAAY,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC;QAC5G,MAAM,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvE,OAAO;IACT,CAAC;IAED,MAAM,IAAI,eAAe,CAAC,0CAA0C,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=topCurrency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topCurrency.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/topCurrency.js"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ async function main() {
3
+ const richest = (await takaro.playerOnGameserver.playerOnGameServerControllerSearch({
4
+ limit: 10,
5
+ sortBy: 'currency',
6
+ sortDirection: 'desc',
7
+ extend: ['player'],
8
+ })).data.data;
9
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', data.gameServerId)).data.data
10
+ .value;
11
+ // TODO: change this to name when it become available in playerOnGameServer
12
+ const richestStrings = richest.map(async (pog, index) => {
13
+ const playerName = (await takaro.player.playerControllerGetOne(pog.playerId)).data.data.name;
14
+ return `${index + 1}. ${playerName} - ${pog.currency} ${currencyName}`;
15
+ });
16
+ await data.player.pm('Richest players:');
17
+ for (const string of richestStrings) {
18
+ await data.player.pm(await string);
19
+ }
20
+ }
21
+ await main();
22
+ //# sourceMappingURL=topCurrency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topCurrency.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/topCurrency.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,CACd,MAAM,MAAM,CAAC,kBAAkB,CAAC,kCAAkC,CAAC;QACjE,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,UAAU;QAClB,aAAa,EAAE,MAAM;QACrB,MAAM,EAAE,CAAC,QAAQ,CAAC;KACnB,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC;IAEZ,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;SAC/G,KAAK,CAAC;IAET,2EAA2E;IAC3E,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QACtD,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7F,OAAO,GAAG,KAAK,GAAG,CAAC,KAAK,UAAU,MAAM,GAAG,CAAC,QAAQ,IAAI,YAAY,EAAE,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;IAEzC,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;QACpC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,CAAC;IACrC,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/transfer.js"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const { pog: sender, arguments: args, gameServerId, module: mod } = data;
4
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
5
+ const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
6
+ // args.receiver has an argument type of "player". Arguments of this type are automatically resolved to the player's id.
7
+ // If the player doesn't exist or multiple players with the same name where found, it will have thrown an error before this command is executed.
8
+ const receiver = args.receiver;
9
+ const senderName = (await takaro.player.playerControllerGetOne(sender.playerId)).data.data.name;
10
+ const receiverName = (await takaro.player.playerControllerGetOne(receiver.playerId)).data.data.name;
11
+ if (mod.userConfig.pendingAmount !== 0 && args.amount >= mod.userConfig.pendingAmount) {
12
+ // create a variable to store confirmation requirement
13
+ // TODO: in the future, we should probably add an expiration date to this variable.
14
+ await takaro.variable.variableControllerCreate({
15
+ key: 'confirmTransfer',
16
+ value: JSON.stringify({
17
+ amount: args.amount,
18
+ receiver: {
19
+ id: receiver.id,
20
+ gameId: receiver.gameId,
21
+ playerId: receiver.playerId,
22
+ },
23
+ }),
24
+ moduleId: mod.moduleId,
25
+ playerId: sender.playerId,
26
+ gameServerId,
27
+ });
28
+ // NOTE: we should maybe check if the player has enough balance to send the amount since this is only checked when the transaction is executed.
29
+ await sender.pm(`You are about to send ${args.amount} ${currencyName} to ${receiverName}. (Please confirm by typing ${prefix}confirmtransfer)`);
30
+ return;
31
+ }
32
+ try {
33
+ await takaro.playerOnGameserver.playerOnGameServerControllerTransactBetweenPlayers(sender.gameServerId, sender.id, receiver.id, {
34
+ currency: args.amount,
35
+ });
36
+ }
37
+ catch {
38
+ throw new TakaroUserError(`Failed to transfer ${args.amount} ${currencyName} to ${receiverName}. Are you sure you have enough balance?`);
39
+ }
40
+ const messageToReceiver = takaro.gameserver.gameServerControllerSendMessage(gameServerId, {
41
+ message: `You received ${args.amount} ${currencyName} from ${senderName}`,
42
+ opts: {
43
+ recipient: {
44
+ gameId: receiver.gameId,
45
+ },
46
+ },
47
+ });
48
+ await Promise.all([
49
+ sender.pm(`You successfully transferred ${args.amount} ${currencyName} to ${receiverName}`),
50
+ messageToReceiver,
51
+ ]);
52
+ return;
53
+ }
54
+ await main();
55
+ //# sourceMappingURL=transfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/transfer.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEzE,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,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAE/G,wHAAwH;IACxH,gJAAgJ;IAChJ,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,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,yCAAyC,CAC9G,CAAC;IACJ,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,UAAU,CAAC,+BAA+B,CAAC,YAAY,EAAE;QACxF,OAAO,EAAE,gBAAgB,IAAI,CAAC,MAAM,IAAI,YAAY,SAAS,UAAU,EAAE;QACzE,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB;SACF;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,MAAM,CAAC,EAAE,CAAC,gCAAgC,IAAI,CAAC,MAAM,IAAI,YAAY,OAAO,YAAY,EAAE,CAAC;QAC3F,iBAAiB;KAClB,CAAC,CAAC;IAEH,OAAO;AACT,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=zombieKillReward.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zombieKillReward.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/cronJobs/zombieKillReward.js"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ import { data, takaro, checkPermission } from '@takaro/helpers';
2
+ const VARIABLE_KEY = 'lastZombieKillReward';
3
+ async function main() {
4
+ const { gameServerId, module: mod } = data;
5
+ const lastRunRes = (await takaro.variable.variableControllerSearch({
6
+ filters: {
7
+ key: [VARIABLE_KEY],
8
+ gameServerId: [gameServerId],
9
+ moduleId: [mod.moduleId],
10
+ },
11
+ })).data.data;
12
+ // We last ran the rewards script at this time
13
+ // If this is the first time we run it, just get the last 5 minutes
14
+ const lastRun = lastRunRes.length ? new Date(JSON.parse(lastRunRes[0].value)) : new Date(Date.now() - 5 * 60 * 1000);
15
+ // Fetch all the kill events since the last time we gave out rewards
16
+ const killEvents = (await takaro.event.eventControllerSearch({
17
+ filters: { eventName: ['entity-killed'], gameserverId: [gameServerId] },
18
+ greaterThan: { createdAt: lastRun.toISOString() },
19
+ limit: 1000,
20
+ })).data.data;
21
+ console.log(`Found ${killEvents.length} kill events since ${lastRun.toISOString()}`);
22
+ // Group the events by player
23
+ const playerKills = {};
24
+ for (const killEvent of killEvents) {
25
+ if (!playerKills[killEvent.playerId]) {
26
+ playerKills[killEvent.playerId] = [];
27
+ }
28
+ playerKills[killEvent.playerId].push(killEvent);
29
+ }
30
+ // Give each player their reward
31
+ // We use Promise.allSettled to run this concurrently
32
+ const results = await Promise.allSettled(Object.entries(playerKills).map(async ([playerId, kills]) => {
33
+ const pog = (await takaro.playerOnGameserver.playerOnGameServerControllerGetOne(gameServerId, playerId)).data
34
+ .data;
35
+ const hasPermission = checkPermission(pog, 'ZOMBIE_KILL_REWARD_OVERRIDE');
36
+ const defaultReward = mod.userConfig.zombieKillReward;
37
+ const reward = hasPermission && hasPermission.count != null ? hasPermission.count : defaultReward;
38
+ const totalReward = reward * kills.length;
39
+ return takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, playerId, {
40
+ currency: totalReward,
41
+ });
42
+ }));
43
+ // Log any errors
44
+ for (const result of results) {
45
+ if (result.status === 'rejected') {
46
+ console.error(result.reason);
47
+ throw new Error(`Failed to give rewards: ${result.reason}`);
48
+ }
49
+ }
50
+ // Update the last run time
51
+ if (lastRunRes.length) {
52
+ await takaro.variable.variableControllerUpdate(lastRunRes[0].id, {
53
+ value: JSON.stringify(new Date()),
54
+ });
55
+ }
56
+ else {
57
+ await takaro.variable.variableControllerCreate({
58
+ key: VARIABLE_KEY,
59
+ value: JSON.stringify(new Date()),
60
+ moduleId: mod.moduleId,
61
+ gameServerId,
62
+ });
63
+ }
64
+ }
65
+ await main();
66
+ //# sourceMappingURL=zombieKillReward.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zombieKillReward.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/cronJobs/zombieKillReward.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,iB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AM,IAAI,KAAK,CAAC,2BAA2B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED,2BAA2B;IAC3B,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;YAC/D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;YAC7C,GAAG,EAAE,YAAY;YACjB,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;YACjC,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,YAAY;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class EconomyUtils extends ModuleTransferDTO<EconomyUtils> {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map