@takaro/modules 0.0.1 → 0.0.4

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 (96) hide show
  1. package/dist/BuiltinModule.js +0 -4
  2. package/dist/BuiltinModule.js.map +1 -1
  3. package/dist/community-modules.json +21 -0
  4. package/dist/dto/gameEvents.d.ts +3 -2
  5. package/dist/dto/gameEvents.js +1 -0
  6. package/dist/dto/gameEvents.js.map +1 -1
  7. package/dist/dto/index.d.ts +6 -0
  8. package/dist/dto/takaroEvents.d.ts +46 -0
  9. package/dist/dto/takaroEvents.js +129 -1
  10. package/dist/dto/takaroEvents.js.map +1 -1
  11. package/dist/main.js +1 -1
  12. package/dist/main.js.map +1 -1
  13. package/dist/modules/chatBridge/hooks/GameToDiscord.js +1 -1
  14. package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -1
  15. package/dist/modules/chatBridge/hooks/PlayerConnected.js +2 -2
  16. package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -1
  17. package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +1 -1
  18. package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -1
  19. package/dist/modules/economyUtils/commands/transfer.js +1 -1
  20. package/dist/modules/economyUtils/commands/transfer.js.map +1 -1
  21. package/dist/modules/geoBlock/hooks/IPDetected.js +13 -15
  22. package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -1
  23. package/dist/modules/geoBlock/index.js +1 -1
  24. package/dist/modules/geoBlock/index.js.map +1 -1
  25. package/dist/modules/lottery/commands/nextDraw.js +1 -1
  26. package/dist/modules/lottery/commands/nextDraw.js.map +1 -1
  27. package/dist/modules/playerOnboarding/index.js.map +1 -1
  28. package/dist/modules/teleports/commands/deletetp.js +1 -1
  29. package/dist/modules/teleports/commands/deletetp.js.map +1 -1
  30. package/dist/modules/teleports/commands/setprivate.js +4 -6
  31. package/dist/modules/teleports/commands/setprivate.js.map +1 -1
  32. package/dist/modules/teleports/commands/setpublic.js +8 -15
  33. package/dist/modules/teleports/commands/setpublic.js.map +1 -1
  34. package/dist/modules/teleports/commands/settp.js +2 -2
  35. package/dist/modules/teleports/commands/settp.js.map +1 -1
  36. package/dist/modules/teleports/commands/teleport.js +3 -8
  37. package/dist/modules/teleports/commands/teleport.js.map +1 -1
  38. package/dist/modules/teleports/commands/teleportwaypoint.js +9 -1
  39. package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -1
  40. package/dist/modules/teleports/commands/tplist.js +13 -12
  41. package/dist/modules/teleports/commands/tplist.js.map +1 -1
  42. package/dist/modules/teleports/functions/utils.d.ts +2 -2
  43. package/dist/modules/teleports/functions/utils.js +21 -3
  44. package/dist/modules/teleports/functions/utils.js.map +1 -1
  45. package/dist/modules.json +98 -78
  46. package/package.json +4 -8
  47. package/scripts/buildBuiltinJson.ts +20 -0
  48. package/src/BuiltinModule.ts +1 -1
  49. package/src/__tests__/aliases.integration.test.ts +2 -3
  50. package/src/__tests__/bugRepros.integration.test.ts +72 -0
  51. package/src/__tests__/commandArgs.integration.test.ts +2 -3
  52. package/src/__tests__/economyUtils.integration.test.ts +38 -39
  53. package/src/__tests__/geoblock.integration.test.ts +11 -12
  54. package/src/__tests__/gimme.integration.test.ts +4 -5
  55. package/src/__tests__/help.integration.test.ts +12 -13
  56. package/src/__tests__/lottery.integration.test.ts +6 -7
  57. package/src/__tests__/modulePermission.integration.test.ts +5 -6
  58. package/src/__tests__/onboarding.integration.test.ts +5 -6
  59. package/src/__tests__/ping.integration.test.ts +2 -3
  60. package/src/__tests__/roleExpiry.integration.test.ts +3 -4
  61. package/src/__tests__/serverMessages.integration.test.ts +5 -6
  62. package/src/__tests__/systemConfigCost.integration.test.ts +6 -7
  63. package/src/__tests__/teleports/listtp.integration.test.ts +84 -10
  64. package/src/__tests__/teleports/publicteleports.integration.test.ts +11 -12
  65. package/src/__tests__/teleports/teleport.integration.test.ts +4 -5
  66. package/src/__tests__/teleports/tpManagement.integration.test.ts +10 -11
  67. package/src/__tests__/teleports/waypoints.integration.test.ts +5 -6
  68. package/src/community-modules/README.md +5 -0
  69. package/src/community-modules/modules/vote.json +19 -0
  70. package/src/dto/gameEvents.ts +2 -2
  71. package/src/dto/takaroEvents.ts +79 -0
  72. package/src/main.ts +2 -3
  73. package/src/modules/chatBridge/hooks/GameToDiscord.js +1 -1
  74. package/src/modules/chatBridge/hooks/PlayerConnected.js +2 -2
  75. package/src/modules/chatBridge/hooks/PlayerDisconnected.js +1 -1
  76. package/src/modules/chatBridge/index.ts +1 -1
  77. package/src/modules/economyUtils/commands/transfer.js +4 -4
  78. package/src/modules/economyUtils/index.ts +1 -1
  79. package/src/modules/geoBlock/hooks/IPDetected.js +12 -13
  80. package/src/modules/geoBlock/index.ts +2 -2
  81. package/src/modules/gimme/index.ts +1 -1
  82. package/src/modules/highPingKicker/index.ts +1 -1
  83. package/src/modules/lottery/commands/nextDraw.js +3 -1
  84. package/src/modules/lottery/index.ts +1 -1
  85. package/src/modules/playerOnboarding/index.ts +2 -1
  86. package/src/modules/serverMessages/index.ts +1 -1
  87. package/src/modules/teleports/commands/deletetp.js +1 -1
  88. package/src/modules/teleports/commands/setprivate.js +6 -6
  89. package/src/modules/teleports/commands/setpublic.js +18 -25
  90. package/src/modules/teleports/commands/settp.js +2 -2
  91. package/src/modules/teleports/commands/teleport.js +3 -10
  92. package/src/modules/teleports/commands/teleportwaypoint.js +12 -1
  93. package/src/modules/teleports/commands/tplist.js +16 -15
  94. package/src/modules/teleports/functions/utils.js +19 -3
  95. package/src/modules/teleports/index.ts +1 -1
  96. package/src/modules/utils/index.ts +1 -1
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../dto/index.js';
4
3
  import { Client } from '@takaro/apiclient';
