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

Parse charm details in inventory array #99

Open leon-w opened 3 weeks ago

leon-w commented 3 weeks ago

98 added charm support to item inspection, however, there is currently no support for charms on items in the own inventory/storage units.

This PR adds charm detail parsing so the item objects are populated with a new charm property:

The naming i chose is not consistent with the names in the inspectItem result, however as this is the case for most of the keys, i decided to go with charm for clarity. Let me know if you think we should go with a different naming scheme.

In the inspectItem result, an array is provided as it seems like there is technical support for multiple charms (possibly because the logic is copied from stickers). As of now, only a single charm is allowed so i decided against using an array of lenght one. If you think we should go with the array solution for possible future compatability, let me know.