@takaro/modules 0.0.15 → 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 (220) 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 +1 -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 +1 -0
  34. package/dist/modules/dailyRewards/commands/daily.d.ts.map +1 -0
  35. package/dist/modules/dailyRewards/commands/streak.d.ts +1 -0
  36. package/dist/modules/dailyRewards/commands/streak.d.ts.map +1 -0
  37. package/dist/modules/dailyRewards/commands/topstreak.d.ts +1 -0
  38. package/dist/modules/dailyRewards/commands/topstreak.d.ts.map +1 -0
  39. package/dist/modules/dailyRewards/functions/utils.d.ts +1 -0
  40. package/dist/modules/dailyRewards/functions/utils.d.ts.map +1 -0
  41. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts +1 -0
  42. package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts.map +1 -0
  43. package/dist/modules/dailyRewards/index.d.ts +3 -2
  44. package/dist/modules/dailyRewards/index.d.ts.map +1 -0
  45. package/dist/modules/dailyRewards/index.js +114 -106
  46. package/dist/modules/dailyRewards/index.js.map +1 -1
  47. package/dist/modules/economyUtils/commands/balance.d.ts +1 -0
  48. package/dist/modules/economyUtils/commands/balance.d.ts.map +1 -0
  49. package/dist/modules/economyUtils/commands/claim.d.ts +1 -0
  50. package/dist/modules/economyUtils/commands/claim.d.ts.map +1 -0
  51. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +1 -0
  52. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts.map +1 -0
  53. package/dist/modules/economyUtils/commands/grantCurrency.d.ts +1 -0
  54. package/dist/modules/economyUtils/commands/grantCurrency.d.ts.map +1 -0
  55. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +1 -0
  56. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts.map +1 -0
  57. package/dist/modules/economyUtils/commands/shop.d.ts +1 -0
  58. package/dist/modules/economyUtils/commands/shop.d.ts.map +1 -0
  59. package/dist/modules/economyUtils/commands/topCurrency.d.ts +1 -0
  60. package/dist/modules/economyUtils/commands/topCurrency.d.ts.map +1 -0
  61. package/dist/modules/economyUtils/commands/transfer.d.ts +1 -0
  62. package/dist/modules/economyUtils/commands/transfer.d.ts.map +1 -0
  63. package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts +1 -0
  64. package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts.map +1 -0
  65. package/dist/modules/economyUtils/index.d.ts +3 -2
  66. package/dist/modules/economyUtils/index.d.ts.map +1 -0
  67. package/dist/modules/economyUtils/index.js +178 -170
  68. package/dist/modules/economyUtils/index.js.map +1 -1
  69. package/dist/modules/geoBlock/hooks/IPDetected.d.ts +1 -0
  70. package/dist/modules/geoBlock/hooks/IPDetected.d.ts.map +1 -0
  71. package/dist/modules/geoBlock/index.d.ts +3 -2
  72. package/dist/modules/geoBlock/index.d.ts.map +1 -0
  73. package/dist/modules/geoBlock/index.js +71 -63
  74. package/dist/modules/geoBlock/index.js.map +1 -1
  75. package/dist/modules/gimme/commands/gimme.d.ts +1 -0
  76. package/dist/modules/gimme/commands/gimme.d.ts.map +1 -0
  77. package/dist/modules/gimme/index.d.ts +3 -2
  78. package/dist/modules/gimme/index.d.ts.map +1 -0
  79. package/dist/modules/gimme/index.js +59 -50
  80. package/dist/modules/gimme/index.js.map +1 -1
  81. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +1 -0
  82. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts.map +1 -0
  83. package/dist/modules/highPingKicker/index.d.ts +3 -2
  84. package/dist/modules/highPingKicker/index.d.ts.map +1 -0
  85. package/dist/modules/highPingKicker/index.js +36 -28
  86. package/dist/modules/highPingKicker/index.js.map +1 -1
  87. package/dist/modules/lottery/commands/buyTicket.d.ts +1 -0
  88. package/dist/modules/lottery/commands/buyTicket.d.ts.map +1 -0
  89. package/dist/modules/lottery/commands/nextDraw.d.ts +1 -0
  90. package/dist/modules/lottery/commands/nextDraw.d.ts.map +1 -0
  91. package/dist/modules/lottery/commands/viewTickets.d.ts +1 -0
  92. package/dist/modules/lottery/commands/viewTickets.d.ts.map +1 -0
  93. package/dist/modules/lottery/cronJobs/drawLottery.d.ts +1 -0
  94. package/dist/modules/lottery/cronJobs/drawLottery.d.ts.map +1 -0
  95. package/dist/modules/lottery/index.d.ts +3 -2
  96. package/dist/modules/lottery/index.d.ts.map +1 -0
  97. package/dist/modules/lottery/index.js +73 -65
  98. package/dist/modules/lottery/index.js.map +1 -1
  99. package/dist/modules/playerOnboarding/commands/starterkit.d.ts +1 -0
  100. package/dist/modules/playerOnboarding/commands/starterkit.d.ts.map +1 -0
  101. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +1 -0
  102. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts.map +1 -0
  103. package/dist/modules/playerOnboarding/index.d.ts +3 -2
  104. package/dist/modules/playerOnboarding/index.d.ts.map +1 -0
  105. package/dist/modules/playerOnboarding/index.js +69 -60
  106. package/dist/modules/playerOnboarding/index.js.map +1 -1
  107. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +1 -0
  108. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts.map +1 -0
  109. package/dist/modules/serverMessages/index.d.ts +3 -2
  110. package/dist/modules/serverMessages/index.d.ts.map +1 -0
  111. package/dist/modules/serverMessages/index.js +36 -28
  112. package/dist/modules/serverMessages/index.js.map +1 -1
  113. package/dist/modules/teleports/commands/deletetp.d.ts +1 -0
  114. package/dist/modules/teleports/commands/deletetp.d.ts.map +1 -0
  115. package/dist/modules/teleports/commands/deletewaypoint.d.ts +1 -0
  116. package/dist/modules/teleports/commands/deletewaypoint.d.ts.map +1 -0
  117. package/dist/modules/teleports/commands/deletewaypoint.js +4 -35
  118. package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -1
  119. package/dist/modules/teleports/commands/listwaypoints.d.ts +1 -0
  120. package/dist/modules/teleports/commands/listwaypoints.d.ts.map +1 -0
  121. package/dist/modules/teleports/commands/listwaypoints.js +3 -22
  122. package/dist/modules/teleports/commands/listwaypoints.js.map +1 -1
  123. package/dist/modules/teleports/commands/setprivate.d.ts +1 -0
  124. package/dist/modules/teleports/commands/setprivate.d.ts.map +1 -0
  125. package/dist/modules/teleports/commands/setpublic.d.ts +1 -0
  126. package/dist/modules/teleports/commands/setpublic.d.ts.map +1 -0
  127. package/dist/modules/teleports/commands/settp.d.ts +1 -0
  128. package/dist/modules/teleports/commands/settp.d.ts.map +1 -0
  129. package/dist/modules/teleports/commands/setwaypoint.d.ts +1 -0
  130. package/dist/modules/teleports/commands/setwaypoint.d.ts.map +1 -0
  131. package/dist/modules/teleports/commands/setwaypoint.js +5 -63
  132. package/dist/modules/teleports/commands/setwaypoint.js.map +1 -1
  133. package/dist/modules/teleports/commands/teleport.d.ts +1 -0
  134. package/dist/modules/teleports/commands/teleport.d.ts.map +1 -0
  135. package/dist/modules/teleports/commands/teleportwaypoint.d.ts +1 -0
  136. package/dist/modules/teleports/commands/teleportwaypoint.d.ts.map +1 -0
  137. package/dist/modules/teleports/commands/teleportwaypoint.js +7 -23
  138. package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -1
  139. package/dist/modules/teleports/commands/tplist.d.ts +1 -0
  140. package/dist/modules/teleports/commands/tplist.d.ts.map +1 -0
  141. package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts +2 -0
  142. package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts.map +1 -0
  143. package/dist/modules/teleports/cronJobs/Waypoint reconciler.js +6 -0
  144. package/dist/modules/teleports/cronJobs/Waypoint reconciler.js.map +1 -0
  145. package/dist/modules/teleports/functions/utils.d.ts +12 -0
  146. package/dist/modules/teleports/functions/utils.d.ts.map +1 -0
  147. package/dist/modules/teleports/functions/utils.js +117 -0
  148. package/dist/modules/teleports/functions/utils.js.map +1 -1
  149. package/dist/modules/teleports/index.d.ts +3 -2
  150. package/dist/modules/teleports/index.d.ts.map +1 -0
  151. package/dist/modules/teleports/index.js +188 -172
  152. package/dist/modules/teleports/index.js.map +1 -1
  153. package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts +1 -0
  154. package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts.map +1 -0
  155. package/dist/modules/timedShutdown/cronJobs/warning.d.ts +1 -0
  156. package/dist/modules/timedShutdown/cronJobs/warning.d.ts.map +1 -0
  157. package/dist/modules/timedShutdown/index.d.ts +3 -2
  158. package/dist/modules/timedShutdown/index.d.ts.map +1 -0
  159. package/dist/modules/timedShutdown/index.js +35 -27
  160. package/dist/modules/timedShutdown/index.js.map +1 -1
  161. package/dist/modules/utils/commands/help.d.ts +1 -0
  162. package/dist/modules/utils/commands/help.d.ts.map +1 -0
  163. package/dist/modules/utils/commands/help.js +10 -9
  164. package/dist/modules/utils/commands/help.js.map +1 -1
  165. package/dist/modules/utils/commands/ping.d.ts +1 -0
  166. package/dist/modules/utils/commands/ping.d.ts.map +1 -0
  167. package/dist/modules/utils/index.d.ts +3 -2
  168. package/dist/modules/utils/index.d.ts.map +1 -0
  169. package/dist/modules/utils/index.js +36 -28
  170. package/dist/modules/utils/index.js.map +1 -1
  171. package/dist/modules.json +600 -570
  172. package/package.json +2 -5
  173. package/scripts/buildBuiltinJson.ts +12 -8
  174. package/src/BuiltinModule.ts +25 -17
  175. package/src/__tests__/aliases.integration.test.ts +23 -26
  176. package/src/__tests__/bugRepros.integration.test.ts +261 -10
  177. package/src/__tests__/builtinmodule.unit.test.ts +3 -1
  178. package/src/__tests__/commandArgs.integration.test.ts +13 -6
  179. package/src/__tests__/economy/claim.integration.test.ts +1 -0
  180. package/src/__tests__/economy/economyUtils.integration.test.ts +43 -46
  181. package/src/__tests__/economy/shop.integration.test.ts +5 -4
  182. package/src/__tests__/economy/zombieKillReward.integration.test.ts +28 -31
  183. package/src/__tests__/geoblock.integration.test.ts +76 -91
  184. package/src/__tests__/gimme.integration.test.ts +22 -25
  185. package/src/__tests__/help.integration.test.ts +21 -20
  186. package/src/__tests__/lottery.integration.test.ts +15 -11
  187. package/src/__tests__/modulePermission.integration.test.ts +17 -13
  188. package/src/__tests__/onboarding.integration.test.ts +31 -34
  189. package/src/__tests__/ping.integration.test.ts +5 -4
  190. package/src/__tests__/roleExpiry.integration.test.ts +5 -4
  191. package/src/__tests__/serverMessages.integration.test.ts +24 -27
  192. package/src/__tests__/systemConfigCooldown.integration.test.ts +5 -1
  193. package/src/__tests__/systemConfigCost.integration.test.ts +16 -17
  194. package/src/__tests__/teleports/listtp.integration.test.ts +20 -21
  195. package/src/__tests__/teleports/publicteleports.integration.test.ts +58 -70
  196. package/src/__tests__/teleports/teleport.integration.test.ts +16 -17
  197. package/src/__tests__/teleports/tpManagement.integration.test.ts +21 -20
  198. package/src/__tests__/teleports/waypoints.integration.test.ts +52 -6
  199. package/src/dto/takaroEvents.ts +21 -0
  200. package/src/main.ts +12 -4
  201. package/src/modules/chatBridge/index.ts +54 -51
  202. package/src/modules/dailyRewards/index.ts +121 -111
  203. package/src/modules/economyUtils/index.ts +182 -179
  204. package/src/modules/geoBlock/index.ts +72 -70
  205. package/src/modules/gimme/index.ts +59 -55
  206. package/src/modules/highPingKicker/index.ts +35 -32
  207. package/src/modules/lottery/index.ts +73 -71
  208. package/src/modules/playerOnboarding/index.ts +71 -67
  209. package/src/modules/serverMessages/index.ts +36 -32
  210. package/src/modules/teleports/commands/deletewaypoint.js +4 -53
  211. package/src/modules/teleports/commands/listwaypoints.js +3 -35
  212. package/src/modules/teleports/commands/setwaypoint.js +5 -83
  213. package/src/modules/teleports/commands/teleportwaypoint.js +9 -36
  214. package/src/modules/teleports/cronJobs/Waypoint reconciler.js +7 -0
  215. package/src/modules/teleports/functions/utils.js +150 -0
  216. package/src/modules/teleports/index.ts +196 -180
  217. package/src/modules/timedShutdown/index.ts +35 -30
  218. package/src/modules/utils/commands/help.js +14 -14
  219. package/src/modules/utils/index.ts +36 -32
  220. package/tsconfig.json +1 -1
