@takaro/modules 0.4.9 → 0.4.11

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.
@@ -1,13 +1,18 @@
1
1
  import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
2
  async function main() {
3
- const { user, player, arguments: args, _gameServerId } = data;
3
+ const { user, player, arguments: args, gameServerId } = data;
4
4
  if (!user)
5
5
  throw new TakaroUserError('You must link your account to Takaro to use this command.');
6
+ const filters = {
7
+ userId: [user.id],
8
+ status: ['PAID'],
9
+ };
10
+ // Only filter by gameServerId if it's available (should always be present in command context)
11
+ if (gameServerId) {
12
+ filters.gameServerId = [gameServerId];
13
+ }
6
14
  const pendingOrdersRes = await takaro.shopOrder.shopOrderControllerSearch({
7
- filters: {
8
- userId: [user.id],
9
- status: ['PAID'],
10
- },
15
+ filters,
11
16
  sortBy: 'createdAt',
12
17
  sortDirection: 'asc',
13
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/claim.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAE9D,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,eAAe,CAAC,2DAA2D,CAAC,CAAC;IAElG,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC;QACxE,OAAO,EAAE;YACP,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB,MAAM,EAAE,CAAC,MAAM,CAAC;SACjB;QACD,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,MAAM,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IAED,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../../src/modules/economyUtils/commands/claim.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAE7D,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,eAAe,CAAC,2DAA2D,CAAC,CAAC;IAElG,MAAM,OAAO,GAAG;QACd,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB,MAAM,EAAE,CAAC,MAAM,CAAC;KACjB,CAAC;IAEF,8FAA8F;IAC9F,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,YAAY,GAAG,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC;QACxE,OAAO;QACP,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,MAAM,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IAED,IAAI,aAAa,GAAG,EAAE,CAAC;IAEvB,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -7,7 +7,7 @@ export class EconomyUtils extends ModuleTransferDTO {
7
7
  this.supportedGames = ['all'];
8
8
  this.versions = [
9
9
  new ModuleTransferVersionDTO({
10
- tag: '0.0.2',
10
+ tag: '0.0.3',
11
11
  description: 'A set of commands to allow players to manage their currency.',
12
12
  configSchema: JSON.stringify({
13
13
  $schema: 'http://json-schema.org/draft-07/schema#',
package/dist/modules.json CHANGED
@@ -385,7 +385,7 @@
385
385
  ],
386
386
  "versions": [
387
387
  {
388
- "tag": "0.0.2",
388
+ "tag": "0.0.3",
389
389
  "description": "A set of commands to allow players to manage their currency.",
390
390
  "configSchema": "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"properties\":{\"pendingAmount\":{\"title\":\"Pending amount\",\"type\":\"number\",\"description\":\"When a player transfers money, they must confirm the transfer when the amount is equal or above this value. Set to 0 to disable.\",\"default\":0},\"zombieKillReward\":{\"title\":\"Zombie kill reward\",\"type\":\"number\",\"description\":\"The default amount of currency a player receives for killing a zombie. This can be overridden by roles.\",\"default\":1}},\"required\":[],\"additionalProperties\":false}",
391
391
  "permissions": [
@@ -504,7 +504,7 @@
504
504
  ]
505
505
  },
506
506
  {
507
- "function": "import { takaro, data, TakaroUserError } from '@takaro/helpers';\nasync function main() {\n const { user, player, arguments: args, _gameServerId } = data;\n if (!user)\n throw new TakaroUserError('You must link your account to Takaro to use this command.');\n const pendingOrdersRes = await takaro.shopOrder.shopOrderControllerSearch({\n filters: {\n userId: [user.id],\n status: ['PAID'],\n },\n sortBy: 'createdAt',\n sortDirection: 'asc',\n });\n if (pendingOrdersRes.data.data.length === 0) {\n await player.pm('You have no pending orders.');\n return;\n }\n let ordersToClaim = [];\n if (args.all) {\n ordersToClaim = pendingOrdersRes.data.data;\n }\n else {\n ordersToClaim.push(pendingOrdersRes.data.data[0]);\n }\n for (const order of ordersToClaim) {\n await takaro.shopOrder.shopOrderControllerClaim(order.id);\n }\n}\nawait main();\n//# sourceMappingURL=claim.js.map",
507
+ "function": "import { takaro, data, TakaroUserError } from '@takaro/helpers';\nasync function main() {\n const { user, player, arguments: args, gameServerId } = data;\n if (!user)\n throw new TakaroUserError('You must link your account to Takaro to use this command.');\n const filters = {\n userId: [user.id],\n status: ['PAID'],\n };\n // Only filter by gameServerId if it's available (should always be present in command context)\n if (gameServerId) {\n filters.gameServerId = [gameServerId];\n }\n const pendingOrdersRes = await takaro.shopOrder.shopOrderControllerSearch({\n filters,\n sortBy: 'createdAt',\n sortDirection: 'asc',\n });\n if (pendingOrdersRes.data.data.length === 0) {\n await player.pm('You have no pending orders.');\n return;\n }\n let ordersToClaim = [];\n if (args.all) {\n ordersToClaim = pendingOrdersRes.data.data;\n }\n else {\n ordersToClaim.push(pendingOrdersRes.data.data[0]);\n }\n for (const order of ordersToClaim) {\n await takaro.shopOrder.shopOrderControllerClaim(order.id);\n }\n}\nawait main();\n//# sourceMappingURL=claim.js.map",
508
508
  "name": "claim",
509
509
  "trigger": "claim",
510
510
  "helpText": "Claim your pending shop orders.",
package/package.json CHANGED
@@ -1,17 +1,26 @@
1
1
  {
2
2
  "name": "@takaro/modules",
3
- "version": "0.4.9",
4
3
  "description": "Built-in modules for Takaro",
4
+ "version": "0.4.11",
5
+ "author": "",
6
+ "dependencies": {
7
+ "class-transformer": "0.5.1",
8
+ "class-validator": "0.14.2"
9
+ },
10
+ "keywords": [],
11
+ "license": "ISC",
5
12
  "main": "dist/main.js",
6
- "types": "dist/main.d.ts",
7
- "type": "module",
13
+ "peerDependencies": {
14
+ "@takaro/apiclient": "*",
15
+ "@takaro/helpers": "*",
16
+ "@takaro/util": "*"
17
+ },
8
18
  "scripts": {
9
- "start:dev": "tsc --watch --preserveWatchOutput -p ./tsconfig.build.json",
10
19
  "build": "tsc -p ./tsconfig.build.json",
20
+ "build:builtin-json": "node --import=ts-node-maintained/register/esm ./scripts/buildBuiltinJson.ts",
11
21
  "postbuild": "npm run build:builtin-json",
12
- "build:builtin-json": "node --import=ts-node-maintained/register/esm ./scripts/buildBuiltinJson.ts"
22
+ "start:dev": ":"
13
23
  },
14
- "keywords": [],
15
- "author": "",
16
- "license": "ISC"
24
+ "type": "module",
25
+ "types": "dist/main.d.ts"
17
26
  }
@@ -0,0 +1,215 @@
1
+ import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
2
+ import { GameEvents } from '../dto/index.js';
3
+ import { describe } from 'node:test';
4
+
5
+ const group = 'DefaultSystemConfig Aliases';
6
+
7
+ const tests = [
8
+ new IntegrationTest<IModuleTestsSetupData>({
9
+ group,
10
+ snapshot: false,
11
+ name: 'Custom module with defaultSystemConfig aliases should work after installation',
12
+ setup: modulesTestSetup,
13
+ test: async function () {
14
+ // Create a module WITHOUT defaultSystemConfig first
15
+ const mod = (
16
+ await this.client.module.moduleControllerCreate({
17
+ name: 'Test Module With Default Aliases',
18
+ latestVersion: {
19
+ description: 'Testing defaultSystemConfig aliases',
20
+ },
21
+ })
22
+ ).data.data;
23
+
24
+ // Create a command in the module FIRST
25
+ await this.client.command.commandControllerCreate({
26
+ name: 'pingcommand',
27
+ description: 'Test ping command',
28
+ trigger: 'ping',
29
+ versionId: mod.latestVersion.id,
30
+ function: `import { data, takaro } from '@takaro/helpers';
31
+ async function main() {
32
+ await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
33
+ message: 'command executed via alias',
34
+ });
35
+ }
36
+ await main();`,
37
+ });
38
+
39
+ // THEN update module with defaultSystemConfig (now command exists, schema is valid)
40
+ await this.client.module.moduleControllerUpdate(mod.id, {
41
+ latestVersion: {
42
+ defaultSystemConfig: JSON.stringify({
43
+ commands: {
44
+ pingcommand: {
45
+ aliases: ['pong', 'pp'],
46
+ },
47
+ },
48
+ }),
49
+ },
50
+ });
51
+
52
+ // Install the module WITHOUT providing explicit systemConfig
53
+ // This should use the defaultSystemConfig with aliases
54
+ await this.client.module.moduleInstallationsControllerInstallModule({
55
+ gameServerId: this.setupData.gameserver.id,
56
+ versionId: mod.latestVersion.id,
57
+ });
58
+
59
+ // Try to trigger the command using the alias from defaultSystemConfig
60
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
61
+
62
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
63
+ msg: '/pong', // Using the alias from defaultSystemConfig
64
+ playerId: this.setupData.players[0].id,
65
+ });
66
+
67
+ // Verify the command executed
68
+ const receivedEvents = await events;
69
+ expect(receivedEvents.length).to.be.eq(1);
70
+ expect(receivedEvents[0].data.meta.msg).to.be.eq('command executed via alias');
71
+ },
72
+ }),
73
+
74
+ new IntegrationTest<IModuleTestsSetupData>({
75
+ group,
76
+ snapshot: false,
77
+ name: 'Custom module aliases work when explicitly provided during installation',
78
+ setup: modulesTestSetup,
79
+ test: async function () {
80
+ // Create a module WITHOUT defaultSystemConfig first
81
+ const mod = (
82
+ await this.client.module.moduleControllerCreate({
83
+ name: 'Test Module Explicit Aliases',
84
+ latestVersion: {
85
+ description: 'Testing explicit aliases',
86
+ },
87
+ })
88
+ ).data.data;
89
+
90
+ // Create command FIRST
91
+ await this.client.command.commandControllerCreate({
92
+ name: 'echocommand',
93
+ description: 'Test echo command',
94
+ trigger: 'echo',
95
+ versionId: mod.latestVersion.id,
96
+ function: `import { data, takaro } from '@takaro/helpers';
97
+ async function main() {
98
+ await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
99
+ message: 'command executed',
100
+ });
101
+ }
102
+ await main();`,
103
+ });
104
+
105
+ // THEN update module with defaultSystemConfig
106
+ await this.client.module.moduleControllerUpdate(mod.id, {
107
+ latestVersion: {
108
+ defaultSystemConfig: JSON.stringify({
109
+ commands: {
110
+ echocommand: {
111
+ aliases: ['defaultalias'],
112
+ },
113
+ },
114
+ }),
115
+ },
116
+ });
117
+
118
+ // Install the module WITH explicit systemConfig (overriding defaults)
119
+ await this.client.module.moduleInstallationsControllerInstallModule({
120
+ gameServerId: this.setupData.gameserver.id,
121
+ versionId: mod.latestVersion.id,
122
+ systemConfig: JSON.stringify({
123
+ commands: {
124
+ echocommand: {
125
+ aliases: ['explicitalias', 'ea'],
126
+ },
127
+ },
128
+ }),
129
+ });
130
+
131
+ // Verify explicit alias works
132
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
133
+
134
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
135
+ msg: '/explicitalias',
136
+ playerId: this.setupData.players[0].id,
137
+ });
138
+
139
+ const receivedEvents = await events;
140
+ expect(receivedEvents.length).to.be.eq(1);
141
+ expect(receivedEvents[0].data.meta.msg).to.be.eq('command executed');
142
+ },
143
+ }),
144
+
145
+ new IntegrationTest<IModuleTestsSetupData>({
146
+ group,
147
+ snapshot: false,
148
+ name: 'Multiple aliases from defaultSystemConfig should all work',
149
+ setup: modulesTestSetup,
150
+ test: async function () {
151
+ // Create module WITHOUT defaultSystemConfig first
152
+ const mod = (
153
+ await this.client.module.moduleControllerCreate({
154
+ name: 'Test Module Multiple Aliases',
155
+ latestVersion: {
156
+ description: 'Testing multiple aliases',
157
+ },
158
+ })
159
+ ).data.data;
160
+
161
+ // Create command FIRST
162
+ await this.client.command.commandControllerCreate({
163
+ name: 'testcmd',
164
+ description: 'Test command',
165
+ trigger: 'test',
166
+ versionId: mod.latestVersion.id,
167
+ function: `import { data, takaro } from '@takaro/helpers';
168
+ async function main() {
169
+ await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
170
+ message: 'success',
171
+ });
172
+ }
173
+ await main();`,
174
+ });
175
+
176
+ // THEN update module with defaultSystemConfig
177
+ await this.client.module.moduleControllerUpdate(mod.id, {
178
+ latestVersion: {
179
+ defaultSystemConfig: JSON.stringify({
180
+ commands: {
181
+ testcmd: {
182
+ aliases: ['alias1', 'alias2', 'alias3'],
183
+ },
184
+ },
185
+ }),
186
+ },
187
+ });
188
+
189
+ await this.client.module.moduleInstallationsControllerInstallModule({
190
+ gameServerId: this.setupData.gameserver.id,
191
+ versionId: mod.latestVersion.id,
192
+ });
193
+
194
+ // Test each alias
195
+ for (const alias of ['alias1', 'alias2', 'alias3']) {
196
+ const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE, 1);
197
+
198
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
199
+ msg: `/${alias}`,
200
+ playerId: this.setupData.players[0].id,
201
+ });
202
+
203
+ const receivedEvents = await events;
204
+ expect(receivedEvents.length).to.be.eq(1);
205
+ expect(receivedEvents[0].data.meta.msg).to.be.eq('success');
206
+ }
207
+ },
208
+ }),
209
+ ];
210
+
211
+ describe(group, () => {
212
+ tests.forEach((test) => {
213
+ test.run();
214
+ });
215
+ });
@@ -133,6 +133,114 @@ const tests = [
133
133
  expect((await events)[3].data.meta.msg).to.equal('1x Wood');
134
134
  },
135
135
  }),
136
+ new IntegrationTest<IShopSetup>({
137
+ group,
138
+ snapshot: false,
139
+ setup: shopSetup,
140
+ name: 'Should only claim orders from the current game server when player has orders on multiple servers',
141
+ test: async function () {
142
+ // Test scenario: Player has pending orders on two servers but is only online on one.
143
+ // The /claim command should only claim orders from the server where they're currently online.
144
+
145
+ // Install economyUtils on gameserver2
146
+ await this.client.module.moduleInstallationsControllerInstallModule({
147
+ gameServerId: this.setupData.gameserver2.id,
148
+ versionId: this.setupData.economyUtilsModule.latestVersion.id,
149
+ });
150
+
151
+ await this.client.settings.settingsControllerSet('economyEnabled', {
152
+ value: 'true',
153
+ gameServerId: this.setupData.gameserver2.id,
154
+ });
155
+
156
+ await new Promise((resolve) => setTimeout(resolve, 1000));
157
+
158
+ // Create player on gameserver2 as online, then disconnect to set offline
159
+ // (Must create as online to trigger POG creation via PLAYER_CONNECTED event)
160
+ await this.client.gameserver.gameServerControllerExecuteCommand(this.setupData.gameserver2.id, {
161
+ command: `createPlayer player2_${this.setupData.players[0].steamId} {"name": "${this.setupData.players[0].name}", "steamId": "${this.setupData.players[0].steamId}", "online": true}`,
162
+ });
163
+
164
+ await new Promise((resolve) => setTimeout(resolve, 2000));
165
+
166
+ const pogsOnServer2 = await this.client.playerOnGameserver.playerOnGameServerControllerSearch({
167
+ filters: {
168
+ gameServerId: [this.setupData.gameserver2.id],
169
+ playerId: [this.setupData.players[0].id],
170
+ },
171
+ });
172
+
173
+ if (pogsOnServer2.data.data.length === 0) {
174
+ throw new Error(`Player POG was not created on gameserver2. Player ID: ${this.setupData.players[0].id}`);
175
+ }
176
+
177
+ await this.client.gameserver.gameServerControllerExecuteCommand(this.setupData.gameserver2.id, {
178
+ command: `disconnectPlayer ${this.setupData.players[0].steamId}`,
179
+ });
180
+
181
+ await new Promise((resolve) => setTimeout(resolve, 1000));
182
+
183
+ await this.client.playerOnGameserver.playerOnGameServerControllerAddCurrency(
184
+ this.setupData.gameserver2.id,
185
+ this.setupData.players[0].id,
186
+ { currency: 250 },
187
+ );
188
+
189
+ // Create listings on both servers
190
+ const listingServer1 = await this.client.shopListing.shopListingControllerCreate({
191
+ gameServerId: this.setupData.gameserver.id,
192
+ items: [{ itemId: this.setupData.items[0].id, amount: 1 }],
193
+ price: 50,
194
+ name: 'Server 1 Item',
195
+ });
196
+
197
+ const listingServer2 = await this.client.shopListing.shopListingControllerCreate({
198
+ gameServerId: this.setupData.gameserver2.id,
199
+ items: [{ itemId: this.setupData.items2[0].id, amount: 1 }],
200
+ price: 75,
201
+ name: 'Server 2 Item',
202
+ });
203
+
204
+ // Create order on server 2 first (older), then server 1 (newer)
205
+ const orderServer2 = await this.setupData.client1.shopOrder.shopOrderControllerCreate({
206
+ listingId: listingServer2.data.data.id,
207
+ amount: 1,
208
+ });
209
+
210
+ const orderServer1 = await this.setupData.client1.shopOrder.shopOrderControllerCreate({
211
+ listingId: listingServer1.data.data.id,
212
+ amount: 1,
213
+ });
214
+
215
+ // Verify both orders start as PAID
216
+ const orderServer1Status = await this.client.shopOrder.shopOrderControllerGetOne(orderServer1.data.data.id);
217
+ const orderServer2Status = await this.client.shopOrder.shopOrderControllerGetOne(orderServer2.data.data.id);
218
+ expect(orderServer1Status.data.data.status).to.equal('PAID');
219
+ expect(orderServer2Status.data.data.status).to.equal('PAID');
220
+
221
+ // Claim on gameserver where player is online
222
+ const claimEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(HookEvents.CHAT_MESSAGE, 2);
223
+
224
+ await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
225
+ msg: '/claim',
226
+ playerId: this.setupData.players[0].id,
227
+ });
228
+
229
+ const messages = await claimEvents;
230
+
231
+ expect(messages).to.have.length(2);
232
+ expect(messages[0].data.meta.msg).to.equal('You have received items from a shop order.');
233
+ expect(messages[1].data.meta.msg).to.match(/1x/);
234
+
235
+ // Verify only the server 1 order was claimed
236
+ const claimedOrderServer1 = await this.client.shopOrder.shopOrderControllerGetOne(orderServer1.data.data.id);
237
+ expect(claimedOrderServer1.data.data.status).to.equal('COMPLETED');
238
+
239
+ // Server 2 order should remain unclaimed
240
+ const unclaimedOrderServer2 = await this.client.shopOrder.shopOrderControllerGetOne(orderServer2.data.data.id);
241
+ expect(unclaimedOrderServer2.data.data.status).to.equal('PAID');
242
+ },
243
+ }),
136
244
  ];
