@takaro/modules 0.0.1 → 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.
- package/dist/BuiltinModule.js +0 -4
- package/dist/BuiltinModule.js.map +1 -1
- package/dist/community-modules.json +21 -0
- package/dist/dto/gameEvents.d.ts +3 -2
- package/dist/dto/gameEvents.js +1 -0
- package/dist/dto/gameEvents.js.map +1 -1
- package/dist/dto/index.d.ts +6 -0
- package/dist/dto/takaroEvents.d.ts +46 -0
- package/dist/dto/takaroEvents.js +129 -1
- package/dist/dto/takaroEvents.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/modules/chatBridge/hooks/GameToDiscord.js +1 -1
- package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -1
- package/dist/modules/chatBridge/hooks/PlayerConnected.js +2 -2
- package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -1
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +1 -1
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -1
- package/dist/modules/economyUtils/commands/transfer.js +1 -1
- package/dist/modules/economyUtils/commands/transfer.js.map +1 -1
- package/dist/modules/geoBlock/hooks/IPDetected.js +3 -5
- package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -1
- package/dist/modules/geoBlock/index.js +1 -1
- package/dist/modules/geoBlock/index.js.map +1 -1
- package/dist/modules/gimme/commands/gimme.js +1 -0
- package/dist/modules/gimme/commands/gimme.js.map +1 -1
- package/dist/modules/lottery/commands/nextDraw.js +1 -1
- package/dist/modules/lottery/commands/nextDraw.js.map +1 -1
- package/dist/modules/playerOnboarding/index.js.map +1 -1
- package/dist/modules/teleports/commands/deletetp.js +1 -1
- package/dist/modules/teleports/commands/deletetp.js.map +1 -1
- package/dist/modules/teleports/commands/setprivate.js +4 -6
- package/dist/modules/teleports/commands/setprivate.js.map +1 -1
- package/dist/modules/teleports/commands/setpublic.js +8 -15
- package/dist/modules/teleports/commands/setpublic.js.map +1 -1
- package/dist/modules/teleports/commands/settp.js +2 -2
- package/dist/modules/teleports/commands/settp.js.map +1 -1
- package/dist/modules/teleports/commands/teleport.js +3 -8
- package/dist/modules/teleports/commands/teleport.js.map +1 -1
- package/dist/modules/teleports/commands/teleportwaypoint.js +9 -1
- package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -1
- package/dist/modules/teleports/commands/tplist.js +13 -12
- package/dist/modules/teleports/commands/tplist.js.map +1 -1
- package/dist/modules/teleports/functions/utils.d.ts +2 -2
- package/dist/modules/teleports/functions/utils.js +21 -3
- package/dist/modules/teleports/functions/utils.js.map +1 -1
- package/dist/modules.json +99 -79
- package/package.json +4 -8
- package/scripts/buildBuiltinJson.ts +20 -0
- package/src/BuiltinModule.ts +1 -1
- package/src/__tests__/aliases.integration.test.ts +6 -7
- package/src/__tests__/bugRepros.integration.test.ts +72 -0
- package/src/__tests__/commandArgs.integration.test.ts +24 -25
- package/src/__tests__/economyUtils.integration.test.ts +66 -60
- package/src/__tests__/geoblock.integration.test.ts +22 -65
- package/src/__tests__/gimme.integration.test.ts +35 -36
- package/src/__tests__/help.integration.test.ts +47 -35
- package/src/__tests__/lottery.integration.test.ts +32 -28
- package/src/__tests__/modulePermission.integration.test.ts +24 -18
- package/src/__tests__/onboarding.integration.test.ts +13 -14
- package/src/__tests__/ping.integration.test.ts +5 -6
- package/src/__tests__/roleExpiry.integration.test.ts +9 -10
- package/src/__tests__/serverMessages.integration.test.ts +14 -12
- package/src/__tests__/systemConfigCost.integration.test.ts +14 -15
- package/src/__tests__/teleports/listtp.integration.test.ts +98 -22
- package/src/__tests__/teleports/publicteleports.integration.test.ts +55 -48
- package/src/__tests__/teleports/teleport.integration.test.ts +17 -16
- package/src/__tests__/teleports/tpManagement.integration.test.ts +26 -27
- package/src/__tests__/teleports/waypoints.integration.test.ts +113 -82
- package/src/community-modules/README.md +5 -0
- package/src/community-modules/modules/vote.json +19 -0
- package/src/dto/gameEvents.ts +2 -2
- package/src/dto/takaroEvents.ts +79 -0
- package/src/main.ts +2 -3
- package/src/modules/chatBridge/hooks/GameToDiscord.js +1 -1
- package/src/modules/chatBridge/hooks/PlayerConnected.js +2 -2
- package/src/modules/chatBridge/hooks/PlayerDisconnected.js +1 -1
- package/src/modules/chatBridge/index.ts +1 -1
- package/src/modules/economyUtils/commands/transfer.js +4 -4
- package/src/modules/economyUtils/index.ts +1 -1
- package/src/modules/geoBlock/hooks/IPDetected.js +3 -4
- package/src/modules/geoBlock/index.ts +2 -2
- package/src/modules/gimme/commands/gimme.js +2 -1
- package/src/modules/gimme/index.ts +1 -1
- package/src/modules/highPingKicker/index.ts +1 -1
- package/src/modules/lottery/commands/nextDraw.js +3 -1
- package/src/modules/lottery/index.ts +1 -1
- package/src/modules/playerOnboarding/index.ts +2 -1
- package/src/modules/serverMessages/index.ts +1 -1
- package/src/modules/teleports/commands/deletetp.js +1 -1
- package/src/modules/teleports/commands/setprivate.js +6 -6
- package/src/modules/teleports/commands/setpublic.js +18 -25
- package/src/modules/teleports/commands/settp.js +2 -2
- package/src/modules/teleports/commands/teleport.js +3 -10
- package/src/modules/teleports/commands/teleportwaypoint.js +12 -1
- package/src/modules/teleports/commands/tplist.js +16 -15
- package/src/modules/teleports/functions/utils.js +19 -3
- package/src/modules/teleports/index.ts +1 -1
- 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, EventsAwaiter } from '@takaro/test';
|
|
3
2
|
import { GameEvents } from '../../dto/index.js';
|
|
4
3
|
|
|
5
4
|
const group = 'Teleports suite';
|
|
@@ -18,10 +17,10 @@ const tests = [
|
|
|
18
17
|
userConfig: JSON.stringify({
|
|
19
18
|
allowPublicTeleports: true,
|
|
20
19
|
}),
|
|
21
|
-
}
|
|
20
|
+
},
|
|
22
21
|
);
|
|
23
22
|
|
|
24
|
-
const setTpEvent = this.
|
|
23
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
25
24
|
|
|
26
25
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
27
26
|
msg: '/settp test',
|
|
@@ -29,9 +28,9 @@ const tests = [
|
|
|
29
28
|
});
|
|
30
29
|
|
|
31
30
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
32
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
31
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
33
32
|
|
|
34
|
-
const setPublicEvent = this.
|
|
33
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
35
34
|
|
|
36
35
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
37
36
|
msg: '/setpublic test',
|
|
@@ -39,16 +38,16 @@ const tests = [
|
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
42
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
41
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
43
42
|
|
|
44
|
-
const tpEvent = this.
|
|
43
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
45
44
|
|
|
46
45
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
47
46
|
msg: '/tp test',
|
|
48
47
|
playerId: this.setupData.players[1].id,
|
|
49
48
|
});
|
|
50
49
|
|
|
51
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
50
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
52
51
|
},
|
|
53
52
|
}),
|
|
54
53
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -64,10 +63,10 @@ const tests = [
|
|
|
64
63
|
userConfig: JSON.stringify({
|
|
65
64
|
allowPublicTeleports: true,
|
|
66
65
|
}),
|
|
67
|
-
}
|
|
66
|
+
},
|
|
68
67
|
);
|
|
69
68
|
|
|
70
|
-
const setTpEvent = this.
|
|
69
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
71
70
|
|
|
72
71
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
73
72
|
msg: '/settp test',
|
|
@@ -75,9 +74,9 @@ const tests = [
|
|
|
75
74
|
});
|
|
76
75
|
|
|
77
76
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
78
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
77
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
79
78
|
|
|
80
|
-
const setPublicEvent = this.
|
|
79
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
81
80
|
|
|
82
81
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
83
82
|
msg: '/setpublic test',
|
|
@@ -85,9 +84,12 @@ const tests = [
|
|
|
85
84
|
});
|
|
86
85
|
|
|
87
86
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
88
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
87
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
89
88
|
|
|
90
|
-
const setPrivateEvent = this.
|
|
89
|
+
const setPrivateEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
90
|
+
GameEvents.CHAT_MESSAGE,
|
|
91
|
+
1,
|
|
92
|
+
);
|
|
91
93
|
|
|
92
94
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
93
95
|
msg: '/setprivate test',
|
|
@@ -95,16 +97,16 @@ const tests = [
|
|
|
95
97
|
});
|
|
96
98
|
|
|
97
99
|
expect((await setPrivateEvent).length).to.be.eq(1);
|
|
98
|
-
expect((await setPrivateEvent)[0].data.msg).to.be.eq('Teleport test is now private.');
|
|
100
|
+
expect((await setPrivateEvent)[0].data.meta.msg).to.be.eq('Teleport test is now private.');
|
|
99
101
|
|
|
100
|
-
const tpEvent = this.
|
|
102
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
101
103
|
|
|
102
104
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
103
105
|
msg: '/tp test',
|
|
104
106
|
playerId: this.setupData.players[1].id,
|
|
105
107
|
});
|
|
106
108
|
|
|
107
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
109
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
108
110
|
},
|
|
109
111
|
}),
|
|
110
112
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -121,10 +123,10 @@ const tests = [
|
|
|
121
123
|
allowPublicTeleports: false,
|
|
122
124
|
timeout: 0,
|
|
123
125
|
}),
|
|
124
|
-
}
|
|
126
|
+
},
|
|
125
127
|
);
|
|
126
128
|
|
|
127
|
-
const setTpEvent = this.
|
|
129
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
128
130
|
|
|
129
131
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
130
132
|
msg: '/settp test',
|
|
@@ -132,9 +134,9 @@ const tests = [
|
|
|
132
134
|
});
|
|
133
135
|
|
|
134
136
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
135
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
137
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
136
138
|
|
|
137
|
-
const setPublicEvent = this.
|
|
139
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
138
140
|
|
|
139
141
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
140
142
|
msg: '/setpublic test',
|
|
@@ -142,7 +144,7 @@ const tests = [
|
|
|
142
144
|
});
|
|
143
145
|
|
|
144
146
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
145
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Public teleports are disabled.');
|
|
147
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Public teleports are disabled.');
|
|
146
148
|
},
|
|
147
149
|
}),
|
|
148
150
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -159,10 +161,10 @@ const tests = [
|
|
|
159
161
|
allowPublicTeleports: true,
|
|
160
162
|
timeout: 0,
|
|
161
163
|
}),
|
|
162
|
-
}
|
|
164
|
+
},
|
|
163
165
|
);
|
|
164
166
|
|
|
165
|
-
const setTpEvent = this.
|
|
167
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
166
168
|
|
|
167
169
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
168
170
|
msg: '/settp test',
|
|
@@ -170,9 +172,9 @@ const tests = [
|
|
|
170
172
|
});
|
|
171
173
|
|
|
172
174
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
173
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
175
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
174
176
|
|
|
175
|
-
const setPublicEvent = this.
|
|
177
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
176
178
|
|
|
177
179
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
178
180
|
msg: '/setpublic test',
|
|
@@ -180,9 +182,9 @@ const tests = [
|
|
|
180
182
|
});
|
|
181
183
|
|
|
182
184
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
183
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
185
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq('Teleport test is now public.');
|
|
184
186
|
|
|
185
|
-
const tpEvent = this.
|
|
187
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
186
188
|
|
|
187
189
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
188
190
|
msg: '/tp test',
|
|
@@ -190,7 +192,7 @@ const tests = [
|
|
|
190
192
|
});
|
|
191
193
|
|
|
192
194
|
expect((await tpEvent).length).to.be.eq(1);
|
|
193
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
195
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
194
196
|
|
|
195
197
|
await this.client.gameserver.gameServerControllerInstallModule(
|
|
196
198
|
this.setupData.gameserver.id,
|
|
@@ -200,10 +202,10 @@ const tests = [
|
|
|
200
202
|
allowPublicTeleports: false,
|
|
201
203
|
timeout: 0,
|
|
202
204
|
}),
|
|
203
|
-
}
|
|
205
|
+
},
|
|
204
206
|
);
|
|
205
207
|
|
|
206
|
-
const tpEvent2 = this.
|
|
208
|
+
const tpEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
207
209
|
|
|
208
210
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
209
211
|
msg: '/tp test',
|
|
@@ -211,7 +213,7 @@ const tests = [
|
|
|
211
213
|
});
|
|
212
214
|
|
|
213
215
|
expect((await tpEvent2).length).to.be.eq(1);
|
|
214
|
-
expect((await tpEvent2)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
216
|
+
expect((await tpEvent2)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
215
217
|
},
|
|
216
218
|
}),
|
|
217
219
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -238,10 +240,10 @@ const tests = [
|
|
|
238
240
|
allowPublicTeleports: true,
|
|
239
241
|
timeout: 0,
|
|
240
242
|
}),
|
|
241
|
-
}
|
|
243
|
+
},
|
|
242
244
|
);
|
|
243
245
|
|
|
244
|
-
const setTpEvent = this.
|
|
246
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
245
247
|
|
|
246
248
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
247
249
|
msg: '/settp test',
|
|
@@ -249,9 +251,9 @@ const tests = [
|
|
|
249
251
|
});
|
|
250
252
|
|
|
251
253
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
252
|
-
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
254
|
+
expect((await setTpEvent)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
253
255
|
|
|
254
|
-
const setPublicEvent = this.
|
|
256
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
255
257
|
|
|
256
258
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
257
259
|
msg: '/setpublic test',
|
|
@@ -259,7 +261,9 @@ const tests = [
|
|
|
259
261
|
});
|
|
260
262
|
|
|
261
263
|
expect((await setPublicEvent).length).to.be.eq(1);
|
|
262
|
-
expect((await setPublicEvent)[0].data.msg).to.be.eq(
|
|
264
|
+
expect((await setPublicEvent)[0].data.meta.msg).to.be.eq(
|
|
265
|
+
'You do not have permission to create public teleports.',
|
|
266
|
+
);
|
|
263
267
|
},
|
|
264
268
|
}),
|
|
265
269
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -290,10 +294,10 @@ const tests = [
|
|
|
290
294
|
allowPublicTeleports: true,
|
|
291
295
|
timeout: 0,
|
|
292
296
|
}),
|
|
293
|
-
}
|
|
297
|
+
},
|
|
294
298
|
);
|
|
295
299
|
|
|
296
|
-
const setTpEvent = this.
|
|
300
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 4);
|
|
297
301
|
|
|
298
302
|
await Promise.all(
|
|
299
303
|
Array.from({ length: 4 }).map(async (_, i) => {
|
|
@@ -301,16 +305,16 @@ const tests = [
|
|
|
301
305
|
msg: `/settp test${i}`,
|
|
302
306
|
playerId: this.setupData.players[0].id,
|
|
303
307
|
});
|
|
304
|
-
})
|
|
308
|
+
}),
|
|
305
309
|
);
|
|
306
310
|
|
|
307
311
|
expect((await setTpEvent).length).to.be.eq(4);
|
|
308
312
|
|
|
309
313
|
for (const event of await setTpEvent) {
|
|
310
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
314
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
311
315
|
}
|
|
312
316
|
|
|
313
|
-
const setPublicEvent = this.
|
|
317
|
+
const setPublicEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
314
318
|
|
|
315
319
|
await Promise.all(
|
|
316
320
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -318,16 +322,19 @@ const tests = [
|
|
|
318
322
|
msg: `/setpublic test${i}`,
|
|
319
323
|
playerId: this.setupData.players[0].id,
|
|
320
324
|
});
|
|
321
|
-
})
|
|
325
|
+
}),
|
|
322
326
|
);
|
|
323
327
|
|
|
324
328
|
expect((await setPublicEvent).length).to.be.eq(3);
|
|
325
329
|
|
|
326
330
|
for (const event of await setPublicEvent) {
|
|
327
|
-
expect(event.data.msg).to.match(/Teleport test\d is now public\./);
|
|
331
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d is now public\./);
|
|
328
332
|
}
|
|
329
333
|
|
|
330
|
-
const setPublicEvent2 = this.
|
|
334
|
+
const setPublicEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
335
|
+
GameEvents.CHAT_MESSAGE,
|
|
336
|
+
1,
|
|
337
|
+
);
|
|
331
338
|
|
|
332
339
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
333
340
|
msg: '/setpublic test4',
|
|
@@ -336,8 +343,8 @@ const tests = [
|
|
|
336
343
|
|
|
337
344
|
expect((await setPublicEvent2).length).to.be.eq(1);
|
|
338
345
|
|
|
339
|
-
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'
|
|
346
|
+
expect((await setPublicEvent2)[0].data.meta.msg).to.be.eq(
|
|
347
|
+
'You have reached the maximum number of public teleports for your role, maximum allowed is 3',
|
|
341
348
|
);
|
|
342
349
|
},
|
|
343
350
|
}),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IntegrationTest, expect } from '@takaro/test';
|
|
2
|
-
import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
3
2
|
import { GameEvents } from '../../dto/index.js';
|
|
4
3
|
|
|
5
4
|
const group = 'Teleports suite';
|
|
@@ -13,26 +12,26 @@ 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
|
-
const setEvents = this.
|
|
18
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
20
19
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
21
20
|
msg: '/settp test',
|
|
22
21
|
playerId: this.setupData.players[0].id,
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
expect((await setEvents).length).to.be.eq(1);
|
|
26
|
-
expect((await setEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
25
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
27
26
|
|
|
28
|
-
const events = this.
|
|
27
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
29
28
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
30
29
|
msg: '/tp test',
|
|
31
30
|
playerId: this.setupData.players[0].id,
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
expect((await events).length).to.be.eq(1);
|
|
35
|
-
expect((await events)[0].data.msg).to.be.eq('Teleported to test.');
|
|
34
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
36
35
|
},
|
|
37
36
|
}),
|
|
38
37
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -43,9 +42,9 @@ 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
|
-
const events = this.
|
|
47
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
49
48
|
|
|
50
49
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
51
50
|
msg: '/tp test',
|
|
@@ -53,7 +52,7 @@ const tests = [
|
|
|
53
52
|
});
|
|
54
53
|
|
|
55
54
|
expect((await events).length).to.be.eq(1);
|
|
56
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
55
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
57
56
|
},
|
|
58
57
|
}),
|
|
59
58
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -69,10 +68,10 @@ const tests = [
|
|
|
69
68
|
userConfig: JSON.stringify({
|
|
70
69
|
timeout: 5000,
|
|
71
70
|
}),
|
|
72
|
-
}
|
|
71
|
+
},
|
|
73
72
|
);
|
|
74
73
|
|
|
75
|
-
const setTpEvent = this.
|
|
74
|
+
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
76
75
|
|
|
77
76
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
78
77
|
msg: '/settp test',
|
|
@@ -81,23 +80,25 @@ const tests = [
|
|
|
81
80
|
|
|
82
81
|
expect((await setTpEvent).length).to.be.eq(1);
|
|
83
82
|
|
|
84
|
-
const tpEvent = this.
|
|
83
|
+
const tpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
85
84
|
|
|
86
85
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
87
86
|
msg: '/tp test',
|
|
88
87
|
playerId: this.setupData.players[0].id,
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
90
|
+
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
92
91
|
|
|
93
|
-
const tpTimeoutEvent = this.
|
|
92
|
+
const tpTimeoutEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
94
93
|
|
|
95
94
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
96
95
|
msg: '/tp test',
|
|
97
96
|
playerId: this.setupData.players[0].id,
|
|
98
97
|
});
|
|
99
98
|
|
|
100
|
-
expect((await tpTimeoutEvent)[0].data.msg).to.be.eq(
|
|
99
|
+
expect((await tpTimeoutEvent)[0].data.meta.msg).to.be.eq(
|
|
100
|
+
'You cannot teleport yet. Please wait before trying again.',
|
|
101
|
+
);
|
|
101
102
|
},
|
|
102
103
|
}),
|
|
103
104
|
];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IntegrationTest, expect } from '@takaro/test';
|
|
2
|
-
import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
3
2
|
import { GameEvents } from '../../dto/index.js';
|
|
4
3
|
|
|
5
4
|
const group = 'Teleports suite';
|
|
@@ -13,9 +12,9 @@ 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
|
-
const events = this.
|
|
17
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
19
18
|
|
|
20
19
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
21
20
|
msg: '/settp test',
|
|
@@ -23,7 +22,7 @@ const tests = [
|
|
|
23
22
|
});
|
|
24
23
|
|
|
25
24
|
expect((await events).length).to.be.eq(1);
|
|
26
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test set.');
|
|
25
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
27
26
|
},
|
|
28
27
|
}),
|
|
29
28
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -34,10 +33,10 @@ 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
|
-
const firstEvents = this.
|
|
39
|
+
const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
41
40
|
|
|
42
41
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
43
42
|
msg: '/settp test',
|
|
@@ -45,9 +44,9 @@ const tests = [
|
|
|
45
44
|
});
|
|
46
45
|
|
|
47
46
|
expect((await firstEvents).length).to.be.eq(1);
|
|
48
|
-
expect((await firstEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
47
|
+
expect((await firstEvents)[0].data.meta.msg).to.be.eq('Teleport test set.');
|
|
49
48
|
|
|
50
|
-
const secondEvents = this.
|
|
49
|
+
const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
51
50
|
|
|
52
51
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
53
52
|
msg: '/settp test',
|
|
@@ -55,8 +54,8 @@ const tests = [
|
|
|
55
54
|
});
|
|
56
55
|
|
|
57
56
|
expect((await secondEvents).length).to.be.eq(1);
|
|
58
|
-
expect((await secondEvents)[0].data.msg).to.be.eq(
|
|
59
|
-
'Teleport test already exists, use /deletetp test to delete it.'
|
|
57
|
+
expect((await secondEvents)[0].data.meta.msg).to.be.eq(
|
|
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']);
|
|
@@ -81,7 +80,7 @@ const tests = [
|
|
|
81
80
|
],
|
|
82
81
|
});
|
|
83
82
|
|
|
84
|
-
const setEvents = this.
|
|
83
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
85
84
|
|
|
86
85
|
await Promise.all(
|
|
87
86
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -89,15 +88,15 @@ 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);
|
|
96
95
|
|
|
97
96
|
for (const event of await setEvents) {
|
|
98
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
97
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
99
98
|
}
|
|
100
|
-
const events = this.
|
|
99
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
101
100
|
|
|
102
101
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
103
102
|
msg: '/settp test',
|
|
@@ -105,8 +104,8 @@ const tests = [
|
|
|
105
104
|
});
|
|
106
105
|
|
|
107
106
|
expect((await events).length).to.be.eq(1);
|
|
108
|
-
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'
|
|
107
|
+
expect((await events)[0].data.meta.msg).to.be.eq(
|
|
108
|
+
'You have reached the maximum number of teleports for your role, maximum allowed is 3',
|
|
110
109
|
);
|
|
111
110
|
},
|
|
112
111
|
}),
|
|
@@ -118,9 +117,9 @@ 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
|
-
const setEvents = this.
|
|
122
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
124
123
|
|
|
125
124
|
await Promise.all(
|
|
126
125
|
Array.from({ length: 3 }).map(async (_, i) => {
|
|
@@ -128,22 +127,22 @@ 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);
|
|
135
134
|
|
|
136
135
|
for (const event of await setEvents) {
|
|
137
|
-
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
136
|
+
expect(event.data.meta.msg).to.match(/Teleport test\d set\./);
|
|
138
137
|
}
|
|
139
|
-
const events = this.
|
|
138
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
140
139
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
141
140
|
msg: '/deletetp test1',
|
|
142
141
|
playerId: this.setupData.players[0].id,
|
|
143
142
|
});
|
|
144
143
|
|
|
145
144
|
expect((await events).length).to.be.eq(1);
|
|
146
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test1 deleted.');
|
|
145
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test1 deleted.');
|
|
147
146
|
},
|
|
148
147
|
}),
|
|
149
148
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -154,16 +153,16 @@ 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
|
-
const events = this.
|
|
158
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
160
159
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
161
160
|
msg: '/deletetp test',
|
|
162
161
|
playerId: this.setupData.players[0].id,
|
|
163
162
|
});
|
|
164
163
|
|
|
165
164
|
expect((await events).length).to.be.eq(1);
|
|
166
|
-
expect((await events)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
165
|
+
expect((await events)[0].data.meta.msg).to.be.eq('Teleport test does not exist.');
|
|
167
166
|
},
|
|
168
167
|
}),
|
|
169
168
|
];
|