Register
Page 1 of 2 12 Last
Results 1 to 10 of 14
  1. #1
    Xsinthis's Avatar
    Posts
    639
    Reputation
    17
    Tagged in
    208 Posts
    Add to this user's reputation

    Post New Economy Script - Measuring a server's economy

    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


    1. REQUIREMENTS

    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.

    3. SETTINGS

    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.


    4. ADVANCED

    • 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.

    9. DISCLAIMER

    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.
    Attached Files Attached Files
    Last edited by Xsinthis; June 11th, 2011 at 03:02 PM.

  2. #2
    Kathroman's Avatar
    Posts
    5,452
    Reputation
    286
    Blog Entries
    20
    Tagged in
    2157 Posts
    Add to this user's reputation
    Quote Originally Posted by Xsinthis View Post
    I am not liable for anything that may occur from this script. Including love childs.
    On that note .

    I don't really have to time to dig too deeply into this, but it sounds quite interesting. I certainly appreciate the effort this must have taken. I'll try and offer a bit more feedback when I get more a chance to sink my teeth into it.

    Nice Work
    Like what you see? Become an Ethereal Contributor to help support the site and gain access to additional perks.

        

    Guides: Thunder Bluff Vendor Supply Route | Entry Level JC Strategy | Alternative DMF Guide

    TSM 2.0: TSM 2.0 Groups & Operations GUIDE | TSM 2.0 Basic JC Shuffler | TSM 2.0 ADVANCED JC Shuffler

  3. #3
    Erorus's Avatar
    Posts
    1,365
    Reputation
    112
    Tagged in
    671 Posts
    Add to this user's reputation
    I gave it a glance and it looks pretty cool. More in-depth comments from me when I don't have dishes and laundry to do.

  4. #4
    Xsinthis's Avatar
    Posts
    639
    Reputation
    17
    Tagged in
    208 Posts
    Add to this user's reputation
    Quote Originally Posted by Kathroman View Post
    I don't really have to time to dig too deeply into this, but it sounds quite interesting. I certainly appreciate the effort this must have taken. I'll try and offer a bit more feedback when I get more a chance to sink my teeth into it.
    This was my first foray into php, took me 3 days to get the xml data loaded alone :P

  5. #5
    Kathroman's Avatar
    Posts
    5,452
    Reputation
    286
    Blog Entries
    20
    Tagged in
    2157 Posts
    Add to this user's reputation
    I have had the intention of doing something similar for months now (whenever the xml feeds became available ), but for me it has been probably about 3 years since I have even used php, and mostly for form processing on websites I had been developing, so a lot of the programming would have been brand new to me. A daunting task for even a motivated fellow, for an unmotivated one, simply out of the question...

    It might be helpful to take a look at somebody else's code to see where they've started from, but I've got a pretty hectic next few days, so perhaps later into the weekend.

    Quick question - you addressed renaming the file for multiple realms, but what if you would like to view the same realm on different machines? Would you need to have 2 separate db's there as well?
    Like what you see? Become an Ethereal Contributor to help support the site and gain access to additional perks.

        

    Guides: Thunder Bluff Vendor Supply Route | Entry Level JC Strategy | Alternative DMF Guide

    TSM 2.0: TSM 2.0 Groups & Operations GUIDE | TSM 2.0 Basic JC Shuffler | TSM 2.0 ADVANCED JC Shuffler

  6. #6
    Xsinthis's Avatar
    Posts
    639
    Reputation
    17
    Tagged in
    208 Posts
    Add to this user's reputation
    Yes, you will need separate databases for each realm no matter what, if they access the same database the data will get contaminated and cause errors since there is no distinction on the table level for different realms. Once I'm done my current to-do list I will look into it though.

  7. #7
    Sterling's Avatar
    Posts
    3,854
    Reputation
    377
    Blog Entries
    1
    Tagged in
    2131 Posts
    Add to this user's reputation
    Very cool, I'll check it out tonight. I formatted this a little, hope you don't mind. I have the original saved just in case.
    Must-See: Stormspire.net Survival Guide | How-to: Tooltips in your posts | Consortium Key Sender (CKS) | Phat Lewts' Learn TSM Series
    Legion Mastery Series: Sniper | Cross-Faction Trading | Cooking | Blacksmithing, Leatherworking, Tailoring Master
    Old World: Smelting | Garrisons Part 1 - Buildings | Garrisons Part 2 - Followers | Profitable Alchemy Crafts
    Archived: Enchanting | Jewelcrafting | Toy Box Guide | Blacksmithing Transmog Guide
    Want to get the most out of the site and support the community? Consider Premium Membership
    Find a post useful? Give the author rep! And above all, be respectful and friendly to everyone.

  8. #8
    Xsinthis's Avatar
    Posts
    639
    Reputation
    17
    Tagged in
    208 Posts
    Add to this user's reputation
    Quote Originally Posted by Sterling View Post
    I formatted this a little, hope you don't mind. I have the original saved just in case.
    Np, I just copy and pasted from the readme I have in the zip lol, thanks a bunch!

  9. #9
    Xsinthis's Avatar
    Posts
    639
    Reputation
    17
    Tagged in
    208 Posts
    Add to this user's reputation
    I just updated the script. It includes the averages functions as well as a listings per hour calculation. Should also be even less error proof (less likely to miss out on snapshot) and maybe I'm imagining it but it looks faster as well.

    This one no longer uses the log table and instead uses a table called snapshots. Basically same thing, but a better name with an extra column in it, also means you can just install this one over the old one and keep going as opposed to altering tables or starting anew. If you want to process all your current data you can copy the old log table into the new table (leave processed as 0 for each entry) and delete the master record. Otherwise it will start adding the extra info to the new entries (it still uses old data for it's calculations).

    P.S. I might also need a snazzy name for this thing :P

    P.P.S. I apologize to the one person who downloaded the file before I caught I had left some troubleshooting spam in :P
    Last edited by Xsinthis; June 9th, 2011 at 10:15 PM.

  10. #10
    Names? The Economizer? The Econominator? The BFEconomy 5000? EconoScriptor 2k11? Econominus maximus?

    Hmm... that reminds me, I need to find out where Maximus Minimus (<---best food truck ever) has been hiding. Mmmm....pork sandwich...

 

 

Similar Threads

  1. Banned for "Abuse of the Economy"
    By rexkicker in forum Archive (General)
    Replies: 64
    Last Post: June 27th, 2011, 08:47 PM

Tags for this Thread