@takaro/modules 0.0.1

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 (227) hide show
  1. package/README.md +3 -0
  2. package/dist/BuiltinModule.d.ts +49 -0
  3. package/dist/BuiltinModule.js +194 -0
  4. package/dist/BuiltinModule.js.map +1 -0
  5. package/dist/dto/base.d.ts +6 -0
  6. package/dist/dto/base.js +28 -0
  7. package/dist/dto/base.js.map +1 -0
  8. package/dist/dto/discordEvents.d.ts +31 -0
  9. package/dist/dto/discordEvents.js +92 -0
  10. package/dist/dto/discordEvents.js.map +1 -0
  11. package/dist/dto/gameEvents.d.ts +84 -0
  12. package/dist/dto/gameEvents.js +190 -0
  13. package/dist/dto/gameEvents.js.map +1 -0
  14. package/dist/dto/index.d.ts +37 -0
  15. package/dist/dto/index.js +18 -0
  16. package/dist/dto/index.js.map +1 -0
  17. package/dist/dto/takaroEvents.d.ts +150 -0
  18. package/dist/dto/takaroEvents.js +422 -0
  19. package/dist/dto/takaroEvents.js.map +1 -0
  20. package/dist/main.d.ts +4 -0
  21. package/dist/main.js +31 -0
  22. package/dist/main.js.map +1 -0
  23. package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +1 -0
  24. package/dist/modules/chatBridge/hooks/DiscordToGame.js +18 -0
  25. package/dist/modules/chatBridge/hooks/DiscordToGame.js.map +1 -0
  26. package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +1 -0
  27. package/dist/modules/chatBridge/hooks/GameToDiscord.js +14 -0
  28. package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -0
  29. package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +1 -0
  30. package/dist/modules/chatBridge/hooks/PlayerConnected.js +9 -0
  31. package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -0
  32. package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +1 -0
  33. package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +9 -0
  34. package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -0
  35. package/dist/modules/chatBridge/index.d.ts +4 -0
  36. package/dist/modules/chatBridge/index.js +54 -0
  37. package/dist/modules/chatBridge/index.js.map +1 -0
  38. package/dist/modules/economyUtils/commands/balance.d.ts +1 -0
  39. package/dist/modules/economyUtils/commands/balance.js +7 -0
  40. package/dist/modules/economyUtils/commands/balance.js.map +1 -0
  41. package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +1 -0
  42. package/dist/modules/economyUtils/commands/confirmTransfer.js +38 -0
  43. package/dist/modules/economyUtils/commands/confirmTransfer.js.map +1 -0
  44. package/dist/modules/economyUtils/commands/grantCurrency.d.ts +1 -0
  45. package/dist/modules/economyUtils/commands/grantCurrency.js +31 -0
  46. package/dist/modules/economyUtils/commands/grantCurrency.js.map +1 -0
  47. package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +1 -0
  48. package/dist/modules/economyUtils/commands/revokeCurrency.js +31 -0
  49. package/dist/modules/economyUtils/commands/revokeCurrency.js.map +1 -0
  50. package/dist/modules/economyUtils/commands/topCurrency.d.ts +1 -0
  51. package/dist/modules/economyUtils/commands/topCurrency.js +22 -0
  52. package/dist/modules/economyUtils/commands/topCurrency.js.map +1 -0
  53. package/dist/modules/economyUtils/commands/transfer.d.ts +1 -0
  54. package/dist/modules/economyUtils/commands/transfer.js +55 -0
  55. package/dist/modules/economyUtils/commands/transfer.js.map +1 -0
  56. package/dist/modules/economyUtils/index.d.ts +4 -0
  57. package/dist/modules/economyUtils/index.js +117 -0
  58. package/dist/modules/economyUtils/index.js.map +1 -0
  59. package/dist/modules/geoBlock/hooks/IPDetected.d.ts +1 -0
  60. package/dist/modules/geoBlock/hooks/IPDetected.js +50 -0
  61. package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -0
  62. package/dist/modules/geoBlock/index.d.ts +8 -0
  63. package/dist/modules/geoBlock/index.js +321 -0
  64. package/dist/modules/geoBlock/index.js.map +1 -0
  65. package/dist/modules/gimme/commands/gimme.d.ts +1 -0
  66. package/dist/modules/gimme/commands/gimme.js +23 -0
  67. package/dist/modules/gimme/commands/gimme.js.map +1 -0
  68. package/dist/modules/gimme/index.d.ts +4 -0
  69. package/dist/modules/gimme/index.js +43 -0
  70. package/dist/modules/gimme/index.js.map +1 -0
  71. package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +1 -0
  72. package/dist/modules/highPingKicker/cronJobs/Ping check.js +54 -0
  73. package/dist/modules/highPingKicker/cronJobs/Ping check.js.map +1 -0
  74. package/dist/modules/highPingKicker/index.d.ts +4 -0
  75. package/dist/modules/highPingKicker/index.js +34 -0
  76. package/dist/modules/highPingKicker/index.js.map +1 -0
  77. package/dist/modules/lottery/commands/buyTicket.d.ts +1 -0
  78. package/dist/modules/lottery/commands/buyTicket.js +54 -0
  79. package/dist/modules/lottery/commands/buyTicket.js.map +1 -0
  80. package/dist/modules/lottery/commands/nextDraw.d.ts +1 -0
  81. package/dist/modules/lottery/commands/nextDraw.js +34 -0
  82. package/dist/modules/lottery/commands/nextDraw.js.map +1 -0
  83. package/dist/modules/lottery/commands/viewTickets.d.ts +1 -0
  84. package/dist/modules/lottery/commands/viewTickets.js +23 -0
  85. package/dist/modules/lottery/commands/viewTickets.js.map +1 -0
  86. package/dist/modules/lottery/cronJobs/drawLottery.d.ts +1 -0
  87. package/dist/modules/lottery/cronJobs/drawLottery.js +96 -0
  88. package/dist/modules/lottery/cronJobs/drawLottery.js.map +1 -0
  89. package/dist/modules/lottery/index.d.ts +4 -0
  90. package/dist/modules/lottery/index.js +73 -0
  91. package/dist/modules/lottery/index.js.map +1 -0
  92. package/dist/modules/playerOnboarding/commands/starterkit.d.ts +1 -0
  93. package/dist/modules/playerOnboarding/commands/starterkit.js +34 -0
  94. package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -0
  95. package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +1 -0
  96. package/dist/modules/playerOnboarding/hooks/playerConnected.js +11 -0
  97. package/dist/modules/playerOnboarding/hooks/playerConnected.js.map +1 -0
  98. package/dist/modules/playerOnboarding/index.d.ts +4 -0
  99. package/dist/modules/playerOnboarding/index.js +51 -0
  100. package/dist/modules/playerOnboarding/index.js.map +1 -0
  101. package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +1 -0
  102. package/dist/modules/serverMessages/cronJobs/Automated message.js +9 -0
  103. package/dist/modules/serverMessages/cronJobs/Automated message.js.map +1 -0
  104. package/dist/modules/serverMessages/index.d.ts +4 -0
  105. package/dist/modules/serverMessages/index.js +35 -0
  106. package/dist/modules/serverMessages/index.js.map +1 -0
  107. package/dist/modules/teleports/commands/deletetp.d.ts +1 -0
  108. package/dist/modules/teleports/commands/deletetp.js +20 -0
  109. package/dist/modules/teleports/commands/deletetp.js.map +1 -0
  110. package/dist/modules/teleports/commands/deletewaypoint.d.ts +1 -0
  111. package/dist/modules/teleports/commands/deletewaypoint.js +54 -0
  112. package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -0
  113. package/dist/modules/teleports/commands/listwaypoints.d.ts +1 -0
  114. package/dist/modules/teleports/commands/listwaypoints.js +36 -0
  115. package/dist/modules/teleports/commands/listwaypoints.js.map +1 -0
  116. package/dist/modules/teleports/commands/setprivate.d.ts +1 -0
  117. package/dist/modules/teleports/commands/setprivate.js +31 -0
  118. package/dist/modules/teleports/commands/setprivate.js.map +1 -0
  119. package/dist/modules/teleports/commands/setpublic.d.ts +1 -0
  120. package/dist/modules/teleports/commands/setpublic.js +55 -0
  121. package/dist/modules/teleports/commands/setpublic.js.map +1 -0
  122. package/dist/modules/teleports/commands/settp.d.ts +1 -0
  123. package/dist/modules/teleports/commands/settp.js +42 -0
  124. package/dist/modules/teleports/commands/settp.js.map +1 -0
  125. package/dist/modules/teleports/commands/setwaypoint.d.ts +1 -0
  126. package/dist/modules/teleports/commands/setwaypoint.js +88 -0
  127. package/dist/modules/teleports/commands/setwaypoint.js.map +1 -0
  128. package/dist/modules/teleports/commands/teleport.d.ts +1 -0
  129. package/dist/modules/teleports/commands/teleport.js +74 -0
  130. package/dist/modules/teleports/commands/teleport.js.map +1 -0
  131. package/dist/modules/teleports/commands/teleportwaypoint.d.ts +1 -0
  132. package/dist/modules/teleports/commands/teleportwaypoint.js +50 -0
  133. package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -0
  134. package/dist/modules/teleports/commands/tplist.d.ts +1 -0
  135. package/dist/modules/teleports/commands/tplist.js +45 -0
  136. package/dist/modules/teleports/commands/tplist.js.map +1 -0
  137. package/dist/modules/teleports/functions/utils.d.ts +2 -0
  138. package/dist/modules/teleports/functions/utils.js +18 -0
  139. package/dist/modules/teleports/functions/utils.js.map +1 -0
  140. package/dist/modules/teleports/index.d.ts +4 -0
  141. package/dist/modules/teleports/index.js +184 -0
  142. package/dist/modules/teleports/index.js.map +1 -0
  143. package/dist/modules/utils/commands/help.d.ts +1 -0
  144. package/dist/modules/utils/commands/help.js +29 -0
  145. package/dist/modules/utils/commands/help.js.map +1 -0
  146. package/dist/modules/utils/commands/ping.d.ts +1 -0
  147. package/dist/modules/utils/commands/ping.js +6 -0
  148. package/dist/modules/utils/commands/ping.js.map +1 -0
  149. package/dist/modules/utils/index.d.ts +4 -0
  150. package/dist/modules/utils/index.js +35 -0
  151. package/dist/modules/utils/index.js.map +1 -0
  152. package/dist/modules.json +478 -0
  153. package/package.json +26 -0
  154. package/scripts/buildBuiltinJson.ts +14 -0
  155. package/src/BuiltinModule.ts +125 -0
  156. package/src/__tests__/aliases.integration.test.ts +54 -0
  157. package/src/__tests__/builtinmodule.unit.test.ts +13 -0
  158. package/src/__tests__/commandArgs.integration.test.ts +285 -0
  159. package/src/__tests__/economyUtils.integration.test.ts +488 -0
  160. package/src/__tests__/geoblock.integration.test.ts +380 -0
  161. package/src/__tests__/gimme.integration.test.ts +97 -0
  162. package/src/__tests__/help.integration.test.ts +133 -0
  163. package/src/__tests__/lottery.integration.test.ts +332 -0
  164. package/src/__tests__/modulePermission.integration.test.ts +192 -0
  165. package/src/__tests__/onboarding.integration.test.ts +123 -0
  166. package/src/__tests__/ping.integration.test.ts +36 -0
  167. package/src/__tests__/roleExpiry.integration.test.ts +74 -0
  168. package/src/__tests__/serverMessages.integration.test.ts +104 -0
  169. package/src/__tests__/systemConfigCost.integration.test.ts +196 -0
  170. package/src/__tests__/teleports/listtp.integration.test.ts +115 -0
  171. package/src/__tests__/teleports/publicteleports.integration.test.ts +350 -0
  172. package/src/__tests__/teleports/teleport.integration.test.ts +109 -0
  173. package/src/__tests__/teleports/tpManagement.integration.test.ts +175 -0
  174. package/src/__tests__/teleports/waypoints.integration.test.ts +613 -0
  175. package/src/dto/base.ts +13 -0
  176. package/src/dto/discordEvents.ts +69 -0
  177. package/src/dto/gameEvents.ts +154 -0
  178. package/src/dto/index.ts +25 -0
  179. package/src/dto/takaroEvents.ts +290 -0
  180. package/src/main.ts +36 -0
  181. package/src/modules/.eslintrc +5 -0
  182. package/src/modules/chatBridge/hooks/DiscordToGame.js +18 -0
  183. package/src/modules/chatBridge/hooks/GameToDiscord.js +18 -0
  184. package/src/modules/chatBridge/hooks/PlayerConnected.js +11 -0
  185. package/src/modules/chatBridge/hooks/PlayerDisconnected.js +11 -0
  186. package/src/modules/chatBridge/index.ts +59 -0
  187. package/src/modules/economyUtils/commands/balance.js +8 -0
  188. package/src/modules/economyUtils/commands/confirmTransfer.js +55 -0
  189. package/src/modules/economyUtils/commands/grantCurrency.js +38 -0
  190. package/src/modules/economyUtils/commands/revokeCurrency.js +38 -0
  191. package/src/modules/economyUtils/commands/topCurrency.js +29 -0
  192. package/src/modules/economyUtils/commands/transfer.js +73 -0
  193. package/src/modules/economyUtils/index.ts +125 -0
  194. package/src/modules/geoBlock/hooks/IPDetected.js +52 -0
  195. package/src/modules/geoBlock/index.ts +331 -0
  196. package/src/modules/gimme/commands/gimme.js +28 -0
  197. package/src/modules/gimme/index.ts +49 -0
  198. package/src/modules/highPingKicker/cronJobs/Ping check.js +66 -0
  199. package/src/modules/highPingKicker/index.ts +39 -0
  200. package/src/modules/lottery/commands/buyTicket.js +68 -0
  201. package/src/modules/lottery/commands/nextDraw.js +45 -0
  202. package/src/modules/lottery/commands/viewTickets.js +32 -0
  203. package/src/modules/lottery/cronJobs/drawLottery.js +124 -0
  204. package/src/modules/lottery/index.ts +80 -0
  205. package/src/modules/playerOnboarding/commands/starterkit.js +47 -0
  206. package/src/modules/playerOnboarding/hooks/playerConnected.js +14 -0
  207. package/src/modules/playerOnboarding/index.ts +58 -0
  208. package/src/modules/serverMessages/cronJobs/Automated message.js +12 -0
  209. package/src/modules/serverMessages/index.ts +40 -0
  210. package/src/modules/teleports/commands/deletetp.js +25 -0
  211. package/src/modules/teleports/commands/deletewaypoint.js +77 -0
  212. package/src/modules/teleports/commands/listwaypoints.js +55 -0
  213. package/src/modules/teleports/commands/setprivate.js +39 -0
  214. package/src/modules/teleports/commands/setpublic.js +71 -0
  215. package/src/modules/teleports/commands/settp.js +54 -0
  216. package/src/modules/teleports/commands/setwaypoint.js +112 -0
  217. package/src/modules/teleports/commands/teleport.js +93 -0
  218. package/src/modules/teleports/commands/teleportwaypoint.js +72 -0
  219. package/src/modules/teleports/commands/tplist.js +61 -0
  220. package/src/modules/teleports/functions/utils.js +20 -0
  221. package/src/modules/teleports/index.ts +193 -0
  222. package/src/modules/utils/commands/help.js +38 -0
  223. package/src/modules/utils/commands/ping.js +7 -0
  224. package/src/modules/utils/index.ts +40 -0
  225. package/tsconfig.build.json +10 -0
  226. package/tsconfig.json +9 -0
  227. package/typedoc.json +3 -0
