Jump to content

Recommended Posts

What is it?
 
WotStatGrabber is a small Python program I've started working on to retrieve player stats from the official API and output them as a CSV file that can be easily opened and worked with in Excel and other programs.  I got the idea from Praetor77 mentioning something like this would be useful in the WN8 thread and the current focus is making it useful to assist with WN development (and/or other statistical methods).
 
Right now it's in alpha, it can be run from the command line only and only has basic functionality.  Currently you provide it with an input file that contains the names of users you want statistics for, the name of the output file, and optionally the number of top played low tier tanks to use for the low tier battles calculation.  At this time only overall stats are supported, 1/30/60 day stats are planned for the future.
 
 
Source
 
For anyone interested in the source here is the GitHub repository:
https://github.com/AltairDusk/WoTStatGrabber/tree/develop
 
 
Downloads
 
I'm also offering it compiled to an exe for Windows which doesn't require Python to be installed or any knowledge of Python.  You just have to unzip the folder somewhere then call WotStatGrabber.exe from the command line.
 
Current Version: 0.2 alpha 1 (updated 9/8/2013)

32 bit:
https://www.dropbox.com/s/ihrswgnce0of83m/WotStatGrabber_0.2_alpha1_32bit.zip
64 bit:
https://www.dropbox.com/s/9kxhyw8b1a290w7/WotStatGrabber_0.2_alpha1_64bit.zip
 
 
How to use it
 
WotStatGrabber.exe inputFile outputFile --wn --top_lt1 # --top_lt2 # --server S --tank_list

  • inputFile is the full path to a file containing 1 player name on each line for the players you want to look up
  • outputFile is the full path to the output file which will be created with the retrieved statistics
  • --wn is optional and used to specify WNx development mode. This will output additional stats that are of interest for development of the WNx statistic (currently the top low tier information).
  • --top_lt1 is optional and can be used to override the number of most played low tier tanks included in the first set of low tier battles calculations. If not provided the 3 most played low tier tanks (tiers 1-3) will be used. This flag has no effect if --wn is not provided.
  • --top_lt2 is optional and can be used to override the number of most played low tier tanks included in the second set of low tier battles calculations. If not provided the 5 most played low tier tanks (tiers 1-5) will be used. This flag has no effect if --wn is not provided.
  • --server is optional and can be used to specify what server you wish to retrieve user statistics from.  If not provided the NA server will be used.  You can specify NA, RU, EU, ASIA, or KR (note: KR is untested but available in the API).  All of the names in inputFile will be requested against that server.  It is not currently possible to get statistics for players across multiple servers in one request.
  • --tank_list overrides any other flags and will create a csv file where the headers (1st row) are the tank_id and the values (2nd row) are the tank name as reported by the API.  From left to right they are sorted by tank_id (the same order tank battles will appear in a normal stats request with the --wn flag enabled).  inputFile is not used with this flag but something must be supplied (can't be left blank) or the program will error out (not ideal I know, I'll fix that when I get around to restructuring the code).  The --server flag can optionally be specified with --tank_list and the list of tanks will be requested from the API for the appropriate server.  I do not believe the tank ids change from server to server but I suspect the localized names will.

 

Examples
 
Basic call (will not output low tier tank information):

WotStatGrabber.exe c:\temp\names.txt c:\temp\stats.csv

WNx development mode (will output additional information of interest for WNx):

WotStatGrabber.exe c:\temp\names.txt c:\temp\stats.txt --wn

 WNx development mode with statistics for top 2 and top 8 most played low tiers:

WotStatGrabber.exe c:\temp\names.txt c:\temp\stats.txt --wn --top_lt1 2 --top_lt2 8

Retrieving the list of tank names from the NA API:

WotStatGrabber.exe c:\temp\names.txt --tank_list --server NA 

 
Changelog
 

  • 0.2 alpha 1:
    • Updated to use WG's new version 2.0 API.
    • Now supports multiple servers through the --server flag.
    • Number of battles in a tank has been added to the WNx development mode output (--wn). These appear after the rest of the fields ordered by tank ID from left to right. The header is the tank ID and the values in the columns are the number of battles in that tank.
    • A list of tank ID to tank name mappings can be generated by using the --tank_list flag. The header is the tank ID and the values in the columns are the tank name as reported by the API.
  • 0.1 alpha 6:
    • Added per-tier battles output to WNx development mode.
  • 0.1 alpha 5:
    • Added WNx development mode, standard output no longer includes top low tier information.
    • WNx development mode now shows two sets of low tier tank information, top 3 and top 5 by default.
    • Added ability to specify how many top low tier tanks should be included in each set of low tier tank information for WNx development mode
  • 0.1 alpha 4:
    • Added total/average capture and defense points

Edited by HibachiSniper
Link to post
Share on other sites

This will be extremely useful for WN8 testing, thanks Hibachi!

 

However, the script is missing information for defense points...

Link to post
Share on other sites

This will be extremely useful for WN8 testing, thanks Hibachi!

 

However, the script is missing information for defense points...

 

/facepalm

 

I swear I was looking at those when I wrote this originally and I don't know how I missed putting them in.  :$

 

