changeset 32:d30a532eae93

Add a simple found potions listing mode.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 21 Mar 2011 19:47:45 +0200
parents 04c32e036da9
children 41a1e2acdb73
files index.php
diffstat 1 files changed, 45 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Mon Mar 21 04:57:47 2011 +0200
+++ b/index.php	Mon Mar 21 19:47:45 2011 +0200
@@ -247,13 +247,20 @@
 // Select view mode based on script GET arguments
 $mode = "min";
 $active = 0;
-foreach ($dbModes as $name => $idx) {
-  if (isset($_GET[$name])) {
-    $active = intval($_GET[$name]);
-    if ($active < 0 || $active >= $dbDims[$idx[1]])
-      $active = 0;
-    $mode = $name;
-    break;
+if (isset($_GET["view"]))
+{
+  $mode = "view";
+}
+else
+{
+  foreach ($dbModes as $name => $idx) {
+    if (isset($_GET[$name])) {
+      $active = intval($_GET[$name]);
+      if ($active < 0 || $active >= $dbDims[$idx[1]])
+        $active = 0;
+      $mode = $name;
+      break;
+    }
   }
 }
 
@@ -350,7 +357,37 @@
   $results["."]." combinations untested.<br />\n";
 
 
-alch_matrix_print($mode, $active);
+if ($mode == "view")
+{
+  echo "<table style=\"background: #444; width: 60%;\">
+  <tr>
+   <th>#</th>
+   <th>Mineral</th>
+   <th>Organ</th>
+   <th>Herb</th>
+   <th>Result</th>
+  </tr>
+  ";
+  $n = 0;
+  for ($x = 0; $x < $dbDims[0]; $x++)
+  for ($y = 0; $y < $dbDims[1]; $y++)
+  for ($z = 0; $z < $dbDims[2]; $z++)
+  {
+    $s = $db[$x][$y][$z];
+    if ($s[0] == "!")
+    {
+      $n++;
+      echo "<tr>".
+      "<td>".$n."</td>".
+      "<td>".$dbNames[0][$x]."</td>".
+      "<td>".$dbNames[1][$y]."</td>".
+      "<td>".$dbNames[2][$z][0]." / ".$dbNames[2][$z][1]."</td>".
+      "<td>".substr($s, 1)."</td></tr>";
+    }
+  }
+  echo "</table>\n";
+} else
+  alch_matrix_print($mode, $active);
 
 ?>