@takaro/modules 0.0.4 → 0.0.5

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 (27) hide show
  1. package/dist/modules/geoBlock/hooks/IPDetected.js +10 -10
  2. package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -1
  3. package/dist/modules/gimme/commands/gimme.js +1 -0
  4. package/dist/modules/gimme/commands/gimme.js.map +1 -1
  5. package/dist/modules.json +2 -2
  6. package/package.json +1 -1
  7. package/src/__tests__/aliases.integration.test.ts +5 -5
  8. package/src/__tests__/bugRepros.integration.test.ts +3 -3
  9. package/src/__tests__/commandArgs.integration.test.ts +23 -23
  10. package/src/__tests__/economyUtils.integration.test.ts +29 -22
  11. package/src/__tests__/geoblock.integration.test.ts +13 -55
  12. package/src/__tests__/gimme.integration.test.ts +33 -33
  13. package/src/__tests__/help.integration.test.ts +36 -23
  14. package/src/__tests__/lottery.integration.test.ts +27 -22
  15. package/src/__tests__/modulePermission.integration.test.ts +20 -13
  16. package/src/__tests__/onboarding.integration.test.ts +9 -9
  17. package/src/__tests__/ping.integration.test.ts +4 -4
  18. package/src/__tests__/roleExpiry.integration.test.ts +7 -7
  19. package/src/__tests__/serverMessages.integration.test.ts +10 -7
  20. package/src/__tests__/systemConfigCost.integration.test.ts +9 -9
  21. package/src/__tests__/teleports/listtp.integration.test.ts +30 -28
  22. package/src/__tests__/teleports/publicteleports.integration.test.ts +45 -37
  23. package/src/__tests__/teleports/teleport.integration.test.ts +14 -12
  24. package/src/__tests__/teleports/tpManagement.integration.test.ts +17 -17
  25. package/src/__tests__/teleports/waypoints.integration.test.ts +109 -77
  26. package/src/modules/geoBlock/hooks/IPDetected.js +9 -9
  27. package/src/modules/gimme/commands/gimme.js +2 -1
@@ -1,5 +1,12 @@
1
- import { IntegrationTest, expect, integrationConfig, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
2
- import { GameEvents } from '../../dto/index.js';
1
+ import {
2
+ IntegrationTest,
3
+ expect,
4
+ integrationConfig,
5
+ IModuleTestsSetupData,
6
+ modulesTestSetup,
7
+ EventsAwaiter,
8
+ } from '@takaro/test';
9
+ import { GameEvents, HookEvents } from '../../dto/index.js';
3
10
  import { GameServerTypesOutputDTOTypeEnum, PlayerOutputDTO, RoleOutputDTO } from '@takaro/apiclient';
4
11
 
5
12
  const group = 'Teleports - waypoints';
@@ -63,7 +70,10 @@ async function setupSecondServer() {
63
70
  this.setupData.teleportsModule.id,
64
71
  );
65
72
 
66
- const connectedEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.PLAYER_CONNECTED, 5);
73
+ const connectedEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
74
+ GameEvents.PLAYER_CONNECTED,
75
+ 5,
76
+ );
67
77
 
68
78
  await this.client.gameserver.gameServerControllerExecuteCommand(newGameServer.data.data.id, {
69
79
  command: 'connectAll',
@@ -98,7 +108,7 @@ const tests = [
98
108
  setup: waypointsSetup,
99
109
  name: 'Can create a waypoint with /setwaypoint',
100
110
  test: async function () {
101
- const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
111
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
102
112
 
103
113
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
104
114
  msg: '/setwaypoint A',
@@ -106,7 +116,7 @@ const tests = [
106
116
  });
107
117
 
108
118
  expect((await events).length).to.be.eq(1);
109
- expect((await events)[0].data.msg).to.be.eq('Waypoint A set.');
119
+ expect((await events)[0].data.meta.msg).to.be.eq('Waypoint A set.');
110
120
  },
111
121
  }),
