saul / demofile

Node.js library for parsing Counter-Strike: Global Offensive demo files

Home Page:https://demofile.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

itemPurchase Event - Cost

zeus1999 opened this issue · comments

Is it possible to get the cash cost of the items which is emit in the "itemPurchase" event?

Yes, the cost of items is available in the items_game.txt file. Search for "in game price" in this file.

Some things not listed in this file are:

  • Kevlar & helmet: $1000
  • Helmet: $350
  • Kevlar: $650

Note that sometimes prices change between game versions, so you want to make sure you're using the right items_game.txt file for the demo that you're reading.

If you don't care about the cost of each individual item, you can track the m_iAccount prop on DT_CSPlayer. This will decrease when players buy items, but it's important to know that if players buy multiple items in the same tick (very likely to happen if they use keybinds/scripts to buy multiple items), then you won't see this decrease for each item.

For example if a player has a binding like bind f1 "buy vesthelm;buy m4a1;buy deagle", your event handler will see m_iAccount decrease by $4800 (which is $1000 + $3100 + $700) in one call.

Hope that helps!