This script is designed to access the raw data provided so generously by Erorus via The Undermine Journal and analyze it. It provides statistical information about a server's economy (faction specific) that can, hopefully, be used to detect trends and provide other interesting pieces of information currently not available. The main purpose is too use the generated data tables to graph in third party applications. That being said it doesn't output some basic information when browsed to about the most recent snapshot.
I do have some more plans for this in the future but this basic ground work should get the ball rolling (and it should all be compatible with the tables it currently produces). I welcome all feedback but do be aware there are limitations about what can be done with the data the script uses.
I figured I would post this here in case others find it useful.
I would like to thank Erorus for his wonderful work on TUJ so far as this would not be possible without his hard work!
Example Web Page
To use the script you will need access to a web server (or for more advanced users a computer) with:
- MySQL (tested with 5.1.56, though any version 5.0 and onwards should work)
- PHP (tested with 5.2.17 though any version 5.0 and later should work)
- HIGHLY SUGGESTED: Cron Jobs or similar scheduling system; this is too make sure you don't miss snapshots and don't have to remember to run it yourself
Also, this only works for realms carried by The Undermine Journal (sorry peeps in the EU)
2. INSTALLATION INSTRUCTIONS
- Download attached zip file and extract it to somewhere on your computer (remember where!)
- Open the php file and edit the settings (explain below)
- Upload economy.php to a web server with the above requirements
- Run script (and or schedule script)
I suggest putting the file in a web accessable location so you can simply browse to the file to see the latest snapshot or force an update.
The script only supports the use of one faction/realm however you can track multiple economies by running multiple copies of the scropt (i.e. economy_serverA.php, economy_serverB.php) however, you *MUST* have a seperate database for each instance of the script.
The script only has a handful of settings most of which involve connecting to the database. You need to set them by opening the file up in a text pad and putting the settings between the quotes, which can be found at the very beginning of the php file. Once you're done simply save the file and that's it.
*NOTE: Do not touch the ones under the heading VARIABLES in the file, those are all managed script side.
- $db_server - Database server address, if it is on the same server, leave it at localhost
- $db_username - Database username
- $db_password - DB password
- $db_name - DB name
- $realm_list - This is the URL which gets everything going, it is the URL to the list of snapshots form your server. It can be found at TUJ>>>Server>>>Site>>>XML API>>>this list in XML. Copy the URL form the resulting page for this variable.
- $fancy_log - If you set this to true it will also store the data in extra tables labled my date (server time) in _Month(name)_day(with leading zeros)_year(4 digits) i.e. _June_08_2011. This is mostly for manual perusing of the data.
- the time column is formatted (all numerically) as YYYYMMDDhhmm
- the time is always the game server's time
- all measurements are currently in gold (the copper numbers were too large for integer storage)
- the weekday is just for easier reading and manual detection of trends
- the raw data table is only used while the script is running, and is purged before and after every snapshot
- the log stores the information found in the snapshot list and acts as a way to prevent snapshots from being proccessed multiple times.
- the fancy record tables are not used by the script
- to reprocess the list, simply drop the log table (though there should be no need) but it will still not overright any entries currently in the master records
- the list on TUJ only keeps recent snapshot data, once you delete data from a snapshot not on that list, this script cannot recover it
5. NOTES AND KNOWN PROBLEMS
1. Many servers have time limits on how long a php script, and the first time running the script it can take a long time to go through all the data (for example the limit on my server is 200 seconds). I have accounted for this in the script and you will loose no data when this happens. Simply restart the script and it will start again with the snapshot it left off on.
2. There are 3 blank values at the end of the table. These are for future designs I am working on but will require a largish redesign of the script, so I added the columns so I could release the script well ahead of 4.2 and not run into problems releasing a new version with these additions.
6. TIPS AND TRICKS
- The script can be run using a Cron Job (and I highly suggest it to ensure you don't miss snapshots by forgetting for a few days and so the data to be processed doesn't back up). In the command field simply put "php -q <dir>" and it will run the php script on the set time frame (I recommend once per hour). You can drop the -q to see the results in the email but it's not pretty since it doesn't follow the html coding.
7. FUTURE PLANS/REQUESTS/IDEAS
- Nicer front end (perhaps with some graphs)
- Multi-realm support
8. TECHNICAL SUPPORT
No technical support is garunteed, though if you do come into errors I welcome the chance to improve my code (providing you have done your hmwk and don't just come to me with "IT DUN WORKZ"). Post any problems (or suggestions) in the forum thread.
Don't be an ass and claim this as your own. Also, don't repost this, just redirect to the Consortium thread. Nuff said.
Also, this data is provided freely by TUJ which gets it's data freely from Blizzard's site. As of such this means a few things:
- If Erorus requests this will be taken down (no there is no back door shutdown switch, it's an honour system)
- I'm pretty damn sure Blizzard's data rules apply to this script, so neither this script or the results may be sold for money or other currencies (ingame or out)
- The data is only as accurate as the chain of sources it goes through
- I am not liable for anything that may occur from this script. Including love childs.