@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
|
@@ -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,15 +11,13 @@ const tests = [
|
|
|
10
11
|
setup: modulesTestSetup,
|
|
11
12
|
name: 'Can set teleports as public, allowing other players to use it',
|
|
12
13
|
test: async function () {
|
|
13
|
-
await this.client.
|
|
14
|
-
this.setupData.gameserver.id,
|
|
15
|
-
this.setupData.teleportsModule.id,
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
);
|
|
14
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
15
|
+
gameServerId: this.setupData.gameserver.id,
|
|
16
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
17
|
+
userConfig: JSON.stringify({
|
|
18
|
+
allowPublicTeleports: true,
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
22
21
|
|
|
23
22
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
24
23
|
|
|
@@ -56,15 +55,13 @@ const tests = [
|
|
|
56
55
|
setup: modulesTestSetup,
|
|
57
56
|
name: 'Can set public teleports as private again',
|
|
58
57
|
test: async function () {
|
|
59
|
-
await this.client.
|
|
60
|
-
this.setupData.gameserver.id,
|
|
61
|
-
this.setupData.teleportsModule.id,
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
);
|
|
58
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
59
|
+
gameServerId: this.setupData.gameserver.id,
|
|
60
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
61
|
+
userConfig: JSON.stringify({
|
|
62
|
+
allowPublicTeleports: true,
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
68
65
|
|
|
69
66
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
70
67
|
|
|
@@ -115,16 +112,14 @@ const tests = [
|
|
|
115
112
|
setup: modulesTestSetup,
|
|
116
113
|
name: 'When configured to not allow public teleports, creating public teleports is not allowed',
|
|
117
114
|
test: async function () {
|
|
118
|
-
await this.client.
|
|
119
|
-
this.setupData.gameserver.id,
|
|
120
|
-
this.setupData.teleportsModule.id,
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
);
|
|
115
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
116
|
+
gameServerId: this.setupData.gameserver.id,
|
|
117
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
118
|
+
userConfig: JSON.stringify({
|
|
119
|
+
allowPublicTeleports: false,
|
|
120
|
+
timeout: 0,
|
|
121
|
+
}),
|
|
122
|
+
});
|
|
128
123
|
|
|
129
124
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
130
125
|
|
|
@@ -153,16 +148,14 @@ const tests = [
|
|
|
153
148
|
setup: modulesTestSetup,
|
|
154
149
|
name: 'When configured to not allow public teleports, players cannot teleport to public teleports',
|
|
155
150
|
test: async function () {
|
|
156
|
-
await this.client.
|
|
157
|
-
this.setupData.gameserver.id,
|
|
158
|
-
this.setupData.teleportsModule.id,
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
);
|
|
151
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
152
|
+
gameServerId: this.setupData.gameserver.id,
|
|
153
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
154
|
+
userConfig: JSON.stringify({
|
|
155
|
+
allowPublicTeleports: true,
|
|
156
|
+
timeout: 0,
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
166
159
|
|
|
167
160
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
168
161
|
|
|
@@ -194,16 +187,14 @@ const tests = [
|
|
|
194
187
|
expect((await tpEvent).length).to.be.eq(1);
|
|
195
188
|
expect((await tpEvent)[0].data.meta.msg).to.be.eq('Teleported to test.');
|
|
196
189
|
|
|
197
|
-
await this.client.
|
|
198
|
-
this.setupData.gameserver.id,
|
|
199
|
-
this.setupData.teleportsModule.id,
|
|
200
|
-
{
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
);
|
|
190
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
191
|
+
gameServerId: this.setupData.gameserver.id,
|
|
192
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
193
|
+
userConfig: JSON.stringify({
|
|
194
|
+
allowPublicTeleports: false,
|
|
195
|
+
timeout: 0,
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
207
198
|
|
|
208
199
|
const tpEvent2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
209
200
|
|
|
@@ -222,6 +213,15 @@ const tests = [
|
|
|
222
213
|
setup: modulesTestSetup,
|
|
223
214
|
name: 'If player does not have role to create public teleports, command gets denied',
|
|
224
215
|
test: async function () {
|
|
216
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
217
|
+
gameServerId: this.setupData.gameserver.id,
|
|
218
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
219
|
+
userConfig: JSON.stringify({
|
|
220
|
+
allowPublicTeleports: true,
|
|
221
|
+
timeout: 0,
|
|
222
|
+
}),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
225
|
const useTeleportsRole = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
|
|
226
226
|
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
227
227
|
permissions: [
|
|
@@ -232,17 +232,6 @@ const tests = [
|
|
|
232
232
|
],
|
|
233
233
|
});
|
|
234
234
|
|
|
235
|
-
await this.client.gameserver.gameServerControllerInstallModule(
|
|
236
|
-
this.setupData.gameserver.id,
|
|
237
|
-
this.setupData.teleportsModule.id,
|
|
238
|
-
{
|
|
239
|
-
userConfig: JSON.stringify({
|
|
240
|
-
allowPublicTeleports: true,
|
|
241
|
-
timeout: 0,
|
|
242
|
-
}),
|
|
243
|
-
},
|
|
244
|
-
);
|
|
245
|
-
|
|
246
235
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
247
236
|
|
|
248
237
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
@@ -270,8 +259,18 @@ const tests = [
|
|
|
270
259
|
group,
|
|
271
260
|
snapshot: false,
|
|
272
261
|
setup: modulesTestSetup,
|
|
262
|
+
attempts: 5,
|
|
273
263
|
name: 'Prohibits players from settings more public teleports than their role allows',
|
|
274
264
|
test: async function () {
|
|
265
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
266
|
+
gameServerId: this.setupData.gameserver.id,
|
|
267
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
268
|
+
userConfig: JSON.stringify({
|
|
269
|
+
allowPublicTeleports: true,
|
|
270
|
+
timeout: 0,
|
|
271
|
+
}),
|
|
272
|
+
});
|
|
273
|
+
|
|
275
274
|
const permissionRes = await this.client.permissionCodesToInputs(['TELEPORTS_CREATE_PUBLIC', 'TELEPORTS_USE']);
|
|
276
275
|
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
277
276
|
permissions: [
|
|
@@ -286,17 +285,6 @@ const tests = [
|
|
|
286
285
|
],
|
|
287
286
|
});
|
|
288
287
|
|
|
289
|
-
await this.client.gameserver.gameServerControllerInstallModule(
|
|
290
|
-
this.setupData.gameserver.id,
|
|
291
|
-
this.setupData.teleportsModule.id,
|
|
292
|
-
{
|
|
293
|
-
userConfig: JSON.stringify({
|
|
294
|
-
allowPublicTeleports: true,
|
|
295
|
-
timeout: 0,
|
|
296
|
-
}),
|
|
297
|
-
},
|
|
298
|
-
);
|
|
299
|
-
|
|
300
288
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 4);
|
|
301
289
|
|
|
302
290
|
await Promise.all(
|
|
@@ -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 teleport with /tp',
|
|
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, 1);
|
|
19
20
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
@@ -40,10 +41,10 @@ const tests = [
|
|
|
40
41
|
setup: modulesTestSetup,
|
|
41
42
|
name: 'Shows an error when teleporting to a non-existing teleport',
|
|
42
43
|
test: async function () {
|
|
43
|
-
await this.client.
|
|
44
|
-
this.setupData.gameserver.id,
|
|
45
|
-
this.setupData.teleportsModule.id,
|
|
46
|
-
);
|
|
44
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
45
|
+
gameServerId: this.setupData.gameserver.id,
|
|
46
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
47
|
+
});
|
|
47
48
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
48
49
|
|
|
49
50
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
@@ -61,15 +62,13 @@ const tests = [
|
|
|
61
62
|
setup: modulesTestSetup,
|
|
62
63
|
name: 'Times out when teleporting faster than set timeout',
|
|
63
64
|
test: async function () {
|
|
64
|
-
await this.client.
|
|
65
|
-
this.setupData.gameserver.id,
|
|
66
|
-
this.setupData.teleportsModule.id,
|
|
67
|
-
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
);
|
|
65
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
66
|
+
gameServerId: this.setupData.gameserver.id,
|
|
67
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
68
|
+
userConfig: JSON.stringify({
|
|
69
|
+
timeout: 5000,
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
73
72
|
|
|
74
73
|
const setTpEvent = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
75
74
|
|
|
@@ -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 set a teleport with /settp',
|
|
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
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
18
19
|
|
|
19
20
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
@@ -31,10 +32,10 @@ const tests = [
|
|
|
31
32
|
setup: modulesTestSetup,
|
|
32
33
|
name: 'Shows an error when setting a teleport with an existing name',
|
|
33
34
|
test: async function () {
|
|
34
|
-
await this.client.
|
|
35
|
-
this.setupData.gameserver.id,
|
|
36
|
-
this.setupData.teleportsModule.id,
|
|
37
|
-
);
|
|
35
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
36
|
+
gameServerId: this.setupData.gameserver.id,
|
|
37
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
38
|
+
});
|
|
38
39
|
|
|
39
40
|
const firstEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
40
41
|
|
|
@@ -65,10 +66,10 @@ const tests = [
|
|
|
65
66
|
setup: modulesTestSetup,
|
|
66
67
|
name: 'Cannot set more than the user-defined amount of max teleports',
|
|
67
68
|
test: async function () {
|
|
68
|
-
await this.client.
|
|
69
|
-
this.setupData.gameserver.id,
|
|
70
|
-
this.setupData.teleportsModule.id,
|
|
71
|
-
);
|
|
69
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
70
|
+
gameServerId: this.setupData.gameserver.id,
|
|
71
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
72
|
+
});
|
|
72
73
|
|
|
73
74
|
const useTeleportsRole = await this.client.permissionCodesToInputs(['TELEPORTS_USE']);
|
|
74
75
|
await this.client.role.roleControllerUpdate(this.setupData.role.id, {
|
|
@@ -115,10 +116,10 @@ const tests = [
|
|
|
115
116
|
setup: modulesTestSetup,
|
|
116
117
|
name: 'Can remove teleports with /deletetp',
|
|
117
118
|
test: async function () {
|
|
118
|
-
await this.client.
|
|
119
|
-
this.setupData.gameserver.id,
|
|
120
|
-
this.setupData.teleportsModule.id,
|
|
121
|
-
);
|
|
119
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
120
|
+
gameServerId: this.setupData.gameserver.id,
|
|
121
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
122
|
+
});
|
|
122
123
|
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 3);
|
|
123
124
|
|
|
124
125
|
await Promise.all(
|
|
@@ -151,10 +152,10 @@ const tests = [
|
|
|
151
152
|
setup: modulesTestSetup,
|
|
152
153
|
name: 'Shows an error when removing a non-existing teleport',
|
|
153
154
|
test: async function () {
|
|
154
|
-
await this.client.
|
|
155
|
-
this.setupData.gameserver.id,
|
|
156
|
-
this.setupData.teleportsModule.id,
|
|
157
|
-
);
|
|
155
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
156
|
+
gameServerId: this.setupData.gameserver.id,
|
|
157
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
158
|
+
});
|
|
158
159
|
const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
159
160
|
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
160
161
|
msg: '/deletetp test',
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from '@takaro/test';
|
|
9
9
|
import { GameEvents, HookEvents } from '../../dto/index.js';
|
|
10
10
|
import { GameServerTypesOutputDTOTypeEnum, PlayerOutputDTO, RoleOutputDTO } from '@takaro/apiclient';
|
|
11
|
+
import { describe } from 'node:test';
|
|
11
12
|
|
|
12
13
|
const group = 'Teleports - waypoints';
|
|
13
14
|
|
|
@@ -21,7 +22,10 @@ interface WaypointsSetup extends IModuleTestsSetupData {
|
|
|
21
22
|
const waypointsSetup = async function (this: IntegrationTest<WaypointsSetup>): Promise<WaypointsSetup> {
|
|
22
23
|
const setupData = await modulesTestSetup.bind(this as unknown as IntegrationTest<IModuleTestsSetupData>)();
|
|
23
24
|
|
|
24
|
-
await this.client.
|
|
25
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
26
|
+
gameServerId: setupData.gameserver.id,
|
|
27
|
+
versionId: setupData.teleportsModule.latestVersion.id,
|
|
28
|
+
});
|
|
25
29
|
|
|
26
30
|
const playersRes = await this.client.player.playerControllerSearch();
|
|
27
31
|
|
|
@@ -55,7 +59,7 @@ const waypointsSetup = async function (this: IntegrationTest<WaypointsSetup>): P
|
|
|
55
59
|
};
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
async function setupSecondServer() {
|
|
62
|
+
async function setupSecondServer(this: IntegrationTest<WaypointsSetup>) {
|
|
59
63
|
const newGameServer = await this.client.gameserver.gameServerControllerCreate({
|
|
60
64
|
name: 'newServer',
|
|
61
65
|
connectionInfo: JSON.stringify({
|
|
@@ -65,10 +69,10 @@ async function setupSecondServer() {
|
|
|
65
69
|
type: GameServerTypesOutputDTOTypeEnum.Mock,
|
|
66
70
|
});
|
|
67
71
|
|
|
68
|
-
await this.client.
|
|
69
|
-
newGameServer.data.data.id,
|
|
70
|
-
this.setupData.teleportsModule.id,
|
|
71
|
-
);
|
|
72
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
73
|
+
gameServerId: newGameServer.data.data.id,
|
|
74
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
75
|
+
});
|
|
72
76
|
|
|
73
77
|
const connectedEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
|
|
74
78
|
GameEvents.PLAYER_CONNECTED,
|
|
@@ -635,6 +639,48 @@ const tests = [
|
|
|
635
639
|
expect((await teleportEvents2)[0].data.meta.msg).to.be.eq('You are not allowed to use the waypoint A.');
|
|
636
640
|
},
|
|
637
641
|
}),
|
|
642
|
+
new IntegrationTest<WaypointsSetup>({
|
|
643
|
+
group,
|
|
644
|
+
snapshot: false,
|
|
645
|
+
setup: waypointsSetup,
|
|
646
|
+
name: 'Reconciler recreates waypoints when deleting the waypoints module',
|
|
647
|
+
test: async function () {
|
|
648
|
+
// Create a waypoint
|
|
649
|
+
// Delete the waypoints module
|
|
650
|
+
// Create another waypoint
|
|
651
|
+
// Both should be present in the waypoints module
|
|
652
|
+
|
|
653
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
654
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
655
|
+
msg: '/setwaypoint A',
|
|
656
|
+
playerId: this.setupData.moderator.id,
|
|
657
|
+
});
|
|
658
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint A set.');
|
|
659
|
+
|
|
660
|
+
const waypointsModuleToRemove = await this.client.module.moduleControllerSearch({
|
|
661
|
+
filters: { name: ['Waypoints'] },
|
|
662
|
+
});
|
|
663
|
+
if (!waypointsModuleToRemove.data.data.length) {
|
|
664
|
+
throw new Error('Waypoints module not found');
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
await this.client.module.moduleControllerRemove(waypointsModuleToRemove.data.data[0].id);
|
|
668
|
+
|
|
669
|
+
const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
670
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
671
|
+
msg: '/setwaypoint B',
|
|
672
|
+
playerId: this.setupData.moderator.id,
|
|
673
|
+
});
|
|
674
|
+
expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint B set.');
|
|
675
|
+
|
|
676
|
+
const waypointsModule = await this.client.module.moduleControllerSearch({ filters: { name: ['Waypoints'] } });
|
|
677
|
+
if (!waypointsModule.data.data.length) {
|
|
678
|
+
throw new Error('Waypoints module not found');
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
expect(waypointsModule.data.data[0].latestVersion.commands).to.be.lengthOf(2);
|
|
682
|
+
},
|
|
683
|
+
}),
|
|
638
684
|
];
|
|
639
685
|
|
|
640
686
|
describe(group, function () {
|
package/src/dto/takaroEvents.ts
CHANGED
|
@@ -42,6 +42,9 @@ export const TakaroEvents = {
|
|
|
42
42
|
SHOP_ORDER_CREATED: 'shop-order-created',
|
|
43
43
|
SHOP_ORDER_STATUS_CHANGED: 'shop-order-status-changed',
|
|
44
44
|
PLAYER_LINKED: 'player-linked',
|
|
45
|
+
GAMESERVER_CREATED: 'gameserver-created',
|
|
46
|
+
GAMESERVER_UPDATED: 'gameserver-updated',
|
|
47
|
+
GAMESERVER_DELETED: 'gameserver-deleted',
|
|
45
48
|
} as const;
|
|
46
49
|
|
|
47
50
|
export class BaseTakaroEvent<T> extends BaseEvent<T> {
|
|
@@ -330,6 +333,21 @@ export class TakaroEventPlayerLinked extends BaseEvent<TakaroEventPlayerLinked>
|
|
|
330
333
|
type = TakaroEvents.PLAYER_LINKED;
|
|
331
334
|
}
|
|
332
335
|
|
|
336
|
+
export class TakaroEventGameserverCreated extends BaseEvent<TakaroEventGameserverCreated> {
|
|
337
|
+
@IsString()
|
|
338
|
+
type = TakaroEvents.GAMESERVER_CREATED;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export class TakaroEventGameserverUpdated extends BaseEvent<TakaroEventGameserverUpdated> {
|
|
342
|
+
@IsString()
|
|
343
|
+
type = TakaroEvents.GAMESERVER_UPDATED;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export class TakaroEventGameserverDeleted extends BaseEvent<TakaroEventGameserverDeleted> {
|
|
347
|
+
@IsString()
|
|
348
|
+
type = TakaroEvents.GAMESERVER_DELETED;
|
|
349
|
+
}
|
|
350
|
+
|
|
333
351
|
export const TakaroEventsMapping = {
|
|
334
352
|
[TakaroEvents.ROLE_ASSIGNED]: TakaroEventRoleAssigned,
|
|
335
353
|
[TakaroEvents.PLAYER_NEW_IP_DETECTED]: TakaroEventPlayerNewIpDetected,
|
|
@@ -356,4 +374,7 @@ export const TakaroEventsMapping = {
|
|
|
356
374
|
[TakaroEvents.SHOP_ORDER_CREATED]: TakaroEventShopOrderCreated,
|
|
357
375
|
[TakaroEvents.SHOP_ORDER_STATUS_CHANGED]: TakaroEventShopOrderStatusChanged,
|
|
358
376
|
[TakaroEvents.PLAYER_LINKED]: TakaroEventPlayerLinked,
|
|
377
|
+
[TakaroEvents.GAMESERVER_CREATED]: TakaroEventGameserverCreated,
|
|
378
|
+
[TakaroEvents.GAMESERVER_UPDATED]: TakaroEventGameserverUpdated,
|
|
379
|
+
[TakaroEvents.GAMESERVER_DELETED]: TakaroEventGameserverDeleted,
|
|
359
380
|
} as const;
|
package/src/main.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO } from './BuiltinModule.js';
|
|
2
2
|
import { ChatBridge } from './modules/chatBridge/index.js';
|
|
3
|
+
import { DailyRewards } from './modules/dailyRewards/index.js';
|
|
3
4
|
import { EconomyUtils } from './modules/economyUtils/index.js';
|
|
4
5
|
import { GeoBlock } from './modules/geoBlock/index.js';
|
|
5
6
|
import { Gimme } from './modules/gimme/index.js';
|
|
@@ -11,12 +12,20 @@ import { Teleports } from './modules/teleports/index.js';
|
|
|
11
12
|
import { TimedShutdown } from './modules/timedShutdown/index.js';
|
|
12
13
|
import { Utils } from './modules/utils/index.js';
|
|
13
14
|
|
|
14
|
-
export {
|
|
15
|
+
export {
|
|
16
|
+
ModuleTransferDTO,
|
|
17
|
+
ModuleTransferVersionDTO,
|
|
18
|
+
ICommand,
|
|
19
|
+
ICommandArgument,
|
|
20
|
+
ICronJob,
|
|
21
|
+
IHook,
|
|
22
|
+
IFunction,
|
|
23
|
+
} from './BuiltinModule.js';
|
|
15
24
|
export * from './dto/index.js';
|
|
16
25
|
|
|
17
|
-
let cached: Array<
|
|
26
|
+
let cached: Array<ModuleTransferDTO<unknown>> | null = null;
|
|
18
27
|
|
|
19
|
-
export function getModules(): Array<
|
|
28
|
+
export function getModules(): Array<ModuleTransferDTO<unknown>> {
|
|
20
29
|
if (!cached) {
|
|
21
30
|
cached = [
|
|
22
31
|
new Utils(),
|
|
@@ -30,6 +39,7 @@ export function getModules(): Array<BuiltinModule<unknown>> {
|
|
|
30
39
|
new Lottery(),
|
|
31
40
|
new GeoBlock(),
|
|
32
41
|
new TimedShutdown(),
|
|
42
|
+
new DailyRewards(),
|
|
33
43
|
];
|
|
34
44
|
}
|
|
35
45
|
|
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, IHook, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
import { HookEvents } from '../../dto/index.js';
|
|
3
3
|
|
|
4
|
-
export class ChatBridge extends
|
|
4
|
+
export class ChatBridge extends ModuleTransferDTO<ChatBridge> {
|
|
5
5
|
constructor() {
|
|
6
|
-
super(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
super();
|
|
7
|
+
this.name = 'chatBridge';
|
|
8
|
+
this.versions = [
|
|
9
|
+
new ModuleTransferVersionDTO({
|
|
10
|
+
tag: '0.0.1',
|
|
11
|
+
description: 'Connect chat to other services like Discord.',
|
|
12
|
+
configSchema: JSON.stringify({
|
|
13
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
sendPlayerConnected: {
|
|
17
|
+
title: 'Send player connected',
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
description: 'Send a message when a player connects.',
|
|
20
|
+
default: true,
|
|
21
|
+
},
|
|
22
|
+
sendPlayerDisconnected: {
|
|
23
|
+
title: 'Send player disconnected',
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
description: 'Send a message when a player disconnects.',
|
|
26
|
+
default: true,
|
|
27
|
+
},
|
|
28
|
+
onlyGlobalChat: {
|
|
29
|
+
title: 'Only global chat',
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
default: true,
|
|
32
|
+
description: 'Only relay messages from global chat. (no team chat or private messages)',
|
|
33
|
+
},
|
|
18
34
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
eventType: HookEvents.CHAT_MESSAGE,
|
|
44
|
-
name: 'GameToDiscord',
|
|
45
|
-
function: this.loadFn('hooks', 'GameToDiscord'),
|
|
46
|
-
}),
|
|
47
|
-
new IHook({
|
|
48
|
-
eventType: HookEvents.PLAYER_CONNECTED,
|
|
49
|
-
name: 'PlayerConnected',
|
|
50
|
-
function: this.loadFn('hooks', 'PlayerConnected'),
|
|
51
|
-
}),
|
|
52
|
-
new IHook({
|
|
53
|
-
eventType: HookEvents.PLAYER_DISCONNECTED,
|
|
54
|
-
name: 'PlayerDisconnected',
|
|
55
|
-
function: this.loadFn('hooks', 'PlayerDisconnected'),
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
}),
|
|
37
|
+
hooks: [
|
|
38
|
+
new IHook({
|
|
39
|
+
eventType: HookEvents.DISCORD_MESSAGE,
|
|
40
|
+
name: 'DiscordToGame',
|
|
41
|
+
function: this.loadFn('hooks', 'DiscordToGame'),
|
|
42
|
+
}),
|
|
43
|
+
new IHook({
|
|
44
|
+
eventType: HookEvents.CHAT_MESSAGE,
|
|
45
|
+
name: 'GameToDiscord',
|
|
46
|
+
function: this.loadFn('hooks', 'GameToDiscord'),
|
|
47
|
+
}),
|
|
48
|
+
new IHook({
|
|
49
|
+
eventType: HookEvents.PLAYER_CONNECTED,
|
|
50
|
+
name: 'PlayerConnected',
|
|
51
|
+
function: this.loadFn('hooks', 'PlayerConnected'),
|
|
52
|
+
}),
|
|
53
|
+
new IHook({
|
|
54
|
+
eventType: HookEvents.PLAYER_DISCONNECTED,
|
|
55
|
+
name: 'PlayerDisconnected',
|
|
56
|
+
function: this.loadFn('hooks', 'PlayerDisconnected'),
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
56
59
|
}),
|
|
57
60
|
];
|
|
58
61
|
}
|