@ianlucas/cs2-lib 6.0.0 → 6.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/dist/economy.d.ts CHANGED
@@ -144,7 +144,7 @@ export declare class CS2EconomyItem implements Interface<Omit<CS2Item, "contents
144
144
  isInContainers(): boolean;
145
145
  isInDisplay(): boolean;
146
146
  isPaintable(): boolean;
147
- getImage(): string;
147
+ getImage(wear?: number): string;
148
148
  getCollectionImage(): string;
149
149
  getSpecialsImage(): string;
150
150
  getTextureImage(): string;
package/dist/economy.js CHANGED
@@ -423,7 +423,17 @@ export class CS2EconomyItem {
423
423
  isPaintable() {
424
424
  return CS2_PAINTABLE_ITEMS.includes(this.type);
425
425
  }
426
- getImage() {
426
+ getImage(wear) {
427
+ if (this.hasWear() && wear !== undefined) {
428
+ switch (true) {
429
+ case wear < 1 / 3:
430
+ return `${this.economy.baseUrl}/images/${this.id}_light.png`;
431
+ case wear < 2 / 3:
432
+ return `${this.economy.baseUrl}/images/${this.id}_medium.png`;
433
+ default:
434
+ return `${this.economy.baseUrl}/images/${this.id}_heavy.png`;
435
+ }
436
+ }
427
437
  if (this.image === undefined) {
428
438
  return `${this.economy.baseUrl}/images/${this.id}.png`;
429
439
  }
@@ -127,6 +127,6 @@ export declare class CS2InventoryItem extends CS2EconomyItem implements Interfac
127
127
  getWear(): number;
128
128
  getStickerWear(slot: number): number;
129
129
  getKeychainSeed(slot: number): number;
130
- getImage(): string;
130
+ getImage(wear?: number): string;
131
131
  asBase(): CS2BaseInventoryItem;
132
132
  }
package/dist/inventory.js CHANGED
@@ -553,19 +553,8 @@ export class CS2InventoryItem extends CS2EconomyItem {
553
553
  getKeychainSeed(slot) {
554
554
  return this.keychains?.get(slot)?.seed ?? CS2_MIN_KEYCHAIN_SEED;
555
555
  }
556
- getImage() {
557
- if (this.hasWear()) {
558
- const wear = this.getWear();
559
- switch (true) {
560
- case wear < 1 / 3:
561
- return `${this.economy.baseUrl}/images/${this.id}_light.png`;
562
- case wear < 2 / 3:
563
- return `${this.economy.baseUrl}/images/${this.id}_medium.png`;
564
- default:
565
- return `${this.economy.baseUrl}/images/${this.id}_heavy.png`;
566
- }
567
- }
568
- return super.getImage();
556
+ getImage(wear) {
557
+ return super.getImage(wear ?? this.getWear());
569
558
  }
570
559
  asBase() {
571
560
  return {
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "typescript": "^5.7.3",
44
44
  "vitest": "^3.0.7"
45
45
  },
46
- "version": "6.0.0"
46
+ "version": "6.0.1"
47
47
  }