Jump to content
McKay Development

Inventory and music kits


anonymous

Recommended Posts

Hi, 

 

I have a question/problem when it comes to music kits. This is regarding the Global Offensive package. 

For all other items, I've found a way through CSGO's complicated items structure to transform the .inventory data into product names, image URL's, etc. However, I'm stuck when it comes to music kits.

An inventory row might look like:

{
  attribute: [
    { def_index: 166, value: null, value_bytes: [Object] },
    { def_index: 75, value: null, value_bytes: [Object] }
  ],
  equipped_state: [],
  id: 'xxxxx',
  account_id: xxxxx,
  inventory: 130,
  def_index: 1314,
  quantity: 1,
  level: 1,
  quality: 4,
  flags: 2,
  origin: 2,
  custom_name: null,
  custom_desc: null,
  interior_item: null,
  in_use: false,
  style: null,
  original_id: null,
  rarity: 3,
  position: 130,
  tradable_after: '2022-01-22T08:00:00.000Z'
}

When I lookup the def_index in the items_game.txt folder from the game files, all I find is the following: 

"1314"
		{
			"name"		"musickit"
			"prefab"		"musickit_prefab"
		}

For all other items, there's some additional details in the inventory result or the items_game.txt result that can help me pinpoint which item I'm dealing with. Not when it comes to music kits. My question is, is the inventory result exhaustive? Is there something I'm missing? I suppose I could call "inspectItem" to gain access to the "musicindex" return value for each music kit in the inventory but I would really prefer not to do so. 

Any help would be much appreciated.

Link to comment
Share on other sites

Hi again, 

I've solved the issue! If you add the following code to "Globaloffensive.prototype._processSOEconItem" into handlers.js, you'll get the music definition index value.

// Music def id
let musicIndexBytes = getAttributeValueBytes(166);
if (musicIndexBytes) {
	item.music_id = musicIndexBytes.readUInt32LE(0);
}

 

Link to comment
Share on other sites

That schema entry is pointing to a musickit_prefab prefab. Check the prefabs section for an item by that name, and use that as a base for the item's data.

I don't plan to decode every individual attribute onto the item object since there are tons of them. If you need to check the value of an attribute that isn't already decoded, you'll just need to decode it yourself.

Link to comment
Share on other sites

21 hours ago, Dr. McKay said:

That schema entry is pointing to a musickit_prefab prefab. Check the prefabs section for an item by that name, and use that as a base for the item's data.

I don't plan to decode every individual attribute onto the item object since there are tons of them. If you need to check the value of an attribute that isn't already decoded, you'll just need to decode it yourself.

Thanks for the fast reply. 

Just a quick follow up question, do you know if there's a way to tell if items are moveable (to storage units)? Some keys, for instance, can be moved while others can't, so It's not as easy as just making a filter by type or name. I'm guessing it has something to do with whether the item is inherently tradable, do you know of a way to tell if the item is tradable, or just generally moveable? Thanks in advance. 

Edited by anonymous
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...