comparison index.php @ 40:bb335b891605

Various improvements.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Mar 2011 13:58:48 +0200
parents 03d7fc455629
children ebd29544477c
comparison
equal deleted inserted replaced
39:15a25bb0a694 40:bb335b891605
13 exit; 13 exit;
14 } 14 }
15 } 15 }
16 16
17 $dbModes = array( 17 $dbModes = array(
18 "min" => array("Mineral", 0), 18 "min" => array("Mineral", 0, "minerals"),
19 "org" => array("Organ", 1), 19 "org" => array("Organ", 1, "organs"),
20 "herb" => array("Herb", 2), 20 "herb" => array("Herb", 2, "herbs"),
21 "list" => array("Potion list", 3), 21 "list" => array("Potion list", 3, "potions"),
22 ); 22 );
23 23
24 $dbNames = array( 24 $dbNames = array(
25 array( 25 array(
26 "adamantium", "aluminium", "anipium", "batium", "brass", "bronze", 26 "adamantium", "aluminium", "anipium", "batium", "brass", "bronze",
173 $div = $max / 3; 173 $div = $max / 3;
174 else 174 else
175 $div = $max / 2; 175 $div = $max / 2;
176 176
177 // Print selection for primary key 177 // Print selection for primary key
178 echo "<table border=\"1\" cellspacing=\"0\">\n"; 178 echo "<table class=\"seltable\" border=\"1\" cellspacing=\"0\">\n";
179 $n = 0; 179 $n = 0;
180 foreach ($pdata as $key => $val) { 180 foreach ($pdata as $key => $val) {
181 if ($n == 0) echo " <tr>\n"; 181 if ($n == 0) echo " <tr>\n";
182 182
183 echo " <td class=\"". 183 echo " <td class=\"".
266 <title>Potion research tool - <? echo $dbModes[$mode][0]." view (".$dbNames[$dbModes[$mode][1]][$active].")"; ?></title> 266 <title>Potion research tool - <? echo $dbModes[$mode][0]." view (".$dbNames[$dbModes[$mode][1]][$active].")"; ?></title>
267 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 267 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
268 <link href="alch.css" title="compact" rel="stylesheet" type="text/css"> 268 <link href="alch.css" title="compact" rel="stylesheet" type="text/css">
269 </head> 269 </head>
270 <body> 270 <body>
271 <div id="info">
271 <? 272 <?
272 273
273 alch_matrix_clear(); 274 alch_matrix_clear();
274 275
275 #if (1) 276 #if (1)
345 for ($x = 0; $x < $dbDims[0]; $x++) 346 for ($x = 0; $x < $dbDims[0]; $x++)
346 for ($y = 0; $y < $dbDims[1]; $y++) 347 for ($y = 0; $y < $dbDims[1]; $y++)
347 for ($z = 0; $z < $dbDims[2]; $z++) 348 for ($z = 0; $z < $dbDims[2]; $z++)
348 $results[$db[$x][$y][$z][0]]++; 349 $results[$db[$x][$y][$z][0]]++;
349 350
350 echo $results["!"]." found potions, ". 351 echo "<b>".$results["!"]."</b> found potions, ".
351 $results["?"]." active partial matches, ". 352 "<b>".$results["?"]."</b> active partial matches, ".
352 $results["-"]." combinations eliminated, ". 353 "<b>".$results["-"]."</b> combinations eliminated, ".
353 $results["."]." combinations untested.<br />\n"; 354 "<b>".$results["."]."</b> combinations untested.\n".
355 "</div>\n";
354 356
355 357
356 function printItem($x, $y, $z, $s, &$index) 358 function printItem($x, $y, $z, $s, &$index)
357 { 359 {
358 global $dbNames, $db; 360 global $dbNames, $db;
371 $s = $db[$x][$y][$z]; 373 $s = $db[$x][$y][$z];
372 if ($s[0] == "!") 374 if ($s[0] == "!")
373 printItem($x, $y, $z, substr($s, 1), $index); 375 printItem($x, $y, $z, substr($s, 1), $index);
374 } 376 }
375 377
376 ?> 378 echo "<div id=\"controls\">Change index key to ";
377 <p> 379 foreach ($dbModes as $id => $data)
378 Change index key to [<a href="?org=0">organs</a>] [<a href="?min=0">minerals</a>] [<a href="?herb=0">herbs</a>] [<a href="?list">Potion list</a>] 380 echo "[<a href=\"?".$id."=0\">".$data[2]."</a>] ";
379 </p> 381 echo "</div>\n";
380 <?
381 382
382 if ($mode == "list") 383 if ($mode == "list")
383 { 384 {
384 $index = 0; 385 $index = 0;
385 echo "<h1>".$dbModes[$mode][0]." view (".$dbNames[$dbModes[$mode][1]][$active].")</h1> 386 echo "<h1>".$dbModes[$mode][0]." view (".$dbNames[$dbModes[$mode][1]][$active].")</h1>
433 else 434 else
434 { 435 {
435 alch_matrix_print($mode, $active); 436 alch_matrix_print($mode, $active);
436 ?> 437 ?>
437 438
438 <table border="1" cellspacing="1"> 439 <table id="legend" border="1" cellspacing="1">
439 <tr><th colspan="2" class="noframe">Legend</th></tr> 440 <tr><th colspan="2" class="noframe">Legend</th></tr>
440 <tr><td width="10%" class="notres">&nbsp;</td><th class="noframe">Not researched yet</th></tr> 441 <tr><td width="10%" class="notres">&nbsp;</td><th class="noframe">Not researched yet</th></tr>
441 <tr><td class="nomatch">-</td><th class="noframe">No match</th></tr> 442 <tr><td class="nomatch">-</td><th class="noframe">No match</th></tr>
442 <tr><td class="nomark">-</td><th class="noframe">Marked to no potion by another no match.</th></tr> 443 <tr><td class="nomark">-</td><th class="noframe">Marked to no potion by another no match.</th></tr>
443 <tr><td class="noclose">-</td><th class="noframe">2 materials match, marked as no potion by another no match.</th></tr> 444 <tr><td class="noclose">-</td><th class="noframe">2 materials match, marked as no potion by another no match.</th></tr>