@takaro/modules 0.0.1
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/README.md +3 -0
- package/dist/BuiltinModule.d.ts +49 -0
- package/dist/BuiltinModule.js +194 -0
- package/dist/BuiltinModule.js.map +1 -0
- package/dist/dto/base.d.ts +6 -0
- package/dist/dto/base.js +28 -0
- package/dist/dto/base.js.map +1 -0
- package/dist/dto/discordEvents.d.ts +31 -0
- package/dist/dto/discordEvents.js +92 -0
- package/dist/dto/discordEvents.js.map +1 -0
- package/dist/dto/gameEvents.d.ts +84 -0
- package/dist/dto/gameEvents.js +190 -0
- package/dist/dto/gameEvents.js.map +1 -0
- package/dist/dto/index.d.ts +37 -0
- package/dist/dto/index.js +18 -0
- package/dist/dto/index.js.map +1 -0
- package/dist/dto/takaroEvents.d.ts +150 -0
- package/dist/dto/takaroEvents.js +422 -0
- package/dist/dto/takaroEvents.js.map +1 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +31 -0
- package/dist/main.js.map +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.js +18 -0
- package/dist/modules/chatBridge/hooks/DiscordToGame.js.map +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.js +14 -0
- package/dist/modules/chatBridge/hooks/GameToDiscord.js.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.js +9 -0
- package/dist/modules/chatBridge/hooks/PlayerConnected.js.map +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.d.ts +1 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js +9 -0
- package/dist/modules/chatBridge/hooks/PlayerDisconnected.js.map +1 -0
- package/dist/modules/chatBridge/index.d.ts +4 -0
- package/dist/modules/chatBridge/index.js +54 -0
- package/dist/modules/chatBridge/index.js.map +1 -0
- package/dist/modules/economyUtils/commands/balance.d.ts +1 -0
- package/dist/modules/economyUtils/commands/balance.js +7 -0
- package/dist/modules/economyUtils/commands/balance.js.map +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.d.ts +1 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.js +38 -0
- package/dist/modules/economyUtils/commands/confirmTransfer.js.map +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/grantCurrency.js +31 -0
- package/dist/modules/economyUtils/commands/grantCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.js +31 -0
- package/dist/modules/economyUtils/commands/revokeCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.d.ts +1 -0
- package/dist/modules/economyUtils/commands/topCurrency.js +22 -0
- package/dist/modules/economyUtils/commands/topCurrency.js.map +1 -0
- package/dist/modules/economyUtils/commands/transfer.d.ts +1 -0
- package/dist/modules/economyUtils/commands/transfer.js +55 -0
- package/dist/modules/economyUtils/commands/transfer.js.map +1 -0
- package/dist/modules/economyUtils/index.d.ts +4 -0
- package/dist/modules/economyUtils/index.js +117 -0
- package/dist/modules/economyUtils/index.js.map +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.d.ts +1 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js +50 -0
- package/dist/modules/geoBlock/hooks/IPDetected.js.map +1 -0
- package/dist/modules/geoBlock/index.d.ts +8 -0
- package/dist/modules/geoBlock/index.js +321 -0
- package/dist/modules/geoBlock/index.js.map +1 -0
- package/dist/modules/gimme/commands/gimme.d.ts +1 -0
- package/dist/modules/gimme/commands/gimme.js +23 -0
- package/dist/modules/gimme/commands/gimme.js.map +1 -0
- package/dist/modules/gimme/index.d.ts +4 -0
- package/dist/modules/gimme/index.js +43 -0
- package/dist/modules/gimme/index.js.map +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.d.ts +1 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.js +54 -0
- package/dist/modules/highPingKicker/cronJobs/Ping check.js.map +1 -0
- package/dist/modules/highPingKicker/index.d.ts +4 -0
- package/dist/modules/highPingKicker/index.js +34 -0
- package/dist/modules/highPingKicker/index.js.map +1 -0
- package/dist/modules/lottery/commands/buyTicket.d.ts +1 -0
- package/dist/modules/lottery/commands/buyTicket.js +54 -0
- package/dist/modules/lottery/commands/buyTicket.js.map +1 -0
- package/dist/modules/lottery/commands/nextDraw.d.ts +1 -0
- package/dist/modules/lottery/commands/nextDraw.js +34 -0
- package/dist/modules/lottery/commands/nextDraw.js.map +1 -0
- package/dist/modules/lottery/commands/viewTickets.d.ts +1 -0
- package/dist/modules/lottery/commands/viewTickets.js +23 -0
- package/dist/modules/lottery/commands/viewTickets.js.map +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.d.ts +1 -0
- package/dist/modules/lottery/cronJobs/drawLottery.js +96 -0
- package/dist/modules/lottery/cronJobs/drawLottery.js.map +1 -0
- package/dist/modules/lottery/index.d.ts +4 -0
- package/dist/modules/lottery/index.js +73 -0
- package/dist/modules/lottery/index.js.map +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.d.ts +1 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js +34 -0
- package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.d.ts +1 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.js +11 -0
- package/dist/modules/playerOnboarding/hooks/playerConnected.js.map +1 -0
- package/dist/modules/playerOnboarding/index.d.ts +4 -0
- package/dist/modules/playerOnboarding/index.js +51 -0
- package/dist/modules/playerOnboarding/index.js.map +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.d.ts +1 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.js +9 -0
- package/dist/modules/serverMessages/cronJobs/Automated message.js.map +1 -0
- package/dist/modules/serverMessages/index.d.ts +4 -0
- package/dist/modules/serverMessages/index.js +35 -0
- package/dist/modules/serverMessages/index.js.map +1 -0
- package/dist/modules/teleports/commands/deletetp.d.ts +1 -0
- package/dist/modules/teleports/commands/deletetp.js +20 -0
- package/dist/modules/teleports/commands/deletetp.js.map +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/deletewaypoint.js +54 -0
- package/dist/modules/teleports/commands/deletewaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/listwaypoints.d.ts +1 -0
- package/dist/modules/teleports/commands/listwaypoints.js +36 -0
- package/dist/modules/teleports/commands/listwaypoints.js.map +1 -0
- package/dist/modules/teleports/commands/setprivate.d.ts +1 -0
- package/dist/modules/teleports/commands/setprivate.js +31 -0
- package/dist/modules/teleports/commands/setprivate.js.map +1 -0
- package/dist/modules/teleports/commands/setpublic.d.ts +1 -0
- package/dist/modules/teleports/commands/setpublic.js +55 -0
- package/dist/modules/teleports/commands/setpublic.js.map +1 -0
- package/dist/modules/teleports/commands/settp.d.ts +1 -0
- package/dist/modules/teleports/commands/settp.js +42 -0
- package/dist/modules/teleports/commands/settp.js.map +1 -0
- package/dist/modules/teleports/commands/setwaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/setwaypoint.js +88 -0
- package/dist/modules/teleports/commands/setwaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/teleport.d.ts +1 -0
- package/dist/modules/teleports/commands/teleport.js +74 -0
- package/dist/modules/teleports/commands/teleport.js.map +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.d.ts +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js +50 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -0
- package/dist/modules/teleports/commands/tplist.d.ts +1 -0
- package/dist/modules/teleports/commands/tplist.js +45 -0
- package/dist/modules/teleports/commands/tplist.js.map +1 -0
- package/dist/modules/teleports/functions/utils.d.ts +2 -0
- package/dist/modules/teleports/functions/utils.js +18 -0
- package/dist/modules/teleports/functions/utils.js.map +1 -0
- package/dist/modules/teleports/index.d.ts +4 -0
- package/dist/modules/teleports/index.js +184 -0
- package/dist/modules/teleports/index.js.map +1 -0
- package/dist/modules/utils/commands/help.d.ts +1 -0
- package/dist/modules/utils/commands/help.js +29 -0
- package/dist/modules/utils/commands/help.js.map +1 -0
- package/dist/modules/utils/commands/ping.d.ts +1 -0
- package/dist/modules/utils/commands/ping.js +6 -0
- package/dist/modules/utils/commands/ping.js.map +1 -0
- package/dist/modules/utils/index.d.ts +4 -0
- package/dist/modules/utils/index.js +35 -0
- package/dist/modules/utils/index.js.map +1 -0
- package/dist/modules.json +478 -0
- package/package.json +26 -0
- package/scripts/buildBuiltinJson.ts +14 -0
- package/src/BuiltinModule.ts +125 -0
- package/src/__tests__/aliases.integration.test.ts +54 -0
- package/src/__tests__/builtinmodule.unit.test.ts +13 -0
- package/src/__tests__/commandArgs.integration.test.ts +285 -0
- package/src/__tests__/economyUtils.integration.test.ts +488 -0
- package/src/__tests__/geoblock.integration.test.ts +380 -0
- package/src/__tests__/gimme.integration.test.ts +97 -0
- package/src/__tests__/help.integration.test.ts +133 -0
- package/src/__tests__/lottery.integration.test.ts +332 -0
- package/src/__tests__/modulePermission.integration.test.ts +192 -0
- package/src/__tests__/onboarding.integration.test.ts +123 -0
- package/src/__tests__/ping.integration.test.ts +36 -0
- package/src/__tests__/roleExpiry.integration.test.ts +74 -0
- package/src/__tests__/serverMessages.integration.test.ts +104 -0
- package/src/__tests__/systemConfigCost.integration.test.ts +196 -0
- package/src/__tests__/teleports/listtp.integration.test.ts +115 -0
- package/src/__tests__/teleports/publicteleports.integration.test.ts +350 -0
- package/src/__tests__/teleports/teleport.integration.test.ts +109 -0
- package/src/__tests__/teleports/tpManagement.integration.test.ts +175 -0
- package/src/__tests__/teleports/waypoints.integration.test.ts +613 -0
- package/src/dto/base.ts +13 -0
- package/src/dto/discordEvents.ts +69 -0
- package/src/dto/gameEvents.ts +154 -0
- package/src/dto/index.ts +25 -0
- package/src/dto/takaroEvents.ts +290 -0
- package/src/main.ts +36 -0
- package/src/modules/.eslintrc +5 -0
- package/src/modules/chatBridge/hooks/DiscordToGame.js +18 -0
- package/src/modules/chatBridge/hooks/GameToDiscord.js +18 -0
- package/src/modules/chatBridge/hooks/PlayerConnected.js +11 -0
- package/src/modules/chatBridge/hooks/PlayerDisconnected.js +11 -0
- package/src/modules/chatBridge/index.ts +59 -0
- package/src/modules/economyUtils/commands/balance.js +8 -0
- package/src/modules/economyUtils/commands/confirmTransfer.js +55 -0
- package/src/modules/economyUtils/commands/grantCurrency.js +38 -0
- package/src/modules/economyUtils/commands/revokeCurrency.js +38 -0
- package/src/modules/economyUtils/commands/topCurrency.js +29 -0
- package/src/modules/economyUtils/commands/transfer.js +73 -0
- package/src/modules/economyUtils/index.ts +125 -0
- package/src/modules/geoBlock/hooks/IPDetected.js +52 -0
- package/src/modules/geoBlock/index.ts +331 -0
- package/src/modules/gimme/commands/gimme.js +28 -0
- package/src/modules/gimme/index.ts +49 -0
- package/src/modules/highPingKicker/cronJobs/Ping check.js +66 -0
- package/src/modules/highPingKicker/index.ts +39 -0
- package/src/modules/lottery/commands/buyTicket.js +68 -0
- package/src/modules/lottery/commands/nextDraw.js +45 -0
- package/src/modules/lottery/commands/viewTickets.js +32 -0
- package/src/modules/lottery/cronJobs/drawLottery.js +124 -0
- package/src/modules/lottery/index.ts +80 -0
- package/src/modules/playerOnboarding/commands/starterkit.js +47 -0
- package/src/modules/playerOnboarding/hooks/playerConnected.js +14 -0
- package/src/modules/playerOnboarding/index.ts +58 -0
- package/src/modules/serverMessages/cronJobs/Automated message.js +12 -0
- package/src/modules/serverMessages/index.ts +40 -0
- package/src/modules/teleports/commands/deletetp.js +25 -0
- package/src/modules/teleports/commands/deletewaypoint.js +77 -0
- package/src/modules/teleports/commands/listwaypoints.js +55 -0
- package/src/modules/teleports/commands/setprivate.js +39 -0
- package/src/modules/teleports/commands/setpublic.js +71 -0
- package/src/modules/teleports/commands/settp.js +54 -0
- package/src/modules/teleports/commands/setwaypoint.js +112 -0
- package/src/modules/teleports/commands/teleport.js +93 -0
- package/src/modules/teleports/commands/teleportwaypoint.js +72 -0
- package/src/modules/teleports/commands/tplist.js +61 -0
- package/src/modules/teleports/functions/utils.js +20 -0
- package/src/modules/teleports/index.ts +193 -0
- package/src/modules/utils/commands/help.js +38 -0
- package/src/modules/utils/commands/ping.js +7 -0
- package/src/modules/utils/index.ts +40 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +9 -0
- package/typedoc.json +3 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
import { getVariableKey, findTp } from './utils.js';
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
const { pog, gameServerId, module: mod, arguments: args } = data;
|
|
6
|
+
|
|
7
|
+
const hasPermission = checkPermission(pog, 'TELEPORTS_USE');
|
|
8
|
+
|
|
9
|
+
if (!hasPermission) {
|
|
10
|
+
throw new TakaroUserError('You do not have permission to use teleports.');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
|
|
14
|
+
|
|
15
|
+
const existingVariable = await findTp(args.tp);
|
|
16
|
+
|
|
17
|
+
if (existingVariable.data.data.length > 0) {
|
|
18
|
+
throw new TakaroUserError(`Teleport ${args.tp} already exists, use ${prefix}deletetp ${args.tp} to delete it.`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const allPlayerTeleports = await takaro.variable.variableControllerSearch({
|
|
22
|
+
search: {
|
|
23
|
+
key: getVariableKey(''),
|
|
24
|
+
},
|
|
25
|
+
filters: {
|
|
26
|
+
gameServerId: [gameServerId],
|
|
27
|
+
playerId: [pog.playerId],
|
|
28
|
+
moduleId: [mod.moduleId],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (allPlayerTeleports.data.data.length >= hasPermission.count) {
|
|
33
|
+
throw new TakaroUserError(
|
|
34
|
+
`You have reached the maximum number of teleports for your role, maximum allowed is ${hasPermission.count}`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await takaro.variable.variableControllerCreate({
|
|
39
|
+
key: getVariableKey(args.tp),
|
|
40
|
+
value: JSON.stringify({
|
|
41
|
+
name: args.tp,
|
|
42
|
+
x: data.pog.positionX,
|
|
43
|
+
y: data.pog.positionY,
|
|
44
|
+
z: data.pog.positionZ,
|
|
45
|
+
}),
|
|
46
|
+
gameServerId,
|
|
47
|
+
moduleId: mod.moduleId,
|
|
48
|
+
playerId: pog.playerId,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await data.player.pm(`Teleport ${args.tp} set.`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await main();
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
|
|
3
|
+
function getWaypointName(name) {
|
|
4
|
+
return `waypoint ${name}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const { pog, gameServerId, module: mod, arguments: args } = data;
|
|
9
|
+
|
|
10
|
+
if (!checkPermission(pog, 'TELEPORTS_MANAGE_WAYPOINTS')) {
|
|
11
|
+
throw new TakaroUserError('You do not have permission to manage waypoints.');
|
|
12
|
+
}
|
|
13
|
+
|
|
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, waypointsDefinition } = await ensureWaypointsModule();
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await takaro.variable.variableControllerCreate({
|
|
51
|
+
moduleId: waypointsInstallation.moduleId,
|
|
52
|
+
gameServerId,
|
|
53
|
+
key: getWaypointName(args.waypoint),
|
|
54
|
+
value: JSON.stringify({
|
|
55
|
+
x: pog.positionX,
|
|
56
|
+
y: pog.positionY,
|
|
57
|
+
z: pog.positionZ,
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (error.message === 'Request failed with status code 409') {
|
|
62
|
+
throw new TakaroUserError(`Waypoint ${args.waypoint} already exists.`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const teleportCommand = await takaro.command.commandControllerSearch({
|
|
67
|
+
filters: {
|
|
68
|
+
moduleId: [mod.moduleId],
|
|
69
|
+
name: ['teleportwaypoint'],
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
await takaro.command.commandControllerCreate({
|
|
74
|
+
moduleId: waypointsInstallation.moduleId,
|
|
75
|
+
name: `waypoint ${args.waypoint} server ${gameServerId}`,
|
|
76
|
+
trigger: args.waypoint,
|
|
77
|
+
helpText: `Teleport to waypoint ${args.waypoint}.`,
|
|
78
|
+
function: teleportCommand.data.data[0].function.code,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const existingPermissions = waypointsDefinition.permissions || [];
|
|
82
|
+
const permissionInputDTOs = existingPermissions.map((permission) => ({
|
|
83
|
+
permission: permission.permission,
|
|
84
|
+
description: permission.description,
|
|
85
|
+
friendlyName: permission.friendlyName,
|
|
86
|
+
canHaveCount: permission.canHaveCount,
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
const gameServer = (await takaro.gameserver.gameServerControllerGetOne(gameServerId)).data.data;
|
|
90
|
+
|
|
91
|
+
await takaro.module.moduleControllerUpdate(waypointsInstallation.moduleId, {
|
|
92
|
+
permissions: [
|
|
93
|
+
{
|
|
94
|
+
permission: `WAYPOINTS_USE_${args.waypoint.toUpperCase()}_${gameServerId}`,
|
|
95
|
+
description: `Use the waypoint ${args.waypoint} on ${gameServer.name}.`,
|
|
96
|
+
friendlyName: `Use waypoint ${args.waypoint} on ${gameServer.name}`,
|
|
97
|
+
canHaveCount: false,
|
|
98
|
+
},
|
|
99
|
+
...permissionInputDTOs,
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Need to reinstall the module to ensure the new commands systemconfig and permissions are properly in place
|
|
104
|
+
await takaro.gameserver.gameServerControllerInstallModule(gameServerId, waypointsInstallation.moduleId, {
|
|
105
|
+
systemConfig: JSON.stringify(waypointsInstallation.systemConfig),
|
|
106
|
+
userConfig: JSON.stringify(waypointsInstallation.userConfig),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
await pog.pm(`Waypoint ${args.waypoint} set.`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
await main();
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
import { findTp } from './utils.js';
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
const { pog, gameServerId, arguments: args, module: mod } = data;
|
|
6
|
+
|
|
7
|
+
if (!checkPermission(pog, 'TELEPORTS_USE')) {
|
|
8
|
+
throw new TakaroUserError('You do not have permission to use teleports.');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ownedTeleportRes = await findTp(args.tp, pog.playerId);
|
|
12
|
+
|
|
13
|
+
let teleports = ownedTeleportRes.data.data;
|
|
14
|
+
|
|
15
|
+
if (mod.userConfig.allowPublicTeleports) {
|
|
16
|
+
const maybePublicTeleportRes = await findTp(args.tp);
|
|
17
|
+
|
|
18
|
+
const publicTeleports = maybePublicTeleportRes.data.data.filter((tele) => {
|
|
19
|
+
const teleport = JSON.parse(tele.value);
|
|
20
|
+
return teleport.public;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
teleports = teleports.concat(publicTeleports);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (teleports.length === 0) {
|
|
27
|
+
throw new TakaroUserError(`Teleport ${args.tp} does not exist.`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const timeout = mod.userConfig.timeout;
|
|
31
|
+
|
|
32
|
+
if (timeout !== 0) {
|
|
33
|
+
const lastExecuted = await takaro.variable.variableControllerSearch({
|
|
34
|
+
filters: {
|
|
35
|
+
key: ['lastExecuted'],
|
|
36
|
+
gameServerId: [gameServerId],
|
|
37
|
+
playerId: [pog.playerId],
|
|
38
|
+
moduleId: [mod.moduleId],
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
let lastExecutedRecord = lastExecuted.data.data[0];
|
|
42
|
+
|
|
43
|
+
if (!lastExecutedRecord) {
|
|
44
|
+
const createRes = await takaro.variable.variableControllerCreate({
|
|
45
|
+
key: 'lastExecuted',
|
|
46
|
+
gameServerId,
|
|
47
|
+
playerId: pog.playerId,
|
|
48
|
+
moduleId: mod.moduleId,
|
|
49
|
+
value: new Date().toISOString(),
|
|
50
|
+
});
|
|
51
|
+
console.log(createRes);
|
|
52
|
+
lastExecutedRecord = createRes.data.data;
|
|
53
|
+
} else {
|
|
54
|
+
const lastExecutedTime = new Date(lastExecutedRecord.value);
|
|
55
|
+
const now = new Date();
|
|
56
|
+
|
|
57
|
+
const diff = now.getTime() - lastExecutedTime.getTime();
|
|
58
|
+
|
|
59
|
+
if (diff < timeout) {
|
|
60
|
+
throw new TakaroUserError('You cannot teleport yet. Please wait before trying again.');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const teleport = JSON.parse(teleports[0].value);
|
|
65
|
+
|
|
66
|
+
await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
|
|
67
|
+
x: teleport.x,
|
|
68
|
+
y: teleport.y,
|
|
69
|
+
z: teleport.z,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
await data.player.pm(`Teleported to ${teleport.name}.`);
|
|
73
|
+
|
|
74
|
+
if (timeout !== 0 && lastExecutedRecord) {
|
|
75
|
+
await takaro.variable.variableControllerUpdate(lastExecutedRecord.id, {
|
|
76
|
+
value: new Date().toISOString(),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const teleport = JSON.parse(teleports[0].value);
|
|
83
|
+
|
|
84
|
+
await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
|
|
85
|
+
x: teleport.x,
|
|
86
|
+
y: teleport.y,
|
|
87
|
+
z: teleport.z,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
await data.player.pm(`Teleported to ${teleport.name}.`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
await main();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { takaro, data, TakaroUserError, checkPermission } from '@takaro/helpers';
|
|
2
|
+
|
|
3
|
+
function getWaypointName(name) {
|
|
4
|
+
return `waypoint ${name}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const { pog, gameServerId, trigger } = data;
|
|
9
|
+
|
|
10
|
+
if (!checkPermission(pog, `WAYPOINTS_USE_${trigger.toUpperCase()}_${gameServerId}`)) {
|
|
11
|
+
throw new TakaroUserError(`You are not allowed to use the waypoint ${trigger}.`);
|
|
12
|
+
}
|
|
13
|
+
|
|
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
|
+
const variable = await takaro.variable.variableControllerSearch({
|
|
50
|
+
filters: {
|
|
51
|
+
key: [getWaypointName(trigger)],
|
|
52
|
+
gameServerId: [gameServerId],
|
|
53
|
+
moduleId: [waypointsInstallation.moduleId],
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (variable.data.data.length === 0) {
|
|
58
|
+
throw new TakaroUserError(`Waypoint ${trigger} does not exist.`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const waypoint = JSON.parse(variable.data.data[0].value);
|
|
62
|
+
|
|
63
|
+
await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
|
|
64
|
+
x: waypoint.x,
|
|
65
|
+
y: waypoint.y,
|
|
66
|
+
z: waypoint.z,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
await pog.pm(`Teleported to waypoint ${trigger}.`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
await main();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { takaro, data } from '@takaro/helpers';
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
const { pog, gameServerId, module: mod } = data;
|
|
5
|
+
|
|
6
|
+
const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data;
|
|
7
|
+
|
|
8
|
+
const ownedTeleports = (
|
|
9
|
+
await takaro.variable.variableControllerSearch({
|
|
10
|
+
filters: {
|
|
11
|
+
gameServerId: [gameServerId],
|
|
12
|
+
playerId: [pog.playerId],
|
|
13
|
+
moduleId: [mod.moduleId],
|
|
14
|
+
},
|
|
15
|
+
search: {
|
|
16
|
+
key: 'tp',
|
|
17
|
+
},
|
|
18
|
+
sortBy: 'key',
|
|
19
|
+
sortDirection: 'asc',
|
|
20
|
+
})
|
|
21
|
+
).data.data;
|
|
22
|
+
|
|
23
|
+
const maybePublicTeleports = (
|
|
24
|
+
await takaro.variable.variableControllerSearch({
|
|
25
|
+
filters: {
|
|
26
|
+
gameServerId: [gameServerId],
|
|
27
|
+
moduleId: [mod.moduleId],
|
|
28
|
+
},
|
|
29
|
+
search: {
|
|
30
|
+
key: ['tp'],
|
|
31
|
+
},
|
|
32
|
+
sortBy: 'key',
|
|
33
|
+
sortDirection: 'asc',
|
|
34
|
+
})
|
|
35
|
+
).data.data;
|
|
36
|
+
|
|
37
|
+
const teleports = maybePublicTeleports.filter((tele) => {
|
|
38
|
+
const teleport = JSON.parse(tele.value);
|
|
39
|
+
|
|
40
|
+
const isPublic = teleport.public && teleport.playerId !== pog.playerId;
|
|
41
|
+
const isOwned = ownedTeleports.find((t) => t.playerId === pog.playerId);
|
|
42
|
+
|
|
43
|
+
return isPublic || isOwned;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (teleports.length === 0) {
|
|
47
|
+
await data.player.pm(`You have no teleports set, use ${prefix}settp <name> to set one.`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
await data.player.pm(`You have ${teleports.length} teleport${teleports.length === 1 ? '' : 's'} available`);
|
|
52
|
+
|
|
53
|
+
for (const rawTeleport of teleports) {
|
|
54
|
+
const teleport = JSON.parse(rawTeleport.value);
|
|
55
|
+
await data.player.pm(
|
|
56
|
+
` - ${teleport.name}: ${teleport.x}, ${teleport.y}, ${teleport.z} ${teleport.public ? '(public)' : ''}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
await main();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { takaro, data } from '@takaro/helpers';
|
|
2
|
+
|
|
3
|
+
export function getVariableKey(tpName) {
|
|
4
|
+
return `tp_${tpName}`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export async function findTp(tpName, playerId) {
|
|
8
|
+
const { gameServerId, module: mod } = data;
|
|
9
|
+
|
|
10
|
+
return takaro.variable.variableControllerSearch({
|
|
11
|
+
filters: {
|
|
12
|
+
key: [getVariableKey(tpName)],
|
|
13
|
+
gameServerId: [gameServerId],
|
|
14
|
+
playerId: [playerId].filter(Boolean),
|
|
15
|
+
moduleId: [mod.moduleId],
|
|
16
|
+
},
|
|
17
|
+
sortBy: 'key',
|
|
18
|
+
sortDirection: 'asc',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { BuiltinModule, ICommand, IFunction, IPermission } from '../../BuiltinModule.js';
|
|
2
|
+
import { Duration } from 'luxon';
|
|
3
|
+
|
|
4
|
+
export class Teleports extends BuiltinModule<Teleports> {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(
|
|
7
|
+
'teleports',
|
|
8
|
+
'A set of commands to allow players to set their own teleport points and teleport to them.',
|
|
9
|
+
JSON.stringify({
|
|
10
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
timeout: {
|
|
14
|
+
title: 'Timeout',
|
|
15
|
+
description: 'The time one has to wait before teleporting again.',
|
|
16
|
+
'x-component': 'duration',
|
|
17
|
+
type: 'number',
|
|
18
|
+
minimum: 0,
|
|
19
|
+
default: Duration.fromObject({ second: 1 }).as('milliseconds'),
|
|
20
|
+
},
|
|
21
|
+
allowPublicTeleports: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
description: 'Players can create public teleports.',
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: [],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
}),
|
|
30
|
+
JSON.stringify({
|
|
31
|
+
timeout: { 'ui:widget': 'duration' },
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
this.functions = [
|
|
36
|
+
new IFunction({
|
|
37
|
+
name: 'utils',
|
|
38
|
+
function: this.loadFn('functions', 'utils'),
|
|
39
|
+
}),
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
this.permissions = [
|
|
43
|
+
new IPermission({
|
|
44
|
+
permission: 'TELEPORTS_CREATE_PUBLIC',
|
|
45
|
+
friendlyName: 'Create Public Teleports',
|
|
46
|
+
description: 'Allows the player to create public teleports.',
|
|
47
|
+
canHaveCount: true,
|
|
48
|
+
}),
|
|
49
|
+
new IPermission({
|
|
50
|
+
permission: 'TELEPORTS_USE',
|
|
51
|
+
friendlyName: 'Use Teleports',
|
|
52
|
+
description: 'Allows the player to use teleports modules.',
|
|
53
|
+
canHaveCount: true,
|
|
54
|
+
}),
|
|
55
|
+
new IPermission({
|
|
56
|
+
permission: 'TELEPORTS_MANAGE_WAYPOINTS',
|
|
57
|
+
friendlyName: 'Manage waypoints',
|
|
58
|
+
description: 'Allows creating, deleting, and managing waypoints.',
|
|
59
|
+
canHaveCount: false,
|
|
60
|
+
}),
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
this.commands = [
|
|
64
|
+
new ICommand({
|
|
65
|
+
function: this.loadFn('commands', 'teleport'),
|
|
66
|
+
name: 'teleport',
|
|
67
|
+
trigger: 'tp',
|
|
68
|
+
helpText: 'Teleports to one of your set locations.',
|
|
69
|
+
arguments: [
|
|
70
|
+
{
|
|
71
|
+
name: 'tp',
|
|
72
|
+
type: 'string',
|
|
73
|
+
defaultValue: null,
|
|
74
|
+
helpText: 'The location to teleport to.',
|
|
75
|
+
position: 0,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}),
|
|
79
|
+
new ICommand({
|
|
80
|
+
function: this.loadFn('commands', 'tplist'),
|
|
81
|
+
name: 'tplist',
|
|
82
|
+
trigger: 'tplist',
|
|
83
|
+
helpText: 'Lists all your set locations.',
|
|
84
|
+
arguments: [],
|
|
85
|
+
}),
|
|
86
|
+
new ICommand({
|
|
87
|
+
function: this.loadFn('commands', 'settp'),
|
|
88
|
+
name: 'settp',
|
|
89
|
+
trigger: 'settp',
|
|
90
|
+
helpText: 'Sets a location to teleport to.',
|
|
91
|
+
arguments: [
|
|
92
|
+
{
|
|
93
|
+
name: 'tp',
|
|
94
|
+
type: 'string',
|
|
95
|
+
defaultValue: null,
|
|
96
|
+
helpText: 'The location name.',
|
|
97
|
+
position: 0,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
}),
|
|
101
|
+
new ICommand({
|
|
102
|
+
function: this.loadFn('commands', 'deletetp'),
|
|
103
|
+
name: 'deletetp',
|
|
104
|
+
trigger: 'deletetp',
|
|
105
|
+
helpText: 'Deletes a location.',
|
|
106
|
+
arguments: [
|
|
107
|
+
{
|
|
108
|
+
name: 'tp',
|
|
109
|
+
type: 'string',
|
|
110
|
+
defaultValue: null,
|
|
111
|
+
helpText: 'The location name.',
|
|
112
|
+
position: 0,
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
}),
|
|
116
|
+
new ICommand({
|
|
117
|
+
function: this.loadFn('commands', 'setpublic'),
|
|
118
|
+
name: 'setpublic',
|
|
119
|
+
trigger: 'setpublic',
|
|
120
|
+
helpText: 'Sets a teleport to be public, allowing other players to teleport to it.',
|
|
121
|
+
arguments: [
|
|
122
|
+
{
|
|
123
|
+
name: 'tp',
|
|
124
|
+
type: 'string',
|
|
125
|
+
defaultValue: null,
|
|
126
|
+
helpText: 'The location name.',
|
|
127
|
+
position: 0,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
}),
|
|
131
|
+
new ICommand({
|
|
132
|
+
function: this.loadFn('commands', 'setprivate'),
|
|
133
|
+
name: 'setprivate',
|
|
134
|
+
trigger: 'setprivate',
|
|
135
|
+
helpText: 'Sets a teleport to be private, only the teleport owner can teleport to it.',
|
|
136
|
+
arguments: [
|
|
137
|
+
{
|
|
138
|
+
name: 'tp',
|
|
139
|
+
type: 'string',
|
|
140
|
+
defaultValue: null,
|
|
141
|
+
helpText: 'The location name.',
|
|
142
|
+
position: 0,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
}),
|
|
146
|
+
new ICommand({
|
|
147
|
+
function: this.loadFn('commands', 'setwaypoint'),
|
|
148
|
+
name: 'setwaypoint',
|
|
149
|
+
trigger: 'setwaypoint',
|
|
150
|
+
helpText: 'Creates a new waypoint.',
|
|
151
|
+
arguments: [
|
|
152
|
+
{
|
|
153
|
+
name: 'waypoint',
|
|
154
|
+
type: 'string',
|
|
155
|
+
defaultValue: null,
|
|
156
|
+
helpText: 'The location name.',
|
|
157
|
+
position: 0,
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
}),
|
|
161
|
+
new ICommand({
|
|
162
|
+
function: this.loadFn('commands', 'deletewaypoint'),
|
|
163
|
+
name: 'deletewaypoint',
|
|
164
|
+
trigger: 'deletewaypoint',
|
|
165
|
+
helpText: 'Deletes a waypoint.',
|
|
166
|
+
arguments: [
|
|
167
|
+
{
|
|
168
|
+
name: 'waypoint',
|
|
169
|
+
type: 'string',
|
|
170
|
+
defaultValue: null,
|
|
171
|
+
helpText: 'The location name.',
|
|
172
|
+
position: 0,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
}),
|
|
176
|
+
new ICommand({
|
|
177
|
+
function: this.loadFn('commands', 'listwaypoints'),
|
|
178
|
+
name: 'listwaypoints',
|
|
179
|
+
trigger: 'waypoints',
|
|
180
|
+
helpText: 'Lists all waypoints.',
|
|
181
|
+
arguments: [],
|
|
182
|
+
}),
|
|
183
|
+
new ICommand({
|
|
184
|
+
function: this.loadFn('commands', 'teleportwaypoint'),
|
|
185
|
+
name: 'teleportwaypoint',
|
|
186
|
+
trigger: 'teleportwaypoint',
|
|
187
|
+
arguments: [],
|
|
188
|
+
helpText:
|
|
189
|
+
'Placeholder command, this will not be used directly. The module will install aliases for this command corresponding to the waypoint names.',
|
|
190
|
+
}),
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { takaro, data, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
const enabledModules = await takaro.gameserver.gameServerControllerGetInstalledModules(data.gameServerId);
|
|
5
|
+
|
|
6
|
+
const moduleCommands = await Promise.all(
|
|
7
|
+
enabledModules.data.data.map(async (mod) => {
|
|
8
|
+
return (await takaro.module.moduleControllerGetOne(mod.moduleId)).data.data.commands;
|
|
9
|
+
})
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
if (data.arguments.command === 'all') {
|
|
13
|
+
await data.player.pm('Available commands:');
|
|
14
|
+
|
|
15
|
+
for (const mod of moduleCommands) {
|
|
16
|
+
await Promise.all(
|
|
17
|
+
mod.map(async (command) => {
|
|
18
|
+
await data.player.pm(`${command.name}: ${command.helpText}`);
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
const allCommandsFlat = moduleCommands.flat();
|
|
24
|
+
const requestedCommand = allCommandsFlat.find((c) => {
|
|
25
|
+
return c.name === data.arguments.command;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (!requestedCommand) {
|
|
29
|
+
throw new TakaroUserError(
|
|
30
|
+
`Unknown command "${data.arguments.command}", use this command without arguments to see all available commands.`
|
|
31
|
+
);
|
|
32
|
+
} else {
|
|
33
|
+
await data.player.pm(`${requestedCommand.name}: ${requestedCommand.helpText}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await main();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BuiltinModule, ICommand } from '../../BuiltinModule.js';
|
|
2
|
+
|
|
3
|
+
export class Utils extends BuiltinModule<Utils> {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(
|
|
6
|
+
'utils',
|
|
7
|
+
'A collection of useful commands',
|
|
8
|
+
JSON.stringify({
|
|
9
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
10
|
+
type: 'object',
|
|
11
|
+
additionalProperties: false,
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
this.commands = [
|
|
16
|
+
new ICommand({
|
|
17
|
+
function: this.loadFn('commands', 'ping'),
|
|
18
|
+
name: 'ping',
|
|
19
|
+
trigger: 'ping',
|
|
20
|
+
helpText: 'Replies with pong, useful for testing if the connection works.',
|
|
21
|
+
arguments: [],
|
|
22
|
+
}),
|
|
23
|
+
new ICommand({
|
|
24
|
+
function: this.loadFn('commands', 'help'),
|
|
25
|
+
name: 'help',
|
|
26
|
+
trigger: 'help',
|
|
27
|
+
helpText: 'The text you are reading right now, displays information about commands.',
|
|
28
|
+
arguments: [
|
|
29
|
+
{
|
|
30
|
+
name: 'command',
|
|
31
|
+
type: 'string',
|
|
32
|
+
defaultValue: 'all',
|
|
33
|
+
helpText: 'The command to get help for',
|
|
34
|
+
position: 0,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
}
|