112
122
  new IntegrationTest<WaypointsSetup>({
@@ -115,7 +125,7 @@ const tests = [
115
125
  setup: waypointsSetup,
116
126
  name: 'Errors when creating duplicate waypoints',
117
127
  test: async function () {
118
- const firstEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
128
+ const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
119
129
 
120
130
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
121
131
  msg: '/setwaypoint A',
@@ -123,9 +133,9 @@ const tests = [
123
133
  });
124
134
 
125
135
  expect((await firstEvents).length).to.be.eq(1);
126
- expect((await firstEvents)[0].data.msg).to.be.eq('Waypoint A set.');
136
+ expect((await firstEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
127
137
 
128
- const secondEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
138
+ const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
129
139
 
130
140
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
131
141
  msg: '/setwaypoint A',
@@ -133,7 +143,7 @@ const tests = [
133
143
  });
134
144
 
135
145
  expect((await secondEvents).length).to.be.eq(1);
136
- expect((await secondEvents)[0].data.msg).to.be.eq('Waypoint A already exists.');
146
+ expect((await secondEvents)[0].data.meta.msg).to.be.eq('Waypoint A already exists.');
137
147
  },
138
148
  }),
139
149
  new IntegrationTest<WaypointsSetup>({
@@ -142,7 +152,7 @@ const tests = [
142
152
  setup: waypointsSetup,
143
153
  name: '/setwaypoint requires TELEPORTS_MANAGE_WAYPOINTS permission',
144
154
  test: async function () {
145
- const firstEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
155
+ const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
146
156
 
147
157
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
148
158
  msg: '/setwaypoint A',
@@ -150,14 +160,14 @@ const tests = [
150
160
  });
151
161
 
152
162
  expect((await firstEvents).length).to.be.eq(1);
153
- expect((await firstEvents)[0].data.msg).to.be.eq('You do not have permission to manage waypoints.');
163
+ expect((await firstEvents)[0].data.meta.msg).to.be.eq('You do not have permission to manage waypoints.');
154
164
 
155
165
  await this.client.player.playerControllerAssignRole(
156
166
  this.setupData.player.id,
157
167
  this.setupData.manageWaypointsRole.id,
158
168
  );
159
169
 
160
- const secondEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
170
+ const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
161
171
 
162
172
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
163
173
  msg: '/setwaypoint A',
@@ -165,7 +175,7 @@ const tests = [
165
175
  });
166
176
 
167
177
  expect((await secondEvents).length).to.be.eq(1);
168
- expect((await secondEvents)[0].data.msg).to.be.eq('Waypoint A set.');
178
+ expect((await secondEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
169
179
  },
170
180
  }),
171
181
  new IntegrationTest<WaypointsSetup>({
@@ -174,7 +184,7 @@ const tests = [
174
184
  setup: waypointsSetup,
175
185
  name: 'Can delete a waypoint with /deletewaypoint',
176
186
  test: async function () {
177
- const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
187
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
178
188
 
179
189
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
180
190
  msg: '/setwaypoint A',
@@ -182,9 +192,9 @@ const tests = [
182
192
  });
183
193
 
184
194
  expect((await events).length).to.be.eq(1);
185
- expect((await events)[0].data.msg).to.be.eq('Waypoint A set.');
195
+ expect((await events)[0].data.meta.msg).to.be.eq('Waypoint A set.');
186
196
 
187
- const teleportEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
197
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
188
198
 
189
199
  const useWaypointPermission = await this.client.permissionCodesToInputs([
190
200
  `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
@@ -199,9 +209,9 @@ const tests = [
199
209
  });
200
210
 
201
211
  expect((await teleportEvents).length).to.be.eq(1);
202
- expect((await teleportEvents)[0].data.msg).to.be.eq('Teleported to waypoint A.');
212
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
203
213
 
204
- const deleteEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
214
+ const deleteEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
205
215
 
206
216
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
207
217
  msg: '/deletewaypoint A',
@@ -209,7 +219,7 @@ const tests = [
209
219
  });
210
220
 
211
221
  expect((await deleteEvents).length).to.be.eq(1);
212
- expect((await deleteEvents)[0].data.msg).to.be.eq('Waypoint A deleted.');
222
+ expect((await deleteEvents)[0].data.meta.msg).to.be.eq('Waypoint A deleted.');
213
223
  },
214
224
  }),
215
225
  new IntegrationTest<WaypointsSetup>({
@@ -218,7 +228,7 @@ const tests = [
218
228
  setup: waypointsSetup,
219
229
  name: 'Errors when trying to delete a waypoint that does not exist',
220
230
  test: async function () {
221
- const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
231
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
222
232
 
223
233
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
224
234
  msg: '/deletewaypoint A',
@@ -227,7 +237,7 @@ const tests = [
227
237
 
228
238
  expect((await events).length).to.be.eq(1);
229
239
  // eslint-disable-next-line quotes
230
- expect((await events)[0].data.msg).to.be.eq("Waypoint A doesn't exist.");
240
+ expect((await events)[0].data.meta.msg).to.be.eq("Waypoint A doesn't exist.");
231
241
  },
232
242
  }),
233
243
  new IntegrationTest<WaypointsSetup>({
@@ -240,7 +250,7 @@ const tests = [
240
250
  // Then try to delete as player -> error
241
251
  // Then try to delete as moderator -> success
242
252
 
243
- const firstEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
253
+ const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
244
254
 
245
255
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
246
256
  msg: '/setwaypoint A',
@@ -248,9 +258,9 @@ const tests = [
248
258
  });
249
259
 
250
260
  expect((await firstEvents).length).to.be.eq(1);
251
- expect((await firstEvents)[0].data.msg).to.be.eq('Waypoint A set.');
261
+ expect((await firstEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
252
262
 
253
- const secondEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
263
+ const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
254
264
 
255
265
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
256
266
  msg: '/deletewaypoint A',
@@ -258,9 +268,9 @@ const tests = [
258
268
  });
259
269
 
260
270
  expect((await secondEvents).length).to.be.eq(1);
261
- expect((await secondEvents)[0].data.msg).to.be.eq('You do not have permission to manage waypoints.');
271
+ expect((await secondEvents)[0].data.meta.msg).to.be.eq('You do not have permission to manage waypoints.');
262
272
 
263
- const thirdEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
273
+ const thirdEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
264
274
 
265
275
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
266
276
  msg: '/deletewaypoint A',
@@ -268,7 +278,7 @@ const tests = [
268
278
  });
269
279
 
270
280
  expect((await thirdEvents).length).to.be.eq(1);
271
- expect((await thirdEvents)[0].data.msg).to.be.eq('Waypoint A deleted.');
281
+ expect((await thirdEvents)[0].data.meta.msg).to.be.eq('Waypoint A deleted.');
272
282
  },
273
283
  }),
274
284
  new IntegrationTest<WaypointsSetup>({
@@ -283,21 +293,28 @@ const tests = [
283
293
  // Remove access to B
284
294
  // /waypoints -> shows only A
285
295
 
286
- const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 2);
296
+ const setWaypointAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
297
+ GameEvents.CHAT_MESSAGE,
298
+ );
287
299
 
288
300
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
289
301
  msg: '/setwaypoint A',
290
302
  playerId: this.setupData.moderator.id,
291
303
  });
292
304
 
305
+ expect((await setWaypointAEvents).length).to.be.eq(1);
306
+ expect((await setWaypointAEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
307
+
293
308
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
294
309
  msg: '/setwaypoint B',
295
310
  playerId: this.setupData.moderator.id,
296
311
  });
297
312
 
298
- expect((await setEvents).length).to.be.eq(2);
299
- expect((await setEvents)[0].data.msg).to.be.eq('Waypoint A set.');
300
- expect((await setEvents)[1].data.msg).to.be.eq('Waypoint B set.');
313
+ const setWaypointBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
314
+ GameEvents.CHAT_MESSAGE,
315
+ );
316
+ expect((await setWaypointBEvents).length).to.be.eq(1);
317
+ expect((await setWaypointBEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
301
318
 
302
319
  const useWaypointAPermission = await this.client.permissionCodesToInputs([
303
320
  `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
@@ -310,7 +327,7 @@ const tests = [
310
327
  permissions: [...useWaypointAPermission, ...useWaypointBPermission],
311
328
  });
312
329
 
313
- const listEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
330
+ const listEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
314
331
 
315
332
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
316
333
  msg: '/waypoints',
@@ -318,13 +335,13 @@ const tests = [
318
335
  });
319
336
 
320
337
  expect((await listEvents).length).to.be.eq(1);
321
- expect((await listEvents)[0].data.msg).to.be.eq('Available waypoints: A, B');
338
+ expect((await listEvents)[0].data.meta.msg).to.be.eq('Available waypoints: A, B');
322
339
 
323
340
  await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
324
341
  permissions: useWaypointAPermission,
325
342
  });
326
343
 
327
- const listEvents2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
344
+ const listEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
328
345
 
329
346
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
330
347
  msg: '/waypoints',
@@ -332,7 +349,7 @@ const tests = [
332
349
  });
333
350
 
334
351
  expect((await listEvents2).length).to.be.eq(1);
335
- expect((await listEvents2)[0].data.msg).to.be.eq('Available waypoints: A');
352
+ expect((await listEvents2)[0].data.meta.msg).to.be.eq('Available waypoints: A');
336
353
  },
337
354
  }),