5
4
 
@@ -11,7 +10,7 @@ async function expectTicketAmountLengthToBe(
11
10
  client: Client,
12
11
  gameServerId: string,
13
12
  moduleId: string,
14
- expectedAmount = 0
13
+ expectedAmount = 0,
15
14
  ) {
16
15
  const ticketVars = await client.variable.variableControllerSearch({
17
16
  filters: {
@@ -122,7 +121,7 @@ const tests = [
122
121
 
123
122
  expect((await events).length).to.be.eq(1);
124
123
  expect((await events)[0].data.msg).to.be.eq(
125
- `You have successfully bought ${ticketAmount} tickets for ${ticketPrice} ${currencyName}. Good luck!`
124
+ `You have successfully bought ${ticketAmount} tickets for ${ticketPrice} ${currencyName}. Good luck!`,
126
125
  );
127
126
 
128
127
  let pog = (
@@ -141,7 +140,7 @@ const tests = [
141
140
 
142
141
  expect((await events).length).to.be.eq(1);
143
142
  expect((await events)[0].data.msg).to.be.eq(
144
- `You have successfully bought ${ticketAmount} tickets for ${ticketPrice} ${currencyName}. Good luck!`
143
+ `You have successfully bought ${ticketAmount} tickets for ${ticketPrice} ${currencyName}. Good luck!`,
145
144
  );
146
145
 
147
146
  pog = (
@@ -216,7 +215,7 @@ const tests = [
216
215
  const mod = (
217
216
  await this.client.gameserver.gameServerControllerGetModuleInstallation(
218
217
  this.setupData.gameserver.id,
219
- this.setupData.lotteryModule.id
218
+ this.setupData.lotteryModule.id,
220
219
  )
221
220
  ).data.data;
222
221
 
@@ -293,7 +292,7 @@ const tests = [
293
292
  expect(events.length).to.be.eq(2);
294
293
  expect(events[0].data.msg).to.eq('Only one person has bought a ticket. The lottery has been cancelled.');
295
294
  expect(events[1].data.msg).to.eq(
296
- `You have been refunded ${ticketCost} ${currencyName} because the lottery has been cancelled.`
295
+ `You have been refunded ${ticketCost} ${currencyName} because the lottery has been cancelled.`,
297
296
  );
298
297
 
299
298
  const pog = (
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect, integrationConfig } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, integrationConfig, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../dto/index.js';
4
3
 
5
4
  const group = 'Module permissions role assignments';
@@ -18,13 +17,13 @@ async function cleanRoleSetup(this: IntegrationTest<IModuleTestsSetupData>) {
18
17
 
19
18
  await this.client.gameserver.gameServerControllerInstallModule(
20
19
  defaultSetup.gameserver.id,
21
- defaultSetup.teleportsModule.id
20
+ defaultSetup.teleportsModule.id,
22
21
  );
23
22
 
24
23
  await Promise.all(
25
24
  playersRes.data.data.map(async (player) => {
26
25
  await this.client.player.playerControllerRemoveRole(player.id, defaultSetup.role.id);
27
- })
26
+ }),
28
27
  );
29
28
 
30
29
  return defaultSetup;
@@ -129,13 +128,13 @@ const tests = [
129
128
  userConfig: JSON.stringify({
130
129
  timeout: 0,
131
130
  }),
132
- }
131
+ },
133
132
  );
134
133
 
135
134
  await Promise.all(
136
135
  this.setupData.players.map(async (player) => {
137
136
  await this.client.player.playerControllerRemoveRole(player.id, this.setupData.role.id);
138
- })
137
+ }),
139
138
  );
140
139
 
141
140
  const playerRoleRes = await this.client.role.roleControllerSearch({ filters: { name: ['Player'] } });
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { EventPlayerConnected, GameEvents } from '../dto/gameEvents.js';
4
3
  import { HookEvents } from '../main.js';
5
4
 
@@ -15,7 +14,7 @@ const _tests = [
15
14
  test: async function () {
16
15
  await this.client.gameserver.gameServerControllerInstallModule(
17
16
  this.setupData.gameserver.id,
18
- this.setupData.onboardingModule.id
17
+ this.setupData.onboardingModule.id,
19
18
  );
20
19
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
21
20
  await this.client.hook.hookControllerTrigger({
@@ -47,7 +46,7 @@ const _tests = [
47
46
  userConfig: JSON.stringify({
48
47
  starterKitItems: ['cigar'],
49
48
  }),
50
- }
49
+ },
51
50
  );
52
51
  const events = this.setupData.eventAwaiter.waitForEvents(HookEvents.COMMAND_EXECUTED);
53
52
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
@@ -72,7 +71,7 @@ const _tests = [
72
71
  userConfig: JSON.stringify({
73
72
  starterKitItems: ['cigar'],
74
73
  }),
75
- }
74
+ },
76
75
  );
77
76
  const firstEvents = this.setupData.eventAwaiter.waitForEvents(HookEvents.COMMAND_EXECUTED);
78
77
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
@@ -101,7 +100,7 @@ const _tests = [
101
100
  test: async function () {
102
101
  await this.client.gameserver.gameServerControllerInstallModule(
103
102
  this.setupData.gameserver.id,
104
- this.setupData.onboardingModule.id
103
+ this.setupData.onboardingModule.id,
105
104
  );
106
105
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
107
106
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../dto/index.js';
4
3
 
5
4
  const group = 'Ping command';
@@ -13,7 +12,7 @@ const tests = [
13
12
  test: async function () {
14
13
  await this.client.gameserver.gameServerControllerInstallModule(
15
14
  this.setupData.gameserver.id,
16
- this.setupData.utilsModule.id
15
+ this.setupData.utilsModule.id,
17
16
  );
18
17
 
19
18
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../dto/index.js';
4
3
 
5
4
  const group = 'Role expiry';
@@ -13,12 +12,12 @@ const tests = [
13
12
  test: async function () {
14
13
  // First, ensure all players have no roles
15
14
  await Promise.all(
16
- this.setupData.players.map((p) => this.client.player.playerControllerRemoveRole(p.id, this.setupData.role.id))
15
+ this.setupData.players.map((p) => this.client.player.playerControllerRemoveRole(p.id, this.setupData.role.id)),
17
16
  );
18
17
 
19
18
  await this.client.gameserver.gameServerControllerInstallModule(
20
19
  this.setupData.gameserver.id,
21
- this.setupData.teleportsModule.id
20
+ this.setupData.teleportsModule.id,
22
21
  );
23
22
 
24
23
  const eventsBeforeRole = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../dto/index.js';
4
3
  import { sleep } from '@takaro/util';
5
4
 
@@ -14,7 +13,7 @@ const tests = [
14
13
  test: async function () {
15
14
  await this.client.gameserver.gameServerControllerInstallModule(
16
15
  this.setupData.gameserver.id,
17
- this.setupData.serverMessagesModule.id
16
+ this.setupData.serverMessagesModule.id,
18
17
  );
19
18
 
20
19
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
@@ -28,7 +27,7 @@ const tests = [
28
27
  expect((await events).length).to.be.eq(1);
29
28
  expect((await events)[0].data.msg).to.be.eq(
30
29
  // eslint-disable-next-line
31
- "This is an automated message, don't forget to read the server rules!"
30
+ "This is an automated message, don't forget to read the server rules!",
32
31
  );
33
32
  },
34
33
  }),
@@ -45,7 +44,7 @@ const tests = [
45
44
  userConfig: JSON.stringify({
46
45
  messages: ['This is a custom message'],
47
46
  }),
48
- }
47
+ },
49
48
  );
50
49
 
51
50
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
@@ -73,7 +72,7 @@ const tests = [
73
72
  userConfig: JSON.stringify({
74
73
  messages: ['Test message 1', 'Test message 2'],
75
74
  }),
76
- }
75
+ },
77
76
  );
78
77
 
79
78
  // We should see each of our test messages at least once
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../dto/index.js';
4
3
  import { sleep } from '@takaro/util';
5
4
 
@@ -28,7 +27,7 @@ const customSetup = async function (this: IntegrationTest<IModuleTestsSetupData>
28
27
  },
29
28
  },
30
29
  }),
31
- }
30
+ },
32
31
  );
33
32
 
34
33
  const setEvents = setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -52,7 +51,7 @@ const customSetup = async function (this: IntegrationTest<IModuleTestsSetupData>
52
51
  playerOnGameServer[0].playerId,
53
52
  {
54
53
  currency: 100,
55
- }
54
+ },
56
55
  );
