Mercurial > hg > batmud > misc
changeset 252:3193bf205f5b misc
Remove old file.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 07 Mar 2015 23:16:51 +0200 |
parents | caad98cd707a |
children | 1eca10751695 |
files | materials/alloy.php |
diffstat | 1 files changed, 0 insertions(+), 282 deletions(-) [+] |
line wrap: on
line diff
--- a/materials/alloy.php Sat Mar 07 23:12:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,282 +0,0 @@ -<? -$pageTitle = "Pupunen BatMUD Alloy Browser"; -$pageIndex = "alloy.php"; - -require "mcommon.inc.php"; -require "materials.inc.php"; -require "alloys.inc.php"; - - -$showOnly = isset($_GET["o"]) ? intval($_GET["o"]) : 0; - -if (isset($_GET["m"])) { - $showMat = strtolower($_GET["m"]); - $showMatName = strtoupper(substr($showMat,0,1)).substr($showMat, 1); -} - -if (isset($_GET["swap"])) - $swapRows = $_GET["swap"]; -else - $swapRows = array(); - - -function matLink($mat, $title = "") { - $tmp = ($title != "") ? " title=\"".htmlentities($title)."\"" : ""; - return "<a href=\"?m=".urlencode($mat)."\"".$tmp.">".htmlentities($mat)."</a>"; -} - - -function addValueStyle($n) -{ - if ($n >= 20) $s = 20; - else - if ($n >= 10) $s = 10; - else - if ($n >= 5) $s = 5; - else - if ($n > 0) $s = 0; - else - return ""; - - return " class=\"hits".$s."\""; -} - - -printPageHeader($pageTitle, " - <meta name=\"robots\" content=\"nofollow\" /> - <style type=\"text/css\"> - .hits20 a { color: black; } - .hits20 { background: #0c0; color: black; } - .hits10 { background: #080; } - .hits5 { background: #750; } - .hits0 { background: #420; } - .nohits { background: black; } - </style> -"); -?> -<h1><? echo $pageTitle; ?></h1> -<form action="<? echo $pageIndex; ?>" method="get"> -<table class="optionsTable" width="100%"> - <tr> - <th width="25%">Show type</th> - <td rowspan="3" class="infobox"> - [<a href="<? echo $pageIndex; ?>">Reset/Clear</a>] [<a href="index.php">Material browser</a>] - <br /> - <ul> - <li><b>Also available in <a href="alloys.txt">ASCII plaintext format</a>.</b></li> - <li>Only 2-material alloys are currently supported by this browser. - <b>Yes, I know some you think that this project is "useless".</b></li> - <li>There may be bugs and lots of combinations are not researched yet.</li> -<!-- - <li><b>You can now help! We have a <a href="submit.php">submission form</a>!</b> - We also have <a href="stats.php">submitter statistics</a>.</li> ---> - <li>The cell colour reflects how "reliable" the information is: <b><span class="hits0">1-4 tries</span>, <span class="hits5">5-9 tries</span>, - <span class="hits10">10-19 tries</span>, <span class="hits20">20 or more</span></b>.</li> - </ul> - </td> - </tr> - <tr> - <td class="icenter"> - <select name="o"> -<? -$typeTable = array( - 0 => array("Organic + cloth (sewing)", 0, 1), - 1 => array("Wood + bone (carpentry)", 5, 3), - 2 => array("Metal + alloy (blacksmithing)", 4, 7), - 3 => array("Stone (masonry)", 6, -1), - 4 => array("Gem (gemcutting)", 10, -1), - 5 => array("Inorganic (sculpture)", 8, -1), - 6 => array("Glass (glassblowing)", 9, -1), - - 7 => array("Organic", 0, -1), - 8 => array("Wood", 5, -1), - 9 => array("Metal", 4, -1), - - 10 => array("Cloth", -1, 1), - 11 => array("Bone", -1, 3), - 12 => array("Alloy", -1, 7), -); - -foreach ($typeTable as $key => $value) { - echo " <option value=\"$key\""; - if ($showOnly == $key) - echo " selected=\"selected\""; - echo ">".htmlentities($value[0])."</option>\n"; -} - -?> - </select> - </td> - </tr> - <tr> - <td class="icenter"><input type="submit" value=" Filter " class="isubmit" /></td> - </tr> -</table> -</form> -<? -if (isset($showMat)) { - if (!isset($matTable[$showMat])) { - echo "<h2>Error! No such material '".$showMatName."'</h2>\n". - "<p>Material is not known. Check spelling.</p>\n"; - } else { - echo "<h2>".$showMatName."</h2>\n". - "<table width=\"95%\">\n". - "<tr>"; - - $n = 0; - foreach ($matTable[$showMat] as $key => $val) { - echo "<th>".htmlentities($transNameTable[$key+1])."</th><td>"; - if (is_array($val)) { - reset($val); - if (list($nam, $lode) = each($val)) - echo htmlentities($transTable[$key][$lode]); - - while (list($nam, $lode) = each($val)) - echo ", ".htmlentities($transTable[$key][$lode]); - } else { - echo htmlentities($transTable[$key][$val]); - } - echo "</td>"; - if ($n++ >= 2) { echo "</tr>\n<tr>"; $n = 0; } - } - - echo "</tr>\n</table>\n"; - - echo "<h3>Alloy combinations</h3>\n"; - if (isset($alloyRevTable[$showMat])) { - echo "<ul>\n"; - - foreach ($alloyRevTable[$showMat] as $mat => $value) { - echo " <li>".matLink($mat)." <b>+</b> "; - - reset($value); - if (list($a, $b) = each($value)) - echo matLink($a); - - while (list($a, $b) = each($value)) - echo " <b>|</b> ".matLink($a); - - echo "<b> = ".htmlentities($showMat)."</b></li>\n"; - } - echo "</ul>\n"; - } else { - echo "<p>No known alloy combinations.</p>\n"; - } - -/* - $typeMats = array(); - foreach ($matTable as $name => $data) { - if ($data[14] == $matTable[$showMat][14] && $name != $showMat) - $typeMats[] = $name; - } - - echo "Full mix: "; - if (list($a, $b) = each($typeMats)) - echo matLink($b); - - while (list($a, $b) = each($typeMats)) - echo " <b>+</b> ".matLink($b); - echo "<br />\n"; -*/ - - echo "<h3>Mixtable</h3>\n"; - if (count($alloyTable[$showMat]) > 0) { - echo - "<table class=\"matTable\">". - " <tr>\n". - " <th>+</th>\n"; - foreach ($alloyTable[$showMat] as $key => $value) { - echo "<th>".matLink($key)."</th>\n"; - } - echo " </tr>\n". - " <tr><th>".htmlentities($showMat)."</th>"; - foreach ($alloyTable[$showMat] as $key => $value) - if (list($a, $b) = each($value)) { - echo "<td ".addValueStyle($b).">".matLink($a)."</td>"; - } - echo "</tr></table>\n"; - } else { - echo "<p>No mixtable entries.</p>\n"; - } - } -} -else -{ - /* - * Print alloy table for given material type - */ - // Filter table from maintable matching desired material type(s) - $currTable = array(); - foreach ($matTable as $name => $data) { - if ($data[14] == $typeTable[$showOnly][1] || $data[14] == $typeTable[$showOnly][2]) - $currTable[] = $name; - } - - // Swap desired rows - if (count($swapRows) > 0) { - $str = ""; - $nkeys = count($currTable); - foreach ($swapRows as $from => $to) - if ($from >= 0 && $from < $nkeys && $to >= 0 && $to < $nkeys && $to != $from) { - if ($str != "") $str .= ", "; - $str .= "$from <=> $to"; - $tmp = $currTable[$from]; - $currTable[$from] = $currTable[$to]; - $currTable[$to] = $tmp; - } - if ($str != "") - echo "<p>Swapped rows: ".$str."</p>\n"; - } - - - // Print out the table - echo "<table class=\"alloyTable\">". - " <tr>\n". - " <th>-</th>\n"; - - foreach ($currTable as $name) { - echo " <th>".matLink($name)."</th>\n"; - } - echo " </tr>\n"; - - foreach ($currTable as $mat1) { - echo " <tr><th>".matLink($mat1)."</th>"; - foreach ($currTable as $mat2) { - - if (isset($alloyTable[$mat1][$mat2])) - $tmp = $alloyTable[$mat1][$mat2]; - else if (isset($alloyTable[$mat2][$mat1])) - $tmp = $alloyTable[$mat2][$mat1]; - else - unset($tmp); - - $tag = ($mat1 == $mat2) ? "th" : "td"; - - if (isset($tmp)) { - arsort($tmp); - $value = 0; - foreach ($tmp as $a => $b) - $value += $b; - - $note = count($tmp) > 1 ? " [UNSTABLE]" : ""; - - echo "<".$tag.addValueStyle($value). - (count($tmp) > 1 ? " style=\"font-style:italic;\">" : ">"); - - foreach ($tmp as $a => $b) { - echo matLink($a, $b." successful alloys (".$mat1." + ".$mat2." = ".$a.")".$note)." "; - } - - echo "</".$tag.">"; - - } else - echo "<".$tag." class=\"nohits\">-</".$tag.">"; - } - echo "</tr>\n"; - } - echo "</table>\n"; -} - -printPageFooter(); -?>