@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,31 @@
|
|
|
1
|
+
import { takaro, data, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
import { getVariableKey } from './utils.js';
|
|
3
|
+
async function main() {
|
|
4
|
+
const { pog, gameServerId, arguments: args, module: mod } = data;
|
|
5
|
+
const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data;
|
|
6
|
+
const teleportRes = await takaro.variable.variableControllerSearch({
|
|
7
|
+
filters: {
|
|
8
|
+
gameServerId: [gameServerId],
|
|
9
|
+
playerId: [pog.playerId],
|
|
10
|
+
key: [getVariableKey(args.tp)],
|
|
11
|
+
moduleId: [mod.moduleId],
|
|
12
|
+
},
|
|
13
|
+
sortBy: 'key',
|
|
14
|
+
sortDirection: 'asc',
|
|
15
|
+
});
|
|
16
|
+
const teleports = teleportRes.data.data;
|
|
17
|
+
if (teleports.length === 0) {
|
|
18
|
+
throw new TakaroUserError(`No teleport with name ${args.tp} found, use ${prefix}settp <name> to set one first.`);
|
|
19
|
+
}
|
|
20
|
+
const teleportRecord = teleports[0];
|
|
21
|
+
const teleport = JSON.parse(teleportRecord.value);
|
|
22
|
+
await takaro.variable.variableControllerUpdate(teleportRecord.id, {
|
|
23
|
+
value: JSON.stringify({
|
|
24
|
+
...teleport,
|
|
25
|
+
public: false,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
await data.player.pm(`Teleport ${args.tp} is now private.`);
|
|
29
|
+
}
|
|
30
|
+
await main();
|
|
31
|
+
//# sourceMappingURL=setprivate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setprivate.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/setprivate.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEjE,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAEzG,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACjE,OAAO,EAAE;YACP,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC9B,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;SACzB;QACD,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;IAExC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,eAAe,CAAC,yBAAyB,IAAI,CAAC,EAAE,eAAe,MAAM,gCAAgC,CAAC,CAAC;IACnH,CAAC;IAED,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,CAAC,EAAE,EAAE;QAChE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;YACpB,GAAG,QAAQ;YACX,MAAM,EAAE,KAAK;SACd,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
import { getVariableKey } from './utils.js';
|
|
3
|
+
async function main() {
|
|
4
|
+
const { pog, gameServerId, module: mod, arguments: args } = data;
|
|
5
|
+
const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data;
|
|
6
|
+
if (!mod.userConfig.allowPublicTeleports) {
|
|
7
|
+
throw new TakaroUserError('Public teleports are disabled.');
|
|
8
|
+
}
|
|
9
|
+
const hasPermission = checkPermission(pog, 'TELEPORTS_CREATE_PUBLIC');
|
|
10
|
+
if (!hasPermission) {
|
|
11
|
+
throw new TakaroUserError('You do not have permission to create public teleports.');
|
|
12
|
+
}
|
|
13
|
+
const existingTeleportsForPlayerRes = await takaro.variable.variableControllerSearch({
|
|
14
|
+
search: {
|
|
15
|
+
key: 'tp_',
|
|
16
|
+
},
|
|
17
|
+
filters: {
|
|
18
|
+
gameServerId: [gameServerId],
|
|
19
|
+
playerId: [pog.playerId],
|
|
20
|
+
moduleId: [mod.moduleId],
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
const existingPublicTeleportsForPlayer = existingTeleportsForPlayerRes.data.data.filter((tp) => {
|
|
24
|
+
const teleport = JSON.parse(tp.value);
|
|
25
|
+
return teleport.public;
|
|
26
|
+
});
|
|
27
|
+
if (existingPublicTeleportsForPlayer.length >= hasPermission.count) {
|
|
28
|
+
throw new TakaroUserError(`You have reached the maximum number of public teleports for your role, maximum allowed is ${hasPermission.count}`);
|
|
29
|
+
}
|
|
30
|
+
const teleportRes = await takaro.variable.variableControllerSearch({
|
|
31
|
+
filters: {
|
|
32
|
+
gameServerId: [gameServerId],
|
|
33
|
+
playerId: [pog.playerId],
|
|
34
|
+
moduleId: [mod.moduleId],
|
|
35
|
+
key: [getVariableKey(args.tp)],
|
|
36
|
+
},
|
|
37
|
+
sortBy: 'key',
|
|
38
|
+
sortDirection: 'asc',
|
|
39
|
+
});
|
|
40
|
+
const teleports = teleportRes.data.data;
|
|
41
|
+
if (teleports.length === 0) {
|
|
42
|
+
throw new TakaroUserError(`No teleport with name ${args.tp} found, use ${prefix}settp <name> to set one first.`);
|
|
43
|
+
}
|
|
44
|
+
const teleportRecord = teleports[0];
|
|
45
|
+
const teleport = JSON.parse(teleportRecord.value);
|
|
46
|
+
await takaro.variable.variableControllerUpdate(teleportRecord.id, {
|
|
47
|
+
value: JSON.stringify({
|
|
48
|
+
...teleport,
|
|
49
|
+
public: true,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
await data.player.pm(`Teleport ${args.tp} is now public.`);
|
|
53
|
+
}
|
|
54
|
+
await main();
|
|
55
|
+
//# sourceMappingURL=setpublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setpublic.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/setpublic.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,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AAG,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACjE,OAAO,EAAE;YACP,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC/B;QACD,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;IAExC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,eAAe,CAAC,yBAAyB,IAAI,CAAC,EAAE,eAAe,MAAM,gCAAgC,CAAC,CAAC;IACnH,CAAC;IAED,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,cAAc,CAAC,EAAE,EAAE;QAChE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;YACpB,GAAG,QAAQ;YACX,MAAM,EAAE,IAAI;SACb,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
import { getVariableKey, findTp } from './utils.js';
|
|
3
|
+
async function main() {
|
|
4
|
+
const { pog, gameServerId, module: mod, arguments: args } = data;
|
|
5
|
+
const hasPermission = checkPermission(pog, 'TELEPORTS_USE');
|
|
6
|
+
if (!hasPermission) {
|
|
7
|
+
throw new TakaroUserError('You do not have permission to use teleports.');
|
|
8
|
+
}
|
|
9
|
+
const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data.value;
|
|
10
|
+
const existingVariable = await findTp(args.tp);
|
|
11
|
+
if (existingVariable.data.data.length > 0) {
|
|
12
|
+
throw new TakaroUserError(`Teleport ${args.tp} already exists, use ${prefix}deletetp ${args.tp} to delete it.`);
|
|
13
|
+
}
|
|
14
|
+
const allPlayerTeleports = await takaro.variable.variableControllerSearch({
|
|
15
|
+
search: {
|
|
16
|
+
key: getVariableKey(''),
|
|
17
|
+
},
|
|
18
|
+
filters: {
|
|
19
|
+
gameServerId: [gameServerId],
|
|
20
|
+
playerId: [pog.playerId],
|
|
21
|
+
moduleId: [mod.moduleId],
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
if (allPlayerTeleports.data.data.length >= hasPermission.count) {
|
|
25
|
+
throw new TakaroUserError(`You have reached the maximum number of teleports for your role, maximum allowed is ${hasPermission.count}`);
|
|
26
|
+
}
|
|
27
|
+
await takaro.variable.variableControllerCreate({
|
|
28
|
+
key: getVariableKey(args.tp),
|
|
29
|
+
value: JSON.stringify({
|
|
30
|
+
name: args.tp,
|
|
31
|
+
x: data.pog.positionX,
|
|
32
|
+
y: data.pog.positionY,
|
|
33
|
+
z: data.pog.positionZ,
|
|
34
|
+
}),
|
|
35
|
+
gameServerId,
|
|
36
|
+
moduleId: mod.moduleId,
|
|
37
|
+
playerId: pog.playerId,
|
|
38
|
+
});
|
|
39
|
+
await data.player.pm(`Teleport ${args.tp} set.`);
|
|
40
|
+
}
|
|
41
|
+
await main();
|
|
42
|
+
//# sourceMappingURL=settp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settp.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/settp.js"],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IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;QAC/D,MAAM,IAAI,eAAe,CACvB,sFAAsF,aAAa,CAAC,KAAK,EAAE,CAC5G,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;YACpB,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;YACrB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;YACrB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS;SACtB,CAAC;QACF,YAAY;QACZ,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;KACvB,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
function getWaypointName(name) {
|
|
3
|
+
return `waypoint ${name}`;
|
|
4
|
+
}
|
|
5
|
+
async function main() {
|
|
6
|
+
const { pog, gameServerId, module: mod, arguments: args } = data;
|
|
7
|
+
if (!checkPermission(pog, 'TELEPORTS_MANAGE_WAYPOINTS')) {
|
|
8
|
+
throw new TakaroUserError('You do not have permission to manage waypoints.');
|
|
9
|
+
}
|
|
10
|
+
async function ensureWaypointsModule() {
|
|
11
|
+
let waypointsDefinition = (await takaro.module.moduleControllerSearch({
|
|
12
|
+
filters: {
|
|
13
|
+
name: ['Waypoints'],
|
|
14
|
+
},
|
|
15
|
+
})).data.data[0];
|
|
16
|
+
if (!waypointsDefinition) {
|
|
17
|
+
console.log('Waypoints module definition not found, creating it.');
|
|
18
|
+
waypointsDefinition = (await takaro.module.moduleControllerCreate({
|
|
19
|
+
name: 'Waypoints',
|
|
20
|
+
description: 'Waypoints module for the teleport system.',
|
|
21
|
+
})).data.data;
|
|
22
|
+
}
|
|
23
|
+
let waypointsInstallation = (await takaro.gameserver.gameServerControllerGetInstalledModules(gameServerId)).data.data.find((module) => module.name === 'Waypoints');
|
|
24
|
+
if (!waypointsInstallation) {
|
|
25
|
+
console.log('Waypoints module not found, installing it.');
|
|
26
|
+
waypointsInstallation = (await takaro.gameserver.gameServerControllerInstallModule(gameServerId, waypointsDefinition.id)).data.data;
|
|
27
|
+
}
|
|
28
|
+
return { waypointsInstallation, waypointsDefinition };
|
|
29
|
+
}
|
|
30
|
+
const { waypointsInstallation, waypointsDefinition } = await ensureWaypointsModule();
|
|
31
|
+
try {
|
|
32
|
+
await takaro.variable.variableControllerCreate({
|
|
33
|
+
moduleId: waypointsInstallation.moduleId,
|
|
34
|
+
gameServerId,
|
|
35
|
+
key: getWaypointName(args.waypoint),
|
|
36
|
+
value: JSON.stringify({
|
|
37
|
+
x: pog.positionX,
|
|
38
|
+
y: pog.positionY,
|
|
39
|
+
z: pog.positionZ,
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error.message === 'Request failed with status code 409') {
|
|
45
|
+
throw new TakaroUserError(`Waypoint ${args.waypoint} already exists.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const teleportCommand = await takaro.command.commandControllerSearch({
|
|
49
|
+
filters: {
|
|
50
|
+
moduleId: [mod.moduleId],
|
|
51
|
+
name: ['teleportwaypoint'],
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
await takaro.command.commandControllerCreate({
|
|
55
|
+
moduleId: waypointsInstallation.moduleId,
|
|
56
|
+
name: `waypoint ${args.waypoint} server ${gameServerId}`,
|
|
57
|
+
trigger: args.waypoint,
|
|
58
|
+
helpText: `Teleport to waypoint ${args.waypoint}.`,
|
|
59
|
+
function: teleportCommand.data.data[0].function.code,
|
|
60
|
+
});
|
|
61
|
+
const existingPermissions = waypointsDefinition.permissions || [];
|
|
62
|
+
const permissionInputDTOs = existingPermissions.map((permission) => ({
|
|
63
|
+
permission: permission.permission,
|
|
64
|
+
description: permission.description,
|
|
65
|
+
friendlyName: permission.friendlyName,
|
|
66
|
+
canHaveCount: permission.canHaveCount,
|
|
67
|
+
}));
|
|
68
|
+
const gameServer = (await takaro.gameserver.gameServerControllerGetOne(gameServerId)).data.data;
|
|
69
|
+
await takaro.module.moduleControllerUpdate(waypointsInstallation.moduleId, {
|
|
70
|
+
permissions: [
|
|
71
|
+
{
|
|
72
|
+
permission: `WAYPOINTS_USE_${args.waypoint.toUpperCase()}_${gameServerId}`,
|
|
73
|
+
description: `Use the waypoint ${args.waypoint} on ${gameServer.name}.`,
|
|
74
|
+
friendlyName: `Use waypoint ${args.waypoint} on ${gameServer.name}`,
|
|
75
|
+
canHaveCount: false,
|
|
76
|
+
},
|
|
77
|
+
...permissionInputDTOs,
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
// Need to reinstall the module to ensure the new commands systemconfig and permissions are properly in place
|
|
81
|
+
await takaro.gameserver.gameServerControllerInstallModule(gameServerId, waypointsInstallation.moduleId, {
|
|
82
|
+
systemConfig: JSON.stringify(waypointsInstallation.systemConfig),
|
|
83
|
+
userConfig: JSON.stringify(waypointsInstallation.userConfig),
|
|
84
|
+
});
|
|
85
|
+
await pog.pm(`Waypoint ${args.waypoint} set.`);
|
|
86
|
+
}
|
|
87
|
+
await main();
|
|
88
|
+
//# sourceMappingURL=setwaypoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setwaypoint.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/setwaypoint.js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UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC;KAC7D,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,QAAQ,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
|
|
2
|
+
import { findTp } from './utils.js';
|
|
3
|
+
async function main() {
|
|
4
|
+
const { pog, gameServerId, arguments: args, module: mod } = data;
|
|
5
|
+
if (!checkPermission(pog, 'TELEPORTS_USE')) {
|
|
6
|
+
throw new TakaroUserError('You do not have permission to use teleports.');
|
|
7
|
+
}
|
|
8
|
+
const ownedTeleportRes = await findTp(args.tp, pog.playerId);
|
|
9
|
+
let teleports = ownedTeleportRes.data.data;
|
|
10
|
+
if (mod.userConfig.allowPublicTeleports) {
|
|
11
|
+
const maybePublicTeleportRes = await findTp(args.tp);
|
|
12
|
+
const publicTeleports = maybePublicTeleportRes.data.data.filter((tele) => {
|
|
13
|
+
const teleport = JSON.parse(tele.value);
|
|
14
|
+
return teleport.public;
|
|
15
|
+
});
|
|
16
|
+
teleports = teleports.concat(publicTeleports);
|
|
17
|
+
}
|
|
18
|
+
if (teleports.length === 0) {
|
|
19
|
+
throw new TakaroUserError(`Teleport ${args.tp} does not exist.`);
|
|
20
|
+
}
|
|
21
|
+
const timeout = mod.userConfig.timeout;
|
|
22
|
+
if (timeout !== 0) {
|
|
23
|
+
const lastExecuted = await takaro.variable.variableControllerSearch({
|
|
24
|
+
filters: {
|
|
25
|
+
key: ['lastExecuted'],
|
|
26
|
+
gameServerId: [gameServerId],
|
|
27
|
+
playerId: [pog.playerId],
|
|
28
|
+
moduleId: [mod.moduleId],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
let lastExecutedRecord = lastExecuted.data.data[0];
|
|
32
|
+
if (!lastExecutedRecord) {
|
|
33
|
+
const createRes = await takaro.variable.variableControllerCreate({
|
|
34
|
+
key: 'lastExecuted',
|
|
35
|
+
gameServerId,
|
|
36
|
+
playerId: pog.playerId,
|
|
37
|
+
moduleId: mod.moduleId,
|
|
38
|
+
value: new Date().toISOString(),
|
|
39
|
+
});
|
|
40
|
+
console.log(createRes);
|
|
41
|
+
lastExecutedRecord = createRes.data.data;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const lastExecutedTime = new Date(lastExecutedRecord.value);
|
|
45
|
+
const now = new Date();
|
|
46
|
+
const diff = now.getTime() - lastExecutedTime.getTime();
|
|
47
|
+
if (diff < timeout) {
|
|
48
|
+
throw new TakaroUserError('You cannot teleport yet. Please wait before trying again.');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const teleport = JSON.parse(teleports[0].value);
|
|
52
|
+
await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
|
|
53
|
+
x: teleport.x,
|
|
54
|
+
y: teleport.y,
|
|
55
|
+
z: teleport.z,
|
|
56
|
+
});
|
|
57
|
+
await data.player.pm(`Teleported to ${teleport.name}.`);
|
|
58
|
+
if (timeout !== 0 && lastExecutedRecord) {
|
|
59
|
+
await takaro.variable.variableControllerUpdate(lastExecutedRecord.id, {
|
|
60
|
+
value: new Date().toISOString(),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const teleport = JSON.parse(teleports[0].value);
|
|
66
|
+
await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
|
|
67
|
+
x: teleport.x,
|
|
68
|
+
y: teleport.y,
|
|
69
|
+
z: teleport.z,
|
|
70
|
+
});
|
|
71
|
+
await data.player.pm(`Teleported to ${teleport.name}.`);
|
|
72
|
+
}
|
|
73
|
+
await main();
|
|
74
|
+
//# sourceMappingURL=teleport.js.map
|
|
@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pers';
|
|
2
|
+
function getWaypointName(name) {
|
|
3
|
+
return `waypoint ${name}`;
|
|
4
|
+
}
|
|
5
|
+
async function main() {
|
|
6
|
+
const { pog, gameServerId, trigger } = data;
|
|
7
|
+
if (!checkPermission(pog, `WAYPOINTS_USE_${trigger.toUpperCase()}_${gameServerId}`)) {
|
|
8
|
+
throw new TakaroUserError(`You are not allowed to use the waypoint ${trigger}.`);
|
|
9
|
+
}
|
|
10
|
+
async function ensureWaypointsModule() {
|
|
11
|
+
let waypointsDefinition = (await takaro.module.moduleControllerSearch({
|
|
12
|
+
filters: {
|
|
13
|
+
name: ['Waypoints'],
|
|
14
|
+
},
|
|
15
|
+
})).data.data[0];
|
|
16
|
+
if (!waypointsDefinition) {
|
|
17
|
+
console.log('Waypoints module definition not found, creating it.');
|
|
18
|
+
waypointsDefinition = (await takaro.module.moduleControllerCreate({
|
|
19
|
+
name: 'Waypoints',
|
|
20
|
+
description: 'Waypoints module for the teleport system.',
|
|
21
|
+
})).data.data;
|
|
22
|
+
}
|
|
23
|
+
let waypointsInstallation = (await takaro.gameserver.gameServerControllerGetInstalledModules(gameServerId)).data.data.find((module) => module.name === 'Waypoints');
|
|
24
|
+
if (!waypointsInstallation) {
|
|
25
|
+
console.log('Waypoints module not found, installing it.');
|
|
26
|
+
waypointsInstallation = (await takaro.gameserver.gameServerControllerInstallModule(gameServerId, waypointsDefinition.id)).data.data;
|
|
27
|
+
}
|
|
28
|
+
return { waypointsInstallation, waypointsDefinition };
|
|
29
|
+
}
|
|
30
|
+
const { waypointsInstallation } = await ensureWaypointsModule();
|
|
31
|
+
const variable = await takaro.variable.variableControllerSearch({
|
|
32
|
+
filters: {
|
|
33
|
+
key: [getWaypointName(trigger)],
|
|
34
|
+
gameServerId: [gameServerId],
|
|
35
|
+
moduleId: [waypointsInstallation.moduleId],
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (variable.data.data.length === 0) {
|
|
39
|
+
throw new TakaroUserError(`Waypoint ${trigger} does not exist.`);
|
|
40
|
+
}
|
|
41
|
+
const waypoint = JSON.parse(variable.data.data[0].value);
|
|
42
|
+
await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, {
|
|
43
|
+
x: waypoint.x,
|
|
44
|
+
y: waypoint.y,
|
|
45
|
+
z: waypoint.z,
|
|
46
|
+
});
|
|
47
|
+
await pog.pm(`Teleported to waypoint ${trigger}.`);
|
|
48
|
+
}
|
|
49
|
+
await main();
|
|
50
|
+
//# sourceMappingURL=teleportwaypoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teleportwaypoint.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/teleportwaypoint.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjF,SAAS,eAAe,CAAC,IAAI;IAC3B,OAAO,YAAY,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAE5C,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,OAAO,CAAC,WAAW,EAAE,IAAI,YAAY,EAAE,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,eAAe,CAAC,2CAA2C,OAAO,GAAG,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,UAAU,qBAAqB;QAClC,IAAI,mBAAmB,GAAG,CACxB,MAAM,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC;YACzC,OAAO,EAAE;gBACP,IAAI,EAAE,CAAC,WAAW,CAAC;aACpB;SACF,CAAC,CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAEf,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;YACnE,mBAAm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IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEzD,MAAM,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE;QACrF,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,CAAC,EAAE,QAAQ,CAAC,CAAC;KACd,CAAC,CAAC;IAEH,MAAM,GAAG,CAAC,EAAE,CAAC,0BAA0B,OAAO,GAAG,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { takaro, data } from '@takaro/helpers';
|
|
2
|
+
async function main() {
|
|
3
|
+
const { pog, gameServerId, module: mod } = data;
|
|
4
|
+
const prefix = (await takaro.settings.settingsControllerGetOne('commandPrefix', gameServerId)).data.data;
|
|
5
|
+
const ownedTeleports = (await takaro.variable.variableControllerSearch({
|
|
6
|
+
filters: {
|
|
7
|
+
gameServerId: [gameServerId],
|
|
8
|
+
playerId: [pog.playerId],
|
|
9
|
+
moduleId: [mod.moduleId],
|
|
10
|
+
},
|
|
11
|
+
search: {
|
|
12
|
+
key: 'tp',
|
|
13
|
+
},
|
|
14
|
+
sortBy: 'key',
|
|
15
|
+
sortDirection: 'asc',
|
|
16
|
+
})).data.data;
|
|
17
|
+
const maybePublicTeleports = (await takaro.variable.variableControllerSearch({
|
|
18
|
+
filters: {
|
|
19
|
+
gameServerId: [gameServerId],
|
|
20
|
+
moduleId: [mod.moduleId],
|
|
21
|
+
},
|
|
22
|
+
search: {
|
|
23
|
+
key: ['tp'],
|
|
24
|
+
},
|
|
25
|
+
sortBy: 'key',
|
|
26
|
+
sortDirection: 'asc',
|
|
27
|
+
})).data.data;
|
|
28
|
+
const teleports = maybePublicTeleports.filter((tele) => {
|
|
29
|
+
const teleport = JSON.parse(tele.value);
|
|
30
|
+
const isPublic = teleport.public && teleport.playerId !== pog.playerId;
|
|
31
|
+
const isOwned = ownedTeleports.find((t) => t.playerId === pog.playerId);
|
|
32
|
+
return isPublic || isOwned;
|
|
33
|
+
});
|
|
34
|
+
if (teleports.length === 0) {
|
|
35
|
+
await data.player.pm(`You have no teleports set, use ${prefix}settp <name> to set one.`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
await data.player.pm(`You have ${teleports.length} teleport${teleports.length === 1 ? '' : 's'} available`);
|
|
39
|
+
for (const rawTeleport of teleports) {
|
|
40
|
+
const teleport = JSON.parse(rawTeleport.value);
|
|
41
|
+
await data.player.pm(` - ${teleport.name}: ${teleport.x}, ${teleport.y}, ${teleport.z} ${teleport.public ? '(public)' : ''}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
await main();
|
|
45
|
+
//# sourceMappingURL=tplist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tplist.js","sourceRoot":"","sources":["../../../../src/modules/teleports/commands/tplist.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEhD,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAEzG,MAAM,cAAc,GAAG,CACrB,MAAM,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC7C,OAAO,EAAE;YACP,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxB,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;SACzB;QACD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AC,CAAC,GAAG,YAAY,CAAC,CAAC;IAE5G,KAAK,MAAM,WAAW,IAAI,SAAS,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAClB,MAAM,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CACxG,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { takaro, data } from '@takaro/helpers';
|
|
2
|
+
export function getVariableKey(tpName) {
|
|
3
|
+
return `tp_${tpName}`;
|
|
4
|
+
}
|
|
5
|
+
export async function findTp(tpName, playerId) {
|
|
6
|
+
const { gameServerId, module: mod } = data;
|
|
7
|
+
return takaro.variable.variableControllerSearch({
|
|
8
|
+
filters: {
|
|
9
|
+
key: [getVariableKey(tpName)],
|
|
10
|
+
gameServerId: [gameServerId],
|
|
11
|
+
playerId: [playerId].filter(Boolean),
|
|
12
|
+
moduleId: [mod.moduleId],
|
|
13
|
+
},
|
|
14
|
+
sortBy: 'key',
|
|
15
|
+
sortDirection: 'asc',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/modules/teleports/functions/utils.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,cAAc,CAAC,MAAM;IACnC,OAAO,MAAM,MAAM,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,MAAM,EAAE,QAAQ;IAC3C,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE3C,OAAO,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC9C,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC7B,YAAY,EAAE,CAAC,YAAY,CAAC;YAC5B,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;YACpC,QAAQ,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;SACzB;QACD,MAAM,EAAE,KAAK;QACb,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;AACL,CAAC"}
|