57
56
  });
58
57
  await Promise.all(giveCurrencies);
@@ -101,7 +100,7 @@ const tests = [
101
100
  msg: `/settp test${index}`,
102
101
  playerId: this.setupData.players[0].id,
103
102
  });
104
- })
103
+ }),
105
104
  );
106
105
 
107
106
  expect((await setEvents).length).to.be.eq(amount);
@@ -114,7 +113,7 @@ const tests = [
114
113
  msg: `/tp test${index}`,
115
114
  playerId: this.setupData.players[0].id,
116
115
  });
117
- })
116
+ }),
118
117
  );
119
118
 
120
119
  expect((await events).length).to.be.eq(amount);
@@ -174,7 +173,7 @@ const tests = [
174
173
  playerOnGameServer[0].playerId,
175
174
  {
176
175
  currency: 5,
177
- }
176
+ },
178
177
  );
179
178
 
180
179
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../../dto/index.js';
4
3
 
5
4
  const group = 'Teleports suite';
@@ -13,7 +12,7 @@ const tests = [
13
12
  test: async function () {
14
13
  await this.client.gameserver.gameServerControllerInstallModule(
15
14
  this.setupData.gameserver.id,
16
- this.setupData.teleportsModule.id
15
+ this.setupData.teleportsModule.id,
17
16
  );
18
17
 
19
18
  const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 3);
@@ -24,7 +23,7 @@ const tests = [
24
23
  msg: `/settp test${i}`,
25
24
  playerId: this.setupData.players[0].id,
26
25
  });
