changeset 1007:e7e2a8c4b496

Sync.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 18 Jun 2010 11:56:28 +0000
parents d6a110dfc77f
children b75992a1545e
files www/index.php www/info.php www/quests.php
diffstat 3 files changed, 35 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/www/index.php	Fri Jun 18 11:55:35 2010 +0000
+++ b/www/index.php	Fri Jun 18 11:56:28 2010 +0000
@@ -178,8 +178,10 @@
 printTR($n++, "hcbat", "HCBat map");
 echo "  <td>";
 printFileTD("hcbat.htm", "XHTML+JS", FALSE);
-echo "</td><td>[<a href=\"loc.php?n=hcbat\">Locations</a>] [<a href=\"loc.php?n=hcbat&amp;c\">PCities</a>]</td>\n";
-echo " </tr>\n";
+echo "</td><td>[<a href=\"loc.php?n=hcbat\">Locations</a>] ".
+"[<a href=\"loc.php?n=hcbat&amp;c\">PCities</a>] ".
+"[<a href=\"quests.php?hcbat\">Quests</a>] ".
+"</td>\n</tr>\n";
 ?>
 </table>
 
--- a/www/info.php	Fri Jun 18 11:55:35 2010 +0000
+++ b/www/info.php	Fri Jun 18 11:56:28 2010 +0000
@@ -66,8 +66,8 @@
 
 /* Print table of wizards
  */
-foreach ($locTable as $key => $value) {
-  foreach ($value["coders"] as $wiz) {
+foreach ($locTable as $location) {
+  foreach ($location["coders"] as $wiz) {
     $name = $wiz["name"];
     if (!isset($wizTable[$name]))
       $wizTable[$name] = array("name" => $name);
@@ -76,34 +76,35 @@
 }
 
 if (count($wizTable) > 0) {
-  /* Make alphabetical table
+  /* Make alphabetically sorted table of wizards
    */
-  foreach ($wizTable as $key => $value)
-    $alphaTable[$key[0]][] = $value;
+  foreach ($wizTable as $alpha => $data)
+    $alphaTable[$alpha[0]][] = $data;
 
   ksort($alphaTable, SORT_STRING);
 
 
-  /* Print wizards per first character
+  /* Print wizards alphabetically per first character of name
    */
   $totalWiz = 0;
   $maxRow = 6;
-  foreach ($alphaTable as $key => $value) {
-    if (count($value) > 0) {
-      asort($value);
-      echo "<h3><a name=\"".strtolower($key)."\"></a>".$key."</h3>\n";
+  foreach ($alphaTable as $alpha => $data) {
+    if (count($data) > 0) {
+      asort($data);
+      echo "<h3><a name=\"".strtolower($alpha)."\"></a>".$alpha."</h3>\n";
       echo "<table class=\"loc\" width=\"95%\">\n";
       $n = 0;
-      while (list($ik, $iv) = each($value)) {
+      
+      foreach ($data as $wizard) {
         if ($n == 0) echo " <tr>\n";
         
         $totalWiz++;
 
         printf("  <td width=\"%d%%\" style=\"background: %s;\"><a href=\"loc.php?a=%s\">%s</a> <span style=\"color: #f80;\">",
-          (100 / $maxRow), (count($iv) > 2 || isset($iv["desc"])) ? "#474" : "#744", $iv["name"], $iv["name"]);
+          (100 / $maxRow), (count($wizard) > 2 || isset($wizard["desc"])) ? "#474" : "#744", $wizard["name"], $wizard["name"]);
 
-        if (isset($iv["areas"]))
-          echo " (".$iv["areas"].")";
+        if (isset($wizard["areas"]))
+          echo " (".$wizard["areas"].")";
 
         echo "</span></td>\n";
         
--- a/www/quests.php	Fri Jun 18 11:55:35 2010 +0000
+++ b/www/quests.php	Fri Jun 18 11:56:28 2010 +0000
@@ -3,7 +3,15 @@
 require "common.inc.php";
 
 printPageHeader($pageTitle." - Quests");
-$locTable = readLocationFiles(FALSE);
+
+if (isset($_GET["hcbat"])) {
+  $locTable = array();
+  parseLocFile("hcbat", $locTable, FALSE, "C");
+  $hcbat = TRUE;
+} else {
+  $locTable = readLocationFiles(FALSE);
+  $hcbat = FALSE;
+}
 
 ?>
 <h1>BatMUD Quests</h1>
@@ -50,7 +58,7 @@
 
 function printQuestData($name, &$area)
 {
-  global $batQuestURL, $specialList, $continentList;
+  global $batQuestURL, $specialList, $continentList, $hcbat;
   echo
   "<td><a href=\"".$batQuestURL.urlencode($name)."\">".chentities($name)."</a></td>".
   "<td class=\"".$area["continent"]."\">";
@@ -60,7 +68,9 @@
     printURL($area["continent"].".html#loc".$area["x"]."_".$area["y"]);
     echo chentities($area["name"])."</a>";
   }
-  echo "</td><td>".$continentList[$area["continent"]][0]."</td>";
+  echo "</td>";
+  if (!$hcbat)
+    echo "<td>".$continentList[$area["continent"]][0]."</td>";
 }
 
 //========================================================================
@@ -76,8 +86,8 @@
   " <tr>\n".
   "  <th>Level</th>\n".
   "  <th>Quest name</th>\n".
-  "  <th>Location</th>\n".
-  "  <th>Continent</th>\n".
+  "  <th>Location</th>\n";
+  ($hcbat ? "" : "  <th>Continent</th>\n").
   " </tr>\n";
   
   while (list($level, $quests) = each($lqTable)) {
@@ -106,7 +116,7 @@
   " <tr>\n".
   "  <th>Quest name</th>\n".
   "  <th>Location</th>\n".
-  "  <th>Continent</th>\n".
+  ($hcbat ? "" : "  <th>Continent</th>\n").
   " </tr>\n";
   
   while (list($name, $area) = each($aqTable)) {