Mercurial > hg > batmud > maputils
annotate www/quests.php @ 2769:e39dc8ee9e4a
Minor code cleanups, remove useless counting.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 13 Mar 2024 13:51:40 +0200 |
parents | 0556b65f137b |
children | 2b85092046b8 |
rev | line source |
---|---|
1646
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
1 <?php |
609 | 2 require "config.inc.php"; |
1272 | 3 require "world.inc.php"; |
609 | 4 require "common.inc.php"; |
5 | |
1007 | 6 |
2034 | 7 if (($hcbat = isset($_GET["hcbat"]))) |
1323 | 8 { |
1007 | 9 $locTable = array(); |
2037
e82ba6f55708
Refactor how the location filtering works internally to use proper LOC flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
2034
diff
changeset
|
10 mpParseLocFile("hcbat", $locTable, FALSE, FALSE, 0); |
1323 | 11 } |
12 else | |
13 { | |
2037
e82ba6f55708
Refactor how the location filtering works internally to use proper LOC flags.
Matti Hamalainen <ccr@tnsp.org>
parents:
2034
diff
changeset
|
14 $locTable = mpParseLocFiles(FALSE); |
1007 | 15 } |
609 | 16 |
1393 | 17 |
18 function printQuestData($name, &$area) | |
19 { | |
20 global $batQuestURL, $continentList, $hcbat; | |
21 echo | |
22 "<td><a href=\"".$batQuestURL.urlencode($name)."\">".chentities($name)."</a></td>". | |
23 "<td class=\"".$area["continent"]."\">". | |
2272
0556b65f137b
Cleanups in the web code, show location type again in some places.
Matti Hamalainen <ccr@tnsp.org>
parents:
2037
diff
changeset
|
24 mpGetMapLink($area, !isset($continentList[$area["continent"]]) || $continentList[$area["continent"]][CTI_HAS_MAP], TRUE, FALSE). |
1393 | 25 "</td>". |
2032
d9c15f7ae4c4
Add defines for continent list array index constants and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
2015
diff
changeset
|
26 ($hcbat ? "" : "<td><a href=\"loc.php?n=".$area["continent"]."\">".$continentList[$area["continent"]][CTI_NAME]."</a></td>"); |
1393 | 27 } |
28 | |
29 | |
813 | 30 // Create quest data tables |
1395 | 31 $lqTable = array(); |
32 $aqTable = array(); | |
2015
135b2b595e2c
Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
1979
diff
changeset
|
33 |
1395 | 34 foreach ($locTable as $loc) |
35 if (isset($loc["freeform"])) | |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
36 { |
1395 | 37 if (preg_match_all("/LQ([0-9]+) *\"([^\"]+)\"/", $loc["freeform"], $matches, PREG_SET_ORDER)) |
1323 | 38 { |
1395 | 39 foreach ($matches as $key => $val) |
40 $lqTable[intval($val[1])][$val[2]] = $loc; | |
609 | 41 } |
1395 | 42 if (preg_match_all("/AQ *\"([^\"]+)\"/", $loc["freeform"], $matches, PREG_SET_ORDER)) |
43 { | |
44 foreach ($matches as $key => $val) | |
45 $aqTable[$val[1]] = $loc; | |
46 } | |
47 } | |
2015
135b2b595e2c
Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
1979
diff
changeset
|
48 |
1395 | 49 ksort($lqTable, SORT_NUMERIC); |
50 ksort($aqTable, SORT_STRING); | |
609 | 51 |
1646
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
52 |
813 | 53 //======================================================================== |
1687 | 54 mpPrintPageHeader($pageTitle." - Quests"); |
1646
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
55 |
609 | 56 echo |
1646
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
57 "<h1>BatMUD Quests</h1>\n". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
58 "\n". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
59 "<div class=\"attnbox\">\n". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
60 "<b>NOTICE!</b> The information herein may be considered as a mild \"spoiler\", ". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
61 "but I've made it available for the reason that some quest descriptions are rather ". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
62 "vague, confusing and in (rare) cases deprecated. <b>You should be aware that this list ". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
63 "does not include all quests and never will, for reasons both technical and ethical</b>. ". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
64 "Please refer to <a href=\"http://www.bat.org/help/quests\">the official BatMUD quest list</a> ". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
65 "for full details.\n". |
2cbce82aa3c3
Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1620
diff
changeset
|
66 "</div>\n". |
1393 | 67 "<div class=\"quests\">\n". |
68 " <h2>Level Quests</h2>\n"; | |
609 | 69 |
1323 | 70 if (count($lqTable) > 0) |
71 { | |
609 | 72 echo |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1646
diff
changeset
|
73 " <table class=\"locTable quests\">\n". |
1393 | 74 " <tr>\n". |
75 " <th>Level</th>\n". | |
76 " <th>Quest name</th>\n". | |
77 " <th>Location</th>\n". | |
78 ($hcbat ? "" : " <th>Continent</th>\n"). | |
79 " </tr>\n"; | |
2015
135b2b595e2c
Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
1979
diff
changeset
|
80 |
1323 | 81 foreach ($lqTable as $level => $quests) |
82 { | |
83 foreach ($quests as $name => $area) | |
84 { | |
1393 | 85 echo " <tr><td>".$level."</td>"; |
813 | 86 printQuestData($name, $area); |
87 echo "</tr>\n"; | |
609 | 88 } |
89 } | |
1393 | 90 echo |
91 " </table>\n". | |
2769
e39dc8ee9e4a
Minor code cleanups, remove useless counting.
Matti Hamalainen <ccr@tnsp.org>
parents:
2272
diff
changeset
|
92 " <p><b>".count($lqTable)."</b> level quests.</p>\n"; |
1393 | 93 } |
94 else | |
95 { | |
96 echo " <p><b>No level quests known!</b></p>\n"; | |
609 | 97 } |
98 | |
813 | 99 //======================================================================== |
609 | 100 |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
101 echo |
1393 | 102 "</div>\n". |
103 "<div class=\"quests\">\n". | |
104 " <h2>Area Quests</h2>\n"; | |
609 | 105 |
1323 | 106 if (count($aqTable) > 0) |
107 { | |
609 | 108 echo |
1677
9d51b4138e7d
CSS updates and related code changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1646
diff
changeset
|
109 " <table class=\"locTable quests\">\n". |
1393 | 110 " <tr>\n". |
111 " <th>Quest name</th>\n". | |
112 " <th>Location</th>\n". | |
113 ($hcbat ? "" : " <th>Continent</th>\n"). | |
114 " </tr>\n"; | |
2015
135b2b595e2c
Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents:
1979
diff
changeset
|
115 |
1323 | 116 foreach ($aqTable as $name => $area) |
117 { | |
813 | 118 echo " <tr>"; |
119 printQuestData($name, $area); | |
120 echo "</tr>\n"; | |
609 | 121 } |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
122 echo |
1393 | 123 " </table>\n". |
2769
e39dc8ee9e4a
Minor code cleanups, remove useless counting.
Matti Hamalainen <ccr@tnsp.org>
parents:
2272
diff
changeset
|
124 " <p><b>".count($aqTable)."</b> area quests.</p>\n"; |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
125 } |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
126 else |
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
127 { |
1393 | 128 echo " <p><b>No area quests known!</b></p>\n"; |
609 | 129 } |
1393 | 130 echo "</div>\n"; |
1387
2b6b38e94bb2
Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
1323
diff
changeset
|
131 |
1891
68b784c7eae2
Get rid of mgeneric.inc.php here.
Matti Hamalainen <ccr@tnsp.org>
parents:
1687
diff
changeset
|
132 mpPrintPageFooter(); |
609 | 133 ?> |