changeset 197:c7c9110b955a misc

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 14 Feb 2011 01:44:39 +0200
parents de3bb01d602d
children 9f79ddd5175d
files prices.php
diffstat 1 files changed, 42 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/prices.php	Sun Feb 13 23:40:16 2011 +0200
+++ b/prices.php	Mon Feb 14 01:44:39 2011 +0200
@@ -128,48 +128,48 @@
 
 // Mage reagents
 $reagents = array(
-  "name"     => "reagents",
+  "name"     => "reagent",
   "title"    => "Power reagents",
   "discount" => true,	// enable discounts for this section
   "datafile" => "reagents.txt",
 
   "desc"     => "Bulk orders may require time to complete, inquire.
 <b>Notice! Availability presented below may or may not reflect the current stock situation.</b>",
-);
 
-$reagent_prices = array(
-  "Blast reagents" => array(
-    "acid1" => array("acid", "Acid Blast",           "handful of olivine powder",    125),
-    "acid2" => array("acid", "Acid Storm",           "pair of interlocked rings",    125),
+  "prices" => array(
+    "Blast reagents" => array(
+      "acid1" => array("acid", "Acid Blast",           "handful of olivine powder",    125),
+      "acid2" => array("acid", "Acid Storm",           "pair of interlocked rings",    125),
+
+      "asph1" => array("asph", "Blast Vacuum",         "bronze marble",                150),
+      "asph2" => array("asph", "Vacuum Globe",         "small fan",                    150),
 
-    "asph1" => array("asph", "Blast Vacuum",         "bronze marble",                150),
-    "asph2" => array("asph", "Vacuum Globe",         "small fan",                    150),
+      "elec1" => array("elec", "Electrocution",        "small piece of electrum wire", 125),
+      "elec2" => array("elec", "Lightning Storm",      "cluster of tungsten wires",    125),
 
-    "elec1" => array("elec", "Electrocution",        "small piece of electrum wire", 125),
-    "elec2" => array("elec", "Lightning Storm",      "cluster of tungsten wires",    125),
+      "cold1" => array("cold", "Cold Ray",             "steel arrowhead",              150),
+      "cold2" => array("cold", "Hailstorm",            "handful of onyx gravel",       125),
 
-    "cold1" => array("cold", "Cold Ray",             "steel arrowhead",              200),
-    "cold2" => array("cold", "Hailstorm",            "handful of onyx gravel",       125),
+      "pois1" => array("pois", "Summon Carnal Spores", "silvery bark chip",            150),
+      "pois2" => array("pois", "Killing Cloud",        "ebony tube",                   100),
 
-    "pois1" => array("pois", "Summon Carnal Spores", "silvery bark chip",            150),
-    "pois2" => array("pois", "Killing Cloud",        "ebony tube",                   100),
+      "fire1" => array("fire", "Lava Blast",           "granite sphere",               125),
+      "fire2" => array("fire", "Lava Storm",           "blue cobalt cup",              125),
 
-    "fire1" => array("fire", "Lava Blast",           "granite sphere",               125),
-    "fire2" => array("fire", "Lava Storm",           "blue cobalt cup",              125),
-
-    "mana1" => array("mana", "Golden Arrow",         "copper rod",                   125),
-    "mana2" => array("mana", "Magic Eruption",       "tiny platinum hammer",         125),
-  ),
+      "mana1" => array("mana", "Golden Arrow",         "copper rod",                   125),
+      "mana2" => array("mana", "Magic Eruption",       "tiny platinum hammer",         125),
+    ),
   
-  "Prot reagents" => array(
-    "phys3" => array("phys", "Armour of Aether",         "small highsteel disc",     200),
-    "acid3" => array("acid", "Acid Shield",              "stone cube",               125),
-    "asph3" => array("asph", "Aura of Wind",             "tiny leather bag",         275),
-    "fire3" => array("fire", "Flame Shield",             "small glass cone",         150),
-    "cold3" => array("cold", "Frost Shield",             "grey fur triangle",        275),
-    "elec3" => array("elec", "Lightning Shield",         "small iron rod",           100),
-    "mana3" => array("mana", "Repulsor Aura",            "quartz prism",             125),
-    "pois3" => array("pois", "Shield of Detoxification", "tiny amethyst crystal",    125),
+    "Prot reagents" => array(
+      "phys3" => array("phys", "Armour of Aether",         "small highsteel disc",     200),
+      "acid3" => array("acid", "Acid Shield",              "stone cube",               125),
+      "asph3" => array("asph", "Aura of Wind",             "tiny leather bag",         275),
+      "fire3" => array("fire", "Flame Shield",             "small glass cone",         150),
+      "cold3" => array("cold", "Frost Shield",             "grey fur triangle",        275),
+      "elec3" => array("elec", "Lightning Shield",         "small iron rod",           100),
+      "mana3" => array("mana", "Repulsor Aura",            "quartz prism",             125),
+      "pois3" => array("pois", "Shield of Detoxification", "tiny amethyst crystal",    125),
+    )
   )
 );
 
@@ -335,6 +335,7 @@
   "</p>\n\n";
 }
 
+
 //============================================================================
 
 if (1) {
@@ -464,9 +465,11 @@
 
 
 if ($sections["reagents"]) {
+  $sec = $reagents;
+
   $showSupply = FALSE;
-  if (file_exists($reagents["datafile"])) {
-    $data = @file_get_contents($reagents["datafile"]);
+  if (file_exists($sec["datafile"])) {
+    $data = @file_get_contents($sec["datafile"]);
     if ($data !== FALSE) {	
       $supply = array();
       $lines = explode("\n", strtolower($data));
@@ -478,8 +481,8 @@
     }
   }
 
-  printSectionHeader($reagents);
-  foreach ($reagent_prices as $fkey => $flist) {
+  printSectionHeader($sec);
+  foreach ($sec["prices"] as $fkey => $flist) {
     echo "<tr><th colspan=\"".($showSupply ? 6 : 5)."\">".$fkey."</th></tr>\n".
     " <tr>\n".
     "  <th>Type</th>\n".
@@ -503,7 +506,8 @@
       $row++;
     }
   }
-  printSectionFooter($reagents);
+
+  printSectionFooter($sec);
 } // reagents enabled
 
 
@@ -649,10 +653,11 @@
 // Reagents
 //============================================================================
 if ($sections["reagents"]) {
-  getDiscount("reagents", $factor, $s);
+  $sec = $reagents;
+  getDiscount($sec["name"], $factor, $s);
   $numReagents = 0;
   $subTotal = 0;
-  foreach ($reagent_prices as $fkey => $flist)
+  foreach ($sec["prices"] as $fkey => $flist)
   foreach ($flist as $key => $item) {
     if (getVal($key, $val) && $val > 0) {
       addVal($key, $val);
@@ -661,7 +666,7 @@
     }
   }
   if ($numReagents > 0)
-    printLine("Total reagents", $numReagents, $subTotal, TRUE);
+    printLine("Total ".$sec["name"]."s", $numReagents, $subTotal, TRUE);
 }
 
 //============================================================================
@@ -693,7 +698,6 @@
       $numItems += $val;
     }
   }
-
   if ($numItems > 0)
     printLine("Total ".$name."s", $numItems, $subTotal, TRUE);
 }