@takaro/modules 0.0.30 → 0.1.0
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/dto/gameEvents.d.ts +2 -6
- package/dist/dto/gameEvents.d.ts.map +1 -1
- package/dist/dto/gameEvents.js +10 -2
- package/dist/dto/gameEvents.js.map +1 -1
- package/dist/modules/dailyRewards/index.d.ts.map +1 -1
- package/dist/modules/dailyRewards/index.js +0 -1
- package/dist/modules/dailyRewards/index.js.map +1 -1
- package/dist/modules/geoBlock/index.d.ts.map +1 -1
- package/dist/modules/geoBlock/index.js +0 -2
- package/dist/modules/geoBlock/index.js.map +1 -1
- package/dist/modules/gimme/commands/gimme.js +1 -1
- package/dist/modules/gimme/commands/gimme.js.map +1 -1
- package/dist/modules/highPingKicker/cronJobs/Ping check.js +19 -14
- package/dist/modules/highPingKicker/cronJobs/Ping check.js.map +1 -1
- package/dist/modules/highPingKicker/index.js +1 -1
- package/dist/modules/playerOnboarding/commands/starterkit.js +2 -2
- package/dist/modules/playerOnboarding/commands/starterkit.js.map +1 -1
- package/dist/modules/teleports/commands/settp.js +1 -0
- package/dist/modules/teleports/commands/settp.js.map +1 -1
- package/dist/modules/teleports/commands/setwaypoint.js +1 -0
- package/dist/modules/teleports/commands/setwaypoint.js.map +1 -1
- package/dist/modules/teleports/commands/teleport.js +2 -0
- package/dist/modules/teleports/commands/teleport.js.map +1 -1
- package/dist/modules/teleports/commands/teleportwaypoint.js +1 -0
- package/dist/modules/teleports/commands/teleportwaypoint.js.map +1 -1
- package/dist/modules/teleports/index.js +1 -1
- package/dist/modules.json +9 -9
- package/package.json +1 -1
- package/src/__tests__/economy/claim.integration.test.ts +6 -6
- package/src/__tests__/economy/economyUtils.integration.test.ts +1 -1
- package/src/__tests__/highPingKicker.integration.test.ts +618 -0
- package/src/__tests__/modulePermission.integration.test.ts +14 -15
- package/src/__tests__/serverMessages.integration.test.ts +0 -1
- package/src/__tests__/teleports/listtp.integration.test.ts +0 -1
- package/src/__tests__/teleports/teleport.integration.test.ts +44 -0
- package/src/__tests__/teleports/waypoints.integration.test.ts +104 -27
- package/src/dto/gameEvents.ts +8 -8
- package/src/modules/dailyRewards/index.ts +0 -1
- package/src/modules/geoBlock/index.ts +0 -2
- package/src/modules/gimme/commands/gimme.js +1 -1
- package/src/modules/highPingKicker/cronJobs/Ping check.js +19 -17
- package/src/modules/highPingKicker/index.ts +1 -1
- package/src/modules/playerOnboarding/commands/starterkit.js +2 -2
- package/src/modules/teleports/commands/settp.js +2 -1
- package/src/modules/teleports/commands/setwaypoint.js +1 -0
- package/src/modules/teleports/commands/teleport.js +2 -0
- package/src/modules/teleports/commands/teleportwaypoint.js +1 -0
- package/src/modules/teleports/index.ts +1 -1
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IntegrationTest,
|
|
3
|
-
expect,
|
|
4
|
-
integrationConfig,
|
|
5
|
-
IModuleTestsSetupData,
|
|
6
|
-
modulesTestSetup,
|
|
7
|
-
EventsAwaiter,
|
|
8
|
-
} from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
9
2
|
import { GameEvents } from '../dto/index.js';
|
|
10
3
|
import { describe } from 'node:test';
|
|
4
|
+
import { randomUUID } from 'crypto';
|
|
5
|
+
import { getMockServer } from '@takaro/mock-gameserver';
|
|
11
6
|
|
|
12
7
|
const group = 'Module permissions role assignments';
|
|
13
8
|
|
|
@@ -76,16 +71,20 @@ const tests = [
|
|
|
76
71
|
setup: cleanRoleSetup,
|
|
77
72
|
name: 'Player has role on other gameserver -> command denied',
|
|
78
73
|
test: async function () {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
if (!this.domainRegistrationToken) throw new Error('Domain registration token not set');
|
|
75
|
+
const identityToken = randomUUID();
|
|
76
|
+
const mockserver = await getMockServer({
|
|
77
|
+
mockserver: { registrationToken: this.domainRegistrationToken, identityToken },
|
|
78
|
+
});
|
|
79
|
+
this.setupData.mockservers.push(mockserver);
|
|
80
|
+
const gameserverRes = await this.client.gameserver.gameServerControllerSearch({
|
|
81
|
+
filters: { identityToken: [identityToken] },
|
|
85
82
|
});
|
|
83
|
+
const newGameServer = gameserverRes.data.data[0];
|
|
84
|
+
if (!newGameServer) throw new Error('Game server not found');
|
|
86
85
|
|
|
87
86
|
await this.client.player.playerControllerAssignRole(this.setupData.players[0].id, this.setupData.role.id, {
|
|
88
|
-
gameServerId: newGameServer.
|
|
87
|
+
gameServerId: newGameServer.id,
|
|
89
88
|
});
|
|
90
89
|
|
|
91
90
|
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
@@ -141,7 +141,6 @@ const tests = [
|
|
|
141
141
|
group,
|
|
142
142
|
snapshot: false,
|
|
143
143
|
setup: modulesTestSetup,
|
|
144
|
-
// eslint-disable-next-line quotes
|
|
145
144
|
name: "bug repro /tplist: Player A and B have teleports set but B cannot see A's teleports",
|
|
146
145
|
test: async function () {
|
|
147
146
|
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
@@ -100,6 +100,50 @@ const tests = [
|
|
|
100
100
|
);
|
|
101
101
|
},
|
|
102
102
|
}),
|
|
103
|
+
new IntegrationTest<IModuleTestsSetupData>({
|
|
104
|
+
group,
|
|
105
|
+
snapshot: false,
|
|
106
|
+
setup: modulesTestSetup,
|
|
107
|
+
name: 'Can teleport with dimension parameter through API endpoint',
|
|
108
|
+
test: async function () {
|
|
109
|
+
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
110
|
+
gameServerId: this.setupData.gameserver.id,
|
|
111
|
+
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// First, set a teleport with a specific dimension via command
|
|
115
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
116
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
117
|
+
msg: '/settp dimension_test',
|
|
118
|
+
playerId: this.setupData.players[0].id,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
expect((await setEvents).length).to.be.eq(1);
|
|
122
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Teleport dimension_test set.');
|
|
123
|
+
|
|
124
|
+
// Now teleport using the API endpoint with a specific dimension
|
|
125
|
+
await this.client.gameserver.gameServerControllerTeleportPlayer(
|
|
126
|
+
this.setupData.gameserver.id,
|
|
127
|
+
this.setupData.players[0].id,
|
|
128
|
+
{
|
|
129
|
+
x: 100,
|
|
130
|
+
y: 200,
|
|
131
|
+
z: 300,
|
|
132
|
+
dimension: 'nether',
|
|
133
|
+
},
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
// Verify that the teleport command works with the saved teleport (which includes dimension)
|
|
137
|
+
const tpEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
138
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
139
|
+
msg: '/tp dimension_test',
|
|
140
|
+
playerId: this.setupData.players[0].id,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
expect((await tpEvents).length).to.be.eq(1);
|
|
144
|
+
expect((await tpEvents)[0].data.meta.msg).to.be.eq('Teleported to dimension_test.');
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
103
147
|
];
|
|
104
148
|
|
|
105
149
|
describe(group, function () {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IntegrationTest,
|
|
3
|
-
expect,
|
|
4
|
-
integrationConfig,
|
|
5
|
-
IModuleTestsSetupData,
|
|
6
|
-
modulesTestSetup,
|
|
7
|
-
EventsAwaiter,
|
|
8
|
-
} from '@takaro/test';
|
|
1
|
+
import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
|
|
9
2
|
import { GameEvents, HookEvents } from '../../dto/index.js';
|
|
10
|
-
import {
|
|
3
|
+
import { PlayerOutputDTO, RoleOutputDTO } from '@takaro/apiclient';
|
|
11
4
|
import { describe } from 'node:test';
|
|
5
|
+
import { randomUUID } from 'crypto';
|
|
6
|
+
import { getMockServer } from '@takaro/mock-gameserver';
|
|
12
7
|
|
|
13
8
|
const group = 'Teleports - waypoints';
|
|
14
9
|
|
|
@@ -69,17 +64,20 @@ const waypointsSetup = async function (this: IntegrationTest<WaypointsSetup>): P
|
|
|
69
64
|
};
|
|
70
65
|
|
|
71
66
|
async function setupSecondServer(this: IntegrationTest<WaypointsSetup>) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
if (!this.domainRegistrationToken) throw new Error('Domain registration token not set');
|
|
68
|
+
const identityToken = randomUUID();
|
|
69
|
+
const mockserver = await getMockServer({
|
|
70
|
+
mockserver: { registrationToken: this.domainRegistrationToken, identityToken },
|
|
71
|
+
});
|
|
72
|
+
this.setupData.mockservers.push(mockserver);
|
|
73
|
+
const gameserverRes = await this.client.gameserver.gameServerControllerSearch({
|
|
74
|
+
filters: { identityToken: [identityToken] },
|
|
79
75
|
});
|
|
76
|
+
const newGameServer = gameserverRes.data.data[0];
|
|
77
|
+
if (!newGameServer) throw new Error('Game server not found');
|
|
80
78
|
|
|
81
79
|
await this.client.module.moduleInstallationsControllerInstallModule({
|
|
82
|
-
gameServerId: newGameServer.
|
|
80
|
+
gameServerId: newGameServer.id,
|
|
83
81
|
versionId: this.setupData.teleportsModule.latestVersion.id,
|
|
84
82
|
});
|
|
85
83
|
|
|
@@ -88,7 +86,7 @@ async function setupSecondServer(this: IntegrationTest<WaypointsSetup>) {
|
|
|
88
86
|
5,
|
|
89
87
|
);
|
|
90
88
|
|
|
91
|
-
await this.client.gameserver.gameServerControllerExecuteCommand(newGameServer.
|
|
89
|
+
await this.client.gameserver.gameServerControllerExecuteCommand(newGameServer.id, {
|
|
92
90
|
command: 'connectAll',
|
|
93
91
|
});
|
|
94
92
|
|
|
@@ -96,7 +94,7 @@ async function setupSecondServer(this: IntegrationTest<WaypointsSetup>) {
|
|
|
96
94
|
|
|
97
95
|
const newServerPlayers = (
|
|
98
96
|
await this.client.playerOnGameserver.playerOnGameServerControllerSearch({
|
|
99
|
-
filters: { gameServerId: [newGameServer.
|
|
97
|
+
filters: { gameServerId: [newGameServer.id] },
|
|
100
98
|
})
|
|
101
99
|
).data.data;
|
|
102
100
|
const newServerModerator = newServerPlayers[0];
|
|
@@ -249,7 +247,6 @@ const tests = [
|
|
|
249
247
|
});
|
|
250
248
|
|
|
251
249
|
expect((await events).length).to.be.eq(1);
|
|
252
|
-
// eslint-disable-next-line quotes
|
|
253
250
|
expect((await events)[0].data.meta.msg).to.be.eq("Waypoint A doesn't exist.");
|
|
254
251
|
},
|
|
255
252
|
}),
|
|
@@ -546,7 +543,7 @@ const tests = [
|
|
|
546
543
|
|
|
547
544
|
// Make a waypoint on the new gameserver
|
|
548
545
|
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
549
|
-
await this.client.command.commandControllerTrigger(newGameServer.
|
|
546
|
+
await this.client.command.commandControllerTrigger(newGameServer.id, {
|
|
550
547
|
msg: '/setwaypoint A',
|
|
551
548
|
playerId: newServerModerator.playerId,
|
|
552
549
|
});
|
|
@@ -562,16 +559,14 @@ const tests = [
|
|
|
562
559
|
expect((await setEvents2).length).to.be.eq(1);
|
|
563
560
|
expect((await setEvents2)[0].data.meta.msg).to.be.eq('Waypoint notused set.');
|
|
564
561
|
|
|
565
|
-
const useWaypointPermission = await this.client.permissionCodesToInputs([
|
|
566
|
-
`WAYPOINTS_USE_A_${newGameServer.data.data.id}`,
|
|
567
|
-
]);
|
|
562
|
+
const useWaypointPermission = await this.client.permissionCodesToInputs([`WAYPOINTS_USE_A_${newGameServer.id}`]);
|
|
568
563
|
await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
|
|
569
564
|
permissions: useWaypointPermission,
|
|
570
565
|
});
|
|
571
566
|
|
|
572
567
|
// Use the waypoint from the new gameserver -> success
|
|
573
568
|
const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
574
|
-
await this.client.command.commandControllerTrigger(newGameServer.
|
|
569
|
+
await this.client.command.commandControllerTrigger(newGameServer.id, {
|
|
575
570
|
msg: '/A',
|
|
576
571
|
playerId: newServerPlayer.playerId,
|
|
577
572
|
});
|
|
@@ -615,7 +610,7 @@ const tests = [
|
|
|
615
610
|
|
|
616
611
|
// Make a waypoint on the new gameserver
|
|
617
612
|
const setEvents2 = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
|
|
618
|
-
await this.client.command.commandControllerTrigger(newGameServer.
|
|
613
|
+
await this.client.command.commandControllerTrigger(newGameServer.id, {
|
|
619
614
|
msg: '/setwaypoint A',
|
|
620
615
|
playerId: newServerModerator.playerId,
|
|
621
616
|
});
|
|
@@ -641,7 +636,7 @@ const tests = [
|
|
|
641
636
|
GameEvents.CHAT_MESSAGE,
|
|
642
637
|
1,
|
|
643
638
|
);
|
|
644
|
-
await this.client.command.commandControllerTrigger(newGameServer.
|
|
639
|
+
await this.client.command.commandControllerTrigger(newGameServer.id, {
|
|
645
640
|
msg: '/A',
|
|
646
641
|
playerId: newServerPlayer.playerId,
|
|
647
642
|
});
|
|
@@ -742,6 +737,88 @@ const tests = [
|
|
|
742
737
|
);
|
|
743
738
|
},
|
|
744
739
|
}),
|
|
740
|
+
new IntegrationTest<WaypointsSetup>({
|
|
741
|
+
group,
|
|
742
|
+
snapshot: false,
|
|
743
|
+
setup: waypointsSetup,
|
|
744
|
+
name: 'Waypoints store and use dimension information correctly',
|
|
745
|
+
test: async function () {
|
|
746
|
+
// Create a waypoint with dimension data via setwaypoint command
|
|
747
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
748
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
749
|
+
msg: '/setwaypoint dimension_waypoint',
|
|
750
|
+
playerId: this.setupData.moderator.id,
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
expect((await setEvents).length).to.be.eq(1);
|
|
754
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint dimension_waypoint set.');
|
|
755
|
+
|
|
756
|
+
// Give player permission to use the waypoint
|
|
757
|
+
const useWaypointPermission = await this.client.permissionCodesToInputs([
|
|
758
|
+
`WAYPOINTS_USE_DIMENSION_WAYPOINT_${this.setupData.gameserver.id}`,
|
|
759
|
+
]);
|
|
760
|
+
await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
|
|
761
|
+
permissions: useWaypointPermission,
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
// Teleport to the waypoint - should include dimension data
|
|
765
|
+
const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
766
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
767
|
+
msg: '/dimension_waypoint',
|
|
768
|
+
playerId: this.setupData.player.id,
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
expect((await teleportEvents).length).to.be.eq(1);
|
|
772
|
+
expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint dimension_waypoint.');
|
|
773
|
+
},
|
|
774
|
+
}),
|
|
775
|
+
new IntegrationTest<WaypointsSetup>({
|
|
776
|
+
group,
|
|
777
|
+
snapshot: false,
|
|
778
|
+
setup: waypointsSetup,
|
|
779
|
+
name: 'Waypoints work with API teleport endpoint including dimension parameter',
|
|
780
|
+
test: async function () {
|
|
781
|
+
// Create a waypoint
|
|
782
|
+
const setEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
783
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
784
|
+
msg: '/setwaypoint api_test_waypoint',
|
|
785
|
+
playerId: this.setupData.moderator.id,
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
expect((await setEvents).length).to.be.eq(1);
|
|
789
|
+
expect((await setEvents)[0].data.meta.msg).to.be.eq('Waypoint api_test_waypoint set.');
|
|
790
|
+
|
|
791
|
+
// Test direct API teleport with dimension
|
|
792
|
+
await this.client.gameserver.gameServerControllerTeleportPlayer(
|
|
793
|
+
this.setupData.gameserver.id,
|
|
794
|
+
this.setupData.player.id,
|
|
795
|
+
{
|
|
796
|
+
x: 500,
|
|
797
|
+
y: 600,
|
|
798
|
+
z: 700,
|
|
799
|
+
dimension: 'end',
|
|
800
|
+
},
|
|
801
|
+
);
|
|
802
|
+
|
|
803
|
+
// Give player permission to use the waypoint
|
|
804
|
+
const useWaypointPermission = await this.client.permissionCodesToInputs([
|
|
805
|
+
`WAYPOINTS_USE_API_TEST_WAYPOINT_${this.setupData.gameserver.id}`,
|
|
806
|
+
]);
|
|
807
|
+
await this.client.role.roleControllerUpdate(this.setupData.playerRole.id, {
|
|
808
|
+
permissions: useWaypointPermission,
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
// Teleport using waypoint command - should work with stored dimension
|
|
812
|
+
const teleportEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
|
|
813
|
+
await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
|
|
814
|
+
msg: '/api_test_waypoint',
|
|
815
|
+
playerId: this.setupData.player.id,
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
expect((await teleportEvents).length).to.be.eq(1);
|
|
819
|
+
expect((await teleportEvents)[0].data.meta.msg).to.be.eq('Teleported to waypoint api_test_waypoint.');
|
|
820
|
+
},
|
|
821
|
+
}),
|
|
745
822
|
];
|
|
746
823
|
|
|
747
824
|
describe(group, function () {
|
package/src/dto/gameEvents.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IsEnum, IsString, ValidateNested, IsOptional, IsNumber } from 'class-validator';
|
|
1
|
+
import { IsEnum, IsString, ValidateNested, IsOptional, IsNumber, Matches } from 'class-validator';
|
|
2
2
|
import { TakaroDTO } from '@takaro/util';
|
|
3
3
|
import { Type } from 'class-transformer';
|
|
4
4
|
import { BaseEvent } from './base.js';
|
|
@@ -41,6 +41,9 @@ export class IGamePlayer extends TakaroDTO<IGamePlayer> {
|
|
|
41
41
|
|
|
42
42
|
@IsString()
|
|
43
43
|
@IsOptional()
|
|
44
|
+
@Matches(/^[a-zA-Z0-9_-]+:[a-zA-Z0-9_-]+$/, {
|
|
45
|
+
message: "Platform ID must be in format 'platform:id' (e.g., 'minecraft:player-uuid')",
|
|
46
|
+
})
|
|
44
47
|
platformId?: string;
|
|
45
48
|
|
|
46
49
|
@IsString()
|
|
@@ -61,12 +64,6 @@ export class BaseGameEvent<T> extends BaseEvent<T> {
|
|
|
61
64
|
msg: string;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
export interface IPositionInterface {
|
|
65
|
-
x: number;
|
|
66
|
-
y: number;
|
|
67
|
-
z: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
67
|
export class EventLogLine extends BaseGameEvent<EventLogLine> {
|
|
71
68
|
@IsString()
|
|
72
69
|
type = GameEvents.LOG_LINE;
|
|
@@ -105,13 +102,16 @@ export class EventChatMessage extends BaseGameEvent<EventChatMessage> {
|
|
|
105
102
|
declare msg: string;
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
export class IPosition
|
|
105
|
+
export class IPosition extends TakaroDTO<IPosition> {
|
|
109
106
|
@IsNumber()
|
|
110
107
|
x: number;
|
|
111
108
|
@IsNumber()
|
|
112
109
|
y: number;
|
|
113
110
|
@IsNumber()
|
|
114
111
|
z: number;
|
|
112
|
+
@IsString()
|
|
113
|
+
@IsOptional()
|
|
114
|
+
dimension?: string;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
export class EventPlayerDeath extends BaseGameEvent<EventPlayerDeath> {
|
|
@@ -57,7 +57,6 @@ export const countryCodes = [
|
|
|
57
57
|
{ code: 'CD', name: 'Congo, Democratic Republic' },
|
|
58
58
|
{ code: 'CK', name: 'Cook Islands' },
|
|
59
59
|
{ code: 'CR', name: 'Costa Rica' },
|
|
60
|
-
// eslint-disable-next-line quotes
|
|
61
60
|
{ code: 'CI', name: "Cote D'Ivoire" },
|
|
62
61
|
{ code: 'HR', name: 'Croatia' },
|
|
63
62
|
{ code: 'CU', name: 'Cuba' },
|
|
@@ -123,7 +122,6 @@ export const countryCodes = [
|
|
|
123
122
|
{ code: 'KR', name: 'Korea' },
|
|
124
123
|
{ code: 'KW', name: 'Kuwait' },
|
|
125
124
|
{ code: 'KG', name: 'Kyrgyzstan' },
|
|
126
|
-
// eslint-disable-next-line quotes
|
|
127
125
|
{ code: 'LA', name: "Lao People's Democratic Republic" },
|
|
128
126
|
{ code: 'LV', name: 'Latvia' },
|
|
129
127
|
{ code: 'LB', name: 'Lebanon' },
|
|
@@ -25,7 +25,7 @@ async function main() {
|
|
|
25
25
|
} else {
|
|
26
26
|
const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;
|
|
27
27
|
await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
|
|
28
|
-
name: item.
|
|
28
|
+
name: item.id,
|
|
29
29
|
amount: randomOption.amount,
|
|
30
30
|
quality: randomOption.quality ?? '',
|
|
31
31
|
});
|
|
@@ -10,16 +10,16 @@ async function main() {
|
|
|
10
10
|
if (player.ping > data.module.userConfig.pingThreshold) {
|
|
11
11
|
const takaroPlayerRes = await takaro.player.playerControllerSearch({
|
|
12
12
|
filters: {
|
|
13
|
-
steamId: player.steamId,
|
|
13
|
+
steamId: [player.steamId],
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
const takaroPlayer = takaroPlayerRes.data.data[0];
|
|
18
18
|
|
|
19
|
-
const currentWarningsRes = await takaro.variable.
|
|
19
|
+
const currentWarningsRes = await takaro.variable.variableControllerSearch({
|
|
20
20
|
filters: {
|
|
21
|
-
playerId: takaroPlayer.id,
|
|
22
|
-
key: VARIABLE_KEY,
|
|
21
|
+
playerId: [takaroPlayer.id],
|
|
22
|
+
key: [VARIABLE_KEY],
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -33,14 +33,24 @@ async function main() {
|
|
|
33
33
|
value: '1',
|
|
34
34
|
});
|
|
35
35
|
} else {
|
|
36
|
-
currentWarnings = parseInt(currentWarningsRecords[0].value, 10);
|
|
36
|
+
currentWarnings = parseInt(currentWarningsRecords[0].value, 10) + 1;
|
|
37
|
+
await takaro.variable.variableControllerUpdate(currentWarningsRecords[0].id, {
|
|
38
|
+
value: currentWarnings.toString(),
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
if
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
// Check if player should be kicked before sending warning
|
|
43
|
+
if (currentWarnings >= data.module.userConfig.warningsBeforeKick) {
|
|
44
|
+
await takaro.gameserver.gameServerControllerKickPlayer(data.gameServerId, takaroPlayer.id, {
|
|
45
|
+
reason: `Your ping (${player.ping}) is too high, please try again later.`,
|
|
42
46
|
});
|
|
43
47
|
|
|
48
|
+
// Delete the warning record after kicking
|
|
49
|
+
if (currentWarningsRecords.length > 0) {
|
|
50
|
+
await takaro.variable.variableControllerDelete(currentWarningsRecords[0].id);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
// Only send warning if player won't be kicked
|
|
44
54
|
await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
|
|
45
55
|
message: `Your ping (${player.ping}) is too high. Warning ${currentWarnings}/${data.module.userConfig.warningsBeforeKick}`,
|
|
46
56
|
opts: {
|
|
@@ -50,16 +60,8 @@ async function main() {
|
|
|
50
60
|
},
|
|
51
61
|
});
|
|
52
62
|
}
|
|
53
|
-
|
|
54
|
-
if (currentWarnings >= data.module.userConfig.warningsBeforeKick) {
|
|
55
|
-
await takaro.gameserver.gameServerControllerKickPlayer(data.gameServerId, takaroPlayer.id, {
|
|
56
|
-
reason: `Your ping (${player.ping}) is too high, please try again later.`,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
await takaro.variable.variableControllerDelete(currentWarningsRecords[0].id);
|
|
60
|
-
}
|
|
61
63
|
}
|
|
62
|
-
})
|
|
64
|
+
}),
|
|
63
65
|
);
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -6,7 +6,7 @@ export class HighPingKicker extends ModuleTransferDTO<HighPingKicker> {
|
|
|
6
6
|
this.name = 'highPingKicker';
|
|
7
7
|
this.versions = [
|
|
8
8
|
new ModuleTransferVersionDTO({
|
|
9
|
-
tag: '0.0.
|
|
9
|
+
tag: '0.0.2',
|
|
10
10
|
description: 'Automatically kick players with high ping, with warnings and configurable thresholds.',
|
|
11
11
|
configSchema: JSON.stringify({
|
|
12
12
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
@@ -32,7 +32,7 @@ async function main() {
|
|
|
32
32
|
throw new TakaroUserError(`Item with ID ${item.item} not found.`);
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
|
-
|
|
35
|
+
id: itemRecord.id,
|
|
36
36
|
quality: item.quality,
|
|
37
37
|
amount: item.amount,
|
|
38
38
|
};
|
|
@@ -41,7 +41,7 @@ async function main() {
|
|
|
41
41
|
await Promise.all(
|
|
42
42
|
fullItems.map(async (item) => {
|
|
43
43
|
return takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
|
|
44
|
-
name: item.
|
|
44
|
+
name: item.id,
|
|
45
45
|
quality: item.quality ?? '',
|
|
46
46
|
amount: item.amount,
|
|
47
47
|
});
|
|
@@ -31,7 +31,7 @@ async function main() {
|
|
|
31
31
|
|
|
32
32
|
if (allPlayerTeleports.data.data.length >= hasPermission.count) {
|
|
33
33
|
throw new TakaroUserError(
|
|
34
|
-
`You have reached the maximum number of teleports for your role, maximum allowed is ${hasPermission.count}
|
|
34
|
+
`You have reached the maximum number of teleports for your role, maximum allowed is ${hasPermission.count}`,
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -42,6 +42,7 @@ async function main() {
|
|
|
42
42
|
x: data.pog.positionX,
|
|
43
43
|
y: data.pog.positionY,
|
|
44
44
|
z: data.pog.positionZ,
|
|
45
|
+
dimension: data.pog.dimension,
|
|
45
46
|
}),
|
|
46
47
|
gameServerId,
|
|
47
48
|
moduleId: mod.moduleId,
|
|
@@ -60,6 +60,7 @@ async function main() {
|
|
|
60
60
|
x: teleport.x,
|
|
61
61
|
y: teleport.y,
|
|
62
62
|
z: teleport.z,
|
|
63
|
+
dimension: teleport.dimension,
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
await data.player.pm(`Teleported to ${teleport.name}.`);
|
|
@@ -78,6 +79,7 @@ async function main() {
|
|
|
78
79
|
x: teleport.x,
|
|
79
80
|
y: teleport.y,
|
|
80
81
|
z: teleport.z,
|
|
82
|
+
dimension: teleport.dimension,
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
await data.player.pm(`Teleported to ${teleport.name}.`);
|
|
@@ -15,7 +15,7 @@ export class Teleports extends ModuleTransferDTO<Teleports> {
|
|
|
15
15
|
this.name = 'teleports';
|
|
16
16
|
this.versions = [
|
|
17
17
|
new ModuleTransferVersionDTO({
|
|
18
|
-
tag: '0.0.
|
|
18
|
+
tag: '0.0.3',
|
|
19
19
|
description: 'A set of commands to allow players to set their own teleport points and teleport to them.',
|
|
20
20
|
configSchema: JSON.stringify({
|
|
21
21
|
$schema: 'http://json-schema.org/draft-07/schema#',
|