Skip to content

Instantly share code, notes, and snippets.

@Raid55
Last active June 10, 2023 21:51
Show Gist options
  • Save Raid55/66de33e184be9c2522672012768745a0 to your computer and use it in GitHub Desktop.
Save Raid55/66de33e184be9c2522672012768745a0 to your computer and use it in GitHub Desktop.
This line, when used in google console on a steam in game purchase list, will sum up all in game transactions and give you a total...pretty neat, but could use some refactoring...

This is a way to find out how much you spent on in-game purchases in steam games. All you have to do is go to a certain game and select in-game purchases, It can be found somewhere in valve's confusing menu and old laggy interface that they haven't fixed in the longest time. Speaking of valve I mean come on, it's like they aren't doing anything these days... VR? yea I want a 500 dollar headset that also requires a metric tone of space. While we're at it whats up with that card game...Artifacts? what the heck, was that a sick joke or something? To be honest all I want it L4D3 but nooo have a card game you pesants!!! ok nevermind rant over... here is the link that took me there, maybe you can use it:

https://help.steampowered.com/en/wizard/HelpWithGameIssue?appid=730&issueid=107

I'm guessing the appid is the game and issueid is the in-game purchases list so that link would normally only work for CSGO. Just go to chrome dev tools and enter this line in the console. You can read it yourself its not a virus or anything. All it does is select all elements with class help_purchase_price and sums it all up, that's it!

Object.values(document.getElementsByClassName("help_purchase_right")) // gets all elements with class "help_purchase_price" the class that holds all the prices
  .map(el => el.innerHTML.match(/(\d+.\d+)/g)[0]) // capture all the monies
  .reduce((accu, el) => accu + Number(el), 0) //reduces array into 1 number

How much money did you spend? Leave a comment below with the game and the amount and also for a limited time only if you leave your social security number you will be guaranteed to win 1 free year of Equifax social security number protection and a brand new used Toyota Corolla 2012 with velvet interior and broken cup holders and a dirty windshield with the front right tire being 2" inches smaller than the others. So what are you waiting for, enter your social security number and tell us in the comments how YOU would use your brand new user Toyota! (Satisfaction not guaranteed, batteries not included, sudden death may occur after inputting code, Raid55 LLC is not responsible for any damage to the computer and/or to the user that may or may not occur after use and/or prolonged use of product, Raid55 LLC makes no guaranty to not steal your information and store it in the cloud for machine learning purposes, please consult your local physician and/or doctor for more information)

OLD VERSION (no longer works after a valve update for whatver reason...its not like anything changed UI wise on that page)

// not that great but it works... so yea, its not like we need to optimal time and space complexity for this one
Object.values(document.getElementsByClassName("help_purchase_price")) // gets all elements with class "help_purchase_price" the class that holds all the prices
  .map(el => el.className === "help_purchase_price"? el.innerHTML : null) //removes all strike through transactions
  .filter(el => el) // removes all null values
  .filter(el => el[0] === "$") // checking for invalid transactions
  .map(el =>  el.slice(1, el.length)) // cuts dollar sign for adding
  .reduce((accu, el) => accu + Number(el), 0) //reduces array into 1 number
@Raid55
Copy link
Author

Raid55 commented Jul 18, 2018

I spent $1118 dollars on CS:GO from 2014 till now, this was only for valve issued in-game purchases, not Steam Market. I feel not good... I am going to rethink my budgeting methods...

@Raid55
Copy link
Author

Raid55 commented Jun 10, 2023

It's 2023, no one won the Toyota... CS:2 was announced and is coming out soon, I thought i would check how much i've spent since.
I have a total of $1744.58. TBH it's not super crazy, just 600 extra bux since 2018, not too shabby!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment