@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,48 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, ICommand, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
|
|
3
|
-
export class Gimme extends
|
|
3
|
+
export class Gimme extends ModuleTransferDTO<Gimme> {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
description: 'List of items that a player can receive.',
|
|
17
|
-
uniqueItems: true,
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
this.name = 'gimme';
|
|
8
|
+
this.versions = [
|
|
9
|
+
new ModuleTransferVersionDTO({
|
|
10
|
+
tag: '0.0.1',
|
|
11
|
+
description: 'Randomly selects item from a list of items and entities.',
|
|
12
|
+
configSchema: JSON.stringify({
|
|
13
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
18
16
|
items: {
|
|
19
|
-
|
|
17
|
+
'x-component': 'item',
|
|
18
|
+
type: 'array',
|
|
19
|
+
title: 'Items',
|
|
20
|
+
description: 'List of items that a player can receive.',
|
|
21
|
+
uniqueItems: true,
|
|
22
|
+
items: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
title: 'Item',
|
|
25
|
+
properties: {
|
|
26
|
+
item: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
title: 'Item',
|
|
29
|
+
},
|
|
30
|
+
amount: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
title: 'Amount',
|
|
33
|
+
},
|
|
34
|
+
quality: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
title: 'Quality',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
commands: {
|
|
42
|
+
title: 'Commands',
|
|
43
|
+
type: 'array',
|
|
44
|
+
default: ['say hello from gimme'],
|
|
45
|
+
items: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
},
|
|
20
48
|
},
|
|
21
49
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
50
|
+
required: ['items'],
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
}),
|
|
53
|
+
uiSchema: JSON.stringify({
|
|
54
|
+
items: {
|
|
26
55
|
items: {
|
|
27
|
-
|
|
56
|
+
item: {
|
|
57
|
+
'ui:widget': 'item',
|
|
58
|
+
},
|
|
28
59
|
},
|
|
29
60
|
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
new ICommand({
|
|
41
|
-
function: this.loadFn('commands', 'gimme'),
|
|
42
|
-
name: 'gimme',
|
|
43
|
-
trigger: 'gimme',
|
|
44
|
-
helpText: 'Randomly selects item from a list of items and entities.',
|
|
45
|
-
arguments: [],
|
|
61
|
+
}),
|
|
62
|
+
commands: [
|
|
63
|
+
new ICommand({
|
|
64
|
+
function: this.loadFn('commands', 'gimme'),
|
|
65
|
+
name: 'gimme',
|
|
66
|
+
trigger: 'gimme',
|
|
67
|
+
helpText: 'Randomly selects item from a list of items and entities.',
|
|
68
|
+
arguments: [],
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
46
71
|
}),
|
|
47
72
|
];
|
|
48
73
|
}
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, ICronJob, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
|
|
3
|
-
export class HighPingKicker extends
|
|
3
|
+
export class HighPingKicker extends ModuleTransferDTO<HighPingKicker> {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
super();
|
|
6
|
+
this.name = 'highPingKicker';
|
|
7
|
+
this.versions = [
|
|
8
|
+
new ModuleTransferVersionDTO({
|
|
9
|
+
tag: '0.0.1',
|
|
10
|
+
description: 'Automatically kick players with high ping, with warnings and configurable thresholds.',
|
|
11
|
+
configSchema: JSON.stringify({
|
|
12
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
pingThreshold: {
|
|
16
|
+
type: 'number',
|
|
17
|
+
title: 'Ping threshold',
|
|
18
|
+
description: 'A ping value that is deemed too high and prompts a warning.',
|
|
19
|
+
default: 200,
|
|
20
|
+
minimum: 0,
|
|
21
|
+
},
|
|
22
|
+
warningsBeforeKick: {
|
|
23
|
+
type: 'number',
|
|
24
|
+
title: 'Kick warnings',
|
|
25
|
+
description: 'Number of warnings before a player is kicked.',
|
|
26
|
+
default: 3,
|
|
27
|
+
minimum: 0,
|
|
28
|
+
},
|
|
18
29
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
this.cronJobs = [
|
|
32
|
-
new ICronJob({
|
|
33
|
-
name: 'Ping check',
|
|
34
|
-
temporalValue: '*/5 * * * *',
|
|
35
|
-
function: this.loadFn('cronJobs', 'Ping check'),
|
|
30
|
+
required: [],
|
|
31
|
+
}),
|
|
32
|
+
cronJobs: [
|
|
33
|
+
new ICronJob({
|
|
34
|
+
name: 'Ping check',
|
|
35
|
+
temporalValue: '*/5 * * * *',
|
|
36
|
+
function: this.loadFn('cronJobs', 'Ping check'),
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
36
39
|
}),
|
|
37
40
|
];
|
|
38
41
|
}
|
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, ICommand, ICronJob, IPermission, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
|
|
3
|
-
export class Lottery extends
|
|
3
|
+
export class Lottery extends ModuleTransferDTO<Lottery> {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(
|
|
6
|
-
'lottery',
|
|
7
|
-
'Players can buy tickets for a lottery, and the winner is chosen at random.',
|
|
8
|
-
JSON.stringify({
|
|
9
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {
|
|
12
|
-
profitMargin: {
|
|
13
|
-
type: 'number',
|
|
14
|
-
maximum: 1,
|
|
15
|
-
minimum: 0,
|
|
16
|
-
description: 'The profit margin the server takes from the lottery.',
|
|
17
|
-
default: 0.1,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
required: [],
|
|
21
|
-
additionalProperties: false,
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
5
|
+
super();
|
|
24
6
|
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
new ICronJob({
|
|
42
|
-
name: 'drawLottery',
|
|
43
|
-
temporalValue: '0 0 * * *',
|
|
44
|
-
function: this.loadFn('cronJobs', 'drawLottery'),
|
|
45
|
-
}),
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
this.commands = [
|
|
49
|
-
new ICommand({
|
|
50
|
-
function: this.loadFn('commands', 'buyTicket'),
|
|
51
|
-
name: 'buyTicket',
|
|
52
|
-
trigger: 'buyTicket',
|
|
53
|
-
helpText: 'Buy a lottery ticket.',
|
|
54
|
-
arguments: [
|
|
55
|
-
{
|
|
56
|
-
name: 'amount',
|
|
57
|
-
type: 'number',
|
|
58
|
-
helpText: 'The amount of tickets to buy.',
|
|
59
|
-
position: 0,
|
|
60
|
-
defaultValue: null,
|
|
7
|
+
this.name = 'lottery';
|
|
8
|
+
this.versions = [
|
|
9
|
+
new ModuleTransferVersionDTO({
|
|
10
|
+
tag: '0.0.1',
|
|
11
|
+
description: 'Players can buy tickets for a lottery, and the winner is chosen at random.',
|
|
12
|
+
configSchema: JSON.stringify({
|
|
13
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
profitMargin: {
|
|
17
|
+
type: 'number',
|
|
18
|
+
maximum: 1,
|
|
19
|
+
minimum: 0,
|
|
20
|
+
description: 'The profit margin the server takes from the lottery.',
|
|
21
|
+
default: 0.1,
|
|
22
|
+
},
|
|
61
23
|
},
|
|
24
|
+
required: [],
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
}),
|
|
27
|
+
permissions: [
|
|
28
|
+
new IPermission({
|
|
29
|
+
permission: 'LOTTERY_BUY',
|
|
30
|
+
friendlyName: 'Buy Lottery Tickets',
|
|
31
|
+
canHaveCount: false,
|
|
32
|
+
description: 'Allows the player to buy lottery tickets.',
|
|
33
|
+
}),
|
|
34
|
+
new IPermission({
|
|
35
|
+
permission: 'LOTTERY_VIEW_TICKETS',
|
|
36
|
+
friendlyName: 'View Lottery Tickets',
|
|
37
|
+
description: 'Allows the player to view his lottery tickets.',
|
|
38
|
+
canHaveCount: false,
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
cronJobs: [
|
|
42
|
+
new ICronJob({
|
|
43
|
+
name: 'drawLottery',
|
|
44
|
+
temporalValue: '0 0 * * *',
|
|
45
|
+
function: this.loadFn('cronJobs', 'drawLottery'),
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
commands: [
|
|
49
|
+
new ICommand({
|
|
50
|
+
function: this.loadFn('commands', 'buyTicket'),
|
|
51
|
+
name: 'buyTicket',
|
|
52
|
+
trigger: 'buyTicket',
|
|
53
|
+
helpText: 'Buy a lottery ticket.',
|
|
54
|
+
arguments: [
|
|
55
|
+
{
|
|
56
|
+
name: 'amount',
|
|
57
|
+
type: 'number',
|
|
58
|
+
helpText: 'The amount of tickets to buy.',
|
|
59
|
+
position: 0,
|
|
60
|
+
defaultValue: null,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
new ICommand({
|
|
65
|
+
function: this.loadFn('commands', 'viewTickets'),
|
|
66
|
+
name: 'viewTickets',
|
|
67
|
+
trigger: 'viewTickets',
|
|
68
|
+
helpText: 'View your lottery tickets.',
|
|
69
|
+
arguments: [],
|
|
70
|
+
}),
|
|
71
|
+
new ICommand({
|
|
72
|
+
function: this.loadFn('commands', 'nextDraw'),
|
|
73
|
+
name: 'nextDraw',
|
|
74
|
+
trigger: 'nextDraw',
|
|
75
|
+
helpText: 'View when the next draw is.',
|
|
76
|
+
arguments: [],
|
|
77
|
+
}),
|
|
62
78
|
],
|
|
63
|
-
}),
|
|
64
|
-
new ICommand({
|
|
65
|
-
function: this.loadFn('commands', 'viewTickets'),
|
|
66
|
-
name: 'viewTickets',
|
|
67
|
-
trigger: 'viewTickets',
|
|
68
|
-
helpText: 'View your lottery tickets.',
|
|
69
|
-
arguments: [],
|
|
70
|
-
}),
|
|
71
|
-
new ICommand({
|
|
72
|
-
function: this.loadFn('commands', 'nextDraw'),
|
|
73
|
-
name: 'nextDraw',
|
|
74
|
-
trigger: 'nextDraw',
|
|
75
|
-
helpText: 'View when the next draw is.',
|
|
76
|
-
arguments: [],
|
|
77
79
|
}),
|
|
78
80
|
];
|
|
79
81
|
}
|
|
@@ -7,7 +7,7 @@ async function main() {
|
|
|
7
7
|
|
|
8
8
|
if (!items || items.length === 0) {
|
|
9
9
|
throw new TakaroUserError(
|
|
10
|
-
'No starter kit items configured. Please ask your server administrator to configure this.'
|
|
10
|
+
'No starter kit items configured. Please ask your server administrator to configure this.',
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -25,13 +25,27 @@ async function main() {
|
|
|
25
25
|
|
|
26
26
|
await data.player.pm('You are about to receive your starter kit...');
|
|
27
27
|
|
|
28
|
+
const itemRecords = (await takaro.item.itemControllerSearch({ filters: { id: items.map((_) => _.item) } })).data.data;
|
|
29
|
+
const fullItems = items.map((item) => {
|
|
30
|
+
const itemRecord = itemRecords.find((record) => record.id === item.item);
|
|
31
|
+
if (!itemRecord) {
|
|
32
|
+
throw new TakaroUserError(`Item with ID ${item.item} not found.`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
code: itemRecord.code,
|
|
36
|
+
quality: item.quality,
|
|
37
|
+
amount: item.amount,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
28
41
|
await Promise.all(
|
|
29
|
-
|
|
42
|
+
fullItems.map(async (item) => {
|
|
30
43
|
return takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
|
|
31
|
-
name: item,
|
|
32
|
-
|
|
44
|
+
name: item.code,
|
|
45
|
+
quality: item.quality ?? '',
|
|
46
|
+
amount: item.amount,
|
|
33
47
|
});
|
|
34
|
-
})
|
|
48
|
+
}),
|
|
35
49
|
);
|
|
36
50
|
|
|
37
51
|
await takaro.variable.variableControllerCreate({
|
|
@@ -1,58 +1,83 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, ICommand, IHook, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
import { HookEvents } from '../../dto/index.js';
|
|
3
3
|
|
|
4
|
-
export class PlayerOnboarding extends
|
|
4
|
+
export class PlayerOnboarding extends ModuleTransferDTO<PlayerOnboarding> {
|
|
5
5
|
constructor() {
|
|
6
|
-
super(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
message
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
super();
|
|
7
|
+
|
|
8
|
+
this.name = 'playerOnboarding';
|
|
9
|
+
this.versions = [
|
|
10
|
+
new ModuleTransferVersionDTO({
|
|
11
|
+
tag: '0.0.1',
|
|
12
|
+
description:
|
|
13
|
+
'Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message.',
|
|
14
|
+
configSchema: JSON.stringify({
|
|
15
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
message: {
|
|
19
|
+
title: 'Message',
|
|
20
|
+
description: 'The message to send to the player when they join the server.',
|
|
21
|
+
type: 'string',
|
|
22
|
+
minLength: 1,
|
|
23
|
+
maxLength: 256,
|
|
24
|
+
default: 'Welcome {player} to the server!',
|
|
25
|
+
},
|
|
26
|
+
starterKitItems: {
|
|
27
|
+
type: 'array',
|
|
28
|
+
title: 'Starter kit items',
|
|
29
|
+
'x-component': 'item',
|
|
30
|
+
description:
|
|
31
|
+
'List of items a player will receive when they execute the starterkit command for the first time.',
|
|
32
|
+
uniqueItems: true,
|
|
33
|
+
items: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
title: 'Item',
|
|
36
|
+
properties: {
|
|
37
|
+
item: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
title: 'Item',
|
|
40
|
+
},
|
|
41
|
+
amount: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
title: 'Amount',
|
|
44
|
+
},
|
|
45
|
+
quality: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
title: 'Quality',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
20
52
|
},
|
|
53
|
+
required: [],
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
}),
|
|
56
|
+
uiSchema: JSON.stringify({
|
|
21
57
|
starterKitItems: {
|
|
22
|
-
type: 'array',
|
|
23
|
-
'x-component': 'item',
|
|
24
|
-
title: 'Starter kit items',
|
|
25
|
-
description:
|
|
26
|
-
'List of items a player will receive when they execute the starterkit command for the first time.',
|
|
27
|
-
uniqueItems: true,
|
|
28
58
|
items: {
|
|
29
|
-
|
|
59
|
+
item: {
|
|
60
|
+
'ui:widget': 'item',
|
|
61
|
+
},
|
|
30
62
|
},
|
|
31
63
|
},
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.commands = [
|
|
50
|
-
new ICommand({
|
|
51
|
-
name: 'starterkit',
|
|
52
|
-
function: this.loadFn('commands', 'starterkit'),
|
|
53
|
-
trigger: 'starterkit',
|
|
54
|
-
helpText: 'Get a starter kit, you can only execute this once on a server!',
|
|
55
|
-
arguments: [],
|
|
64
|
+
}),
|
|
65
|
+
hooks: [
|
|
66
|
+
new IHook({
|
|
67
|
+
eventType: HookEvents.PLAYER_CONNECTED,
|
|
68
|
+
name: 'playerConnected',
|
|
69
|
+
function: this.loadFn('hooks', 'playerConnected'),
|
|
70
|
+
}),
|
|
71
|
+
],
|
|
72
|
+
commands: [
|
|
73
|
+
new ICommand({
|
|
74
|
+
name: 'starterkit',
|
|
75
|
+
function: this.loadFn('commands', 'starterkit'),
|
|
76
|
+
trigger: 'starterkit',
|
|
77
|
+
helpText: 'Get a starter kit, you can only execute this once on a server!',
|
|
78
|
+
arguments: [],
|
|
79
|
+
}),
|
|
80
|
+
],
|
|
56
81
|
}),
|
|
57
82
|
];
|
|
58
83
|
}
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, ICronJob, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
|
|
3
|
-
export class ServerMessages extends
|
|
3
|
+
export class ServerMessages extends ModuleTransferDTO<ServerMessages> {
|
|
4
4
|
constructor() {
|
|
5
|
-
super(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
this.name = 'serverMessages';
|
|
8
|
+
this.versions = [
|
|
9
|
+
new ModuleTransferVersionDTO({
|
|
10
|
+
tag: '0.0.1',
|
|
11
|
+
description: 'Send automated, rotated, configurable messages to players on the server.',
|
|
12
|
+
configSchema: JSON.stringify({
|
|
13
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
messages: {
|
|
17
|
+
type: 'array',
|
|
18
|
+
title: 'Messages',
|
|
19
|
+
description: 'List of messages that will be sent to players on the server.',
|
|
20
|
+
default: [
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
'This is an automated message, don\'t forget to read the server rules!',
|
|
23
|
+
],
|
|
24
|
+
items: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
minLength: 5,
|
|
27
|
+
maxLength: 1024,
|
|
28
|
+
},
|
|
29
|
+
minItems: 1,
|
|
24
30
|
},
|
|
25
|
-
minItems: 1,
|
|
26
31
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function: this.loadFn('cronJobs', 'Automated message'),
|
|
32
|
+
required: ['messages'],
|
|
33
|
+
}),
|
|
34
|
+
cronJobs: [
|
|
35
|
+
new ICronJob({
|
|
36
|
+
name: 'Automated message',
|
|
37
|
+
temporalValue: '*/30 * * * *',
|
|
38
|
+
function: this.loadFn('cronJobs', 'Automated message'),
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
37
41
|
}),
|
|
38
42
|
];
|
|
39
43
|
}
|
|
@@ -1,56 +1,18 @@
|
|
|
1
1
|
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
-
|
|
3
|
-
function getWaypointName(name) {
|
|
4
|
-
return `waypoint ${name}`;
|
|
5
|
-
}
|
|
2
|
+
import { getWaypointName, waypointReconciler } from './utils.js';
|
|
6
3
|
|
|
7
4
|
async function main() {
|
|
8
|
-
const { pog, gameServerId, arguments: args } = data;
|
|
5
|
+
const { pog, gameServerId, arguments: args, module: mod } = data;
|
|
9
6
|
|
|
10
7
|
if (!checkPermission(pog, 'TELEPORTS_MANAGE_WAYPOINTS')) {
|
|
11
8
|
throw new TakaroUserError('You do not have permission to manage waypoints.');
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
async function ensureWaypointsModule() {
|
|
15
|
-
let waypointsDefinition = (
|
|
16
|
-
await takaro.module.moduleControllerSearch({
|
|
17
|
-
filters: {
|
|
18
|
-
name: ['Waypoints'],
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
).data.data[0];
|
|
22
|
-
|
|
23
|
-
if (!waypointsDefinition) {
|
|
24
|
-
console.log('Waypoints module definition not found, creating it.');
|
|
25
|
-
waypointsDefinition = (
|
|
26
|
-
await takaro.module.moduleControllerCreate({
|
|
27
|
-
name: 'Waypoints',
|
|
28
|
-
description: 'Waypoints module for the teleport system.',
|
|
29
|
-
})
|
|
30
|
-
).data.data;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let waypointsInstallation = (
|
|
34
|
-
await takaro.gameserver.gameServerControllerGetInstalledModules(gameServerId)
|
|
35
|
-
).data.data.find((module) => module.name === 'Waypoints');
|
|
36
|
-
|
|
37
|
-
if (!waypointsInstallation) {
|
|
38
|
-
console.log('Waypoints module not found, installing it.');
|
|
39
|
-
waypointsInstallation = (
|
|
40
|
-
await takaro.gameserver.gameServerControllerInstallModule(gameServerId, waypointsDefinition.id)
|
|
41
|
-
).data.data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return { waypointsInstallation, waypointsDefinition };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const { waypointsInstallation } = await ensureWaypointsModule();
|
|
48
|
-
|
|
49
11
|
const variable = await takaro.variable.variableControllerSearch({
|
|
50
12
|
filters: {
|
|
51
13
|
key: [getWaypointName(args.waypoint)],
|
|
52
14
|
gameServerId: [gameServerId],
|
|
53
|
-
moduleId: [
|
|
15
|
+
moduleId: [mod.moduleId],
|
|
54
16
|
},
|
|
55
17
|
});
|
|
56
18
|
|
|
@@ -59,18 +21,7 @@ async function main() {
|
|
|
59
21
|
}
|
|
60
22
|
|
|
61
23
|
await takaro.variable.variableControllerDelete(variable.data.data[0].id);
|
|
62
|
-
|
|
63
|
-
const teleportCommand = await takaro.command.commandControllerSearch({
|
|
64
|
-
filters: {
|
|
65
|
-
moduleId: [waypointsInstallation.moduleId],
|
|
66
|
-
name: [`waypoint ${args.waypoint} server ${gameServerId}`],
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (teleportCommand.data.data.length) {
|
|
71
|
-
await takaro.command.commandControllerRemove(teleportCommand.data.data[0].id);
|
|
72
|
-
}
|
|
73
|
-
|
|
24
|
+
await waypointReconciler();
|
|
74
25
|
await pog.pm(`Waypoint ${args.waypoint} deleted.`);
|
|
75
26
|
}
|
|
76
27
|
|