27
- })
26
+ }),
28
27
  );
29
28
 
30
29
  expect((await setEvents).length).to.be.eq(3);
@@ -42,10 +41,9 @@ const tests = [
42
41
 
43
42
  expect((await events).length).to.be.eq(4);
44
43
  expect((await events)[0].data.msg).to.be.eq('You have 3 teleports available');
45
- // - test0: 61, -262, -52
46
- expect((await events)[1].data.msg).to.match(/ - test0: [-\d]+, [-\d]+, [-\d]+/);
47
- expect((await events)[2].data.msg).to.match(/ - test1: [-\d]+, [-\d]+, [-\d]+/);
48
- expect((await events)[3].data.msg).to.match(/ - test2: [-\d]+, [-\d]+, [-\d]+/);
44
+ expect((await events)[1].data.msg).to.match(/test0: \([-\d]+,[-\d]+,[-\d]+\)/);
45
+ expect((await events)[2].data.msg).to.match(/test1: \([-\d]+,[-\d]+,[-\d]+\)/);
46
+ expect((await events)[3].data.msg).to.match(/test2: \([-\d]+,[-\d]+,[-\d]+\)/);
49
47
  },
50
48
  }),
51
49
  new IntegrationTest<IModuleTestsSetupData>({
@@ -61,7 +59,7 @@ const tests = [
61
59
  userConfig: JSON.stringify({
62
60
  allowPublicTeleports: true,
63
61
  }),
64
- }
62
+ },
65
63
  );
