@takaro/modules 0.0.14 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BuiltinModule.d.ts +13 -8
- package/dist/BuiltinModule.d.ts.map +1 -0
- package/dist/BuiltinModule.js +48 -31
- package/dist/BuiltinModule.js.map +1 -1
- package/dist/dto/base.d.ts +1 -0
- package/dist/dto/base.d.ts.map +1 -0
- package/dist/dto/discordEvents.d.ts +1 -0
- package/dist/dto/discordEvents.d.ts.map +1 -0
- package/dist/dto/gameEvents.d.ts +1 -0
- package/dist/dto/gameEvents.d.ts.map +1 -0
- package/dist/dto/index.d.ts +4 -0
- package/dist/dto/index.d.ts.map +1 -0
- package/dist/dto/takaroEvents.d.ts +16 -0
- package/dist/dto/takaroEvents.d.ts.map +1 -0
- package/dist/dto/takaroEvents.js +36 -0
- package/dist/dto/takaroEvents.js.map +1 -1
- package/dist/main.d.ts +4 -3
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts.map +1 -0
- package/dist/modules/chatBridge/index.d.ts +3 -2
- package/dist/modules/chatBridge/index.d.ts.map +1 -0
- package/dist/modules/chatBridge/index.js +55 -47
- package/dist/modules/chatBridge/index.js.map +1 -1
- package/dist/modules/dailyRewards/commands/daily.d.ts +2 -0
- package/dist/modules/dailyRewards/commands/daily.d.ts.map +1 -0
- package/dist/modules/dailyRewards/commands/daily.js +106 -0
- package/dist/modules/dailyRewards/commands/daily.js.map +1 -0
- package/dist/modules/dailyRewards/commands/streak.d.ts +2 -0
- package/dist/modules/dailyRewards/commands/streak.d.ts.map +1 -0
- package/dist/modules/dailyRewards/commands/streak.js +34 -0
- package/dist/modules/dailyRewards/commands/streak.js.map +1 -0
- package/dist/modules/dailyRewards/commands/topstreak.d.ts +2 -0
- package/dist/modules/dailyRewards/commands/topstreak.d.ts.map +1 -0
- package/dist/modules/dailyRewards/commands/topstreak.js +44 -0
- package/dist/modules/dailyRewards/commands/topstreak.js.map +1 -0
- package/dist/modules/dailyRewards/functions/utils.d.ts +6 -0
- package/dist/modules/dailyRewards/functions/utils.d.ts.map +1 -0
- package/dist/modules/dailyRewards/functions/utils.js +32 -0
- package/dist/modules/dailyRewards/functions/utils.js.map +1 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts +2 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.d.ts.map +1 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js +19 -0
- package/dist/modules/dailyRewards/hooks/dailyLoginCheck.js.map +1 -0
- package/dist/modules/dailyRewards/index.d.ts +5 -0
- package/dist/modules/dailyRewards/index.d.ts.map +1 -0
- package/dist/modules/dailyRewards/index.js +125 -0
- package/dist/modules/dailyRewards/index.js.map +1 -0
- package/dist/modules/economyUtils/commands/balance.d.ts +1 -0
- package/dist/modules/economyUtils/commands/balance.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/claim.d.ts +1 -0
- package/dist/modules/economyUtils/commands/claim.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/shop.d.ts +1 -0
- package/dist/modules/economyUtils/commands/shop.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.d.ts.map +1 -0
- package/dist/modules/economyUtils/commands/transfer.d.ts +1 -0
- package/dist/modules/economyUtils/commands/transfer.d.ts.map +1 -0
- package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts +1 -0
- package/dist/modules/economyUtils/cronJobs/zombieKillReward.d.ts.map +1 -0
- package/dist/modules/economyUtils/index.d.ts +3 -2
- package/dist/modules/economyUtils/index.d.ts.map +1 -0
- package/dist/modules/economyUtils/index.js +178 -170
- package/dist/modules/economyUtils/index.js.map +1 -1
- package/dist/modules/geoBlock/hooks/IPDetected.d.ts +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.d.ts.map +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js +4 -2
- package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -1
- package/dist/modules/geoBlock/index.d.ts +3 -2
- package/dist/modules/geoBlock/index.d.ts.map +1 -0
- package/dist/modules/geoBlock/index.js +71 -63
- package/dist/modules/geoBlock/index.js.map +1 -1
- package/dist/modules/gimme/commands/gimme.d.ts +1 -0
- package/dist/modules/gimme/commands/gimme.d.ts.map +1 -0
- package/dist/modules/gimme/commands/gimme.js +17 -6
- package/dist/modules/gimme/commands/gimme.js.map +1 -1
- package/dist/modules/gimme/index.d.ts +3 -2
- package/dist/modules/gimme/index.d.ts.map +1 -0
- package/dist/modules/gimme/index.js +64 -34
- package/dist/modules/gimme/index.js.map +1 -1
- package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts.map +1 -0
- package/dist/modules/highPingKicker/index.d.ts +3 -2
- package/dist/modules/highPingKicker/index.d.ts.map +1 -0
- package/dist/modules/highPingKicker/index.js +36 -28
- package/dist/modules/highPingKicker/index.js.map +1 -1
- package/dist/modules/lottery/commands/buyTicket.d.ts +1 -0
- package/dist/modules/lottery/commands/buyTicket.d.ts.map +1 -0
- package/dist/modules/lottery/commands/nextDraw.d.ts +1 -0
- package/dist/modules/lottery/commands/nextDraw.d.ts.map +1 -0
- package/dist/modules/lottery/commands/viewTickets.d.ts +1 -0
- package/dist/modules/lottery/commands/viewTickets.d.ts.map +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.d.ts +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.d.ts.map +1 -0
- package/dist/modules/lottery/index.d.ts +3 -2
- package/dist/modules/lottery/index.d.ts.map +1 -0
- package/dist/modules/lottery/index.js +73 -65
- package/dist/modules/lottery/index.js.map +1 -1
- package/dist/modules/playerOnboarding/commands/starterkit.d.ts +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.d.ts.map +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js +16 -3
- package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -1
- package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts.map +1 -0
- package/dist/modules/playerOnboarding/index.d.ts +3 -2
- package/dist/modules/playerOnboarding/index.d.ts.map +1 -0
- package/dist/modules/playerOnboarding/index.js +73 -43
- package/dist/modules/playerOnboarding/index.js.map +1 -1
- package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.d.ts.map +1 -0
- package/dist/modules/serverMessages/index.d.ts +3 -2
- package/dist/modules/serverMessages/index.d.ts.map +1 -0
- package/dist/modules/serverMessages/index.js +36 -28
- package/dist/modules/serverMessages/index.js.map +1 -1
- package/dist/modules/teleports/commands/deletetp.d.ts +1 -0
- package/dist/modules/teleports/commands/deletetp.d.ts.map +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.d.ts.map +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.js +4 -35
- package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -1
- package/dist/modules/teleports/commands/listwaypoints.d.ts +1 -0
- package/dist/modules/teleports/commands/listwaypoints.d.ts.map +1 -0
- package/dist/modules/teleports/commands/listwaypoints.js +3 -22
- package/dist/modules/teleports/commands/listwaypoints.js.map +1 -1
- package/dist/modules/teleports/commands/setprivate.d.ts +1 -0
- package/dist/modules/teleports/commands/setprivate.d.ts.map +1 -0
- package/dist/modules/teleports/commands/setpublic.d.ts +1 -0
- package/dist/modules/teleports/commands/setpublic.d.ts.map +1 -0
- package/dist/modules/teleports/commands/settp.d.ts +1 -0
- package/dist/modules/teleports/commands/settp.d.ts.map +1 -0
- package/dist/modules/teleports/commands/setwaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/setwaypoint.d.ts.map +1 -0
- package/dist/modules/teleports/commands/setwaypoint.js +5 -63
- package/dist/modules/teleports/commands/setwaypoint.js.map +1 -1
- package/dist/modules/teleports/commands/teleport.d.ts +1 -0
- package/dist/modules/teleports/commands/teleport.d.ts.map +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.d.ts.map +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js +7 -23
- package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -1
- package/dist/modules/teleports/commands/tplist.d.ts +1 -0
- package/dist/modules/teleports/commands/tplist.d.ts.map +1 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts +2 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.d.ts.map +1 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.js +6 -0
- package/dist/modules/teleports/cronJobs/Waypoint reconciler.js.map +1 -0
- package/dist/modules/teleports/functions/utils.d.ts +12 -0
- package/dist/modules/teleports/functions/utils.d.ts.map +1 -0
- package/dist/modules/teleports/functions/utils.js +117 -0
- package/dist/modules/teleports/functions/utils.js.map +1 -1
- package/dist/modules/teleports/index.d.ts +3 -2
- package/dist/modules/teleports/index.d.ts.map +1 -0
- package/dist/modules/teleports/index.js +188 -172
- package/dist/modules/teleports/index.js.map +1 -1
- package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts +1 -0
- package/dist/modules/timedShutdown/cronJobs/Shutdown.d.ts.map +1 -0
- package/dist/modules/timedShutdown/cronJobs/warning.d.ts +1 -0
- package/dist/modules/timedShutdown/cronJobs/warning.d.ts.map +1 -0
- package/dist/modules/timedShutdown/index.d.ts +3 -2
- package/dist/modules/timedShutdown/index.d.ts.map +1 -0
- package/dist/modules/timedShutdown/index.js +35 -27
- package/dist/modules/timedShutdown/index.js.map +1 -1
- package/dist/modules/utils/commands/help.d.ts +1 -0
- package/dist/modules/utils/commands/help.d.ts.map +1 -0
- package/dist/modules/utils/commands/help.js +10 -9
- package/dist/modules/utils/commands/help.js.map +1 -1
- package/dist/modules/utils/commands/ping.d.ts +1 -0
- package/dist/modules/utils/commands/ping.d.ts.map +1 -0
- package/dist/modules/utils/index.d.ts +3 -2
- package/dist/modules/utils/index.d.ts.map +1 -0
- package/dist/modules/utils/index.js +36 -28
- package/dist/modules/utils/index.js.map +1 -1
- package/dist/modules.json +601 -506
- package/package.json +2 -5
- package/scripts/buildBuiltinJson.ts +50 -2
- package/src/BuiltinModule.ts +25 -17
- package/src/__tests__/aliases.integration.test.ts +23 -26
- package/src/__tests__/bugRepros.integration.test.ts +261 -10
- package/src/__tests__/builtinmodule.unit.test.ts +3 -1
- package/src/__tests__/commandArgs.integration.test.ts +13 -6
- package/src/__tests__/economy/claim.integration.test.ts +1 -0
- package/src/__tests__/economy/economyUtils.integration.test.ts +43 -46
- package/src/__tests__/economy/shop.integration.test.ts +28 -4
- package/src/__tests__/economy/zombieKillReward.integration.test.ts +28 -31
- package/src/__tests__/geoblock.integration.test.ts +76 -91
- package/src/__tests__/gimme.integration.test.ts +25 -22
- package/src/__tests__/help.integration.test.ts +21 -20
- package/src/__tests__/lottery.integration.test.ts +15 -11
- package/src/__tests__/modulePermission.integration.test.ts +17 -13
- package/src/__tests__/onboarding.integration.test.ts +43 -43
- package/src/__tests__/ping.integration.test.ts +5 -4
- package/src/__tests__/roleExpiry.integration.test.ts +5 -4
- package/src/__tests__/serverMessages.integration.test.ts +24 -27
- package/src/__tests__/systemConfigCooldown.integration.test.ts +5 -1
- package/src/__tests__/systemConfigCost.integration.test.ts +16 -17
- package/src/__tests__/teleports/listtp.integration.test.ts +20 -21
- package/src/__tests__/teleports/publicteleports.integration.test.ts +58 -70
- package/src/__tests__/teleports/teleport.integration.test.ts +16 -17
- package/src/__tests__/teleports/tpManagement.integration.test.ts +21 -20
- package/src/__tests__/teleports/waypoints.integration.test.ts +52 -6
- package/src/dto/takaroEvents.ts +21 -0
- package/src/main.ts +14 -4
- package/src/modules/chatBridge/index.ts +54 -51
- package/src/modules/dailyRewards/commands/daily.js +118 -0
- package/src/modules/dailyRewards/commands/streak.js +42 -0
- package/src/modules/dailyRewards/commands/topstreak.js +54 -0
- package/src/modules/dailyRewards/functions/utils.js +36 -0
- package/src/modules/dailyRewards/hooks/dailyLoginCheck.js +24 -0
- package/src/modules/dailyRewards/index.ts +136 -0
- package/src/modules/economyUtils/index.ts +182 -179
- package/src/modules/geoBlock/hooks/IPDetected.js +4 -2
- package/src/modules/geoBlock/index.ts +72 -70
- package/src/modules/gimme/commands/gimme.js +16 -6
- package/src/modules/gimme/index.ts +62 -37
- package/src/modules/highPingKicker/index.ts +35 -32
- package/src/modules/lottery/index.ts +73 -71
- package/src/modules/playerOnboarding/commands/starterkit.js +19 -5
- package/src/modules/playerOnboarding/index.ts +72 -47
- package/src/modules/serverMessages/index.ts +36 -32
- package/src/modules/teleports/commands/deletewaypoint.js +4 -53
- package/src/modules/teleports/commands/listwaypoints.js +3 -35
- package/src/modules/teleports/commands/setwaypoint.js +5 -83
- package/src/modules/teleports/commands/teleportwaypoint.js +9 -36
- package/src/modules/teleports/cronJobs/Waypoint reconciler.js +7 -0
- package/src/modules/teleports/functions/utils.js +150 -0
- package/src/modules/teleports/index.ts +196 -180
- package/src/modules/timedShutdown/index.ts +35 -30
- package/src/modules/utils/commands/help.js +14 -14
- package/src/modules/utils/index.ts +36 -32
- package/tsconfig.json +1 -1
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
EventsAwaiter,
|
|
8
8
|
} from '@takaro/test';
|
|
9
9
|
import { GameEvents } from '../dto/gameEvents.js';
|
|
10
|
+
import { describe } from 'node:test';
|
|
10
11
|
|
|
11
12
|
const group = 'Help command';
|
|
12
13
|
|
|
@@ -17,10 +18,10 @@ const tests = [
|
|
|
17
18
|
setup: modulesTestSetup,
|
|
18
19
|
name: 'Help command responds with a list of installed commands',
|
|
19
20
|
test: async function () {
|
|
20
|
-
await this.client.
|
|
21
|
-
this.setupData.gameserver.id,
|
|
22
|
-
this.setupData.utilsModule.id,
|
|
23
|
-
);
|
|
21
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
22
|
+
gameServerId: this.setupData.gameserver.id,
|
|
23
|
+
versionId: this.setupData.utilsModule.latestVersion.id,
|
|
24
|
+
});
|
|
24
25
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
25
26
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
26
27
|
msg: '/help',
|
|
@@ -45,14 +46,14 @@ const tests = [
|
|
|
45
46
|
setup: modulesTestSetup,
|
|
46
47
|
name: 'Help command responds with a list of installed commands, picking up commands from multiple modules',
|
|
47
48
|
test: async function () {
|
|
48
|
-
await this.client.
|
|
49
|
-
this.setupData.gameserver.id,
|
|
50
|
-
this.setupData.utilsModule.id,
|
|
51
|
-
);
|
|
52
|
-
await this.client.
|
|
53
|
-
this.setupData.gameserver.id,
|
|
54
|
-
this.setupData.teleportsModule.id,
|
|
55
|
-
);
|
|
49
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
50
|
+
gameServerId: this.setupData.gameserver.id,
|
|
51
|
+
versionId: this.setupData.utilsModule.latestVersion.id,
|
|
52
|
+
});
|
|
53
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
54
|
+
gameServerId: this.setupData.gameserver.id,
|
|
55
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
56
|
+
});
|
|
56
57
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 13);
|
|
57
58
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
58
59
|
msg: '/help',
|
|
@@ -92,10 +93,10 @@ const tests = [
|
|
|
92
93
|
setup: modulesTestSetup,
|
|
93
94
|
name: 'Help command responds with detailed info about a specific command',
|
|
94
95
|
test: async function () {
|
|
95
|
-
await this.client.
|
|
96
|
-
this.setupData.gameserver.id,
|
|
97
|
-
this.setupData.utilsModule.id,
|
|
98
|
-
);
|
|
96
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
97
|
+
gameServerId: this.setupData.gameserver.id,
|
|
98
|
+
versionId: this.setupData.utilsModule.latestVersion.id,
|
|
99
|
+
});
|
|
99
100
|
|
|
100
101
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
101
102
|
|
|
@@ -118,10 +119,10 @@ const tests = [
|
|
|
118
119
|
setup: modulesTestSetup,
|
|
119
120
|
name: 'Help command responds with unknown command message if command does not exist',
|
|
120
121
|
test: async function () {
|
|
121
|
-
await this.client.
|
|
122
|
-
this.setupData.gameserver.id,
|
|
123
|
-
this.setupData.utilsModule.id,
|
|
124
|
-
);
|
|
122
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
123
|
+
gameServerId: this.setupData.gameserver.id,
|
|
124
|
+
versionId: this.setupData.utilsModule.latestVersion.id,
|
|
125
|
+
});
|
|
125
126
|
|
|
126
127
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
127
128
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../dto/index.js';
|
|
3
3
|
import { Client } from '@takaro/apiclient';
|
|
4
|
+
import { describe } from 'node:test';
|
|
4
5
|
|
|
5
6
|
const group = 'lottery suite';
|
|
6
7
|
const ticketCost = 50;
|
|
@@ -35,7 +36,10 @@ const setup = async function (this: IntegrationTest<IModuleTestsSetupData>): Pro
|
|
|
35
36
|
gameServerId: data.gameserver.id,
|
|
36
37
|
});
|
|
37
38
|
|
|
38
|
-
await this.client.
|
|
39
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
40
|
+
gameServerId: data.gameserver.id,
|
|
41
|
+
versionId: data.economyUtilsModule.latestVersion.id,
|
|
42
|
+
});
|
|
39
43
|
|
|
40
44
|
const pogs = await this.client.playerOnGameserver.playerOnGameServerControllerSearch({
|
|
41
45
|
filters: {
|
|
@@ -51,7 +55,9 @@ const setup = async function (this: IntegrationTest<IModuleTestsSetupData>): Pro
|
|
|
51
55
|
|
|
52
56
|
await Promise.allSettled(tasks);
|
|
53
57
|
|
|
54
|
-
await this.client.
|
|
58
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
59
|
+
gameServerId: data.gameserver.id,
|
|
60
|
+
versionId: data.lotteryModule.latestVersion.id,
|
|
55
61
|
systemConfig: JSON.stringify({
|
|
56
62
|
commands: {
|
|
57
63
|
buyTicket: {
|
|
@@ -211,16 +217,14 @@ const tests = [
|
|
|
211
217
|
|
|
212
218
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
213
219
|
moduleId: this.setupData.lotteryModule.id,
|
|
214
|
-
cronjobId: this.setupData.lotteryModule.cronJobs[0].id,
|
|
220
|
+
cronjobId: this.setupData.lotteryModule.latestVersion.cronJobs[0].id,
|
|
215
221
|
gameServerId: this.setupData.gameserver.id,
|
|
216
222
|
});
|
|
217
223
|
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
)
|
|
223
|
-
).data.data;
|
|
224
|
+
const installationsRes = await this.client.module.moduleInstallationsControllerGetInstalledModules({
|
|
225
|
+
filters: { gameserverId: [this.setupData.gameserver.id], moduleId: [this.setupData.lotteryModule.id] },
|
|
226
|
+
});
|
|
227
|
+
const mod = installationsRes.data.data[0];
|
|
224
228
|
|
|
225
229
|
const userConfig: Record<string, any> = mod.userConfig;
|
|
226
230
|
const prize = ticketCost * playerAmount * (1 - userConfig.profitMargin);
|
|
@@ -252,7 +256,7 @@ const tests = [
|
|
|
252
256
|
|
|
253
257
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
254
258
|
moduleId: this.setupData.lotteryModule.id,
|
|
255
|
-
cronjobId: this.setupData.lotteryModule.cronJobs[0].id,
|
|
259
|
+
cronjobId: this.setupData.lotteryModule.latestVersion.cronJobs[0].id,
|
|
256
260
|
gameServerId: this.setupData.gameserver.id,
|
|
257
261
|
});
|
|
258
262
|
|
|
@@ -288,7 +292,7 @@ const tests = [
|
|
|
288
292
|
|
|
289
293
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
290
294
|
moduleId: this.setupData.lotteryModule.id,
|
|
291
|
-
cronjobId: this.setupData.lotteryModule.cronJobs[0].id,
|
|
295
|
+
cronjobId: this.setupData.lotteryModule.latestVersion.cronJobs[0].id,
|
|
292
296
|
gameServerId: this.setupData.gameserver.id,
|
|
293
297
|
});
|
|
294
298
|
|
|
@@ -7,12 +7,18 @@ import {
|
|
|
7
7
|
EventsAwaiter,
|
|
8
8
|
} from '@takaro/test';
|
|
9
9
|
import { GameEvents } from '../dto/index.js';
|
|
10
|
+
import { describe } from 'node:test';
|
|
10
11
|
|
|
11
12
|
const group = 'Module permissions role assignments';
|
|
12
13
|
|
|
13
14
|
async function cleanRoleSetup(this: IntegrationTest<IModuleTestsSetupData>) {
|
|
14
15
|
const defaultSetup = await modulesTestSetup.bind(this)();
|
|
15
16
|
|
|
17
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
18
|
+
gameServerId: defaultSetup.gameserver.id,
|
|
19
|
+
versionId: defaultSetup.teleportsModule.latestVersion.id,
|
|
20
|
+
});
|
|
21
|
+
|
|
16
22
|
const playersRes = await this.client.player.playerControllerSearch();
|
|
17
23
|
|
|
18
24
|
const permissions = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
|
|
@@ -22,10 +28,10 @@ async function cleanRoleSetup(this: IntegrationTest<IModuleTestsSetupData>) {
|
|
|
22
28
|
permissions,
|
|
23
29
|
});
|
|
24
30
|
|
|
25
|
-
await this.client.
|
|
26
|
-
defaultSetup.gameserver.id,
|
|
27
|
-
defaultSetup.teleportsModule.id,
|
|
28
|
-
);
|
|
31
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
32
|
+
gameServerId: defaultSetup.gameserver.id,
|
|
33
|
+
versionId: defaultSetup.teleportsModule.latestVersion.id,
|
|
34
|
+
});
|
|
29
35
|
|
|
30
36
|
await Promise.all(
|
|
31
37
|
playersRes.data.data.map(async (player) => {
|
|
@@ -128,15 +134,13 @@ const tests = [
|
|
|
128
134
|
setup: modulesTestSetup,
|
|
129
135
|
name: 'Uses system roles',
|
|
130
136
|
test: async function () {
|
|
131
|
-
await this.client.
|
|
132
|
-
this.setupData.gameserver.id,
|
|
133
|
-
this.setupData.teleportsModule.id,
|
|
134
|
-
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
);
|
|
137
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
138
|
+
gameServerId: this.setupData.gameserver.id,
|
|
139
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
140
|
+
userConfig: JSON.stringify({
|
|
141
|
+
timeout: 0,
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
140
144
|
|
|
141
145
|
await Promise.all(
|
|
142
146
|
this.setupData.players.map(async (player) => {
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
|
-
import {
|
|
2
|
+
import { GameEvents } from '../dto/gameEvents.js';
|
|
3
3
|
import { HookEvents } from '../main.js';
|
|
4
|
+
import { faker } from '@faker-js/faker';
|
|
5
|
+
import { describe } from 'node:test';
|
|
4
6
|
|
|
5
7
|
const group = 'Onboarding';
|
|
6
8
|
const groupStarterkit = 'Onboarding - Starterkit';
|
|
7
9
|
|
|
8
|
-
const
|
|
10
|
+
const tests = [
|
|
9
11
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
10
12
|
group,
|
|
11
13
|
snapshot: false,
|
|
12
14
|
setup: modulesTestSetup,
|
|
13
15
|
name: 'PlayerConnected hook sends a message when a player connects to the server',
|
|
14
16
|
test: async function () {
|
|
15
|
-
await this.client.
|
|
16
|
-
this.setupData.gameserver.id,
|
|
17
|
-
this.setupData.onboardingModule.id,
|
|
18
|
-
);
|
|
19
|
-
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
20
|
-
await this.client.hook.hookControllerTrigger({
|
|
17
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
21
18
|
gameServerId: this.setupData.gameserver.id,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
msg: 'Player connected',
|
|
29
|
-
}),
|
|
19
|
+
versionId: this.setupData.onboardingModule.latestVersion.id,
|
|
20
|
+
});
|
|
21
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 5);
|
|
22
|
+
await this.client.gameserver.gameServerControllerExecuteCommand(this.setupData.gameserver.id, {
|
|
23
|
+
command: 'connectAll',
|
|
30
24
|
});
|
|
31
25
|
|
|
32
|
-
expect((await events).length).to.be.eq(
|
|
33
|
-
|
|
26
|
+
expect((await events).length).to.be.eq(5);
|
|
27
|
+
// Expect all messages to match
|
|
28
|
+
expect((await events).every((event) => event.data.meta.msg.match(/Welcome .+ to the server!/))).to.be.true;
|
|
34
29
|
},
|
|
35
30
|
}),
|
|
36
31
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -39,15 +34,18 @@ const _tests = [
|
|
|
39
34
|
setup: modulesTestSetup,
|
|
40
35
|
name: 'Starterkit command gives the player items',
|
|
41
36
|
test: async function () {
|
|
42
|
-
await this.client.
|
|
43
|
-
|
|
44
|
-
this.setupData.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
const items = (await this.client.item.itemControllerSearch()).data.data;
|
|
38
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
39
|
+
gameServerId: this.setupData.gameserver.id,
|
|
40
|
+
versionId: this.setupData.onboardingModule.latestVersion.id,
|
|
41
|
+
userConfig: JSON.stringify({
|
|
42
|
+
starterKitItems: items.map((item) => ({
|
|
43
|
+
item: item.id,
|
|
44
|
+
amount: faker.number.int({ min: 1, max: 6 }),
|
|
45
|
+
quality: faker.number.int({ min: 1, max: 6 }).toString(),
|
|
46
|
+
})),
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
51
49
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.COMMAND_EXECUTED);
|
|
52
50
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
53
51
|
msg: '/starterkit',
|
|
@@ -64,15 +62,18 @@ const _tests = [
|
|
|
64
62
|
setup: modulesTestSetup,
|
|
65
63
|
name: 'Starterkit command can only be used once',
|
|
66
64
|
test: async function () {
|
|
67
|
-
await this.client.
|
|
68
|
-
|
|
69
|
-
this.setupData.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
const items = (await this.client.item.itemControllerSearch()).data.data;
|
|
66
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
67
|
+
gameServerId: this.setupData.gameserver.id,
|
|
68
|
+
versionId: this.setupData.onboardingModule.latestVersion.id,
|
|
69
|
+
userConfig: JSON.stringify({
|
|
70
|
+
starterKitItems: items.map((item) => ({
|
|
71
|
+
item: item.id,
|
|
72
|
+
amount: faker.number.int({ min: 1, max: 6 }),
|
|
73
|
+
quality: faker.number.int({ min: 1, max: 6 }).toString(),
|
|
74
|
+
})),
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
76
77
|
const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.COMMAND_EXECUTED);
|
|
77
78
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
78
79
|
msg: '/starterkit',
|
|
@@ -98,10 +99,10 @@ const _tests = [
|
|
|
98
99
|
setup: modulesTestSetup,
|
|
99
100
|
name: 'Starterkit with nothing configured, shows an error message',
|
|
100
101
|
test: async function () {
|
|
101
|
-
await this.client.
|
|
102
|
-
this.setupData.gameserver.id,
|
|
103
|
-
this.setupData.onboardingModule.id,
|
|
104
|
-
);
|
|
102
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
103
|
+
gameServerId: this.setupData.gameserver.id,
|
|
104
|
+
versionId: this.setupData.onboardingModule.latestVersion.id,
|
|
105
|
+
});
|
|
105
106
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
106
107
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
107
108
|
msg: '/starterkit',
|
|
@@ -114,9 +115,8 @@ const _tests = [
|
|
|
114
115
|
}),
|
|
115
116
|
];
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
/* describe(group, function () {
|
|
118
|
+
describe(group, function () {
|
|
119
119
|
tests.forEach((test) => {
|
|
120
120
|
test.run();
|
|
121
121
|
});
|
|
122
|
-
});
|
|
122
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { HookEvents } from '../dto/index.js';
|
|
3
|
+
import { describe } from 'node:test';
|
|
3
4
|
|
|
4
5
|
const group = 'Ping command';
|
|
5
6
|
|
|
@@ -10,10 +11,10 @@ const tests = [
|
|
|
10
11
|
setup: modulesTestSetup,
|
|
11
12
|
name: 'Ping command replies with pong',
|
|
12
13
|
test: async function () {
|
|
13
|
-
await this.client.
|
|
14
|
-
this.setupData.gameserver.id,
|
|
15
|
-
this.setupData.utilsModule.id,
|
|
16
|
-
);
|
|
14
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
15
|
+
gameServerId: this.setupData.gameserver.id,
|
|
16
|
+
versionId: this.setupData.utilsModule.latestVersion.id,
|
|
17
|
+
});
|
|
17
18
|
|
|
18
19
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CHAT_MESSAGE);
|
|
19
20
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../dto/index.js';
|
|
3
|
+
import { describe } from 'node:test';
|
|
3
4
|
|
|
4
5
|
const group = 'Role expiry';
|
|
5
6
|
|
|
@@ -15,10 +16,10 @@ const tests = [
|
|
|
15
16
|
this.setupData.players.map((p) => this.client.player.playerControllerRemoveRole(p.id, this.setupData.role.id)),
|
|
16
17
|
);
|
|
17
18
|
|
|
18
|
-
await this.client.
|
|
19
|
-
this.setupData.gameserver.id,
|
|
20
|
-
this.setupData.teleportsModule.id,
|
|
21
|
-
);
|
|
19
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
20
|
+
gameServerId: this.setupData.gameserver.id,
|
|
21
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
22
|
+
});
|
|
22
23
|
|
|
23
24
|
const eventsBeforeRole = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
24
25
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../dto/index.js';
|
|
3
|
+
import { describe } from 'node:test';
|
|
3
4
|
|
|
4
5
|
const group = 'Server messages';
|
|
5
6
|
|
|
@@ -10,15 +11,15 @@ const tests = [
|
|
|
10
11
|
setup: modulesTestSetup,
|
|
11
12
|
name: 'Default install sends the default message',
|
|
12
13
|
test: async function () {
|
|
13
|
-
await this.client.
|
|
14
|
-
this.setupData.gameserver.id,
|
|
15
|
-
this.setupData.serverMessagesModule.id,
|
|
16
|
-
);
|
|
14
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
15
|
+
gameServerId: this.setupData.gameserver.id,
|
|
16
|
+
versionId: this.setupData.serverMessagesModule.latestVersion.id,
|
|
17
|
+
});
|
|
17
18
|
|
|
18
19
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
19
20
|
|
|
20
21
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
21
|
-
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
22
|
+
cronjobId: this.setupData.serverMessagesModule.latestVersion.cronJobs[0].id,
|
|
22
23
|
gameServerId: this.setupData.gameserver.id,
|
|
23
24
|
moduleId: this.setupData.serverMessagesModule.id,
|
|
24
25
|
});
|
|
@@ -36,20 +37,18 @@ const tests = [
|
|
|
36
37
|
setup: modulesTestSetup,
|
|
37
38
|
name: 'Can override default message via userConfig',
|
|
38
39
|
test: async function () {
|
|
39
|
-
await this.client.
|
|
40
|
-
this.setupData.gameserver.id,
|
|
41
|
-
this.setupData.serverMessagesModule.id,
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
);
|
|
40
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
41
|
+
gameServerId: this.setupData.gameserver.id,
|
|
42
|
+
versionId: this.setupData.serverMessagesModule.latestVersion.id,
|
|
43
|
+
userConfig: JSON.stringify({
|
|
44
|
+
messages: ['This is a custom message'],
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
48
47
|
|
|
49
48
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
50
49
|
|
|
51
50
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
52
|
-
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
51
|
+
cronjobId: this.setupData.serverMessagesModule.latestVersion.cronJobs[0].id,
|
|
53
52
|
gameServerId: this.setupData.gameserver.id,
|
|
54
53
|
moduleId: this.setupData.serverMessagesModule.id,
|
|
55
54
|
});
|
|
@@ -64,22 +63,20 @@ const tests = [
|
|
|
64
63
|
setup: modulesTestSetup,
|
|
65
64
|
name: 'Can override default message via userConfig with multiple messages',
|
|
66
65
|
test: async function () {
|
|
67
|
-
await this.client.
|
|
68
|
-
this.setupData.gameserver.id,
|
|
69
|
-
this.setupData.serverMessagesModule.id,
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
);
|
|
66
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
67
|
+
gameServerId: this.setupData.gameserver.id,
|
|
68
|
+
versionId: this.setupData.serverMessagesModule.latestVersion.id,
|
|
69
|
+
userConfig: JSON.stringify({
|
|
70
|
+
messages: ['Test message 1', 'Test message 2'],
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
76
73
|
|
|
77
74
|
// We should see each of our test messages at least once
|
|
78
75
|
|
|
79
76
|
const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
80
77
|
|
|
81
78
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
82
|
-
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
79
|
+
cronjobId: this.setupData.serverMessagesModule.latestVersion.cronJobs[0].id,
|
|
83
80
|
gameServerId: this.setupData.gameserver.id,
|
|
84
81
|
moduleId: this.setupData.serverMessagesModule.id,
|
|
85
82
|
});
|
|
@@ -90,7 +87,7 @@ const tests = [
|
|
|
90
87
|
const secondEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
91
88
|
|
|
92
89
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
93
|
-
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
90
|
+
cronjobId: this.setupData.serverMessagesModule.latestVersion.cronJobs[0].id,
|
|
94
91
|
gameServerId: this.setupData.gameserver.id,
|
|
95
92
|
moduleId: this.setupData.serverMessagesModule.id,
|
|
96
93
|
});
|
|
@@ -102,7 +99,7 @@ const tests = [
|
|
|
102
99
|
const thirdEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
103
100
|
|
|
104
101
|
await this.client.cronjob.cronJobControllerTrigger({
|
|
105
|
-
cronjobId: this.setupData.serverMessagesModule.cronJobs[0].id,
|
|
102
|
+
cronjobId: this.setupData.serverMessagesModule.latestVersion.cronJobs[0].id,
|
|
106
103
|
gameServerId: this.setupData.gameserver.id,
|
|
107
104
|
moduleId: this.setupData.serverMessagesModule.id,
|
|
108
105
|
});
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { HookEvents } from '../dto/index.js';
|
|
3
|
+
import { describe } from 'node:test';
|
|
3
4
|
|
|
4
5
|
const group = 'System config - cooldown';
|
|
5
6
|
|
|
6
7
|
const customSetup = async function (this: IntegrationTest<IModuleTestsSetupData>): Promise<IModuleTestsSetupData> {
|
|
7
8
|
const setupData = await modulesTestSetup.bind(this)();
|
|
8
9
|
|
|
9
|
-
await this.client.
|
|
10
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
11
|
+
gameServerId: setupData.gameserver.id,
|
|
12
|
+
versionId: setupData.utilsModule.latestVersion.id,
|
|
10
13
|
systemConfig: JSON.stringify({
|
|
11
14
|
commands: {
|
|
12
15
|
ping: {
|
|
@@ -48,6 +51,7 @@ const tests = [
|
|
|
48
51
|
new IntegrationTest<IModuleTestsSetupData>({
|
|
49
52
|
group,
|
|
50
53
|
snapshot: false,
|
|
54
|
+
attempts: 5,
|
|
51
55
|
setup: customSetup,
|
|
52
56
|
name: 'Handles cooldown when using commands in rapid succession',
|
|
53
57
|
test: async function () {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../dto/index.js';
|
|
3
3
|
import { sleep } from '@takaro/util';
|
|
4
|
+
import { describe } from 'node:test';
|
|
4
5
|
|
|
5
6
|
const group = 'System config - cost';
|
|
6
7
|
|
|
@@ -11,24 +12,22 @@ const customSetup = async function (this: IntegrationTest<IModuleTestsSetupData>
|
|
|
11
12
|
gameServerId: setupData.gameserver.id,
|
|
12
13
|
});
|
|
13
14
|
|
|
14
|
-
await this.client.
|
|
15
|
-
setupData.gameserver.id,
|
|
16
|
-
setupData.teleportsModule.id,
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
cost: 10,
|
|
27
|
-
},
|
|
15
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
16
|
+
gameServerId: setupData.gameserver.id,
|
|
17
|
+
versionId: setupData.teleportsModule.latestVersion.id,
|
|
18
|
+
userConfig: JSON.stringify({
|
|
19
|
+
timeout: 0,
|
|
20
|
+
}),
|
|
21
|
+
systemConfig: JSON.stringify({
|
|
22
|
+
commands: {
|
|
23
|
+
teleport: {
|
|
24
|
+
delay: 0,
|
|
25
|
+
aliases: [],
|
|
26
|
+
cost: 10,
|
|
28
27
|
},
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
);
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
32
31
|
|
|
33
32
|
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
34
33
|
await this.client.command.commandControllerTrigger(setupData.gameserver.id, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../../dto/index.js';
|
|
3
|
+
import { describe } from 'node:test';
|
|
3
4
|
|
|
4
5
|
const group = 'Teleports suite';
|
|
5
6
|
|
|
@@ -10,10 +11,10 @@ const tests = [
|
|
|
10
11
|
setup: modulesTestSetup,
|
|
11
12
|
name: 'Can list teleports with /tplist',
|
|
12
13
|
test: async function () {
|
|
13
|
-
await this.client.
|
|
14
|
-
this.setupData.gameserver.id,
|
|
15
|
-
this.setupData.teleportsModule.id,
|
|
16
|
-
);
|
|
14
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
15
|
+
gameServerId: this.setupData.gameserver.id,
|
|
16
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
17
|
+
});
|
|
17
18
|
|
|
18
19
|
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
19
20
|
|
|
@@ -52,15 +53,13 @@ const tests = [
|
|
|
52
53
|
setup: modulesTestSetup,
|
|
53
54
|
name: 'Public teleports show up in /tplist',
|
|
54
55
|
test: async function () {
|
|
55
|
-
await this.client.
|
|
56
|
-
this.setupData.gameserver.id,
|
|
57
|
-
this.setupData.teleportsModule.id,
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
);
|
|
56
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
57
|
+
gameServerId: this.setupData.gameserver.id,
|
|
58
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
59
|
+
userConfig: JSON.stringify({
|
|
60
|
+
allowPublicTeleports: true,
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
64
63
|
|
|
65
64
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
66
65
|
|
|
@@ -110,10 +109,10 @@ const tests = [
|
|
|
110
109
|
setup: modulesTestSetup,
|
|
111
110
|
name: 'Teleports set by player A cannot be seen by player B with /tplist',
|
|
112
111
|
test: async function () {
|
|
113
|
-
await this.client.
|
|
114
|
-
this.setupData.gameserver.id,
|
|
115
|
-
this.setupData.teleportsModule.id,
|
|
116
|
-
);
|
|
112
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
113
|
+
gameServerId: this.setupData.gameserver.id,
|
|
114
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
115
|
+
});
|
|
117
116
|
|
|
118
117
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
119
118
|
|
|
@@ -145,10 +144,10 @@ const tests = [
|
|
|
145
144
|
// eslint-disable-next-line quotes
|
|
146
145
|
name: "bug repro /tplist: Player A and B have teleports set but B cannot see A's teleports",
|
|
147
146
|
test: async function () {
|
|
148
|
-
await this.client.
|
|
149
|
-
this.setupData.gameserver.id,
|
|
150
|
-
this.setupData.teleportsModule.id,
|
|
151
|
-
);
|
|
147
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
148
|
+
gameServerId: this.setupData.gameserver.id,
|
|
149
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
150
|
+
});
|
|
152
151
|
|
|
153
152
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
154
153
|
|