I'm assuming cap points and defense points will be ctf_points and dropped_ctf_points respectively in the API return: http://api.worldoftanks.com/uc/accounts/1001233204/api/1.9/?source_token=WG-WoT_Assistant-1.3.2

 

Give me a few minutes...

Link to post
Share on other sites

Luckily that's not a big change, took longer to compile the exe's and upload to Dropbox than it did to make the actual code change.  :doubleguns2:

 

Updated the links in the OP with the new version.

Link to post
Share on other sites

Couple questions Hibachi.

 

1- Can you modify the script to get BOTH top3 and top5 info?

 

2- Can you include in a field the following calculation for tier 1-3 tanks:

 

((tier of top1 played tank * number of games in top1 tank) + (tier of top2 played tank * number of games in top2 tank) + (tier of top3 played tank * number of games in top3 tank)) *3 / sumbattlestop3_tier1-3tanks

 

3- If that is possible, then we would need that same calculation but for the top 5 tier 1-3 tanks.

 

 

4- Is it possible to get the kills/game for each of the top played tier 1-3 tanks? Also, can you get kills/game for all tanks played and maybe sort them, as in, get some data for the tanks with which the player has the most kills/game?

Link to post
Share on other sites

1, 2, and 3 are definitely possible. For #4 I don't think the API returns enough information to figure out kills/game on a per tank basis but I'll check it out.  Might be a few days before I can take a look at it.

Link to post
Share on other sites

I don't think we can do the kills per game.  It's strange, some tanks actually have the information populated but I haven't figured out any rhyme or reason yet as to why some do and some don't.  If I pull your stats for example this is what I got back for the KV-5:

{
  "spotted": 316, 
  "localized_name": "KV-5", 
  "name": "KV-5", 
  "level": 8, 
  "damageDealt": 366697, 
  "survivedBattles": 94, 
  "battle_count": 866, 
  "nation": "ussr", 
  "image_url": "/static/2.5.2/encyclopedia/tankopedia/vehicle/small/ussr-kv-5.png", 
  "frags": 334, 
  "win_count": 513, 
  "class": "heavyTank"
},  

This is what comes back for your WZ-132:

{
  "spotted": 0, 
  "localized_name": "WZ-132", 
  "name": "Ch17_WZ131_1_WZ132", 
  "level": 8, 
  "damageDealt": 0, 
  "survivedBattles": 0, 
  "battle_count": 415, 
  "nation": "china", 
  "image_url": "/static/2.5.2/encyclopedia/tankopedia/vehicle/small/china-ch17_wz131_1_wz132.png", 
  "frags": 0, 
  "win_count": 265, 
  "class": "lightTank"
}, 
Link to post
Share on other sites

Alright Praetor I just uploaded the new versions with 1-3 included.  Be sure to note the --wn flag, you'll always want to be providing that one.  :D

Link to post
Share on other sites

No problem!  I'm hoping to add support for other servers (right now it's NA only) and recent stats (30d, 60d, etc) in the next few weeks.

Link to post
Share on other sites

Hibachi, could you add code to retrieve number of games at each tier? That would be all that is needed to test the new weighted tier idea.

Link to post
Share on other sites

Good news, I decided to do it sooner rather than later.   :doubleguns2:   

Zipping and uploading right now, will update the main post shortly.

 

Edit: Main post updated, alpha 6 is ready to go.

Link to post
Share on other sites

Been off the radar for a little while I know, haven't been playing and fairly busy but I just got a chance to look at the 2.0 API changes.  I'll see if I can work some of that in for the next release, anything in particular that would be beneficial to have? (I'm also planning to add support for other servers in the next version, may take a little while as I'm not happy with the current structure and plan to rearrange things.)

Link to post
Share on other sites

It would be useful to me if wotstatgrabber could retrieve number of games on each tank, for developing WN8. Maybe an option to do that with a flag? Could we reliably identify which tank each number would correspond to? Is there something like Tank_ID on the API, a unique identifier for each tank?

Link to post
Share on other sites

It's definitely possible, I'm pretty sure there is a Tank ID which means we should be able to match them properly from any server once I add that in, I could probably have it put out readable tank names for the column headings though.  Is CSV still the easiest format for you? Certainly possible to add that in for that but there will need to be a column for every tank in the game so you may have to scroll horizontally quite a bit.  It unfortunately wouldn't be possible to put out the stats for multiple players and only show the tanks they have battles in for CSV output.

Link to post
Share on other sites

You could just do a 0 for tanks not played, right? CSV is fine. I think using sorted tankIDs would be best instead of parsing for tank names though...

 

However, I would obviously need a list of tank name = tank ID. :)

Link to post
Share on other sites

That could be done too, you'd prefer they be sorted left to right by Tank Id rather than tier/class/anything like that?  Either way that order wouldn't be changing from run to run, the column names are set up statically in the code.

Link to post
Share on other sites

Hibachi any updates? We really need to be able to test WN8 further, beyond the vbaddict dataset. Keep me updated on your progress please! :)

 

PS: Once again, thanks for your time and effort, man!

Link to post
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.

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.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...