66
64
 
67
65
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -103,7 +101,83 @@ const tests = [
103
101
 
104
102
  expect((await tpEvent).length).to.be.eq(2);
105
103
  expect((await tpEvent)[0].data.msg).to.be.eq('You have 1 teleport available');
106
- expect((await tpEvent)[1].data.msg).to.match(/ - test: [-\d]+, [-\d]+, [-\d]+ \(public\)/);
104
+ expect((await tpEvent)[1].data.msg).to.match(/test: \([-\d]+,[-\d]+,[-\d]+\) \(public\)/);
105
+ },
106
+ }),
107
+ new IntegrationTest<IModuleTestsSetupData>({
108
+ group,
109
+ snapshot: false,
110
+ setup: modulesTestSetup,
111
+ name: 'Teleports set by player A cannot be seen by player B with /tplist',
112
+ test: async function () {
113
+ await this.client.gameserver.gameServerControllerInstallModule(
114
+ this.setupData.gameserver.id,
115
+ this.setupData.teleportsModule.id,
116
+ );
117
+
118
+ const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
119
+
120
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
121
+ msg: '/settp test',
122
+ playerId: this.setupData.players[0].id,
123
+ });
124
+
125
+ expect((await setTpEvent).length).to.be.eq(1);
126
+ expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
127
+
128
+ const tpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
129
+
130
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
131
+ msg: '/tplist',
132
+ playerId: this.setupData.players[1].id,
133
+ });
134
+
135
+ expect((await tpEvent).length).to.be.eq(1);
136
+ expect((await tpEvent)[0].data.msg).to.be.eq('You have no teleports available, use /settp <name> to set one.');
137
+ },
138
+ }),
139
+ new IntegrationTest<IModuleTestsSetupData>({
140
+ group,
141
+ snapshot: false,
142
+ setup: modulesTestSetup,
143
+ // eslint-disable-next-line quotes
144
+ name: "bug repro /tplist: Player A and B have teleports set but B cannot see A's teleports",
145
+ test: async function () {
146
+ await this.client.gameserver.gameServerControllerInstallModule(
147
+ this.setupData.gameserver.id,
148
+ this.setupData.teleportsModule.id,
149
+ );
150
+
151
+ const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
152
+
153
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
154
+ msg: '/settp test',
155
+ playerId: this.setupData.players[0].id,
156
+ });
157
+
158
+ expect((await setTpEvent).length).to.be.eq(1);
159
+ expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
160
+
161
+ const setTpEvent2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
162
+
163
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
164
+ msg: '/settp test2',
165
+ playerId: this.setupData.players[1].id,
166
+ });
167
+
168
+ expect((await setTpEvent2).length).to.be.eq(1);
169
+ expect((await setTpEvent2)[0].data.msg).to.be.eq('Teleport test2 set.');
170
+
171
+ const tpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 2);
172
+
173
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
174
+ msg: '/tplist',
175
+ playerId: this.setupData.players[1].id,
176
+ });
177
+
178
+ expect((await tpEvent).length).to.be.eq(2);
179
+ expect((await tpEvent)[0].data.msg).to.be.eq('You have 1 teleport available');
180
+ expect((await tpEvent)[1].data.msg).to.match(/test2: \([-\d]+,[-\d]+,[-\d]+\)/);
107
181
  },
