PDA

View Full Version : PHP - HoN XML Stats Pull



Treslo
09-10-2010, 02:28 PM
So, this will likely underwhelm anyone who is even remotely technical. Others, please continue to read.
In the course of studying PHP, I decided that I would focus all of my study-time on solving game-related challenges that I set out for myself. In that, I decided that I wanted to know how to manipulate the wealth of data available to me for my favorite little waste of time, HoN. Thankfully this allowed me to learn about manipulating XML and move forward pretty quickly on some basic fundamentals.


Recent Stats (v0.9): http://www.inmyth.com/mypuck/hon_recentstats.php


Details and Usage:

At this, quite ugly and un-styled, script simply enter in a range of game ID's on a line-by-line basis and return the form. The form will return to you a list of those game's with associated hyperlink to download the game replay.
Input a user-name of the player for the games indicated, and it will return the character level, kills, and deaths for that game. At the top it will indicate the average kills, deaths, and KDR over the games input. This is useful for trending over more recent games.

Example:


A given user - myself in this case - can navigate to a Heroes of Newerth stats page such as: http://www.heroesofnewerth.com/player_stats.php?aid=2370508
There the user should select all those Game ID's of interest from the "Match History" sidebar. (To get a "clean" list of ID's, drop this copied text into your favorite text editor and do a "wildcard" search such the code snipper below for MS Word wildcard search.
[(]***********[)]

Sample Game ID data:
13193669
13192286
13190774
13189335
13102826
13101450
12993210
12990440
12986278
12984145
12980942
Username: Treslo


With the sample data in place in the appropriate text field on the webpage (input game ID's), simply run the script.
The results returned will be in a serialized list of lowest to highest Game ID's and will return an active hyperlink to download a given game replay.

Some simple error checking does occur; alongside limited user input validation. Certain games, such as those no longer available as viewable replays, will not work. The script will indicate when this is the case.



Future Studying Expansion:

Better input validation.
Other stat output
Styling

Comments/Suggestions/Things to Explore

Got any?

Suggestion to users of the script - you can use this to easily create a list of links to download any number of games. For example, the most viewed games interest you? Download them all from a single page.

Octavia
09-10-2010, 08:28 PM
Seems useful, but the title seems a bit off since you aren't pulling stats from the XML, but rather getting download links for games.

Treslo
09-11-2010, 10:03 AM
Yeah, I thought of that as well - but given what I'll be expanding it into once I start filtering based upon user ID, it'll only be a bit annoying.

In any event, I noticed that there are some really spiffy new trackers out there anywho - so this is most assuredly a learning project and little else.

Treslo
09-14-2010, 04:08 PM
**Updated the script to now report out the kills, deaths, and level of the indicated player based upon user-name. Test with "Treslo" as the user for the sample data provided.

Better yet, run the script with your own user-name and games. It will provide a more realistic window into your skills of late.

Suggestions for other stats to pull and provide over the "sample" of games?

MacWayne
02-16-2011, 04:21 AM
Couple sugguestions: 1) have it so you just enter a player name, then it comes back in bundles of 50 games.. so you queue to get ranked/public game matches then you have the ablility to get the stats for them, instead of having to type them all out.. Additionally is it possible to add somewhere a check to see what the highest kill streak was a report that, as well as any quad/anninliations in the displays of your matches. (kinda like halo match awards)..anyways I like it alot. I'm just a csci college student wondering if you'd share you source for my own education. Wanna see how it works. Since I can't seem to make my own run.

Xclio
02-20-2011, 07:00 PM
fyi, i entered a single match id and i get this in the 3rd line

Based upon the following 2 games
bug maybe?

Treslo
02-25-2011, 04:00 PM
I haven't updated this nor maintained it after they added MM. I don't even know the process currently you would need to have a collection of Match_ID's like I previously could do by simply viewing a user-page. If I get myself motivated I'll modify is so that it can provide a sample of recent MM games. I would find that useful still. I just am not certain if things within the XML_API have really been maintained alongside MM updates.

EDIT: Nevermind, this would be easily done. There is the request for player match history now.


Request: Player Match History (http://xml.heroesofnewerth.com/#player_hero_stats)

So from a theory standpoint what you would do is:

Text-box for player name: -> Pass that to your request for match history. -> Pull the associated match ID's from the player history and then pull the data-points you want. -> Calculate the "window" you are interested in -> Format results accordingly.