@takaro/modules 0.0.14 → 0.0.18

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 (244) hide show
  1. package/dist/BuiltinModule.d.ts +13 -8
  2. package/dist/BuiltinModule.d.ts.map +1 -0
  3. package/dist/BuiltinModule.js +48 -31
  4. package/dist/BuiltinModule.js.map +1 -1
  5. package/dist/dto/base.d.ts +1 -0
  6. package/dist/dto/base.d.ts.map +1 -0
  7. package/dist/dto/discordEvents.d.ts +1 -0
  8. package/dist/dto/discordEvents.d.ts.map +1 -0
  9. package/dist/dto/gameEvents.d.ts +1 -0
  10. package/dist/dto/gameEvents.d.ts.map +1 -0
  11. package/dist/dto/index.d.ts +4 -0
  12. package/dist/dto/index.d.ts.map +1 -0
  13. package/dist/dto/takaroEvents.d.ts +16 -0
  14. package/dist/dto/takaroEvents.d.ts.map +1 -0
  15. package/dist/dto/takaroEvents.js +36 -0
  16. package/dist/dto/takaroEvents.js.map +1 -1
  17. package/dist/main.d.ts +4 -3
  18. package/dist/main.d.ts.map +1 -0
  19. package/dist/main.js +3 -1
  20. package/dist/main.js.map +1 -1
  21. package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +1 -0
  22. package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts.map +1 -0
  23. package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +1 -0
  24. package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts.map +1 -0
  25. package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +1 -0
  26. package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts.map +1 -0
  27. package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +1 -0
  28. package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts.map +1 -0
  29. package/dist/modules/chatBridge/index.d.ts +3 -2
  30. package/dist/modules/chatBridge/index.d.ts.map +1 -0
  31. package/dist/modules/chatBridge/index.js +55 -47
  32. package/dist/modules/chatBridge/index.js.map +1 -1
  33. package/dist/modules/dailyRewards/commands/daily.d.ts +2 -0
  34. package/dist/modules/dailyRewards/commands/daily.d.ts.map +1 -0
  35. package/dist/modules/dailyRewards/commands/daily.js +106 -0
  36. package/dist/modules/dailyRewards/commands/daily.js.map +1 -0
  37. package/dist/modules/dailyRewards/commands/streak.d.ts +2 -0
  38. package/dist/modules/dailyRewards/commands/streak.d.ts.map +1 -0
  39. package/dist/modules/dailyRewards/commands/streak.js +34 -0
  40. package/dist/modules/dailyRewards/commands/streak.js.map +1 -0
  41. package/dist/modules/dailyRewards/commands/topstreak.d.ts +2 -0
  42. package/dist/modules/dailyRewards/commands/topstreak.d.ts.map +1 -0
  43. package/dist/modules/dailyRewards/commands/topstreak.js +44 -0
  44. package/dist/modules/dailyRewards/commands/topstreak.js.map +1 -0
  45. package/dist/modules/dailyRewards/functions/utils.d.ts +6 -0
  46. package/dist/modules/dailyRewards/functions/utils.d.ts.map +1 -0
  47. package/dist/modules/dailyRewards/functions/utils.js +32 -0
  48. package/dist/modules/dailyRewards/functions/utils.js.map +1 -0
  49. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts +2 -0
  50. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts.map +1 -0
  51. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js +19 -0
  52. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js.map +1 -0
  53. package/dist/modules/dailyRewards/index.d.ts +5 -0
  54. package/dist/modules/dailyRewards/index.d.ts.map +1 -0
  55. package/dist/modules/dailyRewards/index.js +125 -0
  56. package/dist/modules/dailyRewards/index.js.map +1 -0
  57. package/dist/modules/economyUtils/commands/balance.d.ts +1 -0
  58. package/dist/modules/economyUtils/commands/balance.d.ts.map +1 -0
  59. package/dist/modules/economyUtils/commands/claim.d.ts +1 -0
  60. package/dist/modules/economyUtils/commands/claim.d.ts.map +1 -0
  61. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +1 -0
  62. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts.map +1 -0
  63. package/dist/modules/economyUtils/commands/grantCurrency.d.ts +1 -0
  64. package/dist/modules/economyUtils/commands/grantCurrency.d.ts.map +1 -0
  65. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +1 -0
  66. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts.map +1 -0
  67. package/dist/modules/economyUtils/commands/shop.d.ts +1 -0
  68. package/dist/modules/economyUtils/commands/shop.d.ts.map +1 -0
  69. package/dist/modules/economyUtils/commands/topCurrency.d.ts +1 -0
  70. package/dist/modules/economyUtils/commands/topCurrency.d.ts.map +1 -0
  71. package/dist/modules/economyUtils/commands/transfer.d.ts +1 -0
  72. package/dist/modules/economyUtils/commands/transfer.d.ts.map +1 -0
  73. package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts +1 -0
  74. package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts.map +1 -0
  75. package/dist/modules/economyUtils/index.d.ts +3 -2
  76. package/dist/modules/economyUtils/index.d.ts.map +1 -0
  77. package/dist/modules/economyUtils/index.js +178 -170
  78. package/dist/modules/economyUtils/index.js.map +1 -1
  79. package/dist/modules/geoBlock/hooks/IPDetected.d.ts +1 -0
  80. package/dist/modules/geoBlock/hooks/IPDetected.d.ts.map +1 -0
  81. package/dist/modules/geoBlock/hooks/IPDetected.js +4 -2
  82. package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -1
  83. package/dist/modules/geoBlock/index.d.ts +3 -2
  84. package/dist/modules/geoBlock/index.d.ts.map +1 -0
  85. package/dist/modules/geoBlock/index.js +71 -63
  86. package/dist/modules/geoBlock/index.js.map +1 -1
  87. package/dist/modules/gimme/commands/gimme.d.ts +1 -0
  88. package/dist/modules/gimme/commands/gimme.d.ts.map +1 -0
  89. package/dist/modules/gimme/commands/gimme.js +17 -6
  90. package/dist/modules/gimme/commands/gimme.js.map +1 -1
  91. package/dist/modules/gimme/index.d.ts +3 -2
  92. package/dist/modules/gimme/index.d.ts.map +1 -0
  93. package/dist/modules/gimme/index.js +64 -34
  94. package/dist/modules/gimme/index.js.map +1 -1
  95. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +1 -0
  96. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts.map +1 -0
  97. package/dist/modules/highPingKicker/index.d.ts +3 -2
  98. package/dist/modules/highPingKicker/index.d.ts.map +1 -0
  99. package/dist/modules/highPingKicker/index.js +36 -28
  100. package/dist/modules/highPingKicker/index.js.map +1 -1
  101. package/dist/modules/lottery/commands/buyTicket.d.ts +1 -0
  102. package/dist/modules/lottery/commands/buyTicket.d.ts.map +1 -0
  103. package/dist/modules/lottery/commands/nextDraw.d.ts +1 -0
  104. package/dist/modules/lottery/commands/nextDraw.d.ts.map +1 -0
  105. package/dist/modules/lottery/commands/viewTickets.d.ts +1 -0
  106. package/dist/modules/lottery/commands/viewTickets.d.ts.map +1 -0
  107. package/dist/modules/lottery/cronJobs/drawLottery.d.ts +1 -0
  108. package/dist/modules/lottery/cronJobs/drawLottery.d.ts.map +1 -0
  109. package/dist/modules/lottery/index.d.ts +3 -2
  110. package/dist/modules/lottery/index.d.ts.map +1 -0
  111. package/dist/modules/lottery/index.js +73 -65
  112. package/dist/modules/lottery/index.js.map +1 -1
  113. package/dist/modules/playerOnboarding/commands/starterkit.d.ts +1 -0
  114. package/dist/modules/playerOnboarding/commands/starterkit.d.ts.map +1 -0
  115. package/dist/modules/playerOnboarding/commands/starterkit.js +16 -3
  116. package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -1
  117. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +1 -0
  118. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts.map +1 -0
  119. package/dist/modules/playerOnboarding/index.d.ts +3 -2
  120. package/dist/modules/playerOnboarding/index.d.ts.map +1 -0
  121. package/dist/modules/playerOnboarding/index.js +73 -43
  122. package/dist/modules/playerOnboarding/index.js.map +1 -1
  123. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +1 -0
  124. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts.map +1 -0
  125. package/dist/modules/serverMessages/index.d.ts +3 -2
  126. package/dist/modules/serverMessages/index.d.ts.map +1 -0
  127. package/dist/modules/serverMessages/index.js +36 -28
  128. package/dist/modules/serverMessages/index.js.map +1 -1
  129. package/dist/modules/teleports/commands/deletetp.d.ts +1 -0
  130. package/dist/modules/teleports/commands/deletetp.d.ts.map +1 -0
  131. package/dist/modules/teleports/commands/deletewaypoint.d.ts +1 -0
  132. package/dist/modules/teleports/commands/deletewaypoint.d.ts.map +1 -0
  133. package/dist/modules/teleports/commands/deletewaypoint.js +4 -35
  134. package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -1
  135. package/dist/modules/teleports/commands/listwaypoints.d.ts +1 -0
  136. package/dist/modules/teleports/commands/listwaypoints.d.ts.map +1 -0
  137. package/dist/modules/teleports/commands/listwaypoints.js +3 -22
  138. package/dist/modules/teleports/commands/listwaypoints.js.map +1 -1
  139. package/dist/modules/teleports/commands/setprivate.d.ts +1 -0
  140. package/dist/modules/teleports/commands/setprivate.d.ts.map +1 -0
  141. package/dist/modules/teleports/commands/setpublic.d.ts +1 -0
  142. package/dist/modules/teleports/commands/setpublic.d.ts.map +1 -0
  143. package/dist/modules/teleports/commands/settp.d.ts +1 -0
  144. package/dist/modules/teleports/commands/settp.d.ts.map +1 -0
  145. package/dist/modules/teleports/commands/setwaypoint.d.ts +1 -0
  146. package/dist/modules/teleports/commands/setwaypoint.d.ts.map +1 -0
  147. package/dist/modules/teleports/commands/setwaypoint.js +5 -63
  148. package/dist/modules/teleports/commands/setwaypoint.js.map +1 -1
  149. package/dist/modules/teleports/commands/teleport.d.ts +1 -0
  150. package/dist/modules/teleports/commands/teleport.d.ts.map +1 -0
  151. package/dist/modules/teleports/commands/teleportwaypoint.d.ts +1 -0
  152. package/dist/modules/teleports/commands/teleportwaypoint.d.ts.map +1 -0
  153. package/dist/modules/teleports/commands/teleportwaypoint.js +7 -23
  154. package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -1
  155. package/dist/modules/teleports/commands/tplist.d.ts +1 -0
  156. package/dist/modules/teleports/commands/tplist.d.ts.map +1 -0
  157. package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts +2 -0
  158. package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts.map +1 -0
  159. package/dist/modules/teleports/cronJobs/Waypoint reconciler.js +6 -0
  160. package/dist/modules/teleports/cronJobs/Waypoint reconciler.js.map +1 -0
  161. package/dist/modules/teleports/functions/utils.d.ts +12 -0
  162. package/dist/modules/teleports/functions/utils.d.ts.map +1 -0
  163. package/dist/modules/teleports/functions/utils.js +117 -0
  164. package/dist/modules/teleports/functions/utils.js.map +1 -1
  165. package/dist/modules/teleports/index.d.ts +3 -2
  166. package/dist/modules/teleports/index.d.ts.map +1 -0
  167. package/dist/modules/teleports/index.js +188 -172
  168. package/dist/modules/teleports/index.js.map +1 -1
  169. package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts +1 -0
  170. package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts.map +1 -0
  171. package/dist/modules/timedShutdown/cronJobs/warning.d.ts +1 -0
  172. package/dist/modules/timedShutdown/cronJobs/warning.d.ts.map +1 -0
  173. package/dist/modules/timedShutdown/index.d.ts +3 -2
  174. package/dist/modules/timedShutdown/index.d.ts.map +1 -0
  175. package/dist/modules/timedShutdown/index.js +35 -27
  176. package/dist/modules/timedShutdown/index.js.map +1 -1
  177. package/dist/modules/utils/commands/help.d.ts +1 -0
  178. package/dist/modules/utils/commands/help.d.ts.map +1 -0
  179. package/dist/modules/utils/commands/help.js +10 -9
  180. package/dist/modules/utils/commands/help.js.map +1 -1
  181. package/dist/modules/utils/commands/ping.d.ts +1 -0
  182. package/dist/modules/utils/commands/ping.d.ts.map +1 -0
  183. package/dist/modules/utils/index.d.ts +3 -2
  184. package/dist/modules/utils/index.d.ts.map +1 -0
  185. package/dist/modules/utils/index.js +36 -28
  186. package/dist/modules/utils/index.js.map +1 -1
  187. package/dist/modules.json +601 -506
  188. package/package.json +2 -5
  189. package/scripts/buildBuiltinJson.ts +50 -2
  190. package/src/BuiltinModule.ts +25 -17
  191. package/src/__tests__/aliases.integration.test.ts +23 -26
  192. package/src/__tests__/bugRepros.integration.test.ts +261 -10
  193. package/src/__tests__/builtinmodule.unit.test.ts +3 -1
  194. package/src/__tests__/commandArgs.integration.test.ts +13 -6
  195. package/src/__tests__/economy/claim.integration.test.ts +1 -0
  196. package/src/__tests__/economy/economyUtils.integration.test.ts +43 -46
  197. package/src/__tests__/economy/shop.integration.test.ts +28 -4
  198. package/src/__tests__/economy/zombieKillReward.integration.test.ts +28 -31
  199. package/src/__tests__/geoblock.integration.test.ts +76 -91
  200. package/src/__tests__/gimme.integration.test.ts +25 -22
  201. package/src/__tests__/help.integration.test.ts +21 -20
  202. package/src/__tests__/lottery.integration.test.ts +15 -11
  203. package/src/__tests__/modulePermission.integration.test.ts +17 -13
  204. package/src/__tests__/onboarding.integration.test.ts +43 -43
  205. package/src/__tests__/ping.integration.test.ts +5 -4
  206. package/src/__tests__/roleExpiry.integration.test.ts +5 -4
  207. package/src/__tests__/serverMessages.integration.test.ts +24 -27
  208. package/src/__tests__/systemConfigCooldown.integration.test.ts +5 -1
  209. package/src/__tests__/systemConfigCost.integration.test.ts +16 -17
  210. package/src/__tests__/teleports/listtp.integration.test.ts +20 -21
  211. package/src/__tests__/teleports/publicteleports.integration.test.ts +58 -70
  212. package/src/__tests__/teleports/teleport.integration.test.ts +16 -17
  213. package/src/__tests__/teleports/tpManagement.integration.test.ts +21 -20
  214. package/src/__tests__/teleports/waypoints.integration.test.ts +52 -6
  215. package/src/dto/takaroEvents.ts +21 -0
  216. package/src/main.ts +14 -4
  217. package/src/modules/chatBridge/index.ts +54 -51
  218. package/src/modules/dailyRewards/commands/daily.js +118 -0
  219. package/src/modules/dailyRewards/commands/streak.js +42 -0
  220. package/src/modules/dailyRewards/commands/topstreak.js +54 -0
  221. package/src/modules/dailyRewards/functions/utils.js +36 -0
  222. package/src/modules/dailyRewards/hooks/dailyLoginCheck.js +24 -0
  223. package/src/modules/dailyRewards/index.ts +136 -0
  224. package/src/modules/economyUtils/index.ts +182 -179
  225. package/src/modules/geoBlock/hooks/IPDetected.js +4 -2
  226. package/src/modules/geoBlock/index.ts +72 -70
  227. package/src/modules/gimme/commands/gimme.js +16 -6
  228. package/src/modules/gimme/index.ts +62 -37
  229. package/src/modules/highPingKicker/index.ts +35 -32
  230. package/src/modules/lottery/index.ts +73 -71
  231. package/src/modules/playerOnboarding/commands/starterkit.js +19 -5
  232. package/src/modules/playerOnboarding/index.ts +72 -47
  233. package/src/modules/serverMessages/index.ts +36 -32
  234. package/src/modules/teleports/commands/deletewaypoint.js +4 -53
  235. package/src/modules/teleports/commands/listwaypoints.js +3 -35
  236. package/src/modules/teleports/commands/setwaypoint.js +5 -83
  237. package/src/modules/teleports/commands/teleportwaypoint.js +9 -36
  238. package/src/modules/teleports/cronJobs/Waypoint reconciler.js +7 -0
  239. package/src/modules/teleports/functions/utils.js +150 -0
  240. package/src/modules/teleports/index.ts +196 -180
  241. package/src/modules/timedShutdown/index.ts +35 -30
  242. package/src/modules/utils/commands/help.js +14 -14
  243. package/src/modules/utils/index.ts +36 -32
  244. package/tsconfig.json +1 -1