108
182
  }),
109
183
  ];
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../../dto/index.js';
4
3
 
5
4
  const group = 'Teleports suite';
@@ -18,7 +17,7 @@ const tests = [
18
17
  userConfig: JSON.stringify({
19
18
  allowPublicTeleports: true,
20
19
  }),
21
- }
20
+ },
22
21
  );
23
22
 
24
23
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -64,7 +63,7 @@ const tests = [
64
63
  userConfig: JSON.stringify({
65
64
  allowPublicTeleports: true,
66
65
  }),
67
- }
66
+ },
68
67
  );
69
68
 
70
69
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -121,7 +120,7 @@ const tests = [
121
120
  allowPublicTeleports: false,
122
121
  timeout: 0,
123
122
  }),
124
- }
123
+ },
125
124
  );
126
125
 
127
126
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -159,7 +158,7 @@ const tests = [
159
158
  allowPublicTeleports: true,
160
159
  timeout: 0,
161
160
  }),
162
- }
161
+ },
163
162
  );
164
163
 
165
164
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -200,7 +199,7 @@ const tests = [
200
199
  allowPublicTeleports: false,
201
200
  timeout: 0,
202
201
  }),
203
- }
202
+ },
204
203
  );
205
204
 
206
205
  const tpEvent2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -238,7 +237,7 @@ const tests = [
238
237
  allowPublicTeleports: true,
239
238
  timeout: 0,
240
239
  }),
241
- }
240
+ },
242
241
  );
243
242
 
244
243
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -290,7 +289,7 @@ const tests = [
290
289
  allowPublicTeleports: true,
291
290
  timeout: 0,
292
291
  }),
293
- }
292
+ },
294
293
  );
295
294
 
