@ianlucas/cs2-lib 5.4.0 → 5.6.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.
@@ -83,8 +83,9 @@ export declare class CS2Inventory {
83
83
  getAll(): CS2InventoryItem[];
84
84
  getAllAsBase(): CS2BaseInventoryItem[];
85
85
  setAll(items: Map<number, CS2InventoryItem>): this;
86
+ getData(): CS2InventoryData;
86
87
  size(): number;
87
- move(): CS2Inventory;
88
+ move(options?: Partial<CS2InventorySpec>): CS2Inventory;
88
89
  }
89
90
  export declare class CS2InventoryItem extends CS2EconomyItem implements Interface<Omit<CS2BaseInventoryItem, "patches" | "stickers" | "storage">> {
90
91
  private inventory;
package/dist/inventory.js CHANGED
@@ -95,10 +95,7 @@ export class CS2Inventory {
95
95
  return Object.fromEntries(Array.from(items).map(([key, value]) => [key, value.asBase()]));
96
96
  }
97
97
  stringify() {
98
- return JSON.stringify({
99
- items: this.toBaseInventoryItems(this.items),
100
- version: CS2_INVENTORY_VERSION
101
- });
98
+ return JSON.stringify(this.getData());
102
99
  }
103
100
  isFull() {
104
101
  return this.items.size >= this.options.maxItems;
@@ -374,13 +371,20 @@ export class CS2Inventory {
374
371
  this.items = items;
375
372
  return this;
376
373
  }
374
+ getData() {
375
+ return {
376
+ items: this.toBaseInventoryItems(this.items),
377
+ version: CS2_INVENTORY_VERSION
378
+ };
379
+ }
377
380
  size() {
378
381
  return this.items.size;
379
382
  }
380
- move() {
383
+ move(options = {}) {
381
384
  return new CS2Inventory({
382
385
  ...this.options,
383
- economy: this.economy
386
+ economy: this.economy,
387
+ ...options
384
388
  }).setAll(this.items);
385
389
  }
386
390
  }
package/package.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "@ianlucas/cs2-lib",
3
- "version": "5.4.0",
4
3
  "description": "A TypeScript library for manipulating Counter-Strike 2 data",
5
4
  "license": "MIT",
6
5
  "author": "Ian Lucas",
@@ -8,25 +7,25 @@
8
7
  "type": "module",
9
8
  "main": "dist/index.js",
10
9
  "scripts": {
10
+ "docs": "typedoc --out docs src/index.ts",
11
11
  "format": "prettier . --write",
12
12
  "prepack": "([ -d dist ] && rm -rf dist); tsc",
13
13
  "test": "jest",
14
14
  "upgrade": "npx npm-check-updates@latest --target minor -u",
15
- "assets-downloader": "tsx scripts/assets-downloader.ts",
15
+ "update": "npm run cs2 && npm run item-generator && npm run item-generator-changelog",
16
16
  "container-scraper": "tsx scripts/container-scraper.ts",
17
- "item-generator-diff": "tsx scripts/item-generator-diff.ts",
18
- "item-generator-report": "tsx scripts/item-generator-report.ts",
17
+ "cs2": "tsx scripts/cs2.ts",
18
+ "item-generator-changelog": "tsx scripts/item-generator-changelog.ts",
19
19
  "item-generator": "tsx scripts/item-generator.ts",
20
20
  "non-legacy-paint-scraper": "tsx scripts/non-legacy-paints-scraper.ts",
21
21
  "tint-graffiti-image-scraper": "tsx scripts/tint-graffiti-image-scraper.ts",
22
- "tint-graffiti-name-generator": "tsx scripts/tint-graffiti-name-generator.ts",
23
- "update-items": "npm run assets-downloader && npm run item-generator && npm run item-generator-diff"
22
+ "tint-graffiti-name-generator": "tsx scripts/tint-graffiti-name-generator.ts"
24
23
  },
25
24
  "devDependencies": {
26
- "@ianlucas/depot-downloader": "^0.0.4",
27
- "@ianlucas/vrf-decompiler": "^0.0.3",
25
+ "@ianlucas/depot-downloader": "^2.7.0",
26
+ "@ianlucas/vrf-decompiler": "^10.1.0",
28
27
  "@types/jest": "^29.5.12",
29
- "@types/node": "^18.19.45",
28
+ "@types/node": "^18.19.46",
30
29
  "@types/node-fetch": "^2.6.11",
31
30
  "cheerio": "^1.0.0",
32
31
  "dotenv": "^16.4.5",
@@ -36,8 +35,10 @@
36
35
  "node-fetch": "^2.7.0",
37
36
  "prettier": "3.3.3",
38
37
  "string-strip-html": "^13.4.8",
39
- "ts-jest": "^29.2.4",
40
- "tsx": "^4.17.0",
38
+ "ts-jest": "^29.2.5",
39
+ "tsx": "^4.19.0",
40
+ "typedoc": "^0.26.6",
41
41
  "typescript": "^5.5.4"
42
- }
42
+ },
43
+ "version": "5.6.0"
43
44
  }