DoctorMcKay / node-globaloffensive

A Node.js module to connect to and interact with the CS2 game coordinator. Mostly used to get item data.
https://www.npmjs.com/package/globaloffensive
MIT License
262 stars 61 forks source link

Determining the type of item (prefab) having Casket item info #61

Closed Tanksi closed 3 years ago

Tanksi commented 3 years ago

Hello everyone, I climbed a bunch of sites, I could not find how to get it all the same that the thing below is a sticker or a case or a weapon? Please tell me. Thank you The only thing that came to my mind for my task was logic like "there is no float and there is no sticker in the object, so this is a case, there is a float, it means a weapon, there is a sticker, there is no float - that means a sticker :) But this sounds like a cruel crutch, I would like to study this issue normally. I have the entire base of things with all the data, but now I cannot figure out how to determine what to look for in the "stickers" branch or "weapons", etc.

{ attribute: [ { def_index: 75, value: null, value_bytes: <Buffer 70 13 85 60> }, { def_index: 113, value: null, value_bytes: <Buffer a6 12 00 00> }, { def_index: 137, value: null, value_bytes: <Buffer 11 00 00 00> }, { def_index: 272, value: null, value_bytes: <Buffer 87 cc 0f 14> }, { def_index: 273, value: null, value_bytes: <Buffer 05 00 00 00> } ], equipped_state: [], id: '21819486391', account_id: 180090371, inventory: 3221225475, def_index: 1209, quantity: 1, level: 1, quality: 4, flags: 0, origin: 8, custom_name: null, custom_desc: null, interior_item: null, in_use: false, style: null, original_id: null, rarity: 4, position: 0, casket_id: '21811416199', tradable_after: 2021-04-25T07:00:00.000Z, stickers: [ { slot: 0, sticker_id: 4774, wear: null, scale: null, rotation: null } ] }

DoctorMcKay commented 3 years ago

CS:GO's item system is pretty nasty, with attributes determining what items are a lot of the time. But it stands to reason that def_index will allow you to determine what's a case or a sticker. You'll need to use the item schema to map defindexes to actual items.

https://steamapi.xpaw.me/#IEconItems_730/GetSchema

Tanksi commented 3 years ago

CS:GO's item system is pretty nasty, with attributes determining what items are a lot of the time. But it stands to reason that def_index will allow you to determine what's a case or a sticker. You'll need to use the item schema to map defindexes to actual items.

https://steamapi.xpaw.me/#IEconItems_730/GetSchema

Thanks!