296
295
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 4);
@@ -301,7 +300,7 @@ const tests = [
301
300
  msg: `/settp test${i}`,
302
301
  playerId: this.setupData.players[0].id,
303
302
  });
304
- })
303
+ }),
305
304
  );
306
305
 
307
306
  expect((await setTpEvent).length).to.be.eq(4);
@@ -318,7 +317,7 @@ const tests = [
318
317
  msg: `/setpublic test${i}`,
319
318
  playerId: this.setupData.players[0].id,
320
319
  });
321
- })
320
+ }),
322
321
  );
323
322
 
324
323
  expect((await setPublicEvent).length).to.be.eq(3);
@@ -337,7 +336,7 @@ const tests = [
337
336
  expect((await setPublicEvent2).length).to.be.eq(1);
338
337
 
339
338
  expect((await setPublicEvent2)[0].data.msg).to.be.eq(
340
- 'You have reached the maximum number of public teleports for your role, maximum allowed is 3'
339
+ 'You have reached the maximum number of public teleports for your role, maximum allowed is 3',
341
340
  );
342
341
  },
343
342
  }),
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../../dto/index.js';
4
3
 
5
4
  const group = 'Teleports suite';
@@ -13,7 +12,7 @@ const tests = [
13
12
  test: async function () {
14
13
  await this.client.gameserver.gameServerControllerInstallModule(
15
14
  this.setupData.gameserver.id,
16
- this.setupData.teleportsModule.id
15
+ this.setupData.teleportsModule.id,
17
16
  );
18
17
 
19
18
  const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -43,7 +42,7 @@ const tests = [
43
42
  test: async function () {
44
43
  await this.client.gameserver.gameServerControllerInstallModule(
45
44
  this.setupData.gameserver.id,
46
- this.setupData.teleportsModule.id
45
+ this.setupData.teleportsModule.id,
47
46
  );
48
47
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
49
48
 
@@ -69,7 +68,7 @@ const tests = [
69
68
  userConfig: JSON.stringify({
70
69
  timeout: 5000,
71
70
  }),
72
- }
71
+ },
73
72
  );
74
73
 
75
74
  const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../../dto/index.js';
4
3
 
5
4
  const group = 'Teleports suite';
@@ -13,7 +12,7 @@ const tests = [
13
12
  test: async function () {
14
13
  await this.client.gameserver.gameServerControllerInstallModule(
15
14
  this.setupData.gameserver.id,
16
- this.setupData.teleportsModule.id
15
+ this.setupData.teleportsModule.id,
17
16
  );
18
17
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
19
18
 
@@ -34,7 +33,7 @@ const tests = [
34
33
  test: async function () {
35
34
  await this.client.gameserver.gameServerControllerInstallModule(
36
35
  this.setupData.gameserver.id,
37
- this.setupData.teleportsModule.id
36
+ this.setupData.teleportsModule.id,
38
37
  );
39
38
 
40
39
  const firstEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -56,7 +55,7 @@ const tests = [
56
55
 
57
56
  expect((await secondEvents).length).to.be.eq(1);
58
57
  expect((await secondEvents)[0].data.msg).to.be.eq(
59
- 'Teleport test already exists, use /deletetp test to delete it.'
58
+ 'Teleport test already exists, use /deletetp test to delete it.',
60
59
  );
61
60
  },
62
61
  }),
@@ -68,7 +67,7 @@ const tests = [
68
67
  test: async function () {
69
68
  await this.client.gameserver.gameServerControllerInstallModule(
70
69
  this.setupData.gameserver.id,
71
- this.setupData.teleportsModule.id
70
+ this.setupData.teleportsModule.id,
72
71
  );
73
72
 
74
73
  const useTeleportsRole = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
@@ -89,7 +88,7 @@ const tests = [
89
88
  msg: `/settp test${i}`,
90
89
  playerId: this.setupData.players[0].id,
91
90
  });
92
- })
91
+ }),
93
92
  );
94
93
 
