@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/index.js';
|
|
10
|
+
import { describe } from 'node:test';
|
|
10
11
|
|
|
11
12
|
const group = 'EconomyUtils';
|
|
12
13
|
|
|
@@ -35,10 +36,10 @@ const tests = [
|
|
|
35
36
|
setup: customSetup,
|
|
36
37
|
name: 'Can get balance',
|
|
37
38
|
test: async function () {
|
|
38
|
-
await this.client.
|
|
39
|
-
this.setupData.gameserver.id,
|
|
40
|
-
this.setupData.economyUtilsModule.id,
|
|
41
|
-
);
|
|
39
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
40
|
+
gameServerId: this.setupData.gameserver.id,
|
|
41
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
42
|
+
});
|
|
42
43
|
|
|
43
44
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 2);
|
|
44
45
|
|
|
@@ -79,10 +80,10 @@ const tests = [
|
|
|
79
80
|
name: 'Can show list of top (max 10) players with highest balance',
|
|
80
81
|
test: async function () {
|
|
81
82
|
// install module
|
|
82
|
-
await this.client.
|
|
83
|
-
this.setupData.gameserver.id,
|
|
84
|
-
this.setupData.economyUtilsModule.id,
|
|
85
|
-
);
|
|
83
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
84
|
+
gameServerId: this.setupData.gameserver.id,
|
|
85
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
86
|
+
});
|
|
86
87
|
|
|
87
88
|
const giveCurrencies = this.setupData.players.map(async (player, index) => {
|
|
88
89
|
const playerOnGameServer = (
|
|
@@ -124,10 +125,10 @@ const tests = [
|
|
|
124
125
|
setup: customSetup,
|
|
125
126
|
name: 'Can transfer money to another player',
|
|
126
127
|
test: async function () {
|
|
127
|
-
await this.client.
|
|
128
|
-
this.setupData.gameserver.id,
|
|
129
|
-
this.setupData.economyUtilsModule.id,
|
|
130
|
-
);
|
|
128
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
129
|
+
gameServerId: this.setupData.gameserver.id,
|
|
130
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
131
|
+
});
|
|
131
132
|
|
|
132
133
|
const transferAmount = 500;
|
|
133
134
|
|
|
@@ -182,10 +183,10 @@ const tests = [
|
|
|
182
183
|
setup: customSetup,
|
|
183
184
|
name: 'Should return friendly user error when not enough currency',
|
|
184
185
|
test: async function () {
|
|
185
|
-
await this.client.
|
|
186
|
-
this.setupData.gameserver.id,
|
|
187
|
-
this.setupData.economyUtilsModule.id,
|
|
188
|
-
);
|
|
186
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
187
|
+
gameServerId: this.setupData.gameserver.id,
|
|
188
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
189
|
+
});
|
|
189
190
|
|
|
190
191
|
const sender = this.setupData.players[0];
|
|
191
192
|
const receiver = this.setupData.players[1];
|
|
@@ -211,15 +212,13 @@ const tests = [
|
|
|
211
212
|
setup: customSetup,
|
|
212
213
|
name: 'Should require confirmation when transfer amount is above pendingAmount',
|
|
213
214
|
test: async function () {
|
|
214
|
-
await this.client.
|
|
215
|
-
this.setupData.gameserver.id,
|
|
216
|
-
this.setupData.economyUtilsModule.id,
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
},
|
|
222
|
-
);
|
|
215
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
216
|
+
gameServerId: this.setupData.gameserver.id,
|
|
217
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
218
|
+
userConfig: JSON.stringify({
|
|
219
|
+
pendingAmount: 100,
|
|
220
|
+
}),
|
|
221
|
+
});
|
|
223
222
|
|
|
224
223
|
const transferAmount = 500;
|
|
225
224
|
const prefix = (
|
|
@@ -313,15 +312,13 @@ const tests = [
|
|
|
313
312
|
setup: customSetup,
|
|
314
313
|
name: 'Should return no pending transfers when there are none',
|
|
315
314
|
test: async function () {
|
|
316
|
-
await this.client.
|
|
317
|
-
this.setupData.gameserver.id,
|
|
318
|
-
this.setupData.economyUtilsModule.id,
|
|
319
|
-
{
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
);
|
|
315
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
316
|
+
gameServerId: this.setupData.gameserver.id,
|
|
317
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
318
|
+
userConfig: JSON.stringify({
|
|
319
|
+
pendingAmount: 100,
|
|
320
|
+
}),
|
|
321
|
+
});
|
|
325
322
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
326
323
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
327
324
|
msg: '/confirmtransfer',
|
|
@@ -342,10 +339,10 @@ const tests = [
|
|
|
342
339
|
const receiver = this.setupData.players[1];
|
|
343
340
|
const grantAmount = 500;
|
|
344
341
|
|
|
345
|
-
await this.client.
|
|
346
|
-
this.setupData.gameserver.id,
|
|
347
|
-
this.setupData.economyUtilsModule.id,
|
|
348
|
-
);
|
|
342
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
343
|
+
gameServerId: this.setupData.gameserver.id,
|
|
344
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
345
|
+
});
|
|
349
346
|
|
|
350
347
|
// Change permissions of role to only have manageCurrency permission
|
|
351
348
|
const manageCurrencyPermission = await this.client.permissionCodesToInputs(['ECONOMY_UTILS_MANAGE_CURRENCY']);
|
|
@@ -405,10 +402,10 @@ const tests = [
|
|
|
405
402
|
},
|
|
406
403
|
);
|
|
407
404
|
|
|
408
|
-
await this.client.
|
|
409
|
-
this.setupData.gameserver.id,
|
|
410
|
-
this.setupData.economyUtilsModule.id,
|
|
411
|
-
);
|
|
405
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
406
|
+
gameServerId: this.setupData.gameserver.id,
|
|
407
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
408
|
+
});
|
|
412
409
|
|
|
413
410
|
// Change permissions of role to only have manageCurrency permission
|
|
414
411
|
const manageCurrencyPermission = await this.client.permissionCodesToInputs(['ECONOMY_UTILS_MANAGE_CURRENCY']);
|
|
@@ -459,10 +456,10 @@ const tests = [
|
|
|
459
456
|
permissions: [],
|
|
460
457
|
});
|
|
461
458
|
|
|
462
|
-
await this.client.
|
|
463
|
-
this.setupData.gameserver.id,
|
|
464
|
-
this.setupData.economyUtilsModule.id,
|
|
465
|
-
);
|
|
459
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
460
|
+
gameServerId: this.setupData.gameserver.id,
|
|
461
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
462
|
+
});
|
|
466
463
|
|
|
467
464
|
// currency before revoke
|
|
468
465
|
expect(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventsAwaiter, expect, IntegrationTest, IShopSetup, shopSetup } from '@takaro/test';
|
|
2
2
|
import { HookEvents } from '../../dto/index.js';
|
|
3
|
+
import { describe } from 'node:test';
|
|
3
4
|
|
|
4
5
|
const group = 'EconomyUtils:Shop:Browse';
|
|
5
6
|
|
|
@@ -49,10 +50,10 @@ const tests = [
|
|
|
49
50
|
setup: shopSetup,
|
|
50
51
|
name: 'Can view the second page of shop items',
|
|
51
52
|
test: async function () {
|
|
52
|
-
await this.client.
|
|
53
|
-
this.setupData.gameserver.id,
|
|
54
|
-
this.setupData.utilsModule.id,
|
|
55
|
-
);
|
|
53
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
54
|
+
gameServerId: this.setupData.gameserver.id,
|
|
55
|
+
versionId: this.setupData.utilsModule.latestVersion.id,
|
|
56
|
+
});
|
|
56
57
|
await this.setupData.createListings(this.client, { gameServerId: this.setupData.gameserver.id, amount: 5 });
|
|
57
58
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CHAT_MESSAGE, 3);
|
|
58
59
|
const commandExecutedEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
@@ -139,6 +140,29 @@ const tests = [
|
|
|
139
140
|
playerId: this.setupData.players[0].id,
|
|
140
141
|
});
|
|
141
142
|
|
|
143
|
+
expect(await events).to.have.length(2);
|
|
144
|
+
expect((await events)[0].data.meta.msg).to.equal('You have purchased Test item for 100 test coin.');
|
|
145
|
+
expect((await events)[1].data.meta.msg).to.equal('You have received items from a shop order.');
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
new IntegrationTest<IShopSetup>({
|
|
149
|
+
group,
|
|
150
|
+
snapshot: false,
|
|
151
|
+
setup: shopSetup,
|
|
152
|
+
name: 'Can buy an item when not linked to a user',
|
|
153
|
+
test: async function () {
|
|
154
|
+
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CHAT_MESSAGE, 2);
|
|
155
|
+
const unlinkedPlayer = this.setupData.players[1];
|
|
156
|
+
await this.client.playerOnGameserver.playerOnGameServerControllerAddCurrency(
|
|
157
|
+
this.setupData.gameserver.id,
|
|
158
|
+
unlinkedPlayer.id,
|
|
159
|
+
{ currency: 250 },
|
|
160
|
+
);
|
|
161
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
162
|
+
msg: '/shop 1 1 buy',
|
|
163
|
+
playerId: unlinkedPlayer.id,
|
|
164
|
+
});
|
|
165
|
+
|
|
142
166
|
expect(await events).to.have.length(2);
|
|
143
167
|
expect((await events)[0].data.meta.msg).to.equal('You have purchased Test item for 100 test coin.');
|
|
144
168
|
expect((await events)[1].data.meta.msg).to.equal('You have received items from a shop order.');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventsAwaiter, expect, IntegrationTest, IShopSetup, shopSetup } from '@takaro/test';
|
|
2
2
|
import { HookEvents } from '../../dto/index.js';
|
|
3
3
|
import { Client, PlayerOutputDTO } from '@takaro/apiclient';
|
|
4
|
+
import { describe } from 'node:test';
|
|
4
5
|
|
|
5
6
|
const group = 'EconomyUtils:ZombieKillReward';
|
|
6
7
|
|
|
@@ -38,12 +39,12 @@ const tests = [
|
|
|
38
39
|
).data.data;
|
|
39
40
|
|
|
40
41
|
(
|
|
41
|
-
await this.client.
|
|
42
|
-
this.setupData.gameserver.id,
|
|
43
|
-
this.setupData.economyUtilsModule.id,
|
|
44
|
-
)
|
|
42
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
43
|
+
gameServerId: this.setupData.gameserver.id,
|
|
44
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
45
|
+
})
|
|
45
46
|
).data.data;
|
|
46
|
-
const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
|
|
47
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
47
48
|
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
48
49
|
);
|
|
49
50
|
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
@@ -86,12 +87,12 @@ const tests = [
|
|
|
86
87
|
).data.data;
|
|
87
88
|
|
|
88
89
|
(
|
|
89
|
-
await this.client.
|
|
90
|
-
this.setupData.gameserver.id,
|
|
91
|
-
this.setupData.economyUtilsModule.id,
|
|
92
|
-
)
|
|
90
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
91
|
+
gameServerId: this.setupData.gameserver.id,
|
|
92
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
93
|
+
})
|
|
93
94
|
).data.data;
|
|
94
|
-
const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
|
|
95
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
95
96
|
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
96
97
|
);
|
|
97
98
|
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
@@ -152,12 +153,12 @@ const tests = [
|
|
|
152
153
|
).data.data;
|
|
153
154
|
|
|
154
155
|
(
|
|
155
|
-
await this.client.
|
|
156
|
-
this.setupData.gameserver.id,
|
|
157
|
-
this.setupData.economyUtilsModule.id,
|
|
158
|
-
)
|
|
156
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
157
|
+
gameServerId: this.setupData.gameserver.id,
|
|
158
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
159
|
+
})
|
|
159
160
|
).data.data;
|
|
160
|
-
const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
|
|
161
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
161
162
|
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
162
163
|
);
|
|
163
164
|
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
@@ -201,15 +202,13 @@ const tests = [
|
|
|
201
202
|
)
|
|
202
203
|
).data.data;
|
|
203
204
|
(
|
|
204
|
-
await this.client.
|
|
205
|
-
this.setupData.gameserver.id,
|
|
206
|
-
this.setupData.economyUtilsModule.id,
|
|
207
|
-
{
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
)
|
|
205
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
206
|
+
gameServerId: this.setupData.gameserver.id,
|
|
207
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
208
|
+
userConfig: JSON.stringify({ zombieKillReward: 5 }),
|
|
209
|
+
})
|
|
211
210
|
).data.data;
|
|
212
|
-
const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
|
|
211
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
213
212
|
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
214
213
|
);
|
|
215
214
|
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
@@ -255,16 +254,14 @@ const tests = [
|
|
|
255
254
|
)
|
|
256
255
|
).data.data;
|
|
257
256
|
(
|
|
258
|
-
await this.client.
|
|
259
|
-
this.setupData.gameserver.id,
|
|
260
|
-
this.setupData.economyUtilsModule.id,
|
|
261
|
-
{
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
)
|
|
257
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
258
|
+
gameServerId: this.setupData.gameserver.id,
|
|
259
|
+
versionId: this.setupData.economyUtilsModule.latestVersion.id,
|
|
260
|
+
userConfig: JSON.stringify({ zombieKillReward: 5 }),
|
|
261
|
+
})
|
|
265
262
|
).data.data;
|
|
266
263
|
|
|
267
|
-
const zombieKillCronjob = this.setupData.economyUtilsModule.cronJobs.find(
|
|
264
|
+
const zombieKillCronjob = this.setupData.economyUtilsModule.latestVersion.cronJobs.find(
|
|
268
265
|
(cronjob) => cronjob.name === 'zombieKillReward',
|
|
269
266
|
);
|
|
270
267
|
if (!zombieKillCronjob) throw new Error('Cronjob not found');
|
|
@@ -2,6 +2,7 @@ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, Event
|
|
|
2
2
|
import { HookEvents } from '../dto/index.js';
|
|
3
3
|
import { TakaroEventPlayerNewIpDetected } from '@takaro/modules';
|
|
4
4
|
import { faker } from '@faker-js/faker';
|
|
5
|
+
import { describe } from 'node:test';
|
|
5
6
|
|
|
6
7
|
const group = 'Geo Block';
|
|
7
8
|
|
|
@@ -24,17 +25,15 @@ const tests = [
|
|
|
24
25
|
setup: customSetup,
|
|
25
26
|
name: 'DENY MODE: Blocked country detected -> player gets kicked based on configuration',
|
|
26
27
|
test: async function () {
|
|
27
|
-
await this.client.
|
|
28
|
-
this.setupData.gameserver.id,
|
|
29
|
-
this.setupData.geoBlockModule.id,
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
);
|
|
28
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
29
|
+
gameServerId: this.setupData.gameserver.id,
|
|
30
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
31
|
+
userConfig: JSON.stringify({
|
|
32
|
+
mode: 'deny',
|
|
33
|
+
countries: ['RU'],
|
|
34
|
+
ban: false,
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
38
37
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
39
38
|
await this.client.hook.hookControllerTrigger({
|
|
40
39
|
gameServerId: this.setupData.gameserver.id,
|
|
@@ -59,17 +58,15 @@ const tests = [
|
|
|
59
58
|
setup: customSetup,
|
|
60
59
|
name: 'DENY MODE: Non-blocked country detected -> no action taken',
|
|
61
60
|
test: async function () {
|
|
62
|
-
await this.client.
|
|
63
|
-
this.setupData.gameserver.id,
|
|
64
|
-
this.setupData.geoBlockModule.id,
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
);
|
|
61
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
62
|
+
gameServerId: this.setupData.gameserver.id,
|
|
63
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
64
|
+
userConfig: JSON.stringify({
|
|
65
|
+
mode: 'deny',
|
|
66
|
+
countries: ['RU'],
|
|
67
|
+
ban: false,
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
73
70
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
74
71
|
|
|
75
72
|
await this.client.hook.hookControllerTrigger({
|
|
@@ -98,17 +95,15 @@ const tests = [
|
|
|
98
95
|
setup: customSetup,
|
|
99
96
|
name: 'ALLOW MODE: Allowed country detected -> no action taken',
|
|
100
97
|
test: async function () {
|
|
101
|
-
await this.client.
|
|
102
|
-
this.setupData.gameserver.id,
|
|
103
|
-
this.setupData.geoBlockModule.id,
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
},
|
|
111
|
-
);
|
|
98
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
99
|
+
gameServerId: this.setupData.gameserver.id,
|
|
100
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
101
|
+
userConfig: JSON.stringify({
|
|
102
|
+
mode: 'allow',
|
|
103
|
+
countries: ['RU'],
|
|
104
|
+
ban: false,
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
112
107
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
113
108
|
|
|
114
109
|
await this.client.hook.hookControllerTrigger({
|
|
@@ -137,17 +132,15 @@ const tests = [
|
|
|
137
132
|
setup: customSetup,
|
|
138
133
|
name: 'ALLOW MODE: Non-Allowed country detected -> player gets kicked/banned based on configuration',
|
|
139
134
|
test: async function () {
|
|
140
|
-
await this.client.
|
|
141
|
-
this.setupData.gameserver.id,
|
|
142
|
-
this.setupData.geoBlockModule.id,
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
);
|
|
135
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
136
|
+
gameServerId: this.setupData.gameserver.id,
|
|
137
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
138
|
+
userConfig: JSON.stringify({
|
|
139
|
+
mode: 'allow',
|
|
140
|
+
countries: ['RU'],
|
|
141
|
+
ban: false,
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
151
144
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
152
145
|
|
|
153
146
|
await this.client.hook.hookControllerTrigger({
|
|
@@ -173,17 +166,15 @@ const tests = [
|
|
|
173
166
|
setup: customSetup,
|
|
174
167
|
name: 'BAN CONFIGURATION: Ban enabled -> player gets banned instead of kicked',
|
|
175
168
|
test: async function () {
|
|
176
|
-
await this.client.
|
|
177
|
-
this.setupData.gameserver.id,
|
|
178
|
-
this.setupData.geoBlockModule.id,
|
|
179
|
-
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
);
|
|
169
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
170
|
+
gameServerId: this.setupData.gameserver.id,
|
|
171
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
172
|
+
userConfig: JSON.stringify({
|
|
173
|
+
mode: 'allow',
|
|
174
|
+
countries: ['RU'],
|
|
175
|
+
ban: true,
|
|
176
|
+
}),
|
|
177
|
+
});
|
|
187
178
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
188
179
|
|
|
189
180
|
await this.client.hook.hookControllerTrigger({
|
|
@@ -209,18 +200,16 @@ const tests = [
|
|
|
209
200
|
setup: customSetup,
|
|
210
201
|
name: 'MULTIPLE COUNTRIES: Handling multiple countries in the whitelist or blacklist',
|
|
211
202
|
test: async function () {
|
|
212
|
-
await this.client.
|
|
213
|
-
this.setupData.gameserver.id,
|
|
214
|
-
this.setupData.geoBlockModule.id,
|
|
215
|
-
{
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
},
|
|
223
|
-
);
|
|
203
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
204
|
+
gameServerId: this.setupData.gameserver.id,
|
|
205
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
206
|
+
userConfig: JSON.stringify({
|
|
207
|
+
mode: 'deny',
|
|
208
|
+
countries: ['RU', 'BE'],
|
|
209
|
+
ban: true,
|
|
210
|
+
message: 'Custom message',
|
|
211
|
+
}),
|
|
212
|
+
});
|
|
224
213
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.PLAYER_DISCONNECTED);
|
|
225
214
|
|
|
226
215
|
await this.client.hook.hookControllerTrigger({
|
|
@@ -246,18 +235,16 @@ const tests = [
|
|
|
246
235
|
setup: customSetup,
|
|
247
236
|
name: 'IMMUNITY PERMISSION: Player with GEOBLOCK_IMMUNITY permission is neither kicked nor banned',
|
|
248
237
|
test: async function () {
|
|
249
|
-
await this.client.
|
|
250
|
-
this.setupData.gameserver.id,
|
|
251
|
-
this.setupData.geoBlockModule.id,
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
},
|
|
260
|
-
);
|
|
238
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
239
|
+
gameServerId: this.setupData.gameserver.id,
|
|
240
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
241
|
+
userConfig: JSON.stringify({
|
|
242
|
+
mode: 'deny',
|
|
243
|
+
countries: ['RU'],
|
|
244
|
+
ban: true,
|
|
245
|
+
message: 'Custom message',
|
|
246
|
+
}),
|
|
247
|
+
});
|
|
261
248
|
const permissions = await this.client.permissionCodesToInputs(['GEOBLOCK_IMMUNITY']);
|
|
262
249
|
const roleRes = await this.client.role.roleControllerCreate({
|
|
263
250
|
name: 'Immune to geoblock',
|
|
@@ -294,18 +281,16 @@ const tests = [
|
|
|
294
281
|
setup: customSetup,
|
|
295
282
|
name: 'NO COUNTRIES CONFIGURED: No action taken if countries array is empty',
|
|
296
283
|
test: async function () {
|
|
297
|
-
await this.client.
|
|
298
|
-
this.setupData.gameserver.id,
|
|
299
|
-
this.setupData.geoBlockModule.id,
|
|
300
|
-
{
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
},
|
|
308
|
-
);
|
|
284
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
285
|
+
gameServerId: this.setupData.gameserver.id,
|
|
286
|
+
versionId: this.setupData.geoBlockModule.latestVersion.id,
|
|
287
|
+
userConfig: JSON.stringify({
|
|
288
|
+
mode: 'deny',
|
|
289
|
+
countries: [],
|
|
290
|
+
ban: true,
|
|
291
|
+
message: 'Custom message',
|
|
292
|
+
}),
|
|
293
|
+
});
|
|
309
294
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.HOOK_EXECUTED);
|
|
310
295
|
|
|
311
296
|
await this.client.hook.hookControllerTrigger({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
2
2
|
import { GameEvents } from '../dto/index.js';
|
|
3
|
+
import { faker } from '@faker-js/faker';
|
|
4
|
+
import { describe } from 'node:test';
|
|
3
5
|
|
|
4
6
|
const group = 'gimme suite';
|
|
5
7
|
|
|
@@ -10,16 +12,19 @@ const tests = [
|
|
|
10
12
|
setup: modulesTestSetup,
|
|
11
13
|
name: 'Can give an item to a player',
|
|
12
14
|
test: async function () {
|
|
13
|
-
await this.client.
|
|
14
|
-
|
|
15
|
-
this.setupData.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const items = (await this.client.item.itemControllerSearch()).data.data;
|
|
16
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
17
|
+
gameServerId: this.setupData.gameserver.id,
|
|
18
|
+
versionId: this.setupData.gimmeModule.latestVersion.id,
|
|
19
|
+
userConfig: JSON.stringify({
|
|
20
|
+
items: items.map((item) => ({
|
|
21
|
+
item: item.id,
|
|
22
|
+
amount: faker.number.int({ min: 1, max: 5 }),
|
|
23
|
+
quality: faker.number.int({ min: 1, max: 6 }).toString(),
|
|
24
|
+
})),
|
|
25
|
+
commands: [],
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
23
28
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
24
29
|
|
|
25
30
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
@@ -28,7 +33,7 @@ const tests = [
|
|
|
28
33
|
});
|
|
29
34
|
|
|
30
35
|
expect((await events).length).to.be.eq(1);
|
|
31
|
-
expect((await events)[0].data.meta.msg).to.match(/You received
|
|
36
|
+
expect((await events)[0].data.meta.msg).to.match(/You received \dx \w/);
|
|
32
37
|
},
|
|
33
38
|
}),
|
|
34
39
|
/* new IntegrationTest<IModuleTestsSetupData>({
|
|
@@ -37,7 +42,7 @@ const tests = [
|
|
|
37
42
|
setup: modulesTestSetup,
|
|
38
43
|
name: 'Can execute command',
|
|
39
44
|
test: async function () {
|
|
40
|
-
await this.client.
|
|
45
|
+
await this.client.module.moduleInstallationsControllerInstallModule(
|
|
41
46
|
this.setupData.gameserver.id,
|
|
42
47
|
this.setupData.gimmeModule.id,
|
|
43
48
|
{
|
|
@@ -65,16 +70,14 @@ const tests = [
|
|
|
65
70
|
setup: modulesTestSetup,
|
|
66
71
|
name: 'When no items or commands configured, displays an error',
|
|
67
72
|
test: async function () {
|
|
68
|
-
await this.client.
|
|
69
|
-
this.setupData.gameserver.id,
|
|
70
|
-
this.setupData.gimmeModule.id,
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
);
|
|
73
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
74
|
+
gameServerId: this.setupData.gameserver.id,
|
|
75
|
+
versionId: this.setupData.gimmeModule.latestVersion.id,
|
|
76
|
+
userConfig: JSON.stringify({
|
|
77
|
+
items: [],
|
|
78
|
+
commands: [],
|
|
79
|
+
}),
|
|
80
|
+
});
|
|
78
81
|
|
|
79
82
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
80
83
|
|