@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
@@ -7,6 +7,7 @@ import {
7
7
  EventsAwaiter,
8
8
  } from '@takaro/test';
9
9
  import { GameEvents } from '../../dto/index.js';
10
+ import { describe } from 'node:test';
10
11
 
11
12
  const group = 'EconomyUtils';
12
13
 
@@ -35,10 +36,10 @@ const tests = [
35
36
  setup: customSetup,
36
37
  name: 'Can get balance',
37
38
  test: async function () {
38
- await this.client.gameserver.gameServerControllerInstallModule(
39
- this.setupData.gameserver.id,
40
- this.setupData.economyUtilsModule.id,
41
- );
39
+ await this.client.module.moduleInstallationsControllerInstallModule({
40
+ gameServerId: this.setupData.gameserver.id,
41
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
42
+ });
42
43
 
43
44
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 2);
44
45
 
@@ -79,10 +80,10 @@ const tests = [
79
80
  name: 'Can show list of top (max 10) players with highest balance',
80
81
  test: async function () {
81
82
  // install module
82
- await this.client.gameserver.gameServerControllerInstallModule(
83
- this.setupData.gameserver.id,
84
- this.setupData.economyUtilsModule.id,
85
- );
83
+ await this.client.module.moduleInstallationsControllerInstallModule({
84
+ gameServerId: this.setupData.gameserver.id,
85
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
86
+ });
86
87
 
87
88
  const giveCurrencies = this.setupData.players.map(async (player, index) => {
88
89
  const playerOnGameServer = (
@@ -124,10 +125,10 @@ const tests = [
124
125
  setup: customSetup,
125
126
  name: 'Can transfer money to another player',
126
127
  test: async function () {
127
- await this.client.gameserver.gameServerControllerInstallModule(
128
- this.setupData.gameserver.id,
129
- this.setupData.economyUtilsModule.id,
130
- );
128
+ await this.client.module.moduleInstallationsControllerInstallModule({
129
+ gameServerId: this.setupData.gameserver.id,
130
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
131
+ });
131
132
 
132
133
  const transferAmount = 500;
133
134
 
@@ -182,10 +183,10 @@ const tests = [
182
183
  setup: customSetup,
183
184
  name: 'Should return friendly user error when not enough currency',
184
185
  test: async function () {
185
- await this.client.gameserver.gameServerControllerInstallModule(
186
- this.setupData.gameserver.id,
187
- this.setupData.economyUtilsModule.id,
188
- );
186
+ await this.client.module.moduleInstallationsControllerInstallModule({
187
+ gameServerId: this.setupData.gameserver.id,
188
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
189
+ });
189
190
 
190
191
  const sender = this.setupData.players[0];
191
192
  const receiver = this.setupData.players[1];
@@ -211,15 +212,13 @@ const tests = [
211
212
  setup: customSetup,
212
213
  name: 'Should require confirmation when transfer amount is above pendingAmount',
213
214
  test: async function () {
214
- await this.client.gameserver.gameServerControllerInstallModule(
215
- this.setupData.gameserver.id,
216
- this.setupData.economyUtilsModule.id,
217
- {
218
- userConfig: JSON.stringify({
219
- pendingAmount: 100,
220
- }),
221
- },
222
- );
215
+ await this.client.module.moduleInstallationsControllerInstallModule({
216
+ gameServerId: this.setupData.gameserver.id,
217
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
218
+ userConfig: JSON.stringify({
219
+ pendingAmount: 100,
220
+ }),
221
+ });
223
222
 
224
223
  const transferAmount = 500;
225
224
  const prefix = (
@@ -313,15 +312,13 @@ const tests = [
313
312
  setup: customSetup,
314
313
  name: 'Should return no pending transfers when there are none',
315
314
  test: async function () {
316
- await this.client.gameserver.gameServerControllerInstallModule(
317
- this.setupData.gameserver.id,
318
- this.setupData.economyUtilsModule.id,
319
- {
320
- userConfig: JSON.stringify({
321
- pendingAmount: 100,
322
- }),
323
- },
324
- );
315
+ await this.client.module.moduleInstallationsControllerInstallModule({
316
+ gameServerId: this.setupData.gameserver.id,
317
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
318
+ userConfig: JSON.stringify({
319
+ pendingAmount: 100,
320
+ }),
321
+ });
325
322
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
326
323
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
327
324
  msg: '/confirmtransfer',
@@ -342,10 +339,10 @@ const tests = [
342
339
  const receiver = this.setupData.players[1];
343
340
  const grantAmount = 500;
344
341
 
345
- await this.client.gameserver.gameServerControllerInstallModule(
346
- this.setupData.gameserver.id,
347
- this.setupData.economyUtilsModule.id,
348
- );
342
+ await this.client.module.moduleInstallationsControllerInstallModule({
343
+ gameServerId: this.setupData.gameserver.id,
344
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
345
+ });
349
346
 
350
347
  // Change permissions of role to only have manageCurrency permission
351
348
  const manageCurrencyPermission = await this.client.permissionCodesToInputs(['ECONOMY_UTILS_MANAGE_CURRENCY']);
@@ -405,10 +402,10 @@ const tests = [
405
402
  },
406
403
  );
407
404
 
408
- await this.client.gameserver.gameServerControllerInstallModule(
409
- this.setupData.gameserver.id,
410
- this.setupData.economyUtilsModule.id,
411
- );
405
+ await this.client.module.moduleInstallationsControllerInstallModule({
406
+ gameServerId: this.setupData.gameserver.id,
407
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
408
+ });
412
409
 
413
410
  // Change permissions of role to only have manageCurrency permission
414
411
  const manageCurrencyPermission = await this.client.permissionCodesToInputs(['ECONOMY_UTILS_MANAGE_CURRENCY']);
@@ -459,10 +456,10 @@ const tests = [
459
456
  permissions: [],
460
457
  });
461
458
 
462
- await this.client.gameserver.gameServerControllerInstallModule(
463
- this.setupData.gameserver.id,
464
- this.setupData.economyUtilsModule.id,
465
- );
459
+ await this.client.module.moduleInstallationsControllerInstallModule({
460
+ gameServerId: this.setupData.gameserver.id,
461
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
462
+ });
466
463
 
467
464
  // currency before revoke
468
465
  expect(
@@ -1,5 +1,6 @@
1
1
  import { EventsAwaiter, expect, IntegrationTest, IShopSetup, shopSetup } from '@takaro/test';
2
2
  import { HookEvents } from '../../dto/index.js';
3
+ import { describe } from 'node:test';
3
4
 
4
5
  const group = 'EconomyUtils:Shop:Browse';
5
6
 
@@ -49,10 +50,10 @@ const tests = [
49
50
  setup: shopSetup,
50
51
  name: 'Can view the second page of shop items',
51
52
  test: async function () {
52
- await this.client.gameserver.gameServerControllerInstallModule(
53
- this.setupData.gameserver.id,
54
- this.setupData.utilsModule.id,
55
- );
53
+ await this.client.module.moduleInstallationsControllerInstallModule({
54
+ gameServerId: this.setupData.gameserver.id,
55
+ versionId: this.setupData.utilsModule.latestVersion.id,
56
+ });
56
57
  await this.setupData.createListings(this.client, { gameServerId: this.setupData.gameserver.id, amount: 5 });
57
58
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CHAT_MESSAGE, 3);
58
59
  const commandExecutedEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(
@@ -139,6 +140,29 @@ const tests = [
139
140
  playerId: this.setupData.players[0].id,
140
141
  });
141
142
 
143
+ expect(await events).to.have.length(2);
144
+ expect((await events)[0].data.meta.msg).to.equal('You have purchased Test item for 100 test coin.');
145
+ expect((await events)[1].data.meta.msg).to.equal('You have received items from a shop order.');
146
+ },
147
+ }),
148
+ new IntegrationTest<IShopSetup>({
149
+ group,
150
+ snapshot: false,
151
+ setup: shopSetup,
152
+ name: 'Can buy an item when not linked to a user',
153
+ test: async function () {
154
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CHAT_MESSAGE, 2);
155
+ const unlinkedPlayer = this.setupData.players[1];
156
+ await this.client.playerOnGameserver.playerOnGameServerControllerAddCurrency(
157
+ this.setupData.gameserver.id,
158
+ unlinkedPlayer.id,
159
+ { currency: 250 },
160
+ );
161
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
162
+ msg: '/shop 1 1 buy',
163
+ playerId: unlinkedPlayer.id,
164
+ });
165
+
142
166
  expect(await events).to.have.length(2);
143
167
  expect((await events)[0].data.meta.msg).to.equal('You have purchased Test item for 100 test coin.');
144
168
  expect((await events)[1].data.meta.msg).to.equal('You have received items from a shop order.');
@@ -1,6 +1,7 @@
1
1
  import { EventsAwaiter, expect, IntegrationTest, IShopSetup, shopSetup } from '@takaro/test';
2
2
  import { HookEvents } from '../../dto/index.js';
3
3
  import { Client, PlayerOutputDTO } from '@takaro/apiclient';
4
+ import { describe } from 'node:test';
4
5
 
5
6
  const group = 'EconomyUtils:ZombieKillReward';
6
7
 
@@ -38,12 +39,12 @@ const tests = [
38
39
  ).data.data;
39
40
 
40
41
  (
41
- await this.client.gameserver.gameServerControllerInstallModule(
42
- this.setupData.gameserver.id,
43
- this.setupData.economyUtilsModule.id,
44
- )
42
+ await this.client.module.moduleInstallationsControllerInstallModule({
43
+ gameServerId: this.setupData.gameserver.id,
44
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
45
+ })
45
46
  ).data.data;
46
- const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
47
+ const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
47
48
  (cronjob) => cronjob.name === 'zombieKillReward',
48
49
  );
49
50
  if (!zombieKillCronjob) throw new Error('Cronjob not found');
@@ -86,12 +87,12 @@ const tests = [
86
87
  ).data.data;
87
88
 
88
89
  (
89
- await this.client.gameserver.gameServerControllerInstallModule(
90
- this.setupData.gameserver.id,
91
- this.setupData.economyUtilsModule.id,
92
- )
90
+ await this.client.module.moduleInstallationsControllerInstallModule({
91
+ gameServerId: this.setupData.gameserver.id,
92
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
93
+ })
93
94
  ).data.data;
94
- const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
95
+ const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
95
96
  (cronjob) => cronjob.name === 'zombieKillReward',
96
97
  );
97
98
  if (!zombieKillCronjob) throw new Error('Cronjob not found');
@@ -152,12 +153,12 @@ const tests = [
152
153
  ).data.data;
153
154
 
154
155
  (
155
- await this.client.gameserver.gameServerControllerInstallModule(
156
- this.setupData.gameserver.id,
157
- this.setupData.economyUtilsModule.id,
158
- )
156
+ await this.client.module.moduleInstallationsControllerInstallModule({
157
+ gameServerId: this.setupData.gameserver.id,
158
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
159
+ })
159
160
  ).data.data;
160
- const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
161
+ const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
161
162
  (cronjob) => cronjob.name === 'zombieKillReward',
162
163
  );
163
164
  if (!zombieKillCronjob) throw new Error('Cronjob not found');
@@ -201,15 +202,13 @@ const tests = [
201
202
  )
202
203
  ).data.data;
203
204
  (
204
- await this.client.gameserver.gameServerControllerInstallModule(
205
- this.setupData.gameserver.id,
206
- this.setupData.economyUtilsModule.id,
207
- {
208
- userConfig: JSON.stringify({ zombieKillReward: 5 }),
209
- },
210
- )
205
+ await this.client.module.moduleInstallationsControllerInstallModule({
206
+ gameServerId: this.setupData.gameserver.id,
207
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
208
+ userConfig: JSON.stringify({ zombieKillReward: 5 }),
209
+ })
211
210
  ).data.data;
212
- const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
211
+ const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
213
212
  (cronjob) => cronjob.name === 'zombieKillReward',
214
213
  );
215
214
  if (!zombieKillCronjob) throw new Error('Cronjob not found');
@@ -255,16 +254,14 @@ const tests = [
255
254
  )
256
255
  ).data.data;
257
256
  (
258
- await this.client.gameserver.gameServerControllerInstallModule(
259
- this.setupData.gameserver.id,
260
- this.setupData.economyUtilsModule.id,
261
- {
262
- userConfig: JSON.stringify({ zombieKillReward: 5 }),
263
- },
264
- )
257
+ await this.client.module.moduleInstallationsControllerInstallModule({
258
+ gameServerId: this.setupData.gameserver.id,
259
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
260
+ userConfig: JSON.stringify({ zombieKillReward: 5 }),
261
+ })
265
262
  ).data.data;
266
263
 
267
- const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
264
+ const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
268
265
  (cronjob) => cronjob.name === 'zombieKillReward',
269
266
  );
270
267
  if (!zombieKillCronjob) throw new Error('Cronjob not found');
@@ -2,6 +2,7 @@ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, Event
2
2
  import { HookEvents } from '../dto/index.js';
3
3
  import { TakaroEventPlayerNewIpDetected } from '@takaro/modules';
4
4
  import { faker } from '@faker-js/faker';
5
+ import { describe } from 'node:test';
5
6
 
6
7
  const group = 'Geo Block';
7
8
 
@@ -24,17 +25,15 @@ const tests = [
24
25
  setup: customSetup,
25
26
  name: 'DENY MODE: Blocked country detected -> player gets kicked based on configuration',
26
27
  test: async function () {
27
- await this.client.gameserver.gameServerControllerInstallModule(
28
- this.setupData.gameserver.id,
29
- this.setupData.geoBlockModule.id,
30
- {
31
- userConfig: JSON.stringify({
32
- mode: 'deny',
33
- countries: ['RU'],
34
- ban: false,
35
- }),
36
- },
37
- );
28
+ await this.client.module.moduleInstallationsControllerInstallModule({
29
+ gameServerId: this.setupData.gameserver.id,
30
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
31
+ userConfig: JSON.stringify({
32
+ mode: 'deny',
33
+ countries: ['RU'],
34
+ ban: false,
35
+ }),
36
+ });
38
37
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
39
38
  await this.client.hook.hookControllerTrigger({
40
39
  gameServerId: this.setupData.gameserver.id,
@@ -59,17 +58,15 @@ const tests = [
59
58
  setup: customSetup,
60
59
  name: 'DENY MODE: Non-blocked country detected -> no action taken',
61
60
  test: async function () {
62
- await this.client.gameserver.gameServerControllerInstallModule(
63
- this.setupData.gameserver.id,
64
- this.setupData.geoBlockModule.id,
65
- {
66
- userConfig: JSON.stringify({
67
- mode: 'deny',
68
- countries: ['RU'],
69
- ban: false,
70
- }),
71
- },
72
- );
61
+ await this.client.module.moduleInstallationsControllerInstallModule({
62
+ gameServerId: this.setupData.gameserver.id,
63
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
64
+ userConfig: JSON.stringify({
65
+ mode: 'deny',
66
+ countries: ['RU'],
67
+ ban: false,
68
+ }),
69
+ });
73
70
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
74
71
 
75
72
  await this.client.hook.hookControllerTrigger({
@@ -98,17 +95,15 @@ const tests = [
98
95
  setup: customSetup,
99
96
  name: 'ALLOW MODE: Allowed country detected -> no action taken',
100
97
  test: async function () {
101
- await this.client.gameserver.gameServerControllerInstallModule(
102
- this.setupData.gameserver.id,
103
- this.setupData.geoBlockModule.id,
104
- {
105
- userConfig: JSON.stringify({
106
- mode: 'allow',
107
- countries: ['RU'],
108
- ban: false,
109
- }),
110
- },
111
- );
98
+ await this.client.module.moduleInstallationsControllerInstallModule({
99
+ gameServerId: this.setupData.gameserver.id,
100
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
101
+ userConfig: JSON.stringify({
102
+ mode: 'allow',
103
+ countries: ['RU'],
104
+ ban: false,
105
+ }),
106
+ });
112
107
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
113
108
 
114
109
  await this.client.hook.hookControllerTrigger({
@@ -137,17 +132,15 @@ const tests = [
137
132
  setup: customSetup,
138
133
  name: 'ALLOW MODE: Non-Allowed country detected -> player gets kicked/banned based on configuration',
139
134
  test: async function () {
140
- await this.client.gameserver.gameServerControllerInstallModule(
141
- this.setupData.gameserver.id,
142
- this.setupData.geoBlockModule.id,
143
- {
144
- userConfig: JSON.stringify({
145
- mode: 'allow',
146
- countries: ['RU'],
147
- ban: false,
148
- }),
149
- },
150
- );
135
+ await this.client.module.moduleInstallationsControllerInstallModule({
136
+ gameServerId: this.setupData.gameserver.id,
137
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
138
+ userConfig: JSON.stringify({
139
+ mode: 'allow',
140
+ countries: ['RU'],
141
+ ban: false,
142
+ }),
143
+ });
151
144
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
152
145
 
153
146
  await this.client.hook.hookControllerTrigger({
@@ -173,17 +166,15 @@ const tests = [
173
166
  setup: customSetup,
174
167
  name: 'BAN CONFIGURATION: Ban enabled -> player gets banned instead of kicked',
175
168
  test: async function () {
176
- await this.client.gameserver.gameServerControllerInstallModule(
177
- this.setupData.gameserver.id,
178
- this.setupData.geoBlockModule.id,
179
- {
180
- userConfig: JSON.stringify({
181
- mode: 'allow',
182
- countries: ['RU'],
183
- ban: true,
184
- }),
185
- },
186
- );
169
+ await this.client.module.moduleInstallationsControllerInstallModule({
170
+ gameServerId: this.setupData.gameserver.id,
171
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
172
+ userConfig: JSON.stringify({
173
+ mode: 'allow',
174
+ countries: ['RU'],
175
+ ban: true,
176
+ }),
177
+ });
187
178
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
188
179
 
189
180
  await this.client.hook.hookControllerTrigger({
@@ -209,18 +200,16 @@ const tests = [
209
200
  setup: customSetup,
210
201
  name: 'MULTIPLE COUNTRIES: Handling multiple countries in the whitelist or blacklist',
211
202
  test: async function () {
212
- await this.client.gameserver.gameServerControllerInstallModule(
213
- this.setupData.gameserver.id,
214
- this.setupData.geoBlockModule.id,
215
- {
216
- userConfig: JSON.stringify({
217
- mode: 'deny',
218
- countries: ['RU', 'BE'],
219
- ban: true,
220
- message: 'Custom message',
221
- }),
222
- },
223
- );
203
+ await this.client.module.moduleInstallationsControllerInstallModule({
204
+ gameServerId: this.setupData.gameserver.id,
205
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
206
+ userConfig: JSON.stringify({
207
+ mode: 'deny',
208
+ countries: ['RU', 'BE'],
209
+ ban: true,
210
+ message: 'Custom message',
211
+ }),
212
+ });
224
213
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
225
214
 
226
215
  await this.client.hook.hookControllerTrigger({
@@ -246,18 +235,16 @@ const tests = [
246
235
  setup: customSetup,
247
236
  name: 'IMMUNITY PERMISSION: Player with GEOBLOCK_IMMUNITY permission is neither kicked nor banned',
248
237
  test: async function () {
249
- await this.client.gameserver.gameServerControllerInstallModule(
250
- this.setupData.gameserver.id,
251
- this.setupData.geoBlockModule.id,
252
- {
253
- userConfig: JSON.stringify({
254
- mode: 'deny',
255
- countries: ['RU'],
256
- ban: true,
257
- message: 'Custom message',
258
- }),
259
- },
260
- );
238
+ await this.client.module.moduleInstallationsControllerInstallModule({
239
+ gameServerId: this.setupData.gameserver.id,
240
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
241
+ userConfig: JSON.stringify({
242
+ mode: 'deny',
243
+ countries: ['RU'],
244
+ ban: true,
245
+ message: 'Custom message',
246
+ }),
247
+ });
261
248
  const permissions = await this.client.permissionCodesToInputs(['GEOBLOCK_IMMUNITY']);
262
249
  const roleRes = await this.client.role.roleControllerCreate({
263
250
  name: 'Immune to geoblock',
@@ -294,18 +281,16 @@ const tests = [
294
281
  setup: customSetup,
295
282
  name: 'NO COUNTRIES CONFIGURED: No action taken if countries array is empty',
296
283
  test: async function () {
297
- await this.client.gameserver.gameServerControllerInstallModule(
298
- this.setupData.gameserver.id,
299
- this.setupData.geoBlockModule.id,
300
- {
301
- userConfig: JSON.stringify({
302
- mode: 'deny',
303
- countries: [],
304
- ban: true,
305
- message: 'Custom message',
306
- }),
307
- },
308
- );
284
+ await this.client.module.moduleInstallationsControllerInstallModule({
285
+ gameServerId: this.setupData.gameserver.id,
286
+ versionId: this.setupData.geoBlockModule.latestVersion.id,
287
+ userConfig: JSON.stringify({
288
+ mode: 'deny',
289
+ countries: [],
290
+ ban: true,
291
+ message: 'Custom message',
292
+ }),
293
+ });
309
294
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
310
295
 
311
296
  await this.client.hook.hookControllerTrigger({
@@ -1,5 +1,7 @@
1
1
  import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
2
2
  import { GameEvents } from '../dto/index.js';
3
+ import { faker } from '@faker-js/faker';
4
+ import { describe } from 'node:test';
3
5
 
4
6
  const group = 'gimme suite';
5
7
 
@@ -10,16 +12,19 @@ const tests = [
10
12
  setup: modulesTestSetup,
11
13
  name: 'Can give an item to a player',
12
14
  test: async function () {
13
- await this.client.gameserver.gameServerControllerInstallModule(
14
- this.setupData.gameserver.id,
15
- this.setupData.gimmeModule.id,
16
- {
17
- userConfig: JSON.stringify({
18
- items: ['apple', 'banana', 'orange'],
19
- commands: [],
20
- }),
21
- },
22
- );
15
+ const items = (await this.client.item.itemControllerSearch()).data.data;
16
+ await this.client.module.moduleInstallationsControllerInstallModule({
17
+ gameServerId: this.setupData.gameserver.id,
18
+ versionId: this.setupData.gimmeModule.latestVersion.id,
19
+ userConfig: JSON.stringify({
20
+ items: items.map((item) => ({
21
+ item: item.id,
22
+ amount: faker.number.int({ min: 1, max: 5 }),
23
+ quality: faker.number.int({ min: 1, max: 6 }).toString(),
24
+ })),
25
+ commands: [],
26
+ }),
27
+ });
23
28
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
24
29
 
25
30
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
@@ -28,7 +33,7 @@ const tests = [
28
33
  });
29
34
 
30
35
  expect((await events).length).to.be.eq(1);
31
- expect((await events)[0].data.meta.msg).to.match(/You received (apple|banana|orange)/);
36
+ expect((await events)[0].data.meta.msg).to.match(/You received \dx \w/);
32
37
  },
33
38
  }),
34
39
  /* new IntegrationTest<IModuleTestsSetupData>({
@@ -37,7 +42,7 @@ const tests = [
37
42
  setup: modulesTestSetup,
38
43
  name: 'Can execute command',
39
44
  test: async function () {
40
- await this.client.gameserver.gameServerControllerInstallModule(
45
+ await this.client.module.moduleInstallationsControllerInstallModule(
41
46
  this.setupData.gameserver.id,
42
47
  this.setupData.gimmeModule.id,
43
48
  {
@@ -65,16 +70,14 @@ const tests = [
65
70
  setup: modulesTestSetup,
66
71
  name: 'When no items or commands configured, displays an error',
67
72
  test: async function () {
68
- await this.client.gameserver.gameServerControllerInstallModule(
69
- this.setupData.gameserver.id,
70
- this.setupData.gimmeModule.id,
71
- {
72
- userConfig: JSON.stringify({
73
- items: [],
74
- commands: [],
75
- }),
76
- },
77
- );
73
+ await this.client.module.moduleInstallationsControllerInstallModule({
74
+ gameServerId: this.setupData.gameserver.id,
75
+ versionId: this.setupData.gimmeModule.latestVersion.id,
76
+ userConfig: JSON.stringify({
77
+ items: [],
78
+ commands: [],
79
+ }),
80
+ });
78
81
 
79
82
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
80
83