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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
1 <?php
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 require "config.inc.php";
1272
Matti Hamalainen <ccr@tnsp.org>
parents: 1140
diff changeset
3 require "world.inc.php";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 require "common.inc.php";
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5
1007
Matti Hamalainen <ccr@tnsp.org>
parents: 926
diff changeset
6
2034
d8cbaa058754 Simplify.
Matti Hamalainen <ccr@tnsp.org>
parents: 2032
diff changeset
7 if (($hcbat = isset($_GET["hcbat"])))
1323
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
8 {
1007
Matti Hamalainen <ccr@tnsp.org>
parents: 926
diff changeset
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
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
11 }
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
12 else
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
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
Matti Hamalainen <ccr@tnsp.org>
parents: 926
diff changeset
15 }
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
1393
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
17
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
18 function printQuestData($name, &$area)
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
19 {
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
20 global $batQuestURL, $continentList, $hcbat;
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
21 echo
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
22 "<td><a href=\"".$batQuestURL.urlencode($name)."\">".chentities($name)."</a></td>".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
27 }
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
28
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
29
813
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
30 // Create quest data tables
1395
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
31 $lqTable = array();
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
32 $aqTable = array();
2015
135b2b595e2c Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1979
diff changeset
33
1395
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
34 foreach ($locTable as $loc)
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
35 if (isset($loc["freeform"]))
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1323
diff changeset
36 {
1395
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
37 if (preg_match_all("/LQ([0-9]+) *\"([^\"]+)\"/", $loc["freeform"], $matches, PREG_SET_ORDER))
1323
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
38 {
1395
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
39 foreach ($matches as $key => $val)
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
40 $lqTable[intval($val[1])][$val[2]] = $loc;
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 }
1395
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
42 if (preg_match_all("/AQ *\"([^\"]+)\"/", $loc["freeform"], $matches, PREG_SET_ORDER))
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
43 {
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
44 foreach ($matches as $key => $val)
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
45 $aqTable[$val[1]] = $loc;
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
46 }
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
47 }
2015
135b2b595e2c Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1979
diff changeset
48
1395
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
49 ksort($lqTable, SORT_NUMERIC);
eaadfc23248f Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1393
diff changeset
50 ksort($aqTable, SORT_STRING);
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
52
813
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
53 //========================================================================
1687
Matti Hamalainen <ccr@tnsp.org>
parents: 1677
diff changeset
54 mpPrintPageHeader($pageTitle." - Quests");
1646
2cbce82aa3c3 Use full <?php ?> tag, misc cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1620
diff changeset
55
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
67 "<div class=\"quests\">\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
68 " <h2>Level Quests</h2>\n";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69
1323
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
70 if (count($lqTable) > 0)
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
71 {
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
74 " <tr>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
75 " <th>Level</th>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
76 " <th>Quest name</th>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
77 " <th>Location</th>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
78 ($hcbat ? "" : " <th>Continent</th>\n").
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
79 " </tr>\n";
2015
135b2b595e2c Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1979
diff changeset
80
1323
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
81 foreach ($lqTable as $level => $quests)
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
82 {
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
83 foreach ($quests as $name => $area)
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
84 {
1393
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
85 echo " <tr><td>".$level."</td>";
813
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
86 printQuestData($name, $area);
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
87 echo "</tr>\n";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 }
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 }
1393
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
90 echo
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
93 }
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
94 else
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
95 {
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
96 echo " <p><b>No level quests known!</b></p>\n";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 }
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
813
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
99 //========================================================================
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1323
diff changeset
101 echo
1393
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
102 "</div>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
103 "<div class=\"quests\">\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
104 " <h2>Area Quests</h2>\n";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
1323
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
106 if (count($aqTable) > 0)
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
107 {
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
110 " <tr>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
111 " <th>Quest name</th>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
112 " <th>Location</th>\n".
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
113 ($hcbat ? "" : " <th>Continent</th>\n").
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
114 " </tr>\n";
2015
135b2b595e2c Trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 1979
diff changeset
115
1323
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
116 foreach ($aqTable as $name => $area)
f8d48a4556df Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1272
diff changeset
117 {
813
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
118 echo " <tr>";
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
119 printQuestData($name, $area);
Matti Hamalainen <ccr@tnsp.org>
parents: 735
diff changeset
120 echo "</tr>\n";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 }
1387
2b6b38e94bb2 Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1323
diff changeset
122 echo
1393
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
128 echo " <p><b>No area quests known!</b></p>\n";
609
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 }
1393
68429429c265 More work on cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1387
diff changeset
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
ff42dbb61d1c Updated.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 ?>