cs2-inventory-resolver 0.1.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.
- package/README.md +58 -0
- package/data/inventory.json +63832 -0
- package/dist/data-loader.d.ts +2 -0
- package/dist/data-loader.js +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/resolver.d.ts +45 -0
- package/dist/resolver.js +105 -0
- package/dist/types.d.ts +52 -0
- package/dist/types.js +1 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# cs2-inventory-resolver
|
|
2
|
+
|
|
3
|
+
Resolve raw CS2 Game Coordinator (GC) items into human-readable names, images, and categories.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The package is not yet published to npm. Install directly from GitHub:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install cs2-inventory-resolver
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### `resolveItem(gcItem)`
|
|
16
|
+
|
|
17
|
+
Takes a raw GC item and returns its name, image URL, and category.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { resolveItem } from 'cs2-inventory-resolver';
|
|
21
|
+
|
|
22
|
+
const result = resolveItem({ def_index: 7, paint_index: 282 });
|
|
23
|
+
// => { name: "AK-47 | Redline", image: "https://...", category: "skin" }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Returns `null` if the item could not be identified.
|
|
27
|
+
|
|
28
|
+
### `getAttributeUint32(item, attrDefIndex)`
|
|
29
|
+
|
|
30
|
+
Reads a uint32 value from a GC item's raw `attribute[]` array.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { getAttributeUint32 } from 'cs2-inventory-resolver';
|
|
34
|
+
|
|
35
|
+
const musicIndex = getAttributeUint32(gcItem, 166);
|
|
36
|
+
if (musicIndex) {
|
|
37
|
+
console.log('Music kit ID:', musicIndex);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Common attribute def_indexes:
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
| def_index | Attribute |
|
|
45
|
+
| --------- | ---------------- |
|
|
46
|
+
| 166 | `music_index` |
|
|
47
|
+
| 233 | `graffiti_tint` |
|
|
48
|
+
| 299 | `keychain_index` |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Types
|
|
52
|
+
|
|
53
|
+
The package also exports the following types:
|
|
54
|
+
|
|
55
|
+
- `**GcItemInput**` - The input shape accepted by `resolveItem()`
|
|
56
|
+
- `**ResolvedItemData**` - The object returned by `resolveItem()`
|
|
57
|
+
- `**ItemCategory**` - `'skin' | 'music_kit' | 'keychain' | 'graffiti' | 'crate' | 'collectible' | 'sticker'`
|
|
58
|
+
|