punkt Posted January 19, 2017 Report Posted January 19, 2017 Hello, Firstly, thank you kindly for your sustained work! I'm in a situation where I periodically need to update an account's inventory in a table, and currently I'm doing this by refreshing the inventory items in the database (delete rows + insert). Now, I need to add 'paintwear' and 'paintindex' values to all the skins in the DB and I thought it would be great to use the `inventory` property, which, according to the documentation is "An array containing the items in your inventory". Adding to that, the docs also say that, using `inspectItem` for "an item your account owns is useless as all the data is already available in `inventory`." However, looking at the inventory array structure, it's different from the inspectItem() results one, and I don't quite know where to go on from here. Here's the 'inventory' structure: http://pastebin.com/nHHNne35 Can I get paintwear & paint index from inventory alone? without the need to inspect every skin in there? Are 'paintwear' and 'paintindex' attributes? If they're found in the 'valueBytes' properties inside 'attribute', I'm not sure how to handle that... I should say that using https://api.steampowered.com/IEconItems_730/GetPlayerItems/v1/?key=KEYHERE&SteamID=IDHERE only returns a 503 error for me. Is there any other way to get paint wear & paintindex for an account's inventory or am I stuck to inspect each skin? Thank you for your help! Quote
Dr. McKay Posted January 19, 2017 Report Posted January 19, 2017 It's indeed inside valueBytes. Wear is attribute 8, and I believe paintindex is attribute 7 (it might be 6 so check that one if 7 doesn't give you the expected result). Loop the attributes array till you find the attribute with the expected defindex, then call valueBytes.readFloat() to get the value as a float. Quote
punkt Posted January 20, 2017 Author Report Posted January 20, 2017 (edited) Thanks, that did it For anyone else looking to use node-globaloffensive.inventorry var csgo = new GlobalOffensive(steamUser); // assume already connected to GameCoordinator and that inventory is populated _.forEach(csgo.inventory, (inventoryItem) => { _.forEach(inventoryItem.attribute, (attr) => { if(attr.defIndex === 7) inventoryItem.paintindex = attr.valueBytes.clone().readFloat(); else if(attr.defIndex === 8) inventoryItem.paintwear = attr.valueBytes.clone().readFloat(); }); }); also: defIndex 7 is 'paint index' or 'pattern index'defIndex 8 is 'paint wear' Edited January 20, 2017 by punkt Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.