338
355
  new IntegrationTest<WaypointsSetup>({
@@ -341,7 +358,7 @@ const tests = [
341
358
  setup: waypointsSetup,
342
359
  name: 'Has a user friendly message when listing waypoints and there are none',
343
360
  test: async function () {
344
- const listEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
361
+ const listEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
345
362
 
346
363
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
347
364
  msg: '/waypoints',
@@ -349,7 +366,7 @@ const tests = [
349
366
  });
350
367
 
351
368
  expect((await listEvents).length).to.be.eq(1);
352
- expect((await listEvents)[0].data.msg).to.be.eq('There are no waypoints available.');
369
+ expect((await listEvents)[0].data.meta.msg).to.be.eq('There are no waypoints available.');
353
370
  },
354
371
  }),
355
372
  new IntegrationTest<WaypointsSetup>({
@@ -358,13 +375,13 @@ const tests = [
358
375
  setup: waypointsSetup,
359
376
  name: 'Players can teleport to a waypoint',
360
377
  test: async function () {
361
- const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
378
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
362
379
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
363
380
  msg: '/setwaypoint trader',
364
381
  playerId: this.setupData.moderator.id,
365
382
  });
366
383
  expect((await events).length).to.be.eq(1);
367
- expect((await events)[0].data.msg).to.be.eq('Waypoint trader set.');
384
+ expect((await events)[0].data.meta.msg).to.be.eq('Waypoint trader set.');
368
385
 
369
386
  const useWaypointPermission = await this.client.permissionCodesToInputs([
370
387
  `WAYPOINTS_USE_TRADER_${this.setupData.gameserver.id}`,
@@ -373,13 +390,13 @@ const tests = [
373
390
  permissions: useWaypointPermission,
374
391
  });
375
392
 
376
- const teleportEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
393
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
377
394
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
378
395
  msg: '/trader',
379
396
  playerId: this.setupData.player.id,
380
397
  });
381
398
  expect((await teleportEvents).length).to.be.eq(1);
382
- expect((await teleportEvents)[0].data.msg).to.be.eq('Teleported to waypoint trader.');
399
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint trader.');
383
400
  },
