@takaro/modules 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/BuiltinModule.d.ts +49 -0
- package/dist/BuiltinModule.js +194 -0
- package/dist/BuiltinModule.js.map +1 -0
- package/dist/dto/base.d.ts +6 -0
- package/dist/dto/base.js +28 -0
- package/dist/dto/base.js.map +1 -0
- package/dist/dto/discordEvents.d.ts +31 -0
- package/dist/dto/discordEvents.js +92 -0
- package/dist/dto/discordEvents.js.map +1 -0
- package/dist/dto/gameEvents.d.ts +84 -0
- package/dist/dto/gameEvents.js +190 -0
- package/dist/dto/gameEvents.js.map +1 -0
- package/dist/dto/index.d.ts +37 -0
- package/dist/dto/index.js +18 -0
- package/dist/dto/index.js.map +1 -0
- package/dist/dto/takaroEvents.d.ts +150 -0
- package/dist/dto/takaroEvents.js +422 -0
- package/dist/dto/takaroEvents.js.map +1 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +31 -0
- package/dist/main.js.map +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.js +18 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.js.map +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.js +14 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.js +9 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +9 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -0
- package/dist/modules/chatBridge/index.d.ts +4 -0
- package/dist/modules/chatBridge/index.js +54 -0
- package/dist/modules/chatBridge/index.js.map +1 -0
- package/dist/modules/economyUtils/commands/balance.d.ts +1 -0
- package/dist/modules/economyUtils/commands/balance.js +7 -0
- package/dist/modules/economyUtils/commands/balance.js.map +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.js +38 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.js.map +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.js +31 -0
- package/dist/modules/economyUtils/commands/grantCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.js +31 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.js +22 -0
- package/dist/modules/economyUtils/commands/topCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/transfer.d.ts +1 -0
- package/dist/modules/economyUtils/commands/transfer.js +55 -0
- package/dist/modules/economyUtils/commands/transfer.js.map +1 -0
- package/dist/modules/economyUtils/index.d.ts +4 -0
- package/dist/modules/economyUtils/index.js +117 -0
- package/dist/modules/economyUtils/index.js.map +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.d.ts +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js +50 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -0
- package/dist/modules/geoBlock/index.d.ts +8 -0
- package/dist/modules/geoBlock/index.js +321 -0
- package/dist/modules/geoBlock/index.js.map +1 -0
- package/dist/modules/gimme/commands/gimme.d.ts +1 -0
- package/dist/modules/gimme/commands/gimme.js +23 -0
- package/dist/modules/gimme/commands/gimme.js.map +1 -0
- package/dist/modules/gimme/index.d.ts +4 -0
- package/dist/modules/gimme/index.js +43 -0
- package/dist/modules/gimme/index.js.map +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.js +54 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.js.map +1 -0
- package/dist/modules/highPingKicker/index.d.ts +4 -0
- package/dist/modules/highPingKicker/index.js +34 -0
- package/dist/modules/highPingKicker/index.js.map +1 -0
- package/dist/modules/lottery/commands/buyTicket.d.ts +1 -0
- package/dist/modules/lottery/commands/buyTicket.js +54 -0
- package/dist/modules/lottery/commands/buyTicket.js.map +1 -0
- package/dist/modules/lottery/commands/nextDraw.d.ts +1 -0
- package/dist/modules/lottery/commands/nextDraw.js +34 -0
- package/dist/modules/lottery/commands/nextDraw.js.map +1 -0
- package/dist/modules/lottery/commands/viewTickets.d.ts +1 -0
- package/dist/modules/lottery/commands/viewTickets.js +23 -0
- package/dist/modules/lottery/commands/viewTickets.js.map +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.d.ts +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.js +96 -0
- package/dist/modules/lottery/cronJobs/drawLottery.js.map +1 -0
- package/dist/modules/lottery/index.d.ts +4 -0
- package/dist/modules/lottery/index.js +73 -0
- package/dist/modules/lottery/index.js.map +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.d.ts +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js +34 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.js +11 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.js.map +1 -0
- package/dist/modules/playerOnboarding/index.d.ts +4 -0
- package/dist/modules/playerOnboarding/index.js +51 -0
- package/dist/modules/playerOnboarding/index.js.map +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.js +9 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.js.map +1 -0
- package/dist/modules/serverMessages/index.d.ts +4 -0
- package/dist/modules/serverMessages/index.js +35 -0
- package/dist/modules/serverMessages/index.js.map +1 -0
- package/dist/modules/teleports/commands/deletetp.d.ts +1 -0
- package/dist/modules/teleports/commands/deletetp.js +20 -0
- package/dist/modules/teleports/commands/deletetp.js.map +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.js +54 -0
- package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/listwaypoints.d.ts +1 -0
- package/dist/modules/teleports/commands/listwaypoints.js +36 -0
- package/dist/modules/teleports/commands/listwaypoints.js.map +1 -0
- package/dist/modules/teleports/commands/setprivate.d.ts +1 -0
- package/dist/modules/teleports/commands/setprivate.js +31 -0
- package/dist/modules/teleports/commands/setprivate.js.map +1 -0
- package/dist/modules/teleports/commands/setpublic.d.ts +1 -0
- package/dist/modules/teleports/commands/setpublic.js +55 -0
- package/dist/modules/teleports/commands/setpublic.js.map +1 -0
- package/dist/modules/teleports/commands/settp.d.ts +1 -0
- package/dist/modules/teleports/commands/settp.js +42 -0
- package/dist/modules/teleports/commands/settp.js.map +1 -0
- package/dist/modules/teleports/commands/setwaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/setwaypoint.js +88 -0
- package/dist/modules/teleports/commands/setwaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/teleport.d.ts +1 -0
- package/dist/modules/teleports/commands/teleport.js +74 -0
- package/dist/modules/teleports/commands/teleport.js.map +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js +50 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/tplist.d.ts +1 -0
- package/dist/modules/teleports/commands/tplist.js +45 -0
- package/dist/modules/teleports/commands/tplist.js.map +1 -0
- package/dist/modules/teleports/functions/utils.d.ts +2 -0
- package/dist/modules/teleports/functions/utils.js +18 -0
- package/dist/modules/teleports/functions/utils.js.map +1 -0
- package/dist/modules/teleports/index.d.ts +4 -0
- package/dist/modules/teleports/index.js +184 -0
- package/dist/modules/teleports/index.js.map +1 -0
- package/dist/modules/utils/commands/help.d.ts +1 -0
- package/dist/modules/utils/commands/help.js +29 -0
- package/dist/modules/utils/commands/help.js.map +1 -0
- package/dist/modules/utils/commands/ping.d.ts +1 -0
- package/dist/modules/utils/commands/ping.js +6 -0
- package/dist/modules/utils/commands/ping.js.map +1 -0
- package/dist/modules/utils/index.d.ts +4 -0
- package/dist/modules/utils/index.js +35 -0
- package/dist/modules/utils/index.js.map +1 -0
- package/dist/modules.json +478 -0
- package/package.json +26 -0
- package/scripts/buildBuiltinJson.ts +14 -0
- package/src/BuiltinModule.ts +125 -0
- package/src/__tests__/aliases.integration.test.ts +54 -0
- package/src/__tests__/builtinmodule.unit.test.ts +13 -0
- package/src/__tests__/commandArgs.integration.test.ts +285 -0
- package/src/__tests__/economyUtils.integration.test.ts +488 -0
- package/src/__tests__/geoblock.integration.test.ts +380 -0
- package/src/__tests__/gimme.integration.test.ts +97 -0
- package/src/__tests__/help.integration.test.ts +133 -0
- package/src/__tests__/lottery.integration.test.ts +332 -0
- package/src/__tests__/modulePermission.integration.test.ts +192 -0
- package/src/__tests__/onboarding.integration.test.ts +123 -0
- package/src/__tests__/ping.integration.test.ts +36 -0
- package/src/__tests__/roleExpiry.integration.test.ts +74 -0
- package/src/__tests__/serverMessages.integration.test.ts +104 -0
- package/src/__tests__/systemConfigCost.integration.test.ts +196 -0
- package/src/__tests__/teleports/listtp.integration.test.ts +115 -0
- package/src/__tests__/teleports/publicteleports.integration.test.ts +350 -0
- package/src/__tests__/teleports/teleport.integration.test.ts +109 -0
- package/src/__tests__/teleports/tpManagement.integration.test.ts +175 -0
- package/src/__tests__/teleports/waypoints.integration.test.ts +613 -0
- package/src/dto/base.ts +13 -0
- package/src/dto/discordEvents.ts +69 -0
- package/src/dto/gameEvents.ts +154 -0
- package/src/dto/index.ts +25 -0
- package/src/dto/takaroEvents.ts +290 -0
- package/src/main.ts +36 -0
- package/src/modules/.eslintrc +5 -0
- package/src/modules/chatBridge/hooks/DiscordToGame.js +18 -0
- package/src/modules/chatBridge/hooks/GameToDiscord.js +18 -0
- package/src/modules/chatBridge/hooks/PlayerConnected.js +11 -0
- package/src/modules/chatBridge/hooks/PlayerDisconnected.js +11 -0
- package/src/modules/chatBridge/index.ts +59 -0
- package/src/modules/economyUtils/commands/balance.js +8 -0
- package/src/modules/economyUtils/commands/confirmTransfer.js +55 -0
- package/src/modules/economyUtils/commands/grantCurrency.js +38 -0
- package/src/modules/economyUtils/commands/revokeCurrency.js +38 -0
- package/src/modules/economyUtils/commands/topCurrency.js +29 -0
- package/src/modules/economyUtils/commands/transfer.js +73 -0
- package/src/modules/economyUtils/index.ts +125 -0
- package/src/modules/geoBlock/hooks/IPDetected.js +52 -0
- package/src/modules/geoBlock/index.ts +331 -0
- package/src/modules/gimme/commands/gimme.js +28 -0
- package/src/modules/gimme/index.ts +49 -0
- package/src/modules/highPingKicker/cronJobs/Ping check.js +66 -0
- package/src/modules/highPingKicker/index.ts +39 -0
- package/src/modules/lottery/commands/buyTicket.js +68 -0
- package/src/modules/lottery/commands/nextDraw.js +45 -0
- package/src/modules/lottery/commands/viewTickets.js +32 -0
- package/src/modules/lottery/cronJobs/drawLottery.js +124 -0
- package/src/modules/lottery/index.ts +80 -0
- package/src/modules/playerOnboarding/commands/starterkit.js +47 -0
- package/src/modules/playerOnboarding/hooks/playerConnected.js +14 -0
- package/src/modules/playerOnboarding/index.ts +58 -0
- package/src/modules/serverMessages/cronJobs/Automated message.js +12 -0
- package/src/modules/serverMessages/index.ts +40 -0
- package/src/modules/teleports/commands/deletetp.js +25 -0
- package/src/modules/teleports/commands/deletewaypoint.js +77 -0
- package/src/modules/teleports/commands/listwaypoints.js +55 -0
- package/src/modules/teleports/commands/setprivate.js +39 -0
- package/src/modules/teleports/commands/setpublic.js +71 -0
- package/src/modules/teleports/commands/settp.js +54 -0
- package/src/modules/teleports/commands/setwaypoint.js +112 -0
- package/src/modules/teleports/commands/teleport.js +93 -0
- package/src/modules/teleports/commands/teleportwaypoint.js +72 -0
- package/src/modules/teleports/commands/tplist.js +61 -0
- package/src/modules/teleports/functions/utils.js +20 -0
- package/src/modules/teleports/index.ts +193 -0
- package/src/modules/utils/commands/help.js +38 -0
- package/src/modules/utils/commands/ping.js +7 -0
- package/src/modules/utils/index.ts +40 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +9 -0
- package/typedoc.json +3 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { IntegrationTest, expect } from '@takaro/test';
|
|
2
|
+
import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
3
|
+
import { GameEvents } from '../../dto/index.js';
|
|
4
|
+
|
|
5
|
+
const group = 'Teleports suite';
|
|
6
|
+
|
|
7
|
+
const tests = [
|
|
8
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
9
|
+
group,
|
|
10
|
+
snapshot: false,
|
|
11
|
+
setup: modulesTestSetup,
|
|
12
|
+
name: 'Can set teleports as public, allowing other players to use it',
|
|
13
|
+
test: async function () {
|
|
14
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
15
|
+
this.setupData.gameserver.id,
|
|
16
|
+
this.setupData.teleportsModule.id,
|
|
17
|
+
{
|
|
18
|
+
userConfig: JSON.stringify({
|
|
19
|
+
allowPublicTeleports: true,
|
|
20
|
+
}),
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
25
|
+
|
|
26
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
27
|
+
msg: '/settp test',
|
|
28
|
+
playerId: this.setupData.players[0].id,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect((await setTpEvent).length).to.be.eq(1);
|
|
32
|
+
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
33
|
+
|
|
34
|
+
const setPublicEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
35
|
+
|
|
36
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
37
|
+
msg: '/setpublic test',
|
|
38
|
+
playerId: this.setupData.players[0].id,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect((await setPublicEvent).length).to.be.eq(1);
|
|
42
|
+
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
43
|
+
|
|
44
|
+
const tpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
45
|
+
|
|
46
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
47
|
+
msg: '/tp test',
|
|
48
|
+
playerId: this.setupData.players[1].id,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
55
|
+
group,
|
|
56
|
+
snapshot: false,
|
|
57
|
+
setup: modulesTestSetup,
|
|
58
|
+
name: 'Can set public teleports as private again',
|
|
59
|
+
test: async function () {
|
|
60
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
61
|
+
this.setupData.gameserver.id,
|
|
62
|
+
this.setupData.teleportsModule.id,
|
|
63
|
+
{
|
|
64
|
+
userConfig: JSON.stringify({
|
|
65
|
+
allowPublicTeleports: true,
|
|
66
|
+
}),
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
71
|
+
|
|
72
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
73
|
+
msg: '/settp test',
|
|
74
|
+
playerId: this.setupData.players[0].id,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect((await setTpEvent).length).to.be.eq(1);
|
|
78
|
+
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
79
|
+
|
|
80
|
+
const setPublicEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
81
|
+
|
|
82
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
83
|
+
msg: '/setpublic test',
|
|
84
|
+
playerId: this.setupData.players[0].id,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect((await setPublicEvent).length).to.be.eq(1);
|
|
88
|
+
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
89
|
+
|
|
90
|
+
const setPrivateEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
91
|
+
|
|
92
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
93
|
+
msg: '/setprivate test',
|
|
94
|
+
playerId: this.setupData.players[0].id,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
expect((await setPrivateEvent).length).to.be.eq(1);
|
|
98
|
+
expect((await setPrivateEvent)[0].data.msg).to.be.eq('Teleport test is now private.');
|
|
99
|
+
|
|
100
|
+
const tpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
101
|
+
|
|
102
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
103
|
+
msg: '/tp test',
|
|
104
|
+
playerId: this.setupData.players[1].id,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
expect((await tpEvent)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
111
|
+
group,
|
|
112
|
+
snapshot: false,
|
|
113
|
+
setup: modulesTestSetup,
|
|
114
|
+
name: 'When configured to not allow public teleports, creating public teleports is not allowed',
|
|
115
|
+
test: async function () {
|
|
116
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
117
|
+
this.setupData.gameserver.id,
|
|
118
|
+
this.setupData.teleportsModule.id,
|
|
119
|
+
{
|
|
120
|
+
userConfig: JSON.stringify({
|
|
121
|
+
allowPublicTeleports: false,
|
|
122
|
+
timeout: 0,
|
|
123
|
+
}),
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
128
|
+
|
|
129
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
130
|
+
msg: '/settp test',
|
|
131
|
+
playerId: this.setupData.players[0].id,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
expect((await setTpEvent).length).to.be.eq(1);
|
|
135
|
+
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
136
|
+
|
|
137
|
+
const setPublicEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
138
|
+
|
|
139
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
140
|
+
msg: '/setpublic test',
|
|
141
|
+
playerId: this.setupData.players[0].id,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
expect((await setPublicEvent).length).to.be.eq(1);
|
|
145
|
+
expect((await setPublicEvent)[0].data.msg).to.be.eq('Public teleports are disabled.');
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
149
|
+
group,
|
|
150
|
+
snapshot: false,
|
|
151
|
+
setup: modulesTestSetup,
|
|
152
|
+
name: 'When configured to not allow public teleports, players cannot teleport to public teleports',
|
|
153
|
+
test: async function () {
|
|
154
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
155
|
+
this.setupData.gameserver.id,
|
|
156
|
+
this.setupData.teleportsModule.id,
|
|
157
|
+
{
|
|
158
|
+
userConfig: JSON.stringify({
|
|
159
|
+
allowPublicTeleports: true,
|
|
160
|
+
timeout: 0,
|
|
161
|
+
}),
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
166
|
+
|
|
167
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
168
|
+
msg: '/settp test',
|
|
169
|
+
playerId: this.setupData.players[0].id,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
expect((await setTpEvent).length).to.be.eq(1);
|
|
173
|
+
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
174
|
+
|
|
175
|
+
const setPublicEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
176
|
+
|
|
177
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
178
|
+
msg: '/setpublic test',
|
|
179
|
+
playerId: this.setupData.players[0].id,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
expect((await setPublicEvent).length).to.be.eq(1);
|
|
183
|
+
expect((await setPublicEvent)[0].data.msg).to.be.eq('Teleport test is now public.');
|
|
184
|
+
|
|
185
|
+
const tpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
186
|
+
|
|
187
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
188
|
+
msg: '/tp test',
|
|
189
|
+
playerId: this.setupData.players[1].id,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
expect((await tpEvent).length).to.be.eq(1);
|
|
193
|
+
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
194
|
+
|
|
195
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
196
|
+
this.setupData.gameserver.id,
|
|
197
|
+
this.setupData.teleportsModule.id,
|
|
198
|
+
{
|
|
199
|
+
userConfig: JSON.stringify({
|
|
200
|
+
allowPublicTeleports: false,
|
|
201
|
+
timeout: 0,
|
|
202
|
+
}),
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
const tpEvent2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
207
|
+
|
|
208
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
209
|
+
msg: '/tp test',
|
|
210
|
+
playerId: this.setupData.players[1].id,
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
expect((await tpEvent2).length).to.be.eq(1);
|
|
214
|
+
expect((await tpEvent2)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
217
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
218
|
+
group,
|
|
219
|
+
snapshot: false,
|
|
220
|
+
setup: modulesTestSetup,
|
|
221
|
+
name: 'If player does not have role to create public teleports, command gets denied',
|
|
222
|
+
test: async function () {
|
|
223
|
+
const useTeleportsRole = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
|
|
224
|
+
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
225
|
+
permissions: [
|
|
226
|
+
{
|
|
227
|
+
permissionId: useTeleportsRole[0].permissionId,
|
|
228
|
+
count: 3,
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
234
|
+
this.setupData.gameserver.id,
|
|
235
|
+
this.setupData.teleportsModule.id,
|
|
236
|
+
{
|
|
237
|
+
userConfig: JSON.stringify({
|
|
238
|
+
allowPublicTeleports: true,
|
|
239
|
+
timeout: 0,
|
|
240
|
+
}),
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
245
|
+
|
|
246
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
247
|
+
msg: '/settp test',
|
|
248
|
+
playerId: this.setupData.players[1].id,
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
expect((await setTpEvent).length).to.be.eq(1);
|
|
252
|
+
expect((await setTpEvent)[0].data.msg).to.be.eq('Teleport test set.');
|
|
253
|
+
|
|
254
|
+
const setPublicEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
255
|
+
|
|
256
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
257
|
+
msg: '/setpublic test',
|
|
258
|
+
playerId: this.setupData.players[1].id,
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
expect((await setPublicEvent).length).to.be.eq(1);
|
|
262
|
+
expect((await setPublicEvent)[0].data.msg).to.be.eq('You do not have permission to create public teleports.');
|
|
263
|
+
},
|
|
264
|
+
}),
|
|
265
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
266
|
+
group,
|
|
267
|
+
snapshot: false,
|
|
268
|
+
setup: modulesTestSetup,
|
|
269
|
+
name: 'Prohibits players from settings more public teleports than their role allows',
|
|
270
|
+
test: async function () {
|
|
271
|
+
const permissionRes = await this.client.permissionCodesToInputs(['TELEPORTS_CREATE_PUBLIC', 'TELEPORTS_USE']);
|
|
272
|
+
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
273
|
+
permissions: [
|
|
274
|
+
{
|
|
275
|
+
permissionId: permissionRes[0].permissionId,
|
|
276
|
+
count: 3,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
permissionId: permissionRes[1].permissionId,
|
|
280
|
+
count: 5,
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
286
|
+
this.setupData.gameserver.id,
|
|
287
|
+
this.setupData.teleportsModule.id,
|
|
288
|
+
{
|
|
289
|
+
userConfig: JSON.stringify({
|
|
290
|
+
allowPublicTeleports: true,
|
|
291
|
+
timeout: 0,
|
|
292
|
+
}),
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 4);
|
|
297
|
+
|
|
298
|
+
await Promise.all(
|
|
299
|
+
Array.from({ length: 4 }).map(async (_, i) => {
|
|
300
|
+
return this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
301
|
+
msg: `/settp test${i}`,
|
|
302
|
+
playerId: this.setupData.players[0].id,
|
|
303
|
+
});
|
|
304
|
+
})
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
expect((await setTpEvent).length).to.be.eq(4);
|
|
308
|
+
|
|
309
|
+
for (const event of await setTpEvent) {
|
|
310
|
+
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const setPublicEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
314
|
+
|
|
315
|
+
await Promise.all(
|
|
316
|
+
Array.from({ length: 3 }).map(async (_, i) => {
|
|
317
|
+
return this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
318
|
+
msg: `/setpublic test${i}`,
|
|
319
|
+
playerId: this.setupData.players[0].id,
|
|
320
|
+
});
|
|
321
|
+
})
|
|
322
|
+
);
|
|
323
|
+
|
|
324
|
+
expect((await setPublicEvent).length).to.be.eq(3);
|
|
325
|
+
|
|
326
|
+
for (const event of await setPublicEvent) {
|
|
327
|
+
expect(event.data.msg).to.match(/Teleport test\d is now public\./);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const setPublicEvent2 = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
331
|
+
|
|
332
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
333
|
+
msg: '/setpublic test4',
|
|
334
|
+
playerId: this.setupData.players[0].id,
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
expect((await setPublicEvent2).length).to.be.eq(1);
|
|
338
|
+
|
|
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'
|
|
341
|
+
);
|
|
342
|
+
},
|
|
343
|
+
}),
|
|
344
|
+
];
|
|
345
|
+
|
|
346
|
+
describe(group, function () {
|
|
347
|
+
tests.forEach((test) => {
|
|
348
|
+
test.run();
|
|
349
|
+
});
|
|
350
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { IntegrationTest, expect } from '@takaro/test';
|
|
2
|
+
import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
3
|
+
import { GameEvents } from '../../dto/index.js';
|
|
4
|
+
|
|
5
|
+
const group = 'Teleports suite';
|
|
6
|
+
|
|
7
|
+
const tests = [
|
|
8
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
9
|
+
group,
|
|
10
|
+
snapshot: false,
|
|
11
|
+
setup: modulesTestSetup,
|
|
12
|
+
name: 'Can teleport with /tp',
|
|
13
|
+
test: async function () {
|
|
14
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
15
|
+
this.setupData.gameserver.id,
|
|
16
|
+
this.setupData.teleportsModule.id
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
20
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
21
|
+
msg: '/settp test',
|
|
22
|
+
playerId: this.setupData.players[0].id,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect((await setEvents).length).to.be.eq(1);
|
|
26
|
+
expect((await setEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
27
|
+
|
|
28
|
+
const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
29
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
30
|
+
msg: '/tp test',
|
|
31
|
+
playerId: this.setupData.players[0].id,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect((await events).length).to.be.eq(1);
|
|
35
|
+
expect((await events)[0].data.msg).to.be.eq('Teleported to test.');
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
39
|
+
group,
|
|
40
|
+
snapshot: false,
|
|
41
|
+
setup: modulesTestSetup,
|
|
42
|
+
name: 'Shows an error when teleporting to a non-existing teleport',
|
|
43
|
+
test: async function () {
|
|
44
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
45
|
+
this.setupData.gameserver.id,
|
|
46
|
+
this.setupData.teleportsModule.id
|
|
47
|
+
);
|
|
48
|
+
const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
49
|
+
|
|
50
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
51
|
+
msg: '/tp test',
|
|
52
|
+
playerId: this.setupData.players[0].id,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
expect((await events).length).to.be.eq(1);
|
|
56
|
+
expect((await events)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
60
|
+
group,
|
|
61
|
+
snapshot: false,
|
|
62
|
+
setup: modulesTestSetup,
|
|
63
|
+
name: 'Times out when teleporting faster than set timeout',
|
|
64
|
+
test: async function () {
|
|
65
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
66
|
+
this.setupData.gameserver.id,
|
|
67
|
+
this.setupData.teleportsModule.id,
|
|
68
|
+
{
|
|
69
|
+
userConfig: JSON.stringify({
|
|
70
|
+
timeout: 5000,
|
|
71
|
+
}),
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const setTpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
76
|
+
|
|
77
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
78
|
+
msg: '/settp test',
|
|
79
|
+
playerId: this.setupData.players[0].id,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
expect((await setTpEvent).length).to.be.eq(1);
|
|
83
|
+
|
|
84
|
+
const tpEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
85
|
+
|
|
86
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
87
|
+
msg: '/tp test',
|
|
88
|
+
playerId: this.setupData.players[0].id,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect((await tpEvent)[0].data.msg).to.be.eq('Teleported to test.');
|
|
92
|
+
|
|
93
|
+
const tpTimeoutEvent = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
94
|
+
|
|
95
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
96
|
+
msg: '/tp test',
|
|
97
|
+
playerId: this.setupData.players[0].id,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expect((await tpTimeoutEvent)[0].data.msg).to.be.eq('You cannot teleport yet. Please wait before trying again.');
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
describe(group, function () {
|
|
106
|
+
tests.forEach((test) => {
|
|
107
|
+
test.run();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { IntegrationTest, expect } from '@takaro/test';
|
|
2
|
+
import { IModuleTestsSetupData, modulesTestSetup } from '@takaro/test';
|
|
3
|
+
import { GameEvents } from '../../dto/index.js';
|
|
4
|
+
|
|
5
|
+
const group = 'Teleports suite';
|
|
6
|
+
|
|
7
|
+
const tests = [
|
|
8
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
9
|
+
group,
|
|
10
|
+
snapshot: false,
|
|
11
|
+
setup: modulesTestSetup,
|
|
12
|
+
name: 'Can set a teleport with /settp',
|
|
13
|
+
test: async function () {
|
|
14
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
15
|
+
this.setupData.gameserver.id,
|
|
16
|
+
this.setupData.teleportsModule.id
|
|
17
|
+
);
|
|
18
|
+
const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
19
|
+
|
|
20
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
21
|
+
msg: '/settp test',
|
|
22
|
+
playerId: this.setupData.players[0].id,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
expect((await events).length).to.be.eq(1);
|
|
26
|
+
expect((await events)[0].data.msg).to.be.eq('Teleport test set.');
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
30
|
+
group,
|
|
31
|
+
snapshot: false,
|
|
32
|
+
setup: modulesTestSetup,
|
|
33
|
+
name: 'Shows an error when setting a teleport with an existing name',
|
|
34
|
+
test: async function () {
|
|
35
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
36
|
+
this.setupData.gameserver.id,
|
|
37
|
+
this.setupData.teleportsModule.id
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const firstEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
41
|
+
|
|
42
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
43
|
+
msg: '/settp test',
|
|
44
|
+
playerId: this.setupData.players[0].id,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expect((await firstEvents).length).to.be.eq(1);
|
|
48
|
+
expect((await firstEvents)[0].data.msg).to.be.eq('Teleport test set.');
|
|
49
|
+
|
|
50
|
+
const secondEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
51
|
+
|
|
52
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
53
|
+
msg: '/settp test',
|
|
54
|
+
playerId: this.setupData.players[0].id,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
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.'
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
63
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
64
|
+
group,
|
|
65
|
+
snapshot: false,
|
|
66
|
+
setup: modulesTestSetup,
|
|
67
|
+
name: 'Cannot set more than the user-defined amount of max teleports',
|
|
68
|
+
test: async function () {
|
|
69
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
70
|
+
this.setupData.gameserver.id,
|
|
71
|
+
this.setupData.teleportsModule.id
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const useTeleportsRole = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
|
|
75
|
+
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
76
|
+
permissions: [
|
|
77
|
+
{
|
|
78
|
+
permissionId: useTeleportsRole[0].permissionId,
|
|
79
|
+
count: 3,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
85
|
+
|
|
86
|
+
await Promise.all(
|
|
87
|
+
Array.from({ length: 3 }).map(async (_, i) => {
|
|
88
|
+
return this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
89
|
+
msg: `/settp test${i}`,
|
|
90
|
+
playerId: this.setupData.players[0].id,
|
|
91
|
+
});
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
expect((await setEvents).length).to.be.eq(3);
|
|
96
|
+
|
|
97
|
+
for (const event of await setEvents) {
|
|
98
|
+
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
99
|
+
}
|
|
100
|
+
const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
101
|
+
|
|
102
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
103
|
+
msg: '/settp test',
|
|
104
|
+
playerId: this.setupData.players[0].id,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
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'
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
114
|
+
group,
|
|
115
|
+
snapshot: false,
|
|
116
|
+
setup: modulesTestSetup,
|
|
117
|
+
name: 'Can remove teleports with /deletetp',
|
|
118
|
+
test: async function () {
|
|
119
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
120
|
+
this.setupData.gameserver.id,
|
|
121
|
+
this.setupData.teleportsModule.id
|
|
122
|
+
);
|
|
123
|
+
const setEvents = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
124
|
+
|
|
125
|
+
await Promise.all(
|
|
126
|
+
Array.from({ length: 3 }).map(async (_, i) => {
|
|
127
|
+
return this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
128
|
+
msg: `/settp test${i}`,
|
|
129
|
+
playerId: this.setupData.players[0].id,
|
|
130
|
+
});
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
expect((await setEvents).length).to.be.eq(3);
|
|
135
|
+
|
|
136
|
+
for (const event of await setEvents) {
|
|
137
|
+
expect(event.data.msg).to.match(/Teleport test\d set\./);
|
|
138
|
+
}
|
|
139
|
+
const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
140
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
141
|
+
msg: '/deletetp test1',
|
|
142
|
+
playerId: this.setupData.players[0].id,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
expect((await events).length).to.be.eq(1);
|
|
146
|
+
expect((await events)[0].data.msg).to.be.eq('Teleport test1 deleted.');
|
|
147
|
+
},
|
|
148
|
+
}),
|
|
149
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
150
|
+
group,
|
|
151
|
+
snapshot: false,
|
|
152
|
+
setup: modulesTestSetup,
|
|
153
|
+
name: 'Shows an error when removing a non-existing teleport',
|
|
154
|
+
test: async function () {
|
|
155
|
+
await this.client.gameserver.gameServerControllerInstallModule(
|
|
156
|
+
this.setupData.gameserver.id,
|
|
157
|
+
this.setupData.teleportsModule.id
|
|
158
|
+
);
|
|
159
|
+
const events = this.setupData.eventAwaiter.waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
160
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
161
|
+
msg: '/deletetp test',
|
|
162
|
+
playerId: this.setupData.players[0].id,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
expect((await events).length).to.be.eq(1);
|
|
166
|
+
expect((await events)[0].data.msg).to.be.eq('Teleport test does not exist.');
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
describe(group, function () {
|
|
172
|
+
tests.forEach((test) => {
|
|
173
|
+
test.run();
|
|
174
|
+
});
|
|
175
|
+
});
|