@ianlucas/cs2-lib 5.0.0-rc.19 → 5.0.0-rc.20
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/README.md +7 -9
- package/dist/economy-types.d.ts +3 -3
- package/dist/economy-types.js +3 -3
- package/dist/economy.d.ts +2 -2
- package/dist/economy.js +5 -5
- package/dist/items.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> A TypeScript library for manipulating Counter-Strike 2 data
|
|
4
4
|
|
|
5
|
-
This library contains items and data from Counter-Strike 2, including utility functions and classes for
|
|
5
|
+
This library contains items and data from Counter-Strike 2, including utility functions and classes for interacting with them using TypeScript.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -12,18 +12,16 @@ npm install @ianlucas/cs2-lib
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
For any module that deals with economy items, you need to setup the available items (`CS_ITEMS` contains all items from the game):
|
|
16
|
-
|
|
17
15
|
```typescript
|
|
18
|
-
import
|
|
19
|
-
import
|
|
16
|
+
import { CS2Economy, CS2_ITEMS } from "@ianlucas/cs2-lib";
|
|
17
|
+
import english from "@ianlucas/cslib/assets/localizations/items-english.json";
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
items:
|
|
23
|
-
|
|
19
|
+
CS2Economy.use({
|
|
20
|
+
items: CS2_ITEMS,
|
|
21
|
+
language: english
|
|
24
22
|
});
|
|
25
23
|
|
|
26
|
-
const item =
|
|
24
|
+
const item = CS2Economy.getById(307);
|
|
27
25
|
|
|
28
26
|
item.name;
|
|
29
27
|
//=> "AWP | Dragon Lore"
|
package/dist/economy-types.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ export type CS2ItemTeamValues = EnumValues<typeof CS2ItemTeam>;
|
|
|
9
9
|
export declare const CS2ItemType: {
|
|
10
10
|
readonly Agent: "agent";
|
|
11
11
|
readonly Collectible: "collectible";
|
|
12
|
-
readonly Container: "
|
|
13
|
-
readonly
|
|
14
|
-
readonly Gloves: "gloves";
|
|
12
|
+
readonly Container: "case";
|
|
13
|
+
readonly Gloves: "glove";
|
|
15
14
|
readonly Graffiti: "graffiti";
|
|
15
|
+
readonly Key: "key";
|
|
16
16
|
readonly Melee: "melee";
|
|
17
17
|
readonly MusicKit: "musickit";
|
|
18
18
|
readonly Patch: "patch";
|
package/dist/economy-types.js
CHANGED
|
@@ -10,10 +10,10 @@ export const CS2ItemTeam = {
|
|
|
10
10
|
export const CS2ItemType = {
|
|
11
11
|
Agent: "agent",
|
|
12
12
|
Collectible: "collectible",
|
|
13
|
-
Container: "
|
|
14
|
-
|
|
15
|
-
Gloves: "gloves",
|
|
13
|
+
Container: "case",
|
|
14
|
+
Gloves: "glove",
|
|
16
15
|
Graffiti: "graffiti",
|
|
16
|
+
Key: "key",
|
|
17
17
|
Melee: "melee",
|
|
18
18
|
MusicKit: "musickit",
|
|
19
19
|
Patch: "patch",
|
package/dist/economy.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare class CS2EconomyItem implements Interface<Omit<CS2Item, "contents
|
|
|
103
103
|
isAgent(): boolean;
|
|
104
104
|
isCollectible(): boolean;
|
|
105
105
|
isContainer(): boolean;
|
|
106
|
-
|
|
106
|
+
isKey(): boolean;
|
|
107
107
|
isGloves(): boolean;
|
|
108
108
|
isGraffiti(): boolean;
|
|
109
109
|
isMelee(): boolean;
|
|
@@ -124,7 +124,7 @@ export declare class CS2EconomyItem implements Interface<Omit<CS2Item, "contents
|
|
|
124
124
|
expectNameTag(): this;
|
|
125
125
|
expectStatTrakSwapTool(): this;
|
|
126
126
|
expectContainer(): this;
|
|
127
|
-
|
|
127
|
+
expectKey(): this;
|
|
128
128
|
hasWear(): boolean;
|
|
129
129
|
hasSeed(): boolean;
|
|
130
130
|
hasStickers(): boolean;
|
package/dist/economy.js
CHANGED
|
@@ -169,7 +169,7 @@ export class CS2EconomyInstance {
|
|
|
169
169
|
containerItem.expectContainer();
|
|
170
170
|
keyItem = keyItem !== undefined ? this.get(keyItem) : undefined;
|
|
171
171
|
if (keyItem !== undefined) {
|
|
172
|
-
keyItem.
|
|
172
|
+
keyItem.expectKey();
|
|
173
173
|
assert(containerItem.keys !== undefined);
|
|
174
174
|
assert(containerItem.keys.includes(keyItem.id));
|
|
175
175
|
}
|
|
@@ -315,8 +315,8 @@ export class CS2EconomyItem {
|
|
|
315
315
|
isContainer() {
|
|
316
316
|
return this.type === CS2ItemType.Container;
|
|
317
317
|
}
|
|
318
|
-
|
|
319
|
-
return this.type === CS2ItemType.
|
|
318
|
+
isKey() {
|
|
319
|
+
return this.type === CS2ItemType.Key;
|
|
320
320
|
}
|
|
321
321
|
isGloves() {
|
|
322
322
|
return this.type === CS2ItemType.Gloves;
|
|
@@ -385,8 +385,8 @@ export class CS2EconomyItem {
|
|
|
385
385
|
assert(this.isContainer());
|
|
386
386
|
return this;
|
|
387
387
|
}
|
|
388
|
-
|
|
389
|
-
assert(this.
|
|
388
|
+
expectKey() {
|
|
389
|
+
assert(this.isKey());
|
|
390
390
|
return this;
|
|
391
391
|
}
|
|
392
392
|
hasWear() {
|