# HG changeset patch # User Matti Hamalainen # Date 1451451528 -7200 # Node ID fedf17494a35fbe2ad0d545d45a2ca786834d559 # Parent 72bf6267e34f0135ca3f576222dc9c325796bc6b Various cleanups. diff -r 72bf6267e34f -r fedf17494a35 materials/info.php --- a/materials/info.php Wed Dec 30 06:58:07 2015 +0200 +++ b/materials/info.php Wed Dec 30 06:58:48 2015 +0200 @@ -1,30 +1,46 @@ ["Organic + cloth (sewing)", 0, 1], - 1 => ["Wood + bone (carpentry)", 5, 3], - 2 => ["Metal + alloy (blacksmithing)", 4, 7], - 3 => ["Stone (masonry)", 6, -1], - 4 => ["Gem (gemcutting)", 10, -1], - 5 => ["Inorganic (sculpture)", 8, -1], - 6 => ["Glass (glassblowing)", 9, -1], - - 7 => ["Organic", 0, -1], - 8 => ["Wood", 5, -1], - 9 => ["Metal", 4, -1], - - 10 => ["Cloth", -1, 1], - 11 => ["Bone", -1, 3], - 12 => ["Alloy", -1, 7], +$contributors = +[ + "Hair", "Malacoda", "Kiomet", "Aegenor", "Gileon", "Corto", ]; -require "mgeneric.inc.php"; -require "materials.inc.php"; -require "alloys.inc.php"; +$matTypeTable = +[ + 0 => ["Organic + cloth (sewing)" , 0, 1], + 1 => ["Wood + bone (carpentry)" , 5, 3], + 2 => ["Metal + alloy (blacksmithing)" , 4, 7], + 3 => ["Stone (masonry)" , 6, -1], + 4 => ["Gem (gemcutting)" , 10, -1], + 5 => ["Inorganic (sculpture)" , 8, -1], + 6 => ["Glass (glassblowing)" , 9, -1], + + 7 => ["Organic" , 0, -1], + 8 => ["Wood" , 5, -1], + 9 => ["Metal" , 4, -1], + + 10 => ["Cloth" , -1, 1], + 11 => ["Bone" , -1, 3], + 12 => ["Alloy" , -1, 7], +]; + + +$matReliability = +[ + [ 1, 1, "1 test", "background: #a00; color: white;" ], + [ 2, 3, "2-3 tests", "background: #750; color: white;" ], + [ 4, 6, "4-6 tests", "background: #c90; color: black;", "color: black;" ], + [ 7, 9, "7-10 tests", "background: #080; color: white;" ], + [ 10, 9999, "10 or more", "background: #0c0; color: black;", "color: black;" ], +]; function stGetMatLink($mat, $title = "", $extra = "") @@ -34,19 +50,10 @@ } -$reliability = [ - [ 1, 1, "1 test", "background: #a00; color: white;" ], - [ 2, 4, "2-4 tests", "background: #750; color: white;" ], - [ 5, 9, "5-9 tests", "background: #c90; color: black;", "color: black;" ], - [ 10, 19, "10-19 tests", "background: #080; color: white;" ], - [ 20, 1000, "20 or more", "background: #0c0; color: black;", "color: black;" ], -]; - - -function stGetValueStyle($n) +function stGetReliabilityStyle($n) { - global $reliability; - foreach ($reliability as $chk) + global $matReliability; + foreach ($matReliability as $chk) { if ($n >= $chk[0] && $n <= $chk[1]) return " class=\"hits".$chk[0]."to".$chk[1]."\""; @@ -70,7 +77,7 @@ $extraCSS = []; $extraInfo = []; -foreach ($reliability as $chk) +foreach ($matReliability as $chk) { $tmps = "hits".$chk[0]."to".$chk[1]; $extraCSS[] = " td.".$tmps.", .".$tmps." { ".$chk[3]." }"; @@ -106,10 +113,10 @@ "
  • There may be errors, and lots of combinations are not researched yet.
  • \n". "
  • The cell colour reflects how \"reliable\" the information is: ".implode(", ", $extraInfo).".
  • \n"; -if (isset($people) && count($people) > 0) +if (isset($contributors) && count($contributors) > 0) { $tmp = []; - foreach ($people as $key) + foreach ($contributors as $key) $tmp[] = "".$key.""; echo "
  • Thanks to the following people for providing alloying data: ".join(", ", $tmp).".
  • \n"; } @@ -249,7 +256,7 @@ { if (list($a, $b) = each($value)) { - echo "".stGetMatLink($a).""; + echo "".stGetMatLink($a).""; } } echo "\n"; @@ -349,7 +356,7 @@ // , " ".$b.""); } echo - " 1 ? " mitalic" : "").">". + " 1 ? " mitalic" : "").">". join(" / ", $slist).""; } else