@@ -0,0 +1,106 @@
1
+ import { takaro, data, TakaroUserError, checkPermission } from '@takaro/helpers';
2
+ import { DAILY_KEY, STREAK_KEY, getMultiplier } from './utils.js';
3
+ async function main() {
4
+ const { pog, gameServerId, module: mod } = data;
5
+ if (!checkPermission(pog, 'DAILY_CLAIM')) {
6
+ throw new TakaroUserError('You do not have permission to claim daily rewards.');
7
+ }
8
+ // Get last claim time
9
+ const lastClaimRes = await takaro.variable.variableControllerSearch({
10
+ filters: {
11
+ key: [DAILY_KEY],
12
+ gameServerId: [gameServerId],
13
+ playerId: [pog.playerId],
14
+ moduleId: [mod.moduleId],
15
+ },
16
+ });
17
+ const now = new Date();
18
+ let streak = 1;
19
+ if (lastClaimRes.data.data.length > 0) {
20
+ const lastClaim = new Date(JSON.parse(lastClaimRes.data.data[0].value));
21
+ const hoursSinceLastClaim = (now - lastClaim) / (1000 * 60 * 60);
22
+ // Check if 24 hours have passed
23
+ if (hoursSinceLastClaim < 24) {
24
+ const nextClaimTime = new Date(lastClaim.getTime() + 24 * 60 * 60 * 1000);
25
+ throw new TakaroUserError(`You can claim your next reward at ${nextClaimTime.toLocaleString()}`);
26
+ }
27
+ // Get current streak
28
+ const streakRes = await takaro.variable.variableControllerSearch({
29
+ filters: {
30
+ key: [STREAK_KEY],
31
+ gameServerId: [gameServerId],
32
+ playerId: [pog.playerId],
33
+ moduleId: [mod.moduleId],
34
+ },
35
+ });
36
+ if (streakRes.data.data.length > 0) {
37
+ // If claimed within 48 hours, increment streak
38
+ if (hoursSinceLastClaim < 48) {
39
+ streak = Math.min(JSON.parse(streakRes.data.data[0].value) + 1, mod.userConfig.maxStreak);
40
+ await takaro.variable.variableControllerUpdate(streakRes.data.data[0].id, {
41
+ value: JSON.stringify(streak),
42
+ });
43
+ }
44
+ else {
45
+ // Reset streak if more than 48 hours
46
+ await takaro.variable.variableControllerUpdate(streakRes.data.data[0].id, {
47
+ value: JSON.stringify(1),
48
+ });
49
+ }
50
+ }
51
+ else {
52
+ // Create new streak record
53
+ await takaro.variable.variableControllerCreate({
54
+ key: STREAK_KEY,
55
+ value: JSON.stringify(1),
56
+ gameServerId,
57
+ playerId: pog.playerId,
58
+ moduleId: mod.moduleId,
59
+ });
60
+ }
61
+ // Update last claim time
62
+ await takaro.variable.variableControllerUpdate(lastClaimRes.data.data[0].id, {
63
+ value: JSON.stringify(now),
64
+ });
65
+ }
66
+ else {
67
+ // First time claim
68
+ await takaro.variable.variableControllerCreate({
69
+ key: DAILY_KEY,
70
+ value: JSON.stringify(now),
71
+ gameServerId,
72
+ playerId: pog.playerId,
73
+ moduleId: mod.moduleId,
74
+ });
75
+ await takaro.variable.variableControllerCreate({
76
+ key: STREAK_KEY,
77
+ value: JSON.stringify(1),
78
+ gameServerId,
79
+ playerId: pog.playerId,
80
+ moduleId: mod.moduleId,
81
+ });
82
+ }
83
+ const multiplier = await getMultiplier(pog);
84
+ const baseReward = mod.userConfig.baseReward * streak * multiplier;
85
+ let bonusReward = 0;
86
+ let milestoneMessage = '';
87
+ // Check for milestones
88
+ for (const milestone of mod.userConfig.milestoneRewards) {
89
+ if (streak === milestone.days) {
90
+ bonusReward = milestone.reward;
91
+ milestoneMessage = `\n${milestone.message}`;
92
+ break;
93
+ }
94
+ }
95
+ // Award total rewards
96
+ const totalReward = baseReward + bonusReward;
97
+ await takaro.playerOnGameserver.playerOnGameServerControllerAddCurrency(gameServerId, pog.playerId, {
98
+ currency: totalReward,
99
+ });
100
+ const currencyName = (await takaro.settings.settingsControllerGetOne('currencyName', gameServerId)).data.data.value;
101
+ await pog.pm(`Daily reward claimed! You received ${totalReward} ${currencyName}\n` +
102
+ `Current streak: ${streak} days${multiplier > 1 ? ` (${multiplier}x bonus!)` : ''}` +
103
+ milestoneMessage);
104
+ }
105
+ await main();
106
+ //# sourceMappingURL=daily.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daily.js","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/commands/daily.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAElE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEhD,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,eAAe,CAAC,oDAAoD,CAAC,CAAC;IAClF,CAAC;IAED,sBAAsB;IACtB,MA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AAG,CAAC,QAAQ,EAAE;QAClG,QAAQ,EAAE,WAAW;KACtB,CAAC,CAAC;IAEH,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,GAAG,CAAC,EAAE,CACV,sCAAsC,WAAW,IAAI,YAAY,IAAI;QACnE,mBAAmB,MAAM,QAAQ,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE;QACnF,gBAAgB,CACnB,CAAC;AACJ,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=streak.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streak.d.ts","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/commands/streak.js"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import { data, takaro } from '@takaro/helpers';
2
+ import { getPlayerStreak, getLastClaim, getMultiplier } from './utils.js';
3
+ async function main() {
4
+ const { pog, gameServerId, module: mod } = data;
5
+ const streak = await getPlayerStreak(gameServerId, pog.playerId, mod.moduleId);
6
+ const lastClaim = await getLastClaim(gameServerId, pog.playerId, mod.moduleId);
7
+ const multiplier = await getMultiplier(pog);
8
+ const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
9
+ if (!streak || !lastClaim) {
10
+ await pog.pm(`You haven't claimed any daily rewards yet! Use ${prefix}daily to get started.`);
11
+ return;
12
+ }
13
+ const nextClaimTime = new Date(lastClaim.getTime() + 24 * 60 * 60 * 1000);
14
+ const now = new Date();
15
+ const canClaim = now >= nextClaimTime;
16
+ // Find next milestone
17
+ let nextMilestone = null;
18
+ for (const milestone of mod.userConfig.milestoneRewards) {
19
+ if (milestone.days > streak) {
20
+ nextMilestone = milestone;
21
+ break;
22
+ }
23
+ }
24
+ let message = `Current streak: ${streak} days${multiplier > 1 ? ` (${multiplier}x donor bonus!)` : ''}\n`;
25
+ message += canClaim
26
+ ? `Your daily reward is available! Use ${prefix}daily to claim it!\n`
27
+ : `Next reward available at: ${nextClaimTime.toLocaleString()}\n`;
28
+ if (nextMilestone) {
29
+ message += `\n🎯 Next milestone: ${nextMilestone.days} days (${nextMilestone.days - streak} days to go!)`;
30
+ }
31
+ await pog.pm(message);
32
+ }
33
+ await main();
34
+ //# sourceMappingURL=streak.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streak.js","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/commands/streak.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1E,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/E,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/E,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5C,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,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QAC1B,MAAM,GAAG,CAAC,EAAE,CAAC,kDAAkD,MAAM,uBAAuB,CAAC,CAAC;QAC9F,OAAO;IACT,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1E,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,GAAG,IAAI,aAAa,CAAC;IAEtC,sBAAsB;IACtB,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,KAAK,MAAM,SAAS,IAAI,GAAG,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACxD,IAAI,SAAS,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC;YAC5B,aAAa,GAAG,SAAS,CAAC;YAC1B,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,OAAO,GAAG,mBAAmB,MAAM,QAAQ,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,iBAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IAC1G,OAAO,IAAI,QAAQ;QACjB,CAAC,CAAC,uCAAuC,MAAM,sBAAsB;QACrE,CAAC,CAAC,6BAA6B,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC;IAEpE,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,IAAI,wBAAwB,aAAa,CAAC,IAAI,UAAU,aAAa,CAAC,IAAI,GAAG,MAAM,eAAe,CAAC;IAC5G,CAAC;IAED,MAAM,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=topstreak.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topstreak.d.ts","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/commands/topstreak.js"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ import { takaro, data } from '@takaro/helpers';
2
+ import { STREAK_KEY } from './utils.js';
3
+ async function main() {
4
+ const { pog, gameServerId, module: mod, arguments: args } = data;
5
+ // Limit count to reasonable number
6
+ const count = Math.min(Math.max(1, args.count), 50);
7
+ // Get all streaks
8
+ const streaksRes = await takaro.variable.variableControllerSearch({
9
+ filters: {
10
+ key: [STREAK_KEY],
11
+ gameServerId: [gameServerId],
12
+ moduleId: [mod.moduleId],
13
+ },
14
+ limit: 1000, // Get all possible streaks
15
+ });
16
+ if (streaksRes.data.data.length === 0) {
17
+ await pog.pm('No players have started their daily streak yet!');
18
+ return;
19
+ }
20
+ // Sort by streak value
21
+ const sortedStreaks = streaksRes.data.data
22
+ .map((record) => ({
23
+ playerId: record.playerId,
24
+ streak: JSON.parse(record.value),
25
+ }))
26
+ .sort((a, b) => b.streak - a.streak)
27
+ .slice(0, count);
28
+ // Get player names
29
+ const playerDetails = await Promise.all(sortedStreaks.map(async (record) => {
30
+ const player = (await takaro.player.playerControllerGetOne(record.playerId)).data.data;
31
+ return {
32
+ name: player.name,
33
+ streak: record.streak,
34
+ };
35
+ }));
36
+ // Build message
37
+ let message = `Top ${count} Daily Streaks:\n\n`;
38
+ playerDetails.forEach((player, index) => {
39
+ message += `${index + 1}. ${player.name}: ${player.streak} days\n`;
40
+ });
41
+ await pog.pm(message);
42
+ }
43
+ await main();
44
+ //# sourceMappingURL=topstreak.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topstreak.js","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/commands/topstreak.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEjE,mCAAmC;IACnC,MAAM,K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AO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,gBAAgB;IAChB,IAAI,OAAO,GAAG,OAAO,KAAK,qBAAqB,CAAC;IAChD,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACtC,OAAO,IAAI,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,SAAS,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export function getMultiplier(pog: any): Promise<any>;
2
+ export function getPlayerStreak(gameServerId: any, playerId: any, moduleId: any): Promise<number>;
3
+ export function getLastClaim(gameServerId: any, playerId: any, moduleId: any): Promise<Date | null>;
4
+ export const DAILY_KEY: "daily_timestamp";
5
+ export const STREAK_KEY: "daily_streak";
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/functions/utils.js"],"names":[],"mappings":"AAKA,sDAIC;AAED,kGAWC;AAED,oGAWC;AAjCD,0CAA2C;AAC3C,wCAAyC"}
@@ -0,0 +1,32 @@
1
+ import { takaro, checkPermission } from '@takaro/helpers';
2
+ export const DAILY_KEY = 'daily_timestamp';
3
+ export const STREAK_KEY = 'daily_streak';
4
+ export async function getMultiplier(pog) {
5
+ const perm = checkPermission(pog, 'DAILY_REWARD_MULTIPLIER');
6
+ if (perm)
7
+ return perm.count;
8
+ return 1;
9
+ }
10
+ export async function getPlayerStreak(gameServerId, playerId, moduleId) {
11
+ const streakRes = await takaro.variable.variableControllerSearch({
12
+ filters: {
13
+ key: [STREAK_KEY],
14
+ gameServerId: [gameServerId],
15
+ playerId: [playerId],
16
+ moduleId: [moduleId],
17
+ },
18
+ });
19
+ return streakRes.data.data.length ? parseInt(JSON.parse(streakRes.data.data[0].value)) : 0;
20
+ }
21
+ export async function getLastClaim(gameServerId, playerId, moduleId) {
22
+ const lastClaimRes = await takaro.variable.variableControllerSearch({
23
+ filters: {
24
+ key: [DAILY_KEY],
25
+ gameServerId: [gameServerId],
26
+ playerId: [playerId],
27
+ moduleId: [moduleId],
28
+ },
29
+ });
30
+ return lastClaimRes.data.data.length ? new Date(JSON.parse(lastClaimRes.data.data[0].value)) : null;
31
+ }
32
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/functions/utils.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,CAAC,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAG;IACrC,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,EAAE,yBAAyB,CAAC,CAAC;IAC7D,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAC5B,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ;IACpE,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC/D,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,UAAU,CAAC;YACjB,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,QAAQ,CAAC;YACpB,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;KACF,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ;IACjE,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAClE,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,SAAS,CAAC;YAChB,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,QAAQ,CAAC;YACpB,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;KACF,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACtG,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dailyLoginCheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dailyLoginCheck.d.ts","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/hooks/dailyLoginCheck.js"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { data, takaro } from '@takaro/helpers';
2
+ import { getLastClaim } from './utils.js';
3
+ async function main() {
4
+ const { pog, gameServerId, module: mod } = data;
5
+ const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
6
+ const lastClaim = await getLastClaim(gameServerId, pog.playerId, mod.moduleId);
7
+ // First time player
8
+ if (!lastClaim) {
9
+ await pog.pm(`Welcome! Use ${prefix}daily to claim your first daily reward and start your streak!`);
10
+ return;
11
+ }
12
+ const now = new Date();
13
+ const nextClaimTime = new Date(lastClaim.getTime() + 24 * 60 * 60 * 1000);
14
+ if (now >= nextClaimTime) {
15
+ await pog.pm(`Your daily reward is ready! Use ${prefix}daily to claim it!`);
16
+ }
17
+ }
18
+ await main();
19
+ //# sourceMappingURL=dailyLoginCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dailyLoginCheck.js","sourceRoot":"","sources":["../../../../src/modules/dailyRewards/hooks/dailyLoginCheck.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAChD,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;IAE/G,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE/E,oBAAoB;IACpB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,GAAG,CAAC,EAAE,CAAC,gBAAgB,MAAM,+DAA+D,CAAC,CAAC;QACpG,OAAO;IACT,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAE1E,IAAI,GAAG,IAAI,aAAa,EAAE,CAAC;QACzB,MAAM,GAAG,CAAC,EAAE,CAAC,mCAAmC,MAAM,oBAAoB,CAAC,CAAC;IAC9E,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class DailyRewards extends ModuleTransferDTO<DailyRewards> {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/dailyRewards/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAMlB,MAAM,wBAAwB,CAAC;AAEhC,qBAAa,YAAa,SAAQ,iBAAiB,CAAC,YAAY,CAAC;;CA6HhE"}
@@ -0,0 +1,125 @@
1
+ /* eslint-disable quotes */
2
+ import { ModuleTransferDTO, ICommand, IFunction, IHook, IPermission, ModuleTransferVersionDTO, } from '../../BuiltinModule.js';
3
+ export class DailyRewards extends ModuleTransferDTO {
4
+ constructor() {
5
+ super();
6
+ this.name = 'dailyRewards';
7
+ this.versions = [
8
+ new ModuleTransferVersionDTO({
9
+ description: 'Provides daily login rewards with streak tracking',
10
+ tag: '0.0.1',
11
+ configSchema: JSON.stringify({
12
+ $schema: 'http://json-schema.org/draft-07/schema#',
13
+ type: 'object',
14
+ properties: {
15
+ baseReward: {
16
+ type: 'number',
17
+ title: 'Base Reward',
18
+ description: 'Base amount of currency given for daily rewards. This is multiplied by streak level.',
19
+ default: 100,
20
+ minimum: 1,
21
+ },
22
+ maxStreak: {
23
+ type: 'number',
24
+ title: 'Maximum Streak',
25
+ description: 'Maximum streak level a player can reach',
26
+ default: 365,
27
+ minimum: 1,
28
+ },
29
+ milestoneRewards: {
30
+ type: 'array',
31
+ title: 'Milestone Rewards',
32
+ description: 'Additional rewards for reaching certain streak milestones',
33
+ items: {
34
+ type: 'object',
35
+ properties: {
36
+ days: {
37
+ type: 'number',
38
+ description: 'Days needed to reach milestone',
39
+ minimum: 1,
40
+ },
41
+ reward: {
42
+ type: 'number',
43
+ description: 'Bonus reward amount',
44
+ },
45
+ message: {
46
+ type: 'string',
47
+ description: 'Message to show when milestone is reached',
48
+ },
49
+ },
50
+ },
51
+ default: [
52
+ { days: 7, reward: 1000, message: 'You did it! 7 days in a row!' },
53
+ { days: 30, reward: 5000, message: "A whole month! You're on fire!" },
54
+ { days: 90, reward: 20000, message: "90 days! You're unstoppable!" },
55
+ { days: 180, reward: 50000, message: "Half a year! You're a legend!" },
56
+ { days: 365, reward: 150000, message: "365 days! You're a true champion!" },
57
+ ],
58
+ },
59
+ },
60
+ required: ['baseReward', 'maxStreak', 'milestoneRewards'],
61
+ additionalProperties: false,
62
+ }),
63
+ functions: [
64
+ new IFunction({
65
+ name: 'utils',
66
+ function: this.loadFn('functions', 'utils'),
67
+ }),
68
+ ],
69
+ permissions: [
70
+ new IPermission({
71
+ permission: 'DAILY_CLAIM',
72
+ friendlyName: 'Claim Daily Rewards',
73
+ description: 'Allows the player to claim daily rewards',
74
+ canHaveCount: false,
75
+ }),
76
+ new IPermission({
77
+ permission: 'DAILY_REWARD_MULTIPLIER',
78
+ friendlyName: 'Multiplier',
79
+ description: 'Control the multiplier per role. This is useful to give your donors a little extra. Count is an integer multiplier.',
80
+ canHaveCount: true,
81
+ }),
82
+ ],
83
+ commands: [
84
+ new ICommand({
85
+ function: this.loadFn('commands', 'daily'),
86
+ name: 'daily',
87
+ trigger: 'daily',
88
+ helpText: 'Claim your daily reward',
89
+ arguments: [],
90
+ }),
91
+ new ICommand({
92
+ function: this.loadFn('commands', 'streak'),
93
+ name: 'streak',
94
+ trigger: 'streak',
95
+ helpText: 'Check your current daily reward streak and next claim time',
96
+ arguments: [],
97
+ }),
98
+ new ICommand({
99
+ function: this.loadFn('commands', 'topstreak'),
100
+ name: 'topstreak',
101
+ trigger: 'topstreak',
102
+ helpText: 'Shows the players with highest daily reward streaks',
103
+ arguments: [
104
+ {
105
+ name: 'count',
106
+ type: 'number',
107
+ defaultValue: '5',
108
+ helpText: 'Number of players to show (max 25)',
109
+ position: 0,
110
+ },
111
+ ],
112
+ }),
113
+ ],
114
+ hooks: [
115
+ new IHook({
116
+ eventType: 'player-connected',
117
+ name: 'dailyLoginCheck',
118
+ function: this.loadFn('hooks', 'dailyLoginCheck'),
119
+ }),
120
+ ],
121
+ }),
122
+ ];
123
+ }
124
+ }
125
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/dailyRewards/index.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,YAAa,SAAQ,iBAA+B;IAC/D;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,wBAAwB,CAAC;gBAC3B,WAAW,EAAE,mDAAmD;gBAChE,GAAG,EAAE,OAAO;gBACZ,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAC3B,OAAO,EAAE,yCAAyC;oBAClD,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,UAAU,EAAE;4BACV,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,aAAa;4BACpB,WAAW,EAAE,sFAAsF;4BACnG,OAAO,EAAE,GAAG;4BACZ,OAAO,EAAE,CAAC;yBACX;wBACD,SAAS,EAAE;4BACT,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE,gBAAgB;4BACvB,WAAW,EAAE,yCAAyC;4BACtD,OAAO,EAAE,GAAG;4BACZ,OAAO,EAAE,CAAC;yBACX;wBACD,gBAAgB,EAAE;4BAChB,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,mBAAmB;4BAC1B,WAAW,EAAE,2DAA2D;4BACxE,KAAK,EAA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@
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/balance.js"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=grantCurrency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grantCurrency.d.ts","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/grantCurrency.js"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1 +1,2 @@
1
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":""}
@@ -1,4 +1,5 @@
1
- import { BuiltinModule } from '../../BuiltinModule.js';
2
- export declare class EconomyUtils extends BuiltinModule<EconomyUtils> {
1
+ import { ModuleTransferDTO } from '../../BuiltinModule.js';
2
+ export declare class EconomyUtils extends ModuleTransferDTO<EconomyUtils> {
3
3
  constructor();
4
4
  }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/economyUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6D,MAAM,wBAAwB,CAAC;AAEtH,qBAAa,YAAa,SAAQ,iBAAiB,CAAC,YAAY,CAAC;;CA8LhE"}