@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,177 +1,185 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export class EconomyUtils extends
|
|
1
|
+
import { ModuleTransferDTO, ICommand, ICronJob, IPermission, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
|
+
export class EconomyUtils extends ModuleTransferDTO {
|
|
3
3
|
constructor() {
|
|
4
|
-
super(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
permission: 'ECONOMY_UTILS_MANAGE_CURRENCY',
|
|
27
|
-
friendlyName: 'Manage currency',
|
|
28
|
-
description: 'Allows players to manage currency of other players. This includes granting and revoking currency.',
|
|
29
|
-
canHaveCount: false,
|
|
30
|
-
}),
|
|
31
|
-
new IPermission({
|
|
32
|
-
permission: 'ZOMBIE_KILL_REWARD_OVERRIDE',
|
|
33
|
-
friendlyName: 'Zombie kill reward override',
|
|
34
|
-
description: 'Allows a role to override the amount of currency a player receives for killing a entity.',
|
|
35
|
-
canHaveCount: true,
|
|
36
|
-
}),
|
|
37
|
-
];
|
|
38
|
-
this.cronJobs = [
|
|
39
|
-
new ICronJob({
|
|
40
|
-
function: this.loadFn('cronJobs', 'zombieKillReward'),
|
|
41
|
-
name: 'zombieKillReward',
|
|
42
|
-
temporalValue: '*/5 * * * *',
|
|
43
|
-
}),
|
|
44
|
-
];
|
|
45
|
-
this.commands = [
|
|
46
|
-
new ICommand({
|
|
47
|
-
function: this.loadFn('commands', 'balance'),
|
|
48
|
-
name: 'balance',
|
|
49
|
-
trigger: 'balance',
|
|
50
|
-
helpText: 'Check your balance.',
|
|
51
|
-
arguments: [],
|
|
52
|
-
}),
|
|
53
|
-
new ICommand({
|
|
54
|
-
function: this.loadFn('commands', 'topCurrency'),
|
|
55
|
-
name: 'topCurrency',
|
|
56
|
-
trigger: 'topcurrency',
|
|
57
|
-
helpText: 'List of the 10 players with the highest balance.',
|
|
58
|
-
arguments: [],
|
|
59
|
-
}),
|
|
60
|
-
new ICommand({
|
|
61
|
-
function: this.loadFn('commands', 'grantCurrency'),
|
|
62
|
-
name: 'grantCurrency',
|
|
63
|
-
trigger: 'grantcurrency',
|
|
64
|
-
helpText: 'Grant money to a player. The money is not taken from your own balance but is new currency.',
|
|
65
|
-
arguments: [
|
|
66
|
-
{
|
|
67
|
-
name: 'receiver',
|
|
68
|
-
type: 'player',
|
|
69
|
-
helpText: 'The player to grant currency to.',
|
|
70
|
-
position: 0,
|
|
71
|
-
defaultValue: null,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
name: 'amount',
|
|
75
|
-
type: 'number',
|
|
76
|
-
helpText: 'The amount of money.',
|
|
77
|
-
position: 1,
|
|
78
|
-
defaultValue: null,
|
|
4
|
+
super();
|
|
5
|
+
this.name = 'economyUtils';
|
|
6
|
+
this.versions = [
|
|
7
|
+
new ModuleTransferVersionDTO({
|
|
8
|
+
tag: '0.0.1',
|
|
9
|
+
description: 'A set of commands to allow players to manage their currency.',
|
|
10
|
+
configSchema: JSON.stringify({
|
|
11
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
pendingAmount: {
|
|
15
|
+
title: 'Pending amount',
|
|
16
|
+
type: 'number',
|
|
17
|
+
description: 'When a player transfers money, they must confirm the transfer when the amount is equal or above this value. Set to 0 to disable.',
|
|
18
|
+
default: 0,
|
|
19
|
+
},
|
|
20
|
+
zombieKillReward: {
|
|
21
|
+
title: 'Zombie kill reward',
|
|
22
|
+
type: 'number',
|
|
23
|
+
description: 'The default amount of currency a player receives for killing a zombie. This can be overridden by roles.',
|
|
24
|
+
default: 1,
|
|
25
|
+
},
|
|
79
26
|
},
|
|
27
|
+
required: [],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
}),
|
|
30
|
+
permissions: [
|
|
31
|
+
new IPermission({
|
|
32
|
+
permission: 'ECONOMY_UTILS_MANAGE_CURRENCY',
|
|
33
|
+
friendlyName: 'Manage currency',
|
|
34
|
+
description: 'Allows players to manage currency of other players. This includes granting and revoking currency.',
|
|
35
|
+
canHaveCount: false,
|
|
36
|
+
}),
|
|
37
|
+
new IPermission({
|
|
38
|
+
permission: 'ZOMBIE_KILL_REWARD_OVERRIDE',
|
|
39
|
+
friendlyName: 'Zombie kill reward override',
|
|
40
|
+
description: 'Allows a role to override the amount of currency a player receives for killing a entity.',
|
|
41
|
+
canHaveCount: true,
|
|
42
|
+
}),
|
|
80
43
|
],
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
arguments: [
|
|
88
|
-
{
|
|
89
|
-
name: 'receiver',
|
|
90
|
-
type: 'player',
|
|
91
|
-
helpText: 'The player to revoke currency from.',
|
|
92
|
-
position: 0,
|
|
93
|
-
defaultValue: null,
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
name: 'amount',
|
|
97
|
-
type: 'number',
|
|
98
|
-
helpText: 'The amount of money.',
|
|
99
|
-
position: 1,
|
|
100
|
-
defaultValue: null,
|
|
101
|
-
},
|
|
44
|
+
cronJobs: [
|
|
45
|
+
new ICronJob({
|
|
46
|
+
function: this.loadFn('cronJobs', 'zombieKillReward'),
|
|
47
|
+
name: 'zombieKillReward',
|
|
48
|
+
temporalValue: '*/5 * * * *',
|
|
49
|
+
}),
|
|
102
50
|
],
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
51
|
+
commands: [
|
|
52
|
+
new ICommand({
|
|
53
|
+
function: this.loadFn('commands', 'balance'),
|
|
54
|
+
name: 'balance',
|
|
55
|
+
trigger: 'balance',
|
|
56
|
+
helpText: 'Check your balance.',
|
|
57
|
+
arguments: [],
|
|
58
|
+
}),
|
|
59
|
+
new ICommand({
|
|
60
|
+
function: this.loadFn('commands', 'topCurrency'),
|
|
61
|
+
name: 'topCurrency',
|
|
62
|
+
trigger: 'topcurrency',
|
|
63
|
+
helpText: 'List of the 10 players with the highest balance.',
|
|
64
|
+
arguments: [],
|
|
65
|
+
}),
|
|
66
|
+
new ICommand({
|
|
67
|
+
function: this.loadFn('commands', 'grantCurrency'),
|
|
68
|
+
name: 'grantCurrency',
|
|
69
|
+
trigger: 'grantcurrency',
|
|
70
|
+
helpText: 'Grant money to a player. The money is not taken from your own balance but is new currency.',
|
|
71
|
+
arguments: [
|
|
72
|
+
{
|
|
73
|
+
name: 'receiver',
|
|
74
|
+
type: 'player',
|
|
75
|
+
helpText: 'The player to grant currency to.',
|
|
76
|
+
position: 0,
|
|
77
|
+
defaultValue: null,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'amount',
|
|
81
|
+
type: 'number',
|
|
82
|
+
helpText: 'The amount of money.',
|
|
83
|
+
position: 1,
|
|
84
|
+
defaultValue: null,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
}),
|
|
88
|
+
new ICommand({
|
|
89
|
+
function: this.loadFn('commands', 'revokeCurrency'),
|
|
90
|
+
name: 'revokeCurrency',
|
|
91
|
+
trigger: 'revokecurrency',
|
|
92
|
+
helpText: 'Revokes money from a player. The money disappears.',
|
|
93
|
+
arguments: [
|
|
94
|
+
{
|
|
95
|
+
name: 'receiver',
|
|
96
|
+
type: 'player',
|
|
97
|
+
helpText: 'The player to revoke currency from.',
|
|
98
|
+
position: 0,
|
|
99
|
+
defaultValue: null,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'amount',
|
|
103
|
+
type: 'number',
|
|
104
|
+
helpText: 'The amount of money.',
|
|
105
|
+
position: 1,
|
|
106
|
+
defaultValue: null,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
}),
|
|
110
|
+
new ICommand({
|
|
111
|
+
function: this.loadFn('commands', 'confirmTransfer'),
|
|
112
|
+
name: 'confirmTransfer',
|
|
113
|
+
trigger: 'confirmtransfer',
|
|
114
|
+
helpText: 'Confirms a pending transfer.',
|
|
115
|
+
arguments: [],
|
|
116
|
+
}),
|
|
117
|
+
new ICommand({
|
|
118
|
+
function: this.loadFn('commands', 'transfer'),
|
|
119
|
+
name: 'transfer',
|
|
120
|
+
trigger: 'transfer',
|
|
121
|
+
helpText: 'Transfer money to another player.',
|
|
122
|
+
arguments: [
|
|
123
|
+
{
|
|
124
|
+
name: 'receiver',
|
|
125
|
+
type: 'player',
|
|
126
|
+
helpText: 'The player to transfer money to.',
|
|
127
|
+
position: 0,
|
|
128
|
+
defaultValue: null,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'amount',
|
|
132
|
+
type: 'number',
|
|
133
|
+
helpText: 'The amount of money to transfer.',
|
|
134
|
+
position: 1,
|
|
135
|
+
defaultValue: null,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
}),
|
|
139
|
+
new ICommand({
|
|
140
|
+
function: this.loadFn('commands', 'claim'),
|
|
141
|
+
name: 'claim',
|
|
142
|
+
trigger: 'claim',
|
|
143
|
+
helpText: 'Claim your pending shop orders.',
|
|
144
|
+
arguments: [
|
|
145
|
+
{
|
|
146
|
+
name: 'all',
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
helpText: 'If true, claim ALL pending orders. If false, claim only the first one.',
|
|
149
|
+
position: 0,
|
|
150
|
+
defaultValue: 'false',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
}),
|
|
154
|
+
new ICommand({
|
|
155
|
+
function: this.loadFn('commands', 'shop'),
|
|
156
|
+
name: 'shop',
|
|
157
|
+
trigger: 'shop',
|
|
158
|
+
helpText: 'Browse the shop and view available items.',
|
|
159
|
+
arguments: [
|
|
160
|
+
{
|
|
161
|
+
name: 'page',
|
|
162
|
+
type: 'number',
|
|
163
|
+
helpText: 'Display more items from the shop by specifying a page number.',
|
|
164
|
+
position: 0,
|
|
165
|
+
defaultValue: '1',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'item',
|
|
169
|
+
type: 'number',
|
|
170
|
+
helpText: 'Select a specific item to view more details.',
|
|
171
|
+
position: 1,
|
|
172
|
+
defaultValue: '0',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'action',
|
|
176
|
+
type: 'string',
|
|
177
|
+
helpText: 'Perform an action on the selected item. Currently only "buy" is supported.',
|
|
178
|
+
position: 2,
|
|
179
|
+
defaultValue: 'none',
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
}),
|
|
175
183
|
],
|
|
176
184
|
}),
|
|
177
185
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/economyUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/economyUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAEtH,MAAM,OAAO,YAAa,SAAQ,iBAA+B;IAC/D;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,wBAAwB,CAAC;gBAC3B,GAAG,EAAE,OAAO;gBACZ,WAAW,EAAE,8DAA8D;gBAC3E,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAC3B,OAAO,EAAE,yCAAyC;oBAClD,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,aAAa,EAAE;4BACb,KAAK,EAAE,gBAAgB;4BACvB,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,kIAAkI;4BACpI,OAAO,EAAE,CAAC;yBACX;wBACD,gBAAgB,EAAE;4BAChB,KAAK,EAAE,oBAAoB;4BAC3B,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,yGAAyG;4BAC3G,OAAO,EAAE,CAAC;yBACX;qBACF;oBACD,QAAQ,E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ACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPDetected.d.ts","sourceRoot":"","sources":["../../../../src/modules/geoBlock/hooks/IPDetected.js"],"names":[],"mappings":""}
|
|
@@ -7,9 +7,11 @@ async function main() {
|
|
|
7
7
|
if (ban) {
|
|
8
8
|
const now = new Date();
|
|
9
9
|
const expiresAt = new Date(now.getTime() + banDuration * 1000);
|
|
10
|
-
await takaro.
|
|
10
|
+
await takaro.player.banControllerCreate({
|
|
11
|
+
gameServerId,
|
|
12
|
+
playerId: player.id,
|
|
13
|
+
until: expiresAt,
|
|
11
14
|
reason: message,
|
|
12
|
-
expiresAt,
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPDetected.js","sourceRoot":"","sources":["../../../../src/modules/geoBlock/hooks/IPDetected.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;IACnC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;IAE9E,KAAK,UAAU,YAAY;QACzB,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,WAAW,GAAG,IAAI,CAAC,CAAC;YAC/D,MAAM,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"IPDetected.js","sour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AE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;QAC5D,MAAM,YAAY,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;YAC5D,MAAM,YAAY,EAAE,CAAC;YACrB,OAAO;QACT,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO } from '../../BuiltinModule.js';
|
|
2
2
|
export declare const countryCodes: {
|
|
3
3
|
code: string;
|
|
4
4
|
name: string;
|
|
5
5
|
}[];
|
|
6
|
-
export declare class GeoBlock extends
|
|
6
|
+
export declare class GeoBlock extends ModuleTransferDTO<GeoBlock> {
|
|
7
7
|
constructor();
|
|
8
8
|
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/geoBlock/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgD,MAAM,wBAAwB,CAAC;AAKzG,eAAO,MAAM,YAAY;;;GAuPxB,CAAC;AAEF,qBAAa,QAAS,SAAQ,iBAAiB,CAAC,QAAQ,CAAC;;CA8ExD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleTransferDTO, IHook, IPermission, ModuleTransferVersionDTO } from '../../BuiltinModule.js';
|
|
2
2
|
import { HookEvents } from '../../dto/index.js';
|
|
3
3
|
import { Duration } from 'luxon';
|
|
4
4
|
// temporary solution
|
|
@@ -250,70 +250,78 @@ export const countryCodes = [
|
|
|
250
250
|
{ code: 'ZM', name: 'Zambia' },
|
|
251
251
|
{ code: 'ZW', name: 'Zimbabwe' },
|
|
252
252
|
];
|
|
253
|
-
export class GeoBlock extends
|
|
253
|
+
export class GeoBlock extends ModuleTransferDTO {
|
|
254
254
|
constructor() {
|
|
255
|
-
super(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
255
|
+
super();
|
|
256
|
+
this.name = 'geoBlock';
|
|
257
|
+
this.versions = [
|
|
258
|
+
new ModuleTransferVersionDTO({
|
|
259
|
+
tag: '0.0.1',
|
|
260
|
+
description: 'Block players from certain countries from joining the server.',
|
|
261
|
+
configSchema: JSON.stringify({
|
|
262
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
263
|
+
type: 'object',
|
|
264
|
+
properties: {
|
|
265
|
+
mode: {
|
|
266
|
+
title: 'Mode',
|
|
267
|
+
type: 'string',
|
|
268
|
+
description: 'If set to allow, only players from the specified countries will be allowed to join. If set to deny, players from the specified countries will be banned from the server.',
|
|
269
|
+
enum: ['allow', 'deny'],
|
|
270
|
+
default: 'deny',
|
|
271
|
+
},
|
|
272
|
+
countries: {
|
|
273
|
+
title: 'Countries',
|
|
274
|
+
description: 'List of countries',
|
|
275
|
+
type: 'array',
|
|
276
|
+
uniqueItems: true,
|
|
277
|
+
'x-component': 'country',
|
|
278
|
+
items: {
|
|
279
|
+
type: 'string',
|
|
280
|
+
anyOf: countryCodes.map(({ code, name }) => ({ const: code, title: name })),
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
ban: {
|
|
284
|
+
title: 'Ban',
|
|
285
|
+
description: 'Ban players from the server when they are detected. When false, players will be kicked instead.',
|
|
286
|
+
type: 'boolean',
|
|
287
|
+
default: true,
|
|
288
|
+
},
|
|
289
|
+
banDuration: {
|
|
290
|
+
title: 'Ban duration',
|
|
291
|
+
description: 'Duration of the ban.',
|
|
292
|
+
'x-component': 'duration',
|
|
293
|
+
type: 'number',
|
|
294
|
+
minimum: 0,
|
|
295
|
+
default: Duration.fromObject({ days: 1 }).as('milliseconds'),
|
|
296
|
+
},
|
|
297
|
+
message: {
|
|
298
|
+
title: 'Message',
|
|
299
|
+
type: 'string',
|
|
300
|
+
description: 'Message to send to the player when they are kicked or banned.',
|
|
301
|
+
default: 'Your IP address is banned.',
|
|
302
|
+
},
|
|
275
303
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
},
|
|
298
|
-
required: ['countries'],
|
|
299
|
-
additionalProperties: false,
|
|
300
|
-
}), JSON.stringify({
|
|
301
|
-
banDuration: { 'ui:widget': 'duration' },
|
|
302
|
-
}));
|
|
303
|
-
this.permissions = [
|
|
304
|
-
new IPermission({
|
|
305
|
-
permission: 'GEOBLOCK_IMMUNITY',
|
|
306
|
-
friendlyName: 'GeoBlock immunity',
|
|
307
|
-
description: 'Players with this permission will not be kicked or banned by GeoBlock.',
|
|
308
|
-
canHaveCount: false,
|
|
309
|
-
}),
|
|
310
|
-
];
|
|
311
|
-
this.commands = [];
|
|
312
|
-
this.hooks = [
|
|
313
|
-
new IHook({
|
|
314
|
-
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
315
|
-
name: 'IPDetected',
|
|
316
|
-
function: this.loadFn('hooks', 'IPDetected'),
|
|
304
|
+
required: ['countries'],
|
|
305
|
+
additionalProperties: false,
|
|
306
|
+
}),
|
|
307
|
+
uiSchema: JSON.stringify({
|
|
308
|
+
banDuration: { 'ui:widget': 'duration' },
|
|
309
|
+
}),
|
|
310
|
+
permissions: [
|
|
311
|
+
new IPermission({
|
|
312
|
+
permission: 'GEOBLOCK_IMMUNITY',
|
|
313
|
+
friendlyName: 'GeoBlock immunity',
|
|
314
|
+
description: 'Players with this permission will not be kicked or banned by GeoBlock.',
|
|
315
|
+
canHaveCount: false,
|
|
316
|
+
}),
|
|
317
|
+
],
|
|
318
|
+
hooks: [
|
|
319
|
+
new IHook({
|
|
320
|
+
eventType: HookEvents.PLAYER_NEW_IP_DETECTED,
|
|
321
|
+
name: 'IPDetected',
|
|
322
|
+
function: this.loadFn('hooks', 'IPDetected'),
|
|
323
|
+
}),
|
|
324
|
+
],
|
|
317
325
|
}),
|
|
318
326
|
];
|
|
319
327
|
}
|