137
245
 
138
246
  describe(group, function () {
@@ -1,15 +1,22 @@
1
1
  import { takaro, data, TakaroUserError } from '@takaro/helpers';
2
2
 
3
3
  async function main() {
4
- const { user, player, arguments: args, _gameServerId } = data;
4
+ const { user, player, arguments: args, gameServerId } = data;
5
5
 
6
6
  if (!user) throw new TakaroUserError('You must link your account to Takaro to use this command.');
7
7
 
8
+ const filters = {
9
+ userId: [user.id],
10
+ status: ['PAID'],
11
+ };
12
+
13
+ // Only filter by gameServerId if it's available (should always be present in command context)
14
+ if (gameServerId) {
15
+ filters.gameServerId = [gameServerId];
16
+ }
17
+
8
18
  const pendingOrdersRes = await takaro.shopOrder.shopOrderControllerSearch({
9
- filters: {
10
- userId: [user.id],
11
- status: ['PAID'],
12
- },
19
+ filters,
13
20
  sortBy: 'createdAt',
14
21
  sortDirection: 'asc',
15
22
  });
@@ -9,7 +9,7 @@ export class EconomyUtils extends ModuleTransferDTO<EconomyUtils> {
9
9
  this.supportedGames = ['all'];
10
10
  this.versions = [
11
11
  new ModuleTransferVersionDTO({
12
- tag: '0.0.2',
12
+ tag: '0.0.3',
13
13
  description: 'A set of commands to allow players to manage their currency.',
14
14
  configSchema: JSON.stringify({
15
15
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
3
  "compilerOptions": {
4
+ "composite": true,
4
5
  "rootDir": "./src",
5
6
  "outDir": "dist",
6
7
  "allowJs": true
7
8
  },
8
9
  "include": ["src/**/*"],
9
- "exclude": ["src/**/*.test.ts"]
10
+ "exclude": ["src/**/*.test.ts"],
11
+ "references": [
12
+ { "path": "../lib-util/tsconfig.build.json" }
13
+ ]
10
14
  }