384
401
  }),
385
402
  new IntegrationTest<WaypointsSetup>({
@@ -388,21 +405,28 @@ const tests = [
388
405
  setup: waypointsSetup,
389
406
  name: 'Can set multiple waypoints and teleport to them',
390
407
  test: async function () {
391
- const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 2);
408
+ const setWaypointAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
409
+ GameEvents.CHAT_MESSAGE,
410
+ );
392
411
 
393
412
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
394
413
  msg: '/setwaypoint A',
395
414
  playerId: this.setupData.moderator.id,
396
415
  });
397
416
 
417
+ expect((await setWaypointAEvents).length).to.be.eq(1);
418
+ expect((await setWaypointAEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
419
+
398
420
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
399
421
  msg: '/setwaypoint B',
400
422
  playerId: this.setupData.moderator.id,
401
423
  });
402
424
 
403
- expect((await setEvents).length).to.be.eq(2);
404
- expect((await setEvents)[0].data.msg).to.be.eq('Waypoint A set.');
405
- expect((await setEvents)[1].data.msg).to.be.eq('Waypoint B set.');
425
+ const setWaypointBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
426
+ GameEvents.CHAT_MESSAGE,
427
+ );
428
+ expect((await setWaypointBEvents).length).to.be.eq(1);
429
+ expect((await setWaypointBEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
406
430
 
407
431
  const useWaypointPermission = await this.client.permissionCodesToInputs([
408
432
  `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
@@ -412,7 +436,7 @@ const tests = [
412
436
  permissions: useWaypointPermission,
413
437
  });
414
438
 
415
- const teleportAEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
439
+ const teleportAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
416
440
 
417
441
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
418
442
  msg: '/A',
@@ -420,9 +444,9 @@ const tests = [
420
444
  });
421
445
 
422
446
  expect((await teleportAEvents).length).to.be.eq(1);
423
- expect((await teleportAEvents)[0].data.msg).to.be.eq('Teleported to waypoint A.');
447
+ expect((await teleportAEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
424
448
 
425
- const teleportBEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
449
+ const teleportBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
426
450
 
427
451
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
428
452
  msg: '/B',
@@ -430,7 +454,7 @@ const tests = [
430
454
  });
431
455
 
432
456
  expect((await teleportBEvents).length).to.be.eq(1);
433
- expect((await teleportBEvents)[0].data.msg).to.be.eq('Teleported to waypoint B.');
457
+ expect((await teleportBEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint B.');
434
458
  },
435
459
  }),
436
460
  new IntegrationTest<WaypointsSetup>({
@@ -444,21 +468,28 @@ const tests = [
444
468
  // Player uses A -> success
445
469
  // Player uses B -> error
446
470
 
447
- const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 2);
471
+ const setWaypointAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
472
+ GameEvents.CHAT_MESSAGE,
473
+ );
448
474
 
449
475
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
450
476
  msg: '/setwaypoint A',
451
477
  playerId: this.setupData.moderator.id,
452
478
  });
453
479
 
480
+ expect((await setWaypointAEvents).length).to.be.eq(1);
481
+ expect((await setWaypointAEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
482
+
454
483
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
455
484
  msg: '/setwaypoint B',
456
485
  playerId: this.setupData.moderator.id,
457
486
  });
458
487
 
459
- expect((await setEvents).length).to.be.eq(2);
460
- expect((await setEvents)[0].data.msg).to.be.eq('Waypoint A set.');
461
- expect((await setEvents)[1].data.msg).to.be.eq('Waypoint B set.');
488
+ const setWaypointBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
489
+ GameEvents.CHAT_MESSAGE,
490
+ );
491
+ expect((await setWaypointBEvents).length).to.be.eq(1);
492
+ expect((await setWaypointBEvents)[0].data.meta.msg).to.be.eq('Waypoint B set.');
462
493
 
463
494
  const useWaypointPermission = await this.client.permissionCodesToInputs([
464
495
  `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
@@ -467,7 +498,7 @@ const tests = [
467
498
  permissions: useWaypointPermission,
468
499
  });
469
500
 
470
- const teleportAEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
501
+ const teleportAEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
471
502
 
472
503
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
473
504
  msg: '/A',
@@ -475,9 +506,9 @@ const tests = [
475
506
  });
476
507
 
477
508
  expect((await teleportAEvents).length).to.be.eq(1);
478
- expect((await teleportAEvents)[0].data.msg).to.be.eq('Teleported to waypoint A.');
509
+ expect((await teleportAEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
479
510
 
480
- const teleportBEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
511
+ const teleportBEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
481
512
 
482
513
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
483
514
  msg: '/B',
@@ -485,7 +516,7 @@ const tests = [
485
516
  });
486
517
 
487
518
  expect((await teleportBEvents).length).to.be.eq(1);
488
- expect((await teleportBEvents)[0].data.msg).to.be.eq('You are not allowed to use the waypoint B.');
519
+ expect((await teleportBEvents)[0].data.meta.msg).to.be.eq('You are not allowed to use the waypoint B.');
489
520
  },
490
521
  }),