@@ -1,125 +1,135 @@
1
1
  /* eslint-disable quotes */
2
- import { BuiltinModule, ICommand, IFunction, IHook, IPermission } from '../../BuiltinModule.js';
2
+ import {
3
+ ModuleTransferDTO,
4
+ ICommand,
5
+ IFunction,
6
+ IHook,
7
+ IPermission,
8
+ ModuleTransferVersionDTO,
9
+ } from '../../BuiltinModule.js';
3
10
 
4
- export class DailyRewards extends BuiltinModule<DailyRewards> {
11
+ export class DailyRewards extends ModuleTransferDTO<DailyRewards> {
5
12
  constructor() {
6
- super(
7
- 'dailyRewards',
8
- 'Provides daily login rewards with streak tracking',
9
- JSON.stringify({
10
- $schema: 'http://json-schema.org/draft-07/schema#',
11
- type: 'object',
12
- properties: {
13
- baseReward: {
14
- type: 'number',
15
- title: 'Base Reward',
16
- description: 'Base amount of currency given for daily rewards. This is multiplied by streak level.',
17
- default: 100,
18
- minimum: 1,
19
- },
20
- maxStreak: {
21
- type: 'number',
22
- title: 'Maximum Streak',
23
- description: 'Maximum streak level a player can reach',
24
- default: 365,
25
- minimum: 1,
26
- },
27
- milestoneRewards: {
28
- type: 'array',
29
- title: 'Milestone Rewards',
30
- description: 'Additional rewards for reaching certain streak milestones',
31
- items: {
32
- type: 'object',
33
- properties: {
34
- days: {
35
- type: 'number',
36
- description: 'Days needed to reach milestone',
37
- minimum: 1,
38
- },
39
- reward: {
40
- type: 'number',
41
- description: 'Bonus reward amount',
42
- },
43
- message: {
44
- type: 'string',
45
- description: 'Message to show when milestone is reached',
13
+ super();
14
+ this.name = 'dailyRewards';
15
+ this.versions = [
16
+ new ModuleTransferVersionDTO({
17
+ description: 'Provides daily login rewards with streak tracking',
18
+ tag: '0.0.1',
19
+ configSchema: JSON.stringify({
20
+ $schema: 'http://json-schema.org/draft-07/schema#',
21
+ type: 'object',
22
+ properties: {
23
+ baseReward: {
24
+ type: 'number',
25
+ title: 'Base Reward',
26
+ description: 'Base amount of currency given for daily rewards. This is multiplied by streak level.',
27
+ default: 100,
28
+ minimum: 1,
29
+ },
30
+ maxStreak: {
31
+ type: 'number',
32
+ title: 'Maximum Streak',
33
+ description: 'Maximum streak level a player can reach',
34
+ default: 365,
35
+ minimum: 1,
36
+ },
37
+ milestoneRewards: {
38
+ type: 'array',
39
+ title: 'Milestone Rewards',
40
+ description: 'Additional rewards for reaching certain streak milestones',
41
+ items: {
42
+ type: 'object',
43
+ properties: {
44
+ days: {
45
+ type: 'number',
46
+ description: 'Days needed to reach milestone',
47
+ minimum: 1,
48
+ },
49
+ reward: {
50
+ type: 'number',
51
+ description: 'Bonus reward amount',
52
+ },
53
+ message: {
54
+ type: 'string',
55
+ description: 'Message to show when milestone is reached',
56
+ },
46
57
  },
47
58
  },
59
+ default: [
60
+ { days: 7, reward: 1000, message: 'You did it! 7 days in a row!' },
61
+ { days: 30, reward: 5000, message: "A whole month! You're on fire!" },
62
+ { days: 90, reward: 20000, message: "90 days! You're unstoppable!" },
63
+ { days: 180, reward: 50000, message: "Half a year! You're a legend!" },
64
+ { days: 365, reward: 150000, message: "365 days! You're a true champion!" },
65
+ ],
48
66
  },
49
- default: [
50
- { days: 7, reward: 1000, message: 'You did it! 7 days in a row!' },
51
- { days: 30, reward: 5000, message: "A whole month! You're on fire!" },
52
- { days: 90, reward: 20000, message: "90 days! You're unstoppable!" },
53
- { days: 180, reward: 50000, message: "Half a year! You're a legend!" },
54
- { days: 365, reward: 150000, message: "365 days! You're a true champion!" },
55
- ],
56
67
  },
57
- },
58
- required: ['baseReward', 'maxStreak', 'milestoneRewards'],
59
- additionalProperties: false,
60
- }),
61
- );
62
-
63
- this.functions = [
64
- new IFunction({
65
- name: 'utils',
66
- function: this.loadFn('functions', 'utils'),
67
- }),
68
- ];
68
+ required: ['baseReward', 'maxStreak', 'milestoneRewards'],
69
+ additionalProperties: false,
70
+ }),
71
+ functions: [
72
+ new IFunction({
73
+ name: 'utils',
74
+ function: this.loadFn('functions', 'utils'),
75
+ }),
76
+ ],
69
77
 
70
- this.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:
81
- 'Control the multiplier per role. This is useful to give your donors a little extra. Count is an integer multiplier.',
82
- canHaveCount: true,
83
- }),
84
- ];
78
+ permissions: [
79
+ new IPermission({
80
+ permission: 'DAILY_CLAIM',
81
+ friendlyName: 'Claim Daily Rewards',
82
+ description: 'Allows the player to claim daily rewards',
83
+ canHaveCount: false,
84
+ }),
85
+ new IPermission({
86
+ permission: 'DAILY_REWARD_MULTIPLIER',
87
+ friendlyName: 'Multiplier',
88
+ description:
89
+ 'Control the multiplier per role. This is useful to give your donors a little extra. Count is an integer multiplier.',
90
+ canHaveCount: true,
91
+ }),
92
+ ],
85
93
 
86
- this.commands = [
87
- new ICommand({
88
- function: this.loadFn('commands', 'daily'),
89
- name: 'daily',
90
- trigger: 'daily',
91
- helpText: 'Claim your daily reward',
92
- arguments: [],
93
- }),
94
- new ICommand({
95
- function: this.loadFn('commands', 'streak'),
96
- name: 'streak',
97
- trigger: 'streak',
98
- helpText: 'Check your current daily reward streak and next claim time',
99
- arguments: [],
100
- }),
101
- new ICommand({
102
- function: this.loadFn('commands', 'topstreak'),
103
- name: 'topstreak',
104
- trigger: 'topstreak',
105
- helpText: 'Shows the players with highest daily reward streaks',
106
- arguments: [
107
- {
108
- name: 'count',
109
- type: 'number',
110
- defaultValue: '5',
111
- helpText: 'Number of players to show (max 25)',
112
- position: 0,
113
- },
94
+ commands: [
95
+ new ICommand({
96
+ function: this.loadFn('commands', 'daily'),
97
+ name: 'daily',
98
+ trigger: 'daily',
99
+ helpText: 'Claim your daily reward',
100
+ arguments: [],
101
+ }),
102
+ new ICommand({
103
+ function: this.loadFn('commands', 'streak'),
104
+ name: 'streak',
105
+ trigger: 'streak',
106
+ helpText: 'Check your current daily reward streak and next claim time',
107
+ arguments: [],
108
+ }),
109
+ new ICommand({
110
+ function: this.loadFn('commands', 'topstreak'),
111
+ name: 'topstreak',
112
+ trigger: 'topstreak',
113
+ helpText: 'Shows the players with highest daily reward streaks',
114
+ arguments: [
115
+ {
116
+ name: 'count',
117
+ type: 'number',
118
+ defaultValue: '5',
119
+ helpText: 'Number of players to show (max 25)',
120
+ position: 0,
121
+ },
122
+ ],
123
+ }),
114
124
  ],
115
- }),
116
- ];
117
125
 
118
- this.hooks = [
119
- new IHook({
120
- eventType: 'player-connected',
121
- name: 'dailyLoginCheck',
122
- function: this.loadFn('hooks', 'dailyLoginCheck'),
126
+ hooks: [
127
+ new IHook({
128
+ eventType: 'player-connected',
129
+ name: 'dailyLoginCheck',
130
+ function: this.loadFn('hooks', 'dailyLoginCheck'),
131
+ }),
132
+ ],
123
133
  }),
124
134
  ];
125
135
  }
@@ -1,188 +1,191 @@
1
- import { BuiltinModule, ICommand, ICronJob, IPermission } from '../../BuiltinModule.js';
1
+ import { ModuleTransferDTO, ICommand, ICronJob, IPermission, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
2
2
 
3
- export class EconomyUtils extends BuiltinModule<EconomyUtils> {
3
+ export class EconomyUtils extends ModuleTransferDTO<EconomyUtils> {
4
4
  constructor() {
5
- super(
6
- 'economyUtils',
7
- 'A set of commands to allow players to manage their currency.',
8
- JSON.stringify({
9
- $schema: 'http://json-schema.org/draft-07/schema#',
10
- type: 'object',
11
- properties: {
12
- pendingAmount: {
13
- title: 'Pending amount',
14
- type: 'number',
15
- description:
16
- 'When a player transfers money, they must confirm the transfer when the amount is equal or above this value. Set to 0 to disable.',
17
- default: 0,
18
- },
19
- zombieKillReward: {
20
- title: 'Zombie kill reward',
21
- type: 'number',
22
- description:
23
- 'The default amount of currency a player receives for killing a zombie. This can be overridden by roles.',
24
- default: 1,
25
- },
26
- },
27
- required: [],
28
- additionalProperties: false,
29
- }),
30
- );
31
-
32
- this.permissions = [
33
- new IPermission({
34
- permission: 'ECONOMY_UTILS_MANAGE_CURRENCY',
35
- friendlyName: 'Manage currency',
36
- description:
37
- 'Allows players to manage currency of other players. This includes granting and revoking currency.',
38
- canHaveCount: false,
39
- }),
40
- new IPermission({
41
- permission: 'ZOMBIE_KILL_REWARD_OVERRIDE',
42
- friendlyName: 'Zombie kill reward override',
43
- description: 'Allows a role to override the amount of currency a player receives for killing a entity.',
44
- canHaveCount: true,
45
- }),
46
- ];
47
-
48
- this.cronJobs = [
49
- new ICronJob({
50
- function: this.loadFn('cronJobs', 'zombieKillReward'),
51
- name: 'zombieKillReward',
52
- temporalValue: '*/5 * * * *',
53
- }),
54
- ];
5
+ super();
55
6
 
56
- this.commands = [
57
- new ICommand({
58
- function: this.loadFn('commands', 'balance'),
59
- name: 'balance',
60
- trigger: 'balance',
61
- helpText: 'Check your balance.',
62
- arguments: [],
63
- }),
64
- new ICommand({
65
- function: this.loadFn('commands', 'topCurrency'),
66
- name: 'topCurrency',
67
- trigger: 'topcurrency',
68
- helpText: 'List of the 10 players with the highest balance.',
69
- arguments: [],
70
- }),
71
- new ICommand({
72
- function: this.loadFn('commands', 'grantCurrency'),
73
- name: 'grantCurrency',
74
- trigger: 'grantcurrency',
75
- helpText: 'Grant money to a player. The money is not taken from your own balance but is new currency.',
76
- arguments: [
77
- {
78
- name: 'receiver',
79
- type: 'player',
80
- helpText: 'The player to grant currency to.',
81
- position: 0,
82
- defaultValue: null,
83
- },
84
- {
85
- name: 'amount',
86
- type: 'number',
87
- helpText: 'The amount of money.',
88
- position: 1,
89
- defaultValue: null,
90
- },
91
- ],
92
- }),
93
- new ICommand({
94
- function: this.loadFn('commands', 'revokeCurrency'),
95
- name: 'revokeCurrency',
96
- trigger: 'revokecurrency',
97
- helpText: 'Revokes money from a player. The money disappears.',
98
- arguments: [
99
- {
100
- name: 'receiver',
101
- type: 'player',
102
- helpText: 'The player to revoke currency from.',
103
- position: 0,
104
- defaultValue: null,
105
- },
106
- {
107
- name: 'amount',
108
- type: 'number',
109
- helpText: 'The amount of money.',
110
- position: 1,
111
- defaultValue: null,
112
- },
113
- ],
114
- }),
115
- new ICommand({
116
- function: this.loadFn('commands', 'confirmTransfer'),
117
- name: 'confirmTransfer',
118
- trigger: 'confirmtransfer',
119
- helpText: 'Confirms a pending transfer.',
120
- arguments: [],
121
- }),
122
- new ICommand({
123
- function: this.loadFn('commands', 'transfer'),
124
- name: 'transfer',
125
- trigger: 'transfer',
126
- helpText: 'Transfer money to another player.',
127
- arguments: [
128
- {
129
- name: 'receiver',
130
- type: 'player',
131
- helpText: 'The player to transfer money to.',
132
- position: 0,
133
- defaultValue: null,
134
- },
135
- {
136
- name: 'amount',
137
- type: 'number',
138
- helpText: 'The amount of money to transfer.',
139
- position: 1,
140
- defaultValue: null,
7
+ this.name = 'economyUtils';
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ tag: '0.0.1',
11
+ description: 'A set of commands to allow players to manage their currency.',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ properties: {
16
+ pendingAmount: {
17
+ title: 'Pending amount',
18
+ type: 'number',
19
+ description:
20
+ 'When a player transfers money, they must confirm the transfer when the amount is equal or above this value. Set to 0 to disable.',
21
+ default: 0,
22
+ },
23
+ zombieKillReward: {
24
+ title: 'Zombie kill reward',
25
+ type: 'number',
26
+ description:
27
+ 'The default amount of currency a player receives for killing a zombie. This can be overridden by roles.',
28
+ default: 1,
29
+ },
141
30
  },
31
+ required: [],
32
+ additionalProperties: false,
33
+ }),
34
+ permissions: [
35
+ new IPermission({
36
+ permission: 'ECONOMY_UTILS_MANAGE_CURRENCY',
37
+ friendlyName: 'Manage currency',
38
+ description:
39
+ 'Allows players to manage currency of other players. This includes granting and revoking currency.',
40
+ canHaveCount: false,
41
+ }),
42
+ new IPermission({
43
+ permission: 'ZOMBIE_KILL_REWARD_OVERRIDE',
44
+ friendlyName: 'Zombie kill reward override',
45
+ description: 'Allows a role to override the amount of currency a player receives for killing a entity.',
46
+ canHaveCount: true,
47
+ }),
142
48
  ],
143
- }),
144
- new ICommand({
145
- function: this.loadFn('commands', 'claim'),
146
- name: 'claim',
147
- trigger: 'claim',
148
- helpText: 'Claim your pending shop orders.',
149
- arguments: [
150
- {
151
- name: 'all',
152
- type: 'boolean',
153
- helpText: 'If true, claim ALL pending orders. If false, claim only the first one.',
154
- position: 0,
155
- defaultValue: 'false',
156
- },
49
+ cronJobs: [
50
+ new ICronJob({
51
+ function: this.loadFn('cronJobs', 'zombieKillReward'),
52
+ name: 'zombieKillReward',
53
+ temporalValue: '*/5 * * * *',
54
+ }),
157
55
  ],
158
- }),
159
- new ICommand({
160
- function: this.loadFn('commands', 'shop'),
161
- name: 'shop',
162
- trigger: 'shop',
163
- helpText: 'Browse the shop and view available items.',
164
- arguments: [
165
- {
166
- name: 'page',
167
- type: 'number',
168
- helpText: 'Display more items from the shop by specifying a page number.',
169
- position: 0,
170
- defaultValue: '1',
171
- },
172
- {
173
- name: 'item',
174
- type: 'number',
175
- helpText: 'Select a specific item to view more details.',
176
- position: 1,
177
- defaultValue: '0',
178
- },
179
- {
180
- name: 'action',
181
- type: 'string',
182
- helpText: 'Perform an action on the selected item. Currently only "buy" is supported.',
183
- position: 2,
184
- defaultValue: 'none',
185
- },
56
+
57
+ commands: [
58
+ new ICommand({
59
+ function: this.loadFn('commands', 'balance'),
60
+ name: 'balance',
61
+ trigger: 'balance',
62
+ helpText: 'Check your balance.',
63
+ arguments: [],
64
+ }),
65
+ new ICommand({
66
+ function: this.loadFn('commands', 'topCurrency'),
67
+ name: 'topCurrency',
68
+ trigger: 'topcurrency',
69
+ helpText: 'List of the 10 players with the highest balance.',
70
+ arguments: [],
71
+ }),
72
+ new ICommand({
73
+ function: this.loadFn('commands', 'grantCurrency'),
74
+ name: 'grantCurrency',
75
+ trigger: 'grantcurrency',
76
+ helpText: 'Grant money to a player. The money is not taken from your own balance but is new currency.',
77
+ arguments: [
78
+ {
79
+ name: 'receiver',
80
+ type: 'player',
81
+ helpText: 'The player to grant currency to.',
82
+ position: 0,
83
+ defaultValue: null,
84
+ },
85
+ {
86
+ name: 'amount',
87
+ type: 'number',
88
+ helpText: 'The amount of money.',
89
+ position: 1,
90
+ defaultValue: null,
91
+ },
92
+ ],
93
+ }),
94
+ new ICommand({
95
+ function: this.loadFn('commands', 'revokeCurrency'),
96
+ name: 'revokeCurrency',
97
+ trigger: 'revokecurrency',
98
+ helpText: 'Revokes money from a player. The money disappears.',
99
+ arguments: [
100
+ {
101
+ name: 'receiver',
102
+ type: 'player',
103
+ helpText: 'The player to revoke currency from.',
104
+ position: 0,
105
+ defaultValue: null,
106
+ },
107
+ {
108
+ name: 'amount',
109
+ type: 'number',
110
+ helpText: 'The amount of money.',
111
+ position: 1,
112
+ defaultValue: null,
113
+ },
114
+ ],
115
+ }),
116
+ new ICommand({
117
+ function: this.loadFn('commands', 'confirmTransfer'),
118
+ name: 'confirmTransfer',
119
+ trigger: 'confirmtransfer',
120
+ helpText: 'Confirms a pending transfer.',
121
+ arguments: [],
122
+ }),
123
+ new ICommand({
124
+ function: this.loadFn('commands', 'transfer'),
125
+ name: 'transfer',
126
+ trigger: 'transfer',
127
+ helpText: 'Transfer money to another player.',
128
+ arguments: [
129
+ {
130
+ name: 'receiver',
131
+ type: 'player',
132
+ helpText: 'The player to transfer money to.',
133
+ position: 0,
134
+ defaultValue: null,
135
+ },
136
+ {
137
+ name: 'amount',
138
+ type: 'number',
139
+ helpText: 'The amount of money to transfer.',
140
+ position: 1,
141
+ defaultValue: null,
142
+ },
143
+ ],
144
+ }),
145
+ new ICommand({
146
+ function: this.loadFn('commands', 'claim'),
147
+ name: 'claim',
148
+ trigger: 'claim',
149
+ helpText: 'Claim your pending shop orders.',
150
+ arguments: [
151
+ {
152
+ name: 'all',
153
+ type: 'boolean',
154
+ helpText: 'If true, claim ALL pending orders. If false, claim only the first one.',
155
+ position: 0,
156
+ defaultValue: 'false',
157
+ },
158
+ ],
159
+ }),
160
+ new ICommand({
161
+ function: this.loadFn('commands', 'shop'),
162
+ name: 'shop',
163
+ trigger: 'shop',
164
+ helpText: 'Browse the shop and view available items.',
165
+ arguments: [
166
+ {
167
+ name: 'page',
168
+ type: 'number',
169
+ helpText: 'Display more items from the shop by specifying a page number.',
170
+ position: 0,
171
+ defaultValue: '1',
172
+ },
173
+ {
174
+ name: 'item',
175
+ type: 'number',
176
+ helpText: 'Select a specific item to view more details.',
177
+ position: 1,
178
+ defaultValue: '0',
179
+ },
180
+ {
181
+ name: 'action',
182
+ type: 'string',
183
+ helpText: 'Perform an action on the selected item. Currently only "buy" is supported.',
184
+ position: 2,
185
+ defaultValue: 'none',
186
+ },
187
+ ],
188
+ }),
186
189
  ],
187
190
  }),
188
191
  ];