@takaro/modules 0.1.1 → 0.1.3

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.
@@ -9,23 +9,13 @@ async function main() {
9
9
  const randomIndex = Math.floor(Math.random() * (items.length + commands.length));
10
10
  const randomOption = items.concat(commands)[randomIndex];
11
11
  if (randomIndex < items.length) {
12
- if (typeof randomOption === 'string') {
13
- await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
14
- name: randomOption,
15
- amount: 1,
16
- quality: '0',
17
- });
18
- await data.player.pm(`You received ${randomOption}!`);
19
- }
20
- else {
21
- const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;
22
- await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
23
- name: item.id,
24
- amount: randomOption.amount,
25
- quality: randomOption.quality ?? '',
26
- });
27
- await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);
28
- }
12
+ const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;
13
+ await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
14
+ name: randomOption.item,
15
+ amount: randomOption.amount,
16
+ quality: randomOption.quality ?? '',
17
+ });
18
+ await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);
29
19
  }
30
20
  else {
31
21
  await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: randomOption });
@@ -1 +1 @@
1
- {"version":3,"file":"gimme.js","sourceRoot":"","sources":["../../../../src/modules/gimme/commands/gimme.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEhE,KAAK,UAAU,IAAI;IACjB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;IAEjD,IAAI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,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YACtF,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,EAAE;SACpC,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,YAAY,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IAC3G,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -5,8 +5,8 @@ export class Gimme extends ModuleTransferDTO {
5
5
  this.name = 'gimme';
6
6
  this.versions = [
7
7
  new ModuleTransferVersionDTO({
8
- tag: '0.0.2',
9
- description: 'Randomly selects item from a list of items and entities.',
8
+ tag: '0.0.3',
9
+ description: 'Randomly selects item from a list of items and entities. Fixed issue with item identifiers.',
10
10
  configSchema: JSON.stringify({
11
11
  $schema: 'http://json-schema.org/draft-07/schema#',
12
12
  type: 'object',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/gimme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAE/F,MAAM,OAAO,KAAM,SAAQ,iBAAwB;IACjD;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,wBAAwB,CAAC;gBAC3B,GAAG,EAAE,OAAO;gBACZ,WAAW,EAAE,0DAA0D;gBACvE,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAC3B,OAAO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CAAC;oBACvB,KAAK,EAAE;wBACL,KAAK,EAAE;4BACL,IAAI,EAAE;gCACJ,WAAW,EAAE,MAAM;6BACpB;yBACF;qBACF;iBACF,CAAC;gBACF,QAAQ,EAAE;oBACR,IAAI,QAAQ,CAAC;wBACX,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC;wBAC1C,IAAI,EAAE,OAAO;wBACb,OAAO,EAAE,OAAO;wBAChB,QAAQ,EAAE,0DAA0D;wBACpE,SAAS,EAAE,EAAE;qBACd,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
@@ -6,8 +6,8 @@ export class PlayerOnboarding extends ModuleTransferDTO {
6
6
  this.name = 'playerOnboarding';
7
7
  this.versions = [
8
8
  new ModuleTransferVersionDTO({
9
- tag: '0.0.2',
10
- description: 'Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message.',
9
+ tag: '0.0.3',
10
+ description: 'Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message. Fixed issue with starterkit item identifiers.',
11
11
  configSchema: JSON.stringify({
12
12
  $schema: 'http://json-schema.org/draft-07/schema#',
13
13
  type: 'object',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/playerOnboarding/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,OAAO,gBAAiB,SAAQ,iBAAmC;IACvE;QACE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,wBAAwB,CAAC;gBAC3B,GAAG,EAAE,OAAO;gBACZ,WAAW,EACT,8IAA8I;gBAChJ,YAAY,EAAE,IA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AAI,EAAE,QAAQ;wCACd,KAAK,EAAE,MAAM;qCACd;oCACD,MAAM,EAAE;wCACN,IAAI,EAAE,QAAQ;wCACd,KAAK,EAAE,QAAQ;qCAChB;oCACD,OAAO,EAAE;wCACP,IAAI,EAAE,QAAQ;wCACd,KAAK,EAAE,SAAS;qCACjB;iCACF;6BACF;yBACF;qBACF;oBACD,QAAQ,EAAE,EAAE;oBACZ,oBAAoB,EAAE,KAAK;iBAC5B,CAAC;gBACF,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,eAAe,EAAE;wBACf,KAAK,EAAE;4BACL,IAAI,EAAE;gCACJ,WAAW,EAAE,MAAM;6BACpB;yBACF;qBACF;iBACF,CAAC;gBACF,KAAK,EAAE;oBACL,IAAI,KAAK,CAAC;wBACR,SAAS,EAAE,UAAU,CAAC,gBAAgB;wBACtC,IAAI,EAAE,iBAAiB;wBACvB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC;qBAClD,CAAC;iBACH;gBACD,QAAQ,EAAE;oBACR,IAAI,QAAQ,CAAC;wBACX,IAAI,EAAE,YAAY;wBAClB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC;wBAC/C,OAAO,EAAE,YAAY;wBACrB,QAAQ,EAAE,gEAAgE;wBAC1E,SAAS,EAAE,EAAE;qBACd,CAAC;iBACH;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF"}
package/dist/modules.json CHANGED
@@ -209,8 +209,8 @@
209
209
  "name": "playerOnboarding",
210
210
  "versions": [
211
211
  {
212
- "tag": "0.0.2",
213
- "description": "Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message.",
212
+ "tag": "0.0.3",
213
+ "description": "Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message. Fixed issue with starterkit item identifiers.",
214
214
  "configSchema": "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"properties\":{\"message\":{\"title\":\"Message\",\"description\":\"The message to send to the player when they join the server.\",\"type\":\"string\",\"minLength\":1,\"maxLength\":256,\"default\":\"Welcome {player} to the server!\"},\"starterKitItems\":{\"type\":\"array\",\"title\":\"Starter kit items\",\"x-component\":\"item\",\"description\":\"List of items a player will receive when they execute the starterkit command for the first time.\",\"uniqueItems\":true,\"items\":{\"type\":\"object\",\"title\":\"Item\",\"properties\":{\"item\":{\"type\":\"string\",\"title\":\"Item\"},\"amount\":{\"type\":\"number\",\"title\":\"Amount\"},\"quality\":{\"type\":\"string\",\"title\":\"Quality\"}}}}},\"required\":[],\"additionalProperties\":false}",
215
215
  "uiSchema": "{\"starterKitItems\":{\"items\":{\"item\":{\"ui:widget\":\"item\"}}}}",
216
216
  "hooks": [
@@ -285,13 +285,13 @@
285
285
  "name": "gimme",
286
286
  "versions": [
287
287
  {
288
- "tag": "0.0.2",
289
- "description": "Randomly selects item from a list of items and entities.",
288
+ "tag": "0.0.3",
289
+ "description": "Randomly selects item from a list of items and entities. Fixed issue with item identifiers.",
290
290
  "configSchema": "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"properties\":{\"items\":{\"x-component\":\"item\",\"type\":\"array\",\"title\":\"Items\",\"description\":\"List of items that a player can receive.\",\"uniqueItems\":true,\"items\":{\"type\":\"object\",\"title\":\"Item\",\"properties\":{\"item\":{\"type\":\"string\",\"title\":\"Item\"},\"amount\":{\"type\":\"number\",\"title\":\"Amount\"},\"quality\":{\"type\":\"string\",\"title\":\"Quality\"}}}},\"commands\":{\"title\":\"Commands\",\"type\":\"array\",\"default\":[\"say hello from gimme\"],\"items\":{\"type\":\"string\"}}},\"required\":[\"items\"],\"additionalProperties\":false}",
291
291
  "uiSchema": "{\"items\":{\"items\":{\"item\":{\"ui:widget\":\"item\"}}}}",
292
292
  "commands": [
293
293
  {
294
- "function": "import { takaro, data, TakaroUserError } from '@takaro/helpers';\nasync function main() {\n const items = data.module.userConfig.items;\n const commands = data.module.userConfig.commands;\n if (items.length + commands.length === 0) {\n throw new TakaroUserError('No items or commands configured, please ask your server administrator to configure this module.');\n }\n // pick a random item between 0 and the length of both the items and commands arrays\n const randomIndex = Math.floor(Math.random() * (items.length + commands.length));\n const randomOption = items.concat(commands)[randomIndex];\n if (randomIndex < items.length) {\n if (typeof randomOption === 'string') {\n await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {\n name: randomOption,\n amount: 1,\n quality: '0',\n });\n await data.player.pm(`You received ${randomOption}!`);\n }\n else {\n const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;\n await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {\n name: item.id,\n amount: randomOption.amount,\n quality: randomOption.quality ?? '',\n });\n await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);\n }\n }\n else {\n await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: randomOption });\n }\n}\nawait main();\n//# sourceMappingURL=gimme.js.map",
294
+ "function": "import { takaro, data, TakaroUserError } from '@takaro/helpers';\nasync function main() {\n const items = data.module.userConfig.items;\n const commands = data.module.userConfig.commands;\n if (items.length + commands.length === 0) {\n throw new TakaroUserError('No items or commands configured, please ask your server administrator to configure this module.');\n }\n // pick a random item between 0 and the length of both the items and commands arrays\n const randomIndex = Math.floor(Math.random() * (items.length + commands.length));\n const randomOption = items.concat(commands)[randomIndex];\n if (randomIndex < items.length) {\n const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;\n await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {\n name: randomOption.item,\n amount: randomOption.amount,\n quality: randomOption.quality ?? '',\n });\n await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);\n }\n else {\n await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: randomOption });\n }\n}\nawait main();\n//# sourceMappingURL=gimme.js.map",
295
295
  "name": "gimme",
296
296
  "trigger": "gimme",
297
297
  "helpText": "Randomly selects item from a list of items and entities.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takaro/modules",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Built-in modules for Takaro",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",
@@ -1,5 +1,5 @@
1
1
  import { IntegrationTest, expect, IModuleTestsSetupData, modulesTestSetup, EventsAwaiter } from '@takaro/test';
2
- import { GameEvents } from '../dto/index.js';
2
+ import { GameEvents, HookEvents } from '../dto/index.js';
3
3
  import { faker } from '@faker-js/faker';
4
4
  import { describe } from 'node:test';
5
5
 
@@ -25,13 +25,20 @@ const tests = [
25
25
  commands: [],
26
26
  }),
27
27
  });
28
+
28
29
  const events = (await new EventsAwaiter().connect(this.client)).waitForEvents(GameEvents.CHAT_MESSAGE);
30
+ const executionEvents = (await new EventsAwaiter().connect(this.client)).waitForEvents(
31
+ HookEvents.COMMAND_EXECUTED,
32
+ );
29
33
 
30
34
  await this.client.command.commandControllerTrigger(this.setupData.gameserver.id, {
31
35
  msg: '/gimme',
32
36
  playerId: this.setupData.players[0].id,
33
37
  });
34
38
 
39
+ const resultLogs = (await executionEvents)[0].data.meta.result.logs;
40
+ expect(resultLogs.some((log: any) => log.msg.match(/giveItem 200 OK/))).to.be.true;
41
+
35
42
  expect((await events).length).to.be.eq(1);
36
43
  expect((await events)[0].data.meta.msg).to.match(/You received \dx \w/);
37
44
  },
@@ -15,22 +15,13 @@ async function main() {
15
15
  const randomOption = items.concat(commands)[randomIndex];
16
16
 
17
17
  if (randomIndex < items.length) {
18
- if (typeof randomOption === 'string') {
19
- await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
20
- name: randomOption,
21
- amount: 1,
22
- quality: '0',
23
- });
24
- await data.player.pm(`You received ${randomOption}!`);
25
- } else {
26
- const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;
27
- await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
28
- name: item.id,
29
- amount: randomOption.amount,
30
- quality: randomOption.quality ?? '',
31
- });
32
- await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);
33
- }
18
+ const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data;
19
+ await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, {
20
+ name: randomOption.item,
21
+ amount: randomOption.amount,
22
+ quality: randomOption.quality ?? '',
23
+ });
24
+ await data.player.pm(`You received ${randomOption.amount}x ${item.name}!`);
34
25
  } else {
35
26
  await takaro.gameserver.gameServerControllerExecuteCommand(data.gameServerId, { command: randomOption });
36
27
  }
@@ -7,8 +7,8 @@ export class Gimme extends ModuleTransferDTO<Gimme> {
7
7
  this.name = 'gimme';
8
8
  this.versions = [
9
9
  new ModuleTransferVersionDTO({
10
- tag: '0.0.2',
11
- description: 'Randomly selects item from a list of items and entities.',
10
+ tag: '0.0.3',
11
+ description: 'Randomly selects item from a list of items and entities. Fixed issue with item identifiers.',
12
12
  configSchema: JSON.stringify({
13
13
  $schema: 'http://json-schema.org/draft-07/schema#',
14
14
  type: 'object',
@@ -8,9 +8,9 @@ export class PlayerOnboarding extends ModuleTransferDTO<PlayerOnboarding> {
8
8
  this.name = 'playerOnboarding';
9
9
  this.versions = [
10
10
  new ModuleTransferVersionDTO({
11
- tag: '0.0.2',
11
+ tag: '0.0.3',
12
12
  description:
13
- 'Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message.',
13
+ 'Collection of functions that are executed when a player joins the server. Helps with onboarding new players, like sending a welcome message. Fixed issue with starterkit item identifiers.',
14
14
  configSchema: JSON.stringify({
15
15
  $schema: 'http://json-schema.org/draft-07/schema#',
16
16
  type: 'object',