491
522
  new IntegrationTest<WaypointsSetup>({
@@ -501,22 +532,22 @@ const tests = [
501
532
  const { newGameServer, newServerModerator, newServerPlayer } = await setupSecondServer.bind(this)();
502
533
 
503
534
  // Make a waypoint on the new gameserver
504
- const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
535
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
505
536
  await this.client.command.commandControllerTrigger(newGameServer.data.data.id, {
506
537
  msg: '/setwaypoint A',
507
538
  playerId: newServerModerator.playerId,
508
539
  });
509
540
  expect((await setEvents).length).to.be.eq(1);
510
- expect((await setEvents)[0].data.msg).to.be.eq('Waypoint A set.');
541
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
511
542
 
512
543
  // Make a waypoint on the original gameserver
513
- const setEvents2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
544
+ const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
514
545
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
515
546
  msg: '/setwaypoint notused',
516
547
  playerId: this.setupData.moderator.id,
517
548
  });
518
549
  expect((await setEvents2).length).to.be.eq(1);
519
- expect((await setEvents2)[0].data.msg).to.be.eq('Waypoint notused set.');
550
+ expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint notused set.');
520
551
 
521
552
  const useWaypointPermission = await this.client.permissionCodesToInputs([
522
553
  `WAYPOINTS_USE_A_${newGameServer.data.data.id}`,
@@ -526,22 +557,24 @@ const tests = [
526
557
  });
527
558
 
528
559
  // Use the waypoint from the new gameserver -> success
529
- const teleportEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
560
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
530
561
  await this.client.command.commandControllerTrigger(newGameServer.data.data.id, {
531
562
  msg: '/A',
532
563
  playerId: newServerPlayer.playerId,
533
564
  });
534
565
  expect((await teleportEvents).length).to.be.eq(1);
535
- expect((await teleportEvents)[0].data.msg).to.be.eq('Teleported to waypoint A.');
566
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
536
567
 
537
568
  // Use the waypoint from the original gameserver -> "waypoint does not exist"
538
- const teleportEvents2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
569
+ const teleportEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(
570
+ HookEvents.COMMAND_EXECUTED,
571
+ );
539
572
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
540
573
  msg: '/A',
541
574
  playerId: this.setupData.player.id,
542
575
  });
