User:Rupert/Methods
I play every page of Urban Dead through a Javascript page on my home computer that I coded up using the Prototype Javascript library (awesome) that uses AJAX HttpRequests to a php proxy (super awesome). That's because Javascript can't contact urbandead.com directly due to the security sandbox, but it can contact php on the same machine and php can contact any website it wishes, so it's more of a two-level proxy, sometimes three. I can then over-analyze the HTML with Javascript till my heart's content, extracting all sorts of information, as well as auto-searching (a fire-and-forget time saver). Javascript is surprisingly good at this and fun to program.
Each search result scraped by Javascript is sent via another AJAX request to a similar php page that stores the data in a MySQL table with these columns:
+--------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+---------------------+------+-----+---------+-------+ | name | char(25) | NO | | | | | date | date | YES | | NULL | | | building_name | char(40) | NO | | | | | building_type | char(20) | NO | | | | | inside | tinyint(3) unsigned | NO | | | | | building_condition | char(10) | NO | | | | | building_light | tinyint(3) unsigned | NO | | | | | has_shopping | tinyint(3) unsigned | NO | | | | | has_bargain | tinyint(3) unsigned | NO | | | | | item_found | char(40) | NO | | | | | has_necro | tinyint(3) unsigned | NO | | 0 | | | has_necro_lab | tinyint(3) unsigned | NO | | 0 | | +--------------------+---------------------+------+-----+---------+-------+
When I'm done playing, I run a SQL script that copies that data into a temporary table, transforming all items named "pistol(*)" to just "pistol" because I don't care about the odds of pistol ammo right now, same for "shotgun(*)". Then I transform "NecroTech syringe" and "revivification syringe" into just "syringe", "rusty knife" and "pocket knife" and "hunting knife" into just "knife". Then I count identical rows. This condenses the table from thousands of rows (one per search) to only hundreds, at which point it looks like this:
+-------------+----+-----------+-------+----------+---------+-------+-----+----------------+-------+ | building | in | condition | light | shopping | bargain | necro | lab | item | count | +-------------+----+-----------+-------+----------+---------+-------+-----+----------------+-------+ | auto repair | 1 | okay | 1 | 0 | 0 | 1 | 1 | bottle of beer | 2 | | auto repair | 1 | okay | 1 | 0 | 0 | 1 | 1 | crowbar | 1 | | auto repair | 1 | okay | 1 | 0 | 0 | 1 | 1 | fire axe | 1 | | auto repair | 1 | okay | 1 | 0 | 0 | 1 | 1 | fuel can | 4 | | auto repair | 1 | okay | 1 | 0 | 0 | 1 | 1 | nothing | 34 | | auto repair | 1 | okay | 1 | 0 | 0 | 1 | 1 | spray can | 3 | | auto repair | 1 | okay | 1 | 1 | 0 | 0 | 0 | bottle of beer | 1 | | auto repair | 1 | okay | 1 | 1 | 0 | 0 | 0 | crowbar | 3 | | auto repair | 1 | okay | 1 | 1 | 0 | 0 | 0 | fire axe | 1 | | auto repair | 1 | okay | 1 | 1 | 0 | 0 | 0 | fuel can | 2 | +-------------+----+-----------+-------+----------+---------+-------+-----+----------------+-------+
Then the script builds up a second temporary table populated by three queries on the first temp table:
- all non-mall and non-necrotech rows grouped by building type, light, and item
- all malls and mall substores further grouped by has_shopping and has_bargain
- all necrotechs grouped by the same as (1) but also by has_necro and has_lab (because the odds appear to be different)
Then I order the table by building and condition to get the "By Building" table, and by item for the "By Item" table. Then I execute a php page to get the html tables to paste into this lovely wiki.