- Get the code
- Open Developer tools in Chrome
- Go to drugwars game page
- Copy the JS (in my case the last line was enough (line 137))
- Replace \n with new lines
- Format the code for e. g. using (https://www.freeformatter.com/javascript-beautifier.html)[https://www.freeformatter.com/javascript-beautifier.html]
- Learn Websocket (API uses it)
- Calls which are used by the game you can find also in Developer Tool, just switch the tab to correct one
- Look for text next to interesting values for e. g. in if you want to know how are the values displayed next to "Current Capacity" HTML text
- look for the text it in the code
- Next to it you will find
Blaze.View("lookup:calculate_capacity"
- Then look for definition of calculate_capacity function
calculate_capacity: function () {
- Now you got the math which is behind the capacity calculation