543
576
  expect((await teleportEvents2).length).to.be.eq(1);
544
- expect((await teleportEvents2)[0].data.msg).to.be.eq('You are not allowed to use the waypoint A.');
577
+ expect((await teleportEvents2)[0].data.meta.result.logs[0].msg).to.be.eq('Waypoint A is not for this server.');
545
578
  },
546
579
  }),
547
580
  new IntegrationTest<WaypointsSetup>({
@@ -560,20 +593,20 @@ const tests = [
560
593
  const { newGameServer, newServerModerator, newServerPlayer } = await setupSecondServer.bind(this)();
561
594
 
562
595
  // Make a waypoint on the original gameserver
563
- const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
596
+ const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
564
597
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
565
598
  msg: '/setwaypoint A',
566
599
  playerId: this.setupData.moderator.id,
567
600
  });
568
- expect((await setEvents)[0].data.msg).to.be.eq('Waypoint A set.');
601
+ expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
569
602
 
570
603
  // Make a waypoint on the new gameserver
571
- const setEvents2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
604
+ const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
572
605
  await this.client.command.commandControllerTrigger(newGameServer.data.data.id, {
573
606
  msg: '/setwaypoint A',
574
607
  playerId: newServerModerator.playerId,
575
608
  });
576
- expect((await setEvents2)[0].data.msg).to.be.eq('Waypoint A set.');
609
+ expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint A set.');
577
610
 
578
611
  const useWaypointPermission = await this.client.permissionCodesToInputs([
579
612
  `WAYPOINTS_USE_A_${this.setupData.gameserver.id}`,
@@ -583,24 +616,23 @@ const tests = [
583
616
  });
584
617
 
585
618
  // Use the waypoint from the original gameserver -> success
586
- const teleportEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1, {
587
- gameServerId: this.setupData.gameserver.id,
588
- });
619
+ const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
589
620
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
590
621
  msg: '/A',
591
622
  playerId: this.setupData.player.id,
592
623
  });
