@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
@@ -1,193 +1,209 @@
1
- import { BuiltinModule, ICommand, IFunction, IPermission } from '../../BuiltinModule.js';
1
+ import {
2
+ ModuleTransferDTO,
3
+ ICommand,
4
+ IFunction,
5
+ IPermission,
6
+ ModuleTransferVersionDTO,
7
+ ICronJob,
8
+ } from '../../BuiltinModule.js';
2
9
  import { Duration } from 'luxon';
3
10
 
4
- export class Teleports extends BuiltinModule<Teleports> {
11
+ export class Teleports extends ModuleTransferDTO<Teleports> {
5
12
  constructor() {
6
- super(
7
- 'teleports',
8
- 'A set of commands to allow players to set their own teleport points and teleport to them.',
9
- JSON.stringify({
10
- $schema: 'http://json-schema.org/draft-07/schema#',
11
- type: 'object',
12
- properties: {
13
- timeout: {
14
- title: 'Timeout',
15
- description: 'The time one has to wait before teleporting again.',
16
- 'x-component': 'duration',
17
- type: 'number',
18
- minimum: 0,
19
- default: Duration.fromObject({ second: 1 }).as('milliseconds'),
20
- },
21
- allowPublicTeleports: {
22
- type: 'boolean',
23
- description: 'Players can create public teleports.',
24
- default: false,
25
- },
26
- },
27
- required: [],
28
- additionalProperties: false,
29
- }),
30
- JSON.stringify({
31
- timeout: { 'ui:widget': 'duration' },
32
- }),
33
- );
13
+ super();
34
14
 
35
- this.functions = [
36
- new IFunction({
37
- name: 'utils',
38
- function: this.loadFn('functions', 'utils'),
39
- }),
40
- ];
41
-
42
- this.permissions = [
43
- new IPermission({
44
- permission: 'TELEPORTS_CREATE_PUBLIC',
45
- friendlyName: 'Create Public Teleports',
46
- description: 'Allows the player to create public teleports.',
47
- canHaveCount: true,
48
- }),
49
- new IPermission({
50
- permission: 'TELEPORTS_USE',
51
- friendlyName: 'Use Teleports',
52
- description: 'Allows the player to use teleports modules.',
53
- canHaveCount: true,
54
- }),
55
- new IPermission({
56
- permission: 'TELEPORTS_MANAGE_WAYPOINTS',
57
- friendlyName: 'Manage waypoints',
58
- description: 'Allows creating, deleting, and managing waypoints.',
59
- canHaveCount: false,
60
- }),
61
- ];
62
-
63
- this.commands = [
64
- new ICommand({
65
- function: this.loadFn('commands', 'teleport'),
66
- name: 'teleport',
67
- trigger: 'tp',
68
- helpText: 'Teleports to one of your set locations.',
69
- arguments: [
70
- {
71
- name: 'tp',
72
- type: 'string',
73
- defaultValue: null,
74
- helpText: 'The location to teleport to.',
75
- position: 0,
76
- },
77
- ],
78
- }),
79
- new ICommand({
80
- function: this.loadFn('commands', 'tplist'),
81
- name: 'tplist',
82
- trigger: 'tplist',
83
- helpText: 'Lists all your set locations.',
84
- arguments: [],
85
- }),
86
- new ICommand({
87
- function: this.loadFn('commands', 'settp'),
88
- name: 'settp',
89
- trigger: 'settp',
90
- helpText: 'Sets a location to teleport to.',
91
- arguments: [
92
- {
93
- name: 'tp',
94
- type: 'string',
95
- defaultValue: null,
96
- helpText: 'The location name.',
97
- position: 0,
15
+ this.name = 'teleports';
16
+ this.versions = [
17
+ new ModuleTransferVersionDTO({
18
+ tag: '0.0.2',
19
+ description: 'A set of commands to allow players to set their own teleport points and teleport to them.',
20
+ configSchema: JSON.stringify({
21
+ $schema: 'http://json-schema.org/draft-07/schema#',
22
+ type: 'object',
23
+ properties: {
24
+ timeout: {
25
+ title: 'Timeout',
26
+ description: 'The time one has to wait before teleporting again.',
27
+ 'x-component': 'duration',
28
+ type: 'number',
29
+ minimum: 0,
30
+ default: Duration.fromObject({ second: 1 }).as('milliseconds'),
31
+ },
32
+ allowPublicTeleports: {
33
+ type: 'boolean',
34
+ description: 'Players can create public teleports.',
35
+ default: false,
36
+ },
98
37
  },
38
+ required: [],
39
+ additionalProperties: false,
40
+ }),
41
+ uiSchema: JSON.stringify({
42
+ timeout: { 'ui:widget': 'duration' },
43
+ }),
44
+ functions: [
45
+ new IFunction({
46
+ name: 'utils',
47
+ function: this.loadFn('functions', 'utils'),
48
+ }),
99
49
  ],
100
- }),
101
- new ICommand({
102
- function: this.loadFn('commands', 'deletetp'),
103
- name: 'deletetp',
104
- trigger: 'deletetp',
105
- helpText: 'Deletes a location.',
106
- arguments: [
107
- {
108
- name: 'tp',
109
- type: 'string',
110
- defaultValue: null,
111
- helpText: 'The location name.',
112
- position: 0,
113
- },
50
+ permissions: [
51
+ new IPermission({
52
+ permission: 'TELEPORTS_CREATE_PUBLIC',
53
+ friendlyName: 'Create Public Teleports',
54
+ description: 'Allows the player to create public teleports.',
55
+ canHaveCount: true,
56
+ }),
57
+ new IPermission({
58
+ permission: 'TELEPORTS_USE',
59
+ friendlyName: 'Use Teleports',
60
+ description: 'Allows the player to use teleports modules.',
61
+ canHaveCount: true,
62
+ }),
63
+ new IPermission({
64
+ permission: 'TELEPORTS_MANAGE_WAYPOINTS',
65
+ friendlyName: 'Manage waypoints',
66
+ description: 'Allows creating, deleting, and managing waypoints.',
67
+ canHaveCount: false,
68
+ }),
114
69
  ],
115
- }),
116
- new ICommand({
117
- function: this.loadFn('commands', 'setpublic'),
118
- name: 'setpublic',
119
- trigger: 'setpublic',
120
- helpText: 'Sets a teleport to be public, allowing other players to teleport to it.',
121
- arguments: [
122
- {
123
- name: 'tp',
124
- type: 'string',
125
- defaultValue: null,
126
- helpText: 'The location name.',
127
- position: 0,
128
- },
70
+ commands: [
71
+ new ICommand({
72
+ function: this.loadFn('commands', 'teleport'),
73
+ name: 'teleport',
74
+ trigger: 'tp',
75
+ helpText: 'Teleports to one of your set locations.',
76
+ arguments: [
77
+ {
78
+ name: 'tp',
79
+ type: 'string',
80
+ defaultValue: null,
81
+ helpText: 'The location to teleport to.',
82
+ position: 0,
83
+ },
84
+ ],
85
+ }),
86
+ new ICommand({
87
+ function: this.loadFn('commands', 'tplist'),
88
+ name: 'tplist',
89
+ trigger: 'tplist',
90
+ helpText: 'Lists all your set locations.',
91
+ arguments: [],
92
+ }),
93
+ new ICommand({
94
+ function: this.loadFn('commands', 'settp'),
95
+ name: 'settp',
96
+ trigger: 'settp',
97
+ helpText: 'Sets a location to teleport to.',
98
+ arguments: [
99
+ {
100
+ name: 'tp',
101
+ type: 'string',
102
+ defaultValue: null,
103
+ helpText: 'The location name.',
104
+ position: 0,
105
+ },
106
+ ],
107
+ }),
108
+ new ICommand({
109
+ function: this.loadFn('commands', 'deletetp'),
110
+ name: 'deletetp',
111
+ trigger: 'deletetp',
112
+ helpText: 'Deletes a location.',
113
+ arguments: [
114
+ {
115
+ name: 'tp',
116
+ type: 'string',
117
+ defaultValue: null,
118
+ helpText: 'The location name.',
119
+ position: 0,
120
+ },
121
+ ],
122
+ }),
123
+ new ICommand({
124
+ function: this.loadFn('commands', 'setpublic'),
125
+ name: 'setpublic',
126
+ trigger: 'setpublic',
127
+ helpText: 'Sets a teleport to be public, allowing other players to teleport to it.',
128
+ arguments: [
129
+ {
130
+ name: 'tp',
131
+ type: 'string',
132
+ defaultValue: null,
133
+ helpText: 'The location name.',
134
+ position: 0,
135
+ },
136
+ ],
137
+ }),
138
+ new ICommand({
139
+ function: this.loadFn('commands', 'setprivate'),
140
+ name: 'setprivate',
141
+ trigger: 'setprivate',
142
+ helpText: 'Sets a teleport to be private, only the teleport owner can teleport to it.',
143
+ arguments: [
144
+ {
145
+ name: 'tp',
146
+ type: 'string',
147
+ defaultValue: null,
148
+ helpText: 'The location name.',
149
+ position: 0,
150
+ },
151
+ ],
152
+ }),
153
+ new ICommand({
154
+ function: this.loadFn('commands', 'setwaypoint'),
155
+ name: 'setwaypoint',
156
+ trigger: 'setwaypoint',
157
+ helpText: 'Creates a new waypoint.',
158
+ arguments: [
159
+ {
160
+ name: 'waypoint',
161
+ type: 'string',
162
+ defaultValue: null,
163
+ helpText: 'The location name.',
164
+ position: 0,
165
+ },
166
+ ],
167
+ }),
168
+ new ICommand({
169
+ function: this.loadFn('commands', 'deletewaypoint'),
170
+ name: 'deletewaypoint',
171
+ trigger: 'deletewaypoint',
172
+ helpText: 'Deletes a waypoint.',
173
+ arguments: [
174
+ {
175
+ name: 'waypoint',
176
+ type: 'string',
177
+ defaultValue: null,
178
+ helpText: 'The location name.',
179
+ position: 0,
180
+ },
181
+ ],
182
+ }),
183
+ new ICommand({
184
+ function: this.loadFn('commands', 'listwaypoints'),
185
+ name: 'listwaypoints',
186
+ trigger: 'waypoints',
187
+ helpText: 'Lists all waypoints.',
188
+ arguments: [],
189
+ }),
190
+ new ICommand({
191
+ function: this.loadFn('commands', 'teleportwaypoint'),
192
+ name: 'teleportwaypoint',
193
+ trigger: 'teleportwaypoint',
194
+ arguments: [],
195
+ helpText:
196
+ 'Placeholder command, this will not be used directly. The module will install aliases for this command corresponding to the waypoint names.',
197
+ }),
129
198
  ],
130
- }),
131
- new ICommand({
132
- function: this.loadFn('commands', 'setprivate'),
133
- name: 'setprivate',
134
- trigger: 'setprivate',
135
- helpText: 'Sets a teleport to be private, only the teleport owner can teleport to it.',
136
- arguments: [
137
- {
138
- name: 'tp',
139
- type: 'string',
140
- defaultValue: null,
141
- helpText: 'The location name.',
142
- position: 0,
143
- },
199
+ cronJobs: [
200
+ new ICronJob({
201
+ name: 'Waypoint reconciler',
202
+ temporalValue: '*/30 * * * *',
203
+ function: this.loadFn('cronJobs', 'Waypoint reconciler'),
204
+ }),
144
205
  ],
145
206
  }),
146
- new ICommand({
147
- function: this.loadFn('commands', 'setwaypoint'),
148
- name: 'setwaypoint',
149
- trigger: 'setwaypoint',
150
- helpText: 'Creates a new waypoint.',
151
- arguments: [
152
- {
153
- name: 'waypoint',
154
- type: 'string',
155
- defaultValue: null,
156
- helpText: 'The location name.',
157
- position: 0,
158
- },
159
- ],
160
- }),
161
- new ICommand({
162
- function: this.loadFn('commands', 'deletewaypoint'),
163
- name: 'deletewaypoint',
164
- trigger: 'deletewaypoint',
165
- helpText: 'Deletes a waypoint.',
166
- arguments: [
167
- {
168
- name: 'waypoint',
169
- type: 'string',
170
- defaultValue: null,
171
- helpText: 'The location name.',
172
- position: 0,
173
- },
174
- ],
175
- }),
176
- new ICommand({
177
- function: this.loadFn('commands', 'listwaypoints'),
178
- name: 'listwaypoints',
179
- trigger: 'waypoints',
180
- helpText: 'Lists all waypoints.',
181
- arguments: [],
182
- }),
183
- new ICommand({
184
- function: this.loadFn('commands', 'teleportwaypoint'),
185
- name: 'teleportwaypoint',
186
- trigger: 'teleportwaypoint',
187
- arguments: [],
188
- helpText:
189
- 'Placeholder command, this will not be used directly. The module will install aliases for this command corresponding to the waypoint names.',
190
- }),
191
207
  ];
192
208
  }
193
209
  }
@@ -1,37 +1,42 @@
1
- import { BuiltinModule, ICronJob } from '../../BuiltinModule.js';
1
+ import { ModuleTransferDTO, ICronJob, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
2
2
 
3
- export class TimedShutdown extends BuiltinModule<TimedShutdown> {
3
+ export class TimedShutdown extends ModuleTransferDTO<TimedShutdown> {
4
4
  constructor() {
5
- super(
6
- 'timedShutdown',
7
- 'Automatically shut down the server at a specific time.',
8
- JSON.stringify({
9
- $schema: 'http://json-schema.org/draft-07/schema#',
10
- type: 'object',
11
- properties: {
12
- warningMessage: {
13
- type: 'string',
14
- title: 'Warning message',
15
- description: 'Message to send to players before the server shuts down.',
16
- default: 'Server is shutting down in 5 minutes!',
17
- minLength: 1,
18
- maxLength: 1024,
5
+ super();
6
+
7
+ this.name = 'timedShutdown';
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ tag: '0.0.1',
11
+ description: 'Automatically shut down the server at a specific time.',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ properties: {
16
+ warningMessage: {
17
+ type: 'string',
18
+ title: 'Warning message',
19
+ description: 'Message to send to players before the server shuts down.',
20
+ default: 'Server is shutting down in 5 minutes!',
21
+ minLength: 1,
22
+ maxLength: 1024,
23
+ },
19
24
  },
20
- },
21
- required: ['warningMessage'],
22
- }),
23
- );
25
+ required: ['warningMessage'],
26
+ }),
24
27
 
25
- this.cronJobs = [
26
- new ICronJob({
27
- name: 'Shutdown',
28
- temporalValue: '3 30 * * *',
29
- function: this.loadFn('cronJobs', 'Shutdown'),
30
- }),
31
- new ICronJob({
32
- name: 'warning',
33
- temporalValue: '3 25 * * *',
34
- function: this.loadFn('cronJobs', 'warning'),
28
+ cronJobs: [
29
+ new ICronJob({
30
+ name: 'Shutdown',
31
+ temporalValue: '30 3 * * *',
32
+ function: this.loadFn('cronJobs', 'Shutdown'),
33
+ }),
34
+ new ICronJob({
35
+ name: 'warning',
36
+ temporalValue: '25 3 * * *',
37
+ function: this.loadFn('cronJobs', 'warning'),
38
+ }),
39
+ ],
35
40
  }),
36
41
  ];
37
42
  }
@@ -1,33 +1,33 @@
1
- import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
-
1
+ import { data, takaro, TakaroUserError } from '@takaro/helpers';
3
2
  async function main() {
4
- const enabledModules = await takaro.gameserver.gameServerControllerGetInstalledModules(data.gameServerId);
3
+ const enabledModules = await takaro.module.moduleInstallationsControllerGetInstalledModules({
4
+ filters: { gameserverId: [data.gameServerId] },
5
+ });
5
6
 
6
7
  const moduleCommands = await Promise.all(
7
8
  enabledModules.data.data.map(async (mod) => {
8
- return (await takaro.module.moduleControllerGetOne(mod.moduleId)).data.data.commands;
9
- })
9
+ const installedVersion = await takaro.module.moduleVersionControllerGetModuleVersion(mod.versionId);
10
+ return installedVersion.data.data.commands;
11
+ }),
10
12
  );
13
+ const allCommandsFlat = moduleCommands.flat();
11
14
 
12
15
  if (data.arguments.command === 'all') {
13
16
  await data.player.pm('Available commands:');
14
17
 
15
- for (const mod of moduleCommands) {
16
- await Promise.all(
17
- mod.map(async (command) => {
18
- await data.player.pm(`${command.name}: ${command.helpText}`);
19
- })
20
- );
21
- }
18
+ await Promise.all(
19
+ allCommandsFlat.map(async (command) => {
20
+ await data.player.pm(`${command.name}: ${command.helpText}`);
21
+ }),
22
+ );
22
23
  } else {
23
- const allCommandsFlat = moduleCommands.flat();
24
24
  const requestedCommand = allCommandsFlat.find((c) => {
25
25
  return c.name === data.arguments.command;
26
26
  });
27
27
 
28
28
  if (!requestedCommand) {
29
29
  throw new TakaroUserError(
30
- `Unknown command "${data.arguments.command}", use this command without arguments to see all available commands.`
30
+ `Unknown command "${data.arguments.command}", use this command without arguments to see all available commands.`,
31
31
  );
32
32
  } else {
33
33
  await data.player.pm(`${requestedCommand.name}: ${requestedCommand.helpText}`);
@@ -1,38 +1,42 @@
1
- import { BuiltinModule, ICommand } from '../../BuiltinModule.js';
1
+ import { ModuleTransferDTO, ICommand, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
2
2
 
3
- export class Utils extends BuiltinModule<Utils> {
3
+ export class Utils extends ModuleTransferDTO<Utils> {
4
4
  constructor() {
5
- super(
6
- 'utils',
7
- 'A collection of useful commands',
8
- JSON.stringify({
9
- $schema: 'http://json-schema.org/draft-07/schema#',
10
- type: 'object',
11
- additionalProperties: false,
12
- }),
13
- );
5
+ super();
14
6
 
15
- this.commands = [
16
- new ICommand({
17
- function: this.loadFn('commands', 'ping'),
18
- name: 'ping',
19
- trigger: 'ping',
20
- helpText: 'Replies with pong, useful for testing if the connection works.',
21
- arguments: [],
22
- }),
23
- new ICommand({
24
- function: this.loadFn('commands', 'help'),
25
- name: 'help',
26
- trigger: 'help',
27
- helpText: 'The text you are reading right now, displays information about commands.',
28
- arguments: [
29
- {
30
- name: 'command',
31
- type: 'string',
32
- defaultValue: 'all',
33
- helpText: 'The command to get help for',
34
- position: 0,
35
- },
7
+ this.name = 'utils';
8
+ this.versions = [
9
+ new ModuleTransferVersionDTO({
10
+ tag: '0.0.1',
11
+ description: 'A collection of useful commands',
12
+ configSchema: JSON.stringify({
13
+ $schema: 'http://json-schema.org/draft-07/schema#',
14
+ type: 'object',
15
+ additionalProperties: false,
16
+ }),
17
+ commands: [
18
+ new ICommand({
19
+ function: this.loadFn('commands', 'ping'),
20
+ name: 'ping',
21
+ trigger: 'ping',
22
+ helpText: 'Replies with pong, useful for testing if the connection works.',
23
+ arguments: [],
24
+ }),
25
+ new ICommand({
26
+ function: this.loadFn('commands', 'help'),
27
+ name: 'help',
28
+ trigger: 'help',
29
+ helpText: 'The text you are reading right now, displays information about commands.',
30
+ arguments: [
31
+ {
32
+ name: 'command',
33
+ type: 'string',
34
+ defaultValue: 'all',
35
+ helpText: 'The command to get help for',
36
+ position: 0,
37
+ },
38
+ ],
39
+ }),
36
40
  ],
37
41
  }),
38
42
  ];
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../tsconfig.esm.json",
2
+ "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": "src",
5
5
  "outDir": "dist",