Mercurial > hg > batmud > maputils
view www/info.php @ 2763:78ad0e51b7b5
Improve wizards.txt parser, add functionality for specifying alternative /
additional names as some wizards have used more than one.
Also other improvements in wizard data handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 12 Mar 2024 15:47:58 +0200 |
parents | 164aa519640d |
children |
line wrap: on
line source
<?php require "config.inc.php"; require "world.inc.php"; require "common.inc.php"; /* Page start */ mpPrintPageHeader($pageTitle." - Wizards of the Realm"); echo "<h1>Wizards of the Realm</h1>\n". "<div class=\"attnbox\">\n". " <b>Notice #1</b>: The area counts are not really accurate, as the database MOSTLY ". "lists areas accessible from outworld. Thus areas only accessible via some ". "other fashion MIGHT not be listed. Also, maintainerships of some areas are not ". "clear, and may be credited to wrong wizard(s).\n". " <br />\n". "\n". " <b>Notice #2</b>: Not everyone who has once been immortal is listed. ". "Some purged and/or remorted wizards without known contributions are unlisted.\n". " <br />\n". "\n". " <b>Notice #3</b>: It is certainly possible, that some of this information is ". "incorrect. Sorry for that. Please report to ".burl("Ggr").", if you have Knowledge(tm).\n". "</div>\n". "<hr />\n". "<div style=\"text-align: center;\">\n". " <table class=\"locWizHasInfo\">\n". " <tr>\n". " <td class=\"locWizHasDesc\">Entry has information about the wizard.</td>\n". " <td class=\"locWizHasNoDesc\">No wizard information entry.</td>\n". " </tr>\n". " </table>\n". "</div>\n"; $locTable = apcu_fetch("info_locTable"); if (empty($locTable)) { $locTable = mpParseLocFiles(TRUE); apcu_store("info_locTable", $locTable, 3600); } $wizTable = apcu_fetch("wizTable"); if (empty($wizTable)) { $wizTable = mpReadWizInfoFiles(); apcu_store("wizTable", $wizTable, 3600); } function wizardSort($a, $b) { return strcmp($a["name"], $b["name"]); } // Get area counts foreach ($locTable as $location) { foreach ($location["authors"] as $wiz) { $name = $wiz["name"]; // Many wizards do not have an entry in wizard info table if (!isset($wizTable[$name])) { $wizTable[$name] = [ "name" => $name, "names" => [], "areas" => 0, ]; } $wizTable[$name]["areas"]++; } } // Make alphabetically sorted table of wizards foreach ($wizTable as $name => $data) $alphaTable[$name[0]][$name] = $data; ksort($alphaTable, SORT_STRING); // Print wizards alphabetically per first character of name foreach ($alphaTable as $alpha => $data) if (count($data) > 0) { usort($data, "wizardSort"); $letter = strtoupper($alpha); echo "<h3><a id=\"ch".$letter."\"></a>".$letter."</h3>\n"; echo "<div class=\"locTable\">\n"; foreach ($data as $name => $wizard) { echo " <div class=\"locWizard ". (isset($wizard["desc"]) ? "locWizHasDesc" : "locWizHasNoDesc")."\">". "<a href=\"loc.php?a=".$wizard["name"]."\">".$wizard["name"]."</a>"; if ($wizard["areas"] > 0) echo " <span class=\"locWizNumAreas\">(".$wizard["areas"].")</span>"; echo "</div>\n"; } echo "</div>\n"; } echo "<p><b>".count($wizTable)."</b> wizards.</p>\n". "</div>\n"; // end of contents div // Print out the alpha link index mpPrintExtraBoxAlphaList("ch", $alphaTable); mpPrintPageFooter(FALSE); ?>