593
- expect((await teleportEvents)[0].data.msg).to.be.eq('Teleported to waypoint A.');
624
+ expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint A.');
594
625
 
595
626
  // Use the waypoint from the new gameserver -> error
596
- const teleportEvents2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1, {
597
- gameServerId: newGameServer.data.data.id,
598
- });
627
+ const teleportEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(
628
+ GameEvents.CHAT_MESSAGE,
629
+ 1,
630
+ );
599
631
  await this.client.command.commandControllerTrigger(newGameServer.data.data.id, {
600
632
  msg: '/A',
601
633
  playerId: newServerPlayer.playerId,
602
634
  });
603
- expect((await teleportEvents2)[0].data.msg).to.be.eq('You are not allowed to use the waypoint A.');
635
+ expect((await teleportEvents2)[0].data.meta.msg).to.be.eq('You are not allowed to use the waypoint A.');
604
636
  },
605
637
  }),
606
638
  ];
@@ -35,16 +35,16 @@ async function main() {
35
35
  await handleAction();
36
36
  return;
37
37
  }
38
- }
39
38
 
40
- if (mode === 'deny') {
41
- if (countries.includes(country)) {
42
- console.log('Blocked country detected, performing actions');
43
- await handleAction();
44
- return;
45
- } else {
46
- console.log('Allowed country detected, no action');
47
- return;
39
+ if (mode === 'deny') {
40
+ if (countries.includes(country)) {
41
+ console.log('Blocked country detected, performing actions');
42
+ await handleAction();
43
+ return;
44
+ } else {
45
+ console.log('Allowed country detected, no action');
46
+ return;
47
+ }
48
48
  }
49
49
  }
50
50
 
@@ -6,7 +6,7 @@ async function main() {
6
6
 
7
7
  if (items.length + commands.length === 0) {
8
8
  throw new TakaroUserError(
9
- 'No items or commands configured, please ask your server administrator to configure this module.'
9
+ 'No items or commands configured, please ask your server administrator to configure this module.',
10
10
  );
11
11
  }
12
12
 
@@ -18,6 +18,7 @@ async function main() {
18
18
  await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
19
19
  name: randomOption,
20
20
  amount: 1,
21
+ quality: 0,
21
22
  });
22
23
  await data.player.pm(`You received ${randomOption}!`);
23
24
  } else {