95
94
  expect((await setEvents).length).to.be.eq(3);
@@ -106,7 +105,7 @@ const tests = [
106
105
 
107
106
  expect((await events).length).to.be.eq(1);
108
107
  expect((await events)[0].data.msg).to.be.eq(
109
- 'You have reached the maximum number of teleports for your role, maximum allowed is 3'
108
+ 'You have reached the maximum number of teleports for your role, maximum allowed is 3',
110
109
  );
111
110
  },
112
111
  }),
@@ -118,7 +117,7 @@ const tests = [
118
117
  test: async function () {
119
118
  await this.client.gameserver.gameServerControllerInstallModule(
120
119
  this.setupData.gameserver.id,
121
- this.setupData.teleportsModule.id
120
+ this.setupData.teleportsModule.id,
122
121
  );
123
122
  const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 3);
124
123
 
@@ -128,7 +127,7 @@ const tests = [
128
127
  msg: `/settp test${i}`,
129
128
  playerId: this.setupData.players[0].id,
130
129
  });
131
- })
130
+ }),
132
131
  );
133
132
 
134
133
  expect((await setEvents).length).to.be.eq(3);
@@ -154,7 +153,7 @@ const tests = [
154
153
  test: async function () {
155
154
  await this.client.gameserver.gameServerControllerInstallModule(
156
155
  this.setupData.gameserver.id,
157
- this.setupData.teleportsModule.id
156
+ this.setupData.teleportsModule.id,
158
157
  );
159
158
  const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
160
159
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
@@ -1,5 +1,4 @@
1
- import { IntegrationTest, expect, integrationConfig } from '@takaro/test';
2
- import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
1
+ import { IntegrationTest, expect, integrationConfig, IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
3
2
  import { GameEvents } from '../../dto/index.js';
4
3
  import { GameServerTypesOutputDTOTypeEnum, PlayerOutputDTO, RoleOutputDTO } from '@takaro/apiclient';
5
4
 
@@ -22,7 +21,7 @@ const waypointsSetup = async function (this: IntegrationTest<WaypointsSetup>): P
22
21
  await Promise.all(
23
22
  playersRes.data.data.map(async (player) => {
24
23
  await this.client.player.playerControllerRemoveRole(player.id, setupData.role.id);
25
- })
24
+ }),
26
25
  );
27
26
 
28
27
  const manageWaypointsPermission = await this.client.permissionCodesToInputs(['TELEPORTS_MANAGE_WAYPOINTS']);
@@ -61,7 +60,7 @@ async function setupSecondServer() {
61
60
 
62
61
  await this.client.gameserver.gameServerControllerInstallModule(
63
62
  newGameServer.data.data.id,
64
- this.setupData.teleportsModule.id
63
+ this.setupData.teleportsModule.id,
65
64
  );
66
65
 
67
66
  const connectedEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.PLAYER_CONNECTED, 5);
@@ -82,7 +81,7 @@ async function setupSecondServer() {
82
81
 
83
82
  await this.client.player.playerControllerAssignRole(
84
83
  newServerModerator.playerId,
85
- this.setupData.manageWaypointsRole.id
84
+ this.setupData.manageWaypointsRole.id,
86
85
  );
87
86
 
88
87
  return {
@@ -155,7 +154,7 @@ const tests = [
155
154
 
156
155
  await this.client.player.playerControllerAssignRole(
157
156
  this.setupData.player.id,
158
- this.setupData.manageWaypointsRole.id
157
+ this.setupData.manageWaypointsRole.id,
159
158
  );
160
159
 
161
160
  const secondEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
@@ -0,0 +1,5 @@
1
+ # Community modules
2
+
3
+ This directory contains modules that are not part of the core suite of built in modules, but are contributed by the community. They are not officially supported, but are provided as-is for the community to use and improve.
4
+
5
+ We welcome contributions to this directory. If you have a module that you would like to contribute, please open a pull request.