@@ -0,0 +1,184 @@
1
+ import { BuiltinModule, ICommand, IFunction, IPermission } from '../../BuiltinModule.js';
2
+ import { Duration } from 'luxon';
3
+ export class Teleports extends BuiltinModule {
4
+ constructor() {
5
+ super('teleports', 'A set of commands to allow players to set their own teleport points and teleport to them.', JSON.stringify({
6
+ $schema: 'http://json-schema.org/draft-07/schema#',
7
+ type: 'object',
8
+ properties: {
9
+ timeout: {
10
+ title: 'Timeout',
11
+ description: 'The time one has to wait before teleporting again.',
12
+ 'x-component': 'duration',
13
+ type: 'number',
14
+ minimum: 0,
15
+ default: Duration.fromObject({ second: 1 }).as('milliseconds'),
16
+ },
17
+ allowPublicTeleports: {
18
+ type: 'boolean',
19
+ description: 'Players can create public teleports.',
20
+ default: false,
21
+ },
22
+ },
23
+ required: [],
24
+ additionalProperties: false,
25
+ }), JSON.stringify({
26
+ timeout: { 'ui:widget': 'duration' },
27
+ }));
28
+ this.functions = [
29
+ new IFunction({
30
+ name: 'utils',
31
+ function: this.loadFn('functions', 'utils'),
32
+ }),
33
+ ];
34
+ this.permissions = [
35
+ new IPermission({
36
+ permission: 'TELEPORTS_CREATE_PUBLIC',
37
+ friendlyName: 'Create Public Teleports',
38
+ description: 'Allows the player to create public teleports.',
39
+ canHaveCount: true,
40
+ }),
41
+ new IPermission({
42
+ permission: 'TELEPORTS_USE',
43
+ friendlyName: 'Use Teleports',
44
+ description: 'Allows the player to use teleports modules.',
45
+ canHaveCount: true,
46
+ }),
47
+ new IPermission({
48
+ permission: 'TELEPORTS_MANAGE_WAYPOINTS',
49
+ friendlyName: 'Manage waypoints',
50
+ description: 'Allows creating, deleting, and managing waypoints.',
51
+ canHaveCount: false,
52
+ }),
53
+ ];
54
+ this.commands = [
55
+ new ICommand({
56
+ function: this.loadFn('commands', 'teleport'),
57
+ name: 'teleport',
58
+ trigger: 'tp',
59
+ helpText: 'Teleports to one of your set locations.',
60
+ arguments: [
61
+ {
62
+ name: 'tp',
63
+ type: 'string',
64
+ defaultValue: null,
65
+ helpText: 'The location to teleport to.',
66
+ position: 0,
67
+ },
68
+ ],
69
+ }),
70
+ new ICommand({
71
+ function: this.loadFn('commands', 'tplist'),
72
+ name: 'tplist',
73
+ trigger: 'tplist',
74
+ helpText: 'Lists all your set locations.',
75
+ arguments: [],
76
+ }),
77
+ new ICommand({
78
+ function: this.loadFn('commands', 'settp'),
79
+ name: 'settp',
80
+ trigger: 'settp',
81
+ helpText: 'Sets a location to teleport to.',
82
+ arguments: [
83
+ {
84
+ name: 'tp',
85
+ type: 'string',
86
+ defaultValue: null,
87
+ helpText: 'The location name.',
88
+ position: 0,
89
+ },
90
+ ],
91
+ }),
92
+ new ICommand({
93
+ function: this.loadFn('commands', 'deletetp'),
94
+ name: 'deletetp',
95
+ trigger: 'deletetp',
96
+ helpText: 'Deletes a location.',
97
+ arguments: [
98
+ {
99
+ name: 'tp',
100
+ type: 'string',
101
+ defaultValue: null,
102
+ helpText: 'The location name.',
103
+ position: 0,
104
+ },
105
+ ],
106
+ }),
107
+ new ICommand({
108
+ function: this.loadFn('commands', 'setpublic'),
109
+ name: 'setpublic',
110
+ trigger: 'setpublic',
111
+ helpText: 'Sets a teleport to be public, allowing other players to teleport to it.',
112
+ arguments: [
113
+ {
114
+ name: 'tp',
115
+ type: 'string',
116
+ defaultValue: null,
117
+ helpText: 'The location name.',
118
+ position: 0,
119
+ },
120
+ ],
121
+ }),
122
+ new ICommand({
123
+ function: this.loadFn('commands', 'setprivate'),
124
+ name: 'setprivate',
125
+ trigger: 'setprivate',
126
+ helpText: 'Sets a teleport to be private, only the teleport owner can teleport to it.',
127
+ arguments: [
128
+ {
129
+ name: 'tp',
130
+ type: 'string',
131
+ defaultValue: null,
132
+ helpText: 'The location name.',
133
+ position: 0,
134
+ },
135
+ ],
136
+ }),
137
+ new ICommand({
138
+ function: this.loadFn('commands', 'setwaypoint'),
139
+ name: 'setwaypoint',
140
+ trigger: 'setwaypoint',
141
+ helpText: 'Creates a new waypoint.',
142
+ arguments: [
143
+ {
144
+ name: 'waypoint',
145
+ type: 'string',
146
+ defaultValue: null,
147
+ helpText: 'The location name.',
148
+ position: 0,
149
+ },
150
+ ],
151
+ }),
152
+ new ICommand({
153
+ function: this.loadFn('commands', 'deletewaypoint'),
154
+ name: 'deletewaypoint',
155
+ trigger: 'deletewaypoint',
156
+ helpText: 'Deletes a waypoint.',
157
+ arguments: [
158
+ {
159
+ name: 'waypoint',
160
+ type: 'string',
161
+ defaultValue: null,
162
+ helpText: 'The location name.',
163
+ position: 0,
164
+ },
165
+ ],
166
+ }),
167
+ new ICommand({
168
+ function: this.loadFn('commands', 'listwaypoints'),
169
+ name: 'listwaypoints',
170
+ trigger: 'waypoints',
171
+ helpText: 'Lists all waypoints.',
172
+ arguments: [],
173
+ }),
174
+ new ICommand({
175
+ function: this.loadFn('commands', 'teleportwaypoint'),
176
+ name: 'teleportwaypoint',
177
+ trigger: 'teleportwaypoint',
178
+ arguments: [],
179
+ helpText: 'Placeholder command, this will not be used directly. The module will install aliases for this command corresponding to the waypoint names.',
180
+ }),
181
+ ];
182
+ }
183
+ }
184
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/teleports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,OAAO,SAAU,SAAQ,aAAwB;IACrD;QACE,KAAK,CACH,WAAW,EACX,2FAA2F,EAC3F,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,yCAAyC;YAClD,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,oDAAoD;oBACjE,aAAa,EAAE,UAAU;oBACzB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,CAAC;oBACV,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC;iBAC/D;gBACD,oBAAoB,EAAE;oBACpB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,sCAAsC;oBACnD,OAAO,EAAE,KAAK;iBACf;aACF;YACD,QAAQ,EAAE,EAAE;YACZ,oBAAoB,EAAE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gBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,kBAAkB,CAAC;gBACrD,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,kBAAkB;gBAC3B,SAAS,EAAE,EAAE;gBACb,QAAQ,EACN,4IAA4I;aAC/I,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
+ async function main() {
3
+ const enabledModules = await takaro.gameserver.gameServerControllerGetInstalledModules(data.gameServerId);
4
+ const moduleCommands = await Promise.all(enabledModules.data.data.map(async (mod) => {
5
+ return (await takaro.module.moduleControllerGetOne(mod.moduleId)).data.data.commands;
6
+ }));
7
+ if (data.arguments.command === 'all') {
8
+ await data.player.pm('Available commands:');
9
+ for (const mod of moduleCommands) {
10
+ await Promise.all(mod.map(async (command) => {
11
+ await data.player.pm(`${command.name}: ${command.helpText}`);
12
+ }));
13
+ }
14
+ }
15
+ else {
16
+ const allCommandsFlat = moduleCommands.flat();
17
+ const requestedCommand = allCommandsFlat.find((c) => {
18
+ return c.name === data.arguments.command;
19
+ });
20
+ if (!requestedCommand) {
21
+ throw new TakaroUserError(`Unknown command "${data.arguments.command}", use this command without arguments to see all available commands.`);
22
+ }
23
+ else {
24
+ await data.player.pm(`${requestedCommand.name}: ${requestedCommand.helpText}`);
25
+ }
26
+ }
27
+ }
28
+ await main();
29
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../../../src/modules/utils/commands/help.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,uCAAuC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAE1G,M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AAC,CAAC;QACjF,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import { data } from '@takaro/helpers';
2
+ async function main() {
3
+ await data.player.pm('Pong!');
4
+ }
5
+ await main();
6
+ //# sourceMappingURL=ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.js","sourceRoot":"","sources":["../../../../src/modules/utils/commands/ping.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { BuiltinModule } from '../../BuiltinModule.js';
2
+ export declare class Utils extends BuiltinModule<Utils> {
3
+ constructor();
4
+ }
@@ -0,0 +1,35 @@
1
+ import { BuiltinModule, ICommand } from '../../BuiltinModule.js';
2
+ export class Utils extends BuiltinModule {
3
+ constructor() {
4
+ super('utils', 'A collection of useful commands', JSON.stringify({
5
+ $schema: 'http://json-schema.org/draft-07/schema#',
6
+ type: 'object',
7
+ additionalProperties: false,
8
+ }));
9
+ this.commands = [
10
+ new ICommand({
11
+ function: this.loadFn('commands', 'ping'),
12
+ name: 'ping',
13
+ trigger: 'ping',
14
+ helpText: 'Replies with pong, useful for testing if the connection works.',
15
+ arguments: [],
16
+ }),
17
+ new ICommand({
18
+ function: this.loadFn('commands', 'help'),
19
+ name: 'help',
20
+ trigger: 'help',
21
+ helpText: 'The text you are reading right now, displays information about commands.',
22
+ arguments: [
23
+ {
24
+ name: 'command',
25
+ type: 'string',
26
+ defaultValue: 'all',
27
+ helpText: 'The command to get help for',
28
+ position: 0,
29
+ },
30
+ ],
31
+ }),
32
+ ];
33
+ }
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,OAAO,KAAM,SAAQ,aAAoB;IAC7C;QACE,KAAK,CACH,OAAO,EACP,iCAAiC,EACjC,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,yCAAyC;YAClD,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;SAC5B,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,QAAQ,CAAC;gBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;gBACzC,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,MAAM;gBACf,QAAQ,EAAE,gEAAgE;gBAC1E,SAAS,EAAE,EAAE;aACd,CAAC;YACF,IAAI,QAAQ,CAAC;gBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC;gBACzC,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,MAAM;gBACf,QAAQ,EAAE,0EAA0E;gBACpF,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,QAAQ;wBACd,YAAY,EAAE,KAAK;wBACnB,QAAQ,EAAE,6BAA6B;wBACvC,QAAQ,EAAE,CAAC;qBACZ;iBACF;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}