-
Notifications
You must be signed in to change notification settings - Fork 2
/
zone.php
408 lines (362 loc) · 12.6 KB
/
zone.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
<?php
include('./includes/constantes.php');
include('./includes/config.php');
include($includes_dir.'mysql.php');
$name = (isset($_GET['name']) ? addslashes($_GET['name']) : '');
$order = (isset($_GET['order']) ? addslashes($_GET["order"]) : 'name');
$mode= (isset($_GET['mode']) ? addslashes($_GET["mode"]) : 'npcs');
if ($UseCustomZoneList==TRUE && $name != '')
{
$ZoneNote=GetFieldByQuery("note","SELECT note FROM $tbzones WHERE short_name='$name'");
if (substr_count(strtolower($ZoneNote), "disabled") >= 1)
{
header("Location: index.php");
exit();
}
}
$Title=GetFieldByQuery("long_name","SELECT long_name FROM $tbzones WHERE short_name='$name'")." ($name)";
include($includes_dir.'headers.php');
include($includes_dir.'functions.php');
if (!isset($name)) { print "<script>document.location=\"zones.php\";</script>"; }
$ZoneDebug=FALSE; // this is new in 0.5.3 but undocumented, it is for world builders
print "<table border=0 width=100%><tr valign=top><td width=100%>";
$query="SELECT $tbzones.*
FROM $tbzones
WHERE $tbzones.short_name='$name'";
$result=mysql_query($query) or message_die('zones.php','MYSQL_QUERY',$query,mysql_error());
$zone=mysql_fetch_array($result);
print "<center><table border=0 width=0%><tr valign=top><td>";
print "<p><b>Succor point : X (</b>".floor($zone["safe_x"]).") Y (".floor($zone["safe_y"]).") Z (".floor($zone["safe_z"]). ")";
if ($zone["minium_level"]>0) { print "<br><b>Minimum level : </b>".floor($zone["minium_level"]); }
print "</td>";
if (file_exists($maps_dir.$name.".jpg"))
{
if (!file_exists($maps_url.$name."._tn.jpg")) { make_thumb($maps_dir.$name.".jpg"); }
print "<td> </td><td align=center><a href=".$maps_url.$name.".jpg><img src=".$maps_url.$name."._tn.jpg width=120 height=80 border=0></a><br>
<a href=".$maps_url.$name.".jpg target=_new>Popup map</a>
</td>";
}
print "</tr></table></center>";
if ($mode=="npcs") {
////////////// NPCS
$query="SELECT $tbnpctypes.id,$tbnpctypes.class,$tbnpctypes.level,$tbnpctypes.trackable,$tbnpctypes.maxlevel,$tbnpctypes.race,$tbnpctypes.name,$tbnpctypes.maxlevel,$tbnpctypes.loottable_id
FROM $tbnpctypes,$tbspawn2,$tbspawnentry,$tbspawngroup";
$query.=" WHERE $tbspawn2.zone='$name'
AND $tbspawnentry.spawngroupID=$tbspawn2.spawngroupID
AND $tbspawnentry.npcID=$tbnpctypes.id
AND $tbspawngroup.id=$tbspawnentry.spawngroupID";
if ($HideInvisibleMen==TRUE) { $query.=" AND $tbnpctypes.race!=127 AND $tbnpctypes.race!=240"; }
if ($GroupNpcsByName==TRUE)
{
$query.=" GROUP BY $tbnpctypes.name";
}
else
{
$query.=" GROUP BY $tbnpctypes.id";
}
$query.=" ORDER BY $order";
$result=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
print "<center>";
if (mysql_num_rows($result) > 0)
{
print "<p>Bestiary<p><table border=0 width='0%' cellpadding='5' cellspacing='0'><tr>";
if ($ZoneDebug==TRUE) { print "<td class='menuh'><b><a href=$PHP_SELF?name=$name&order=id>Id</a></b></td>"; }
print "<td align='left' class='menuh'><b><a href=$PHP_SELF?name=$name&order=name>Name</a></b></td>";
if ($ZoneDebug==TRUE) { print "<td class='menuh' align='left'><b><a href=$PHP_SELF?name=$name&order=loottable_id>Loottable</a></b></td>"; }
print "<td align='left' class='menuh'><b><a href=$PHP_SELF?name=$name&order=level>Level Range</a></b></td>";
print "<td align='left' class='menuh'><b><a href=$PHP_SELF?name=$name&order=race>Race</a></b></td>";
print "<td align='left' class='menuh'><b>Type</b></td>";
$RowClass = "lr";
while ($row=mysql_fetch_array($result))
{
if ((ReadableNpcName($row["name"])) != '' && ($row["trackable"] > 0 || $TrackableNPCsOnly==FALSE))
{
print "<tr class='" .$RowClass. "'>";
if ($ZoneDebug==TRUE) { print "<td>".$row["id"]."</td>"; }
print "<td><a href=npc.php?id=".$row["id"].">".ReadableNpcName($row["name"])."</a>";
if ($ZoneDebug==TRUE) { print "</td><td>".$row["loottable_id"]; }
if($row['maxlevel'] == 0){
$MaxLevel = $row['level'];
}
else{
$MaxLevel = $row['maxlevel'];
}
print "</td><td align=left>".$row["level"]." - ". $MaxLevel . " </td>";
print "<td align=left>".$dbiracenames[$row["race"]]."</td>";
print "<td align=left>".NpcTypeFromName($row["name"])."</td></tr>";
if ($RowClass == "lr")
{
$RowClass = "dr";
}
else
{
$RowClass = "lr";
}
}
}
print "</table>";
}
else
{
print "<br><b>No NPCs Found</b>";
}
print "</center>";
} // end npcs
if ($mode=="items") {
$ItemsFound = 0;
$EquiptmentTable = "<p>Equipment List<p><table border=0><tr>
<th class='menuh'>Icon</a></th>
<th class='menuh'><a href=$PHP_SELF?name=$name&mode=items&order=Name>Name</a></th>
<th class='menuh'><a href=$PHP_SELF?name=$name&mode=items&order=itemtype>Item type</a></th>
</tr>";
$query="SELECT $tbnpctypes.id";
$query.=" FROM $tbnpctypes,$tbspawn2,$tbspawnentry,$tbspawngroup";
$query.=" WHERE $tbspawn2.zone='$name'
AND $tbspawnentry.spawngroupID=$tbspawn2.spawngroupID
AND $tbspawnentry.npcID=$tbnpctypes.id
AND $tbspawngroup.id=$tbspawnentry.spawngroupID";
if ($MerchantsDontDropStuff==TRUE)
{
foreach($dbmerchants AS $c) { $query.=" AND $tbnpctypes.class!=$c"; }
}
$query.=" GROUP BY $tbnpctypes.id";
$result=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
$ItemsData = array();
$RowClass = "lr";
while ($row=mysql_fetch_array($result))
{
//# For each NPC in the zone...
$query="SELECT $tbitems.*";
$query.=" FROM $tbitems,$tbloottableentries,$tbnpctypes,$tblootdropentries";
if ($DiscoveredItemsOnly==TRUE)
{
$query.=",$tbdiscovereditems";
}
$query.=" WHERE $tbnpctypes.id=".$row["id"]."
AND $tbnpctypes.loottable_id=$tbloottableentries.loottable_id
AND $tbloottableentries.lootdrop_id=$tblootdropentries.lootdrop_id
AND $tblootdropentries.item_id=$tbitems.id";
if ($DiscoveredItemsOnly==TRUE)
{
$query.=" AND $tbdiscovereditems.item_id=$tbitems.id";
}
$query.=" GROUP BY $tbitems.id ORDER BY $tbitems.name";
$result2=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
if (mysql_num_rows($result2) > 0)
{
$ItemsFound = mysql_num_rows($result2);
}
while ($res=mysql_fetch_array($result2))
{
$ItemsData[$res["id"]] = $res;
}
}
$ToolTips = "";
$sortby = $order;
if ($sortby == "name")
{
$sortby = "Name";
}
// Sort the Array by the desired field of the items table
$tmp = Array();
foreach($ItemsData as &$MultiKey)
{
$tmp[] = &$MultiKey[$sortby];
}
array_multisort($tmp, $ItemsData);
foreach ($ItemsData as $key => $ItemData)
{
if ($ItemData["itemtype"]>0)
{
$ItemType=$dbitypes[$ItemData["itemtype"]];
}
else
{
if ($ItemData["bagslots"]>0)
{
$ItemType="Bag";
}
else
{
$ItemType=$dbitypes[$ItemData["itemtype"]];
}
}
$EquiptmentTable .= "<tr class='".$RowClass."'>
<td><img src='".$icons_url."item_".$ItemData["icon"].".gif' align='left'/>
<img src='".$images_url."spacer_1.png' align='left'/>
</td><td><a href=item.php?id=".$ItemData["id"]." id='" . $ItemData["id"] . "'>".$ItemData["Name"]."</a></td>
<td>".$ItemType."</td></tr>";
if ($RowClass == "lr")
{
$RowClass = "dr";
}
else
{
$RowClass = "lr";
}
}
$EquiptmentTable .= "</table>";
print "<center>";
if ($ItemsFound > 0)
{
print $EquiptmentTable;
foreach ($ItemsData as $key => $ItemData)
{
$ToolTips .= CreateToolTip($ItemData["id"], BuildItemStats($ItemData, 1));
}
print $ToolTips;
}
else
{
print "<br><b>No Items Found</b>";
}
print "</center>";
} // end items
if ($mode=="spawngroups") {
if ($DisplaySpawnGroupInfo==TRUE)
{
print "</center>";
$query="SELECT $tbspawngroup.*,$tbspawn2.x,$tbspawn2.y,$tbspawn2.z,$tbspawn2.respawntime
FROM $tbspawn2,$tbspawngroup
WHERE $tbspawn2.zone='$name'
AND $tbspawngroup.id=$tbspawn2.spawngroupID
ORDER BY $tbspawngroup.name ASC";
$result=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
if (mysql_num_rows($result) > 0)
{
while ($row=mysql_fetch_array($result))
{
print "<li><a href=spawngroup.php?id=".$row["id"].">".$row["name"]."</a> (".
floor($row["y"])." / ".floor($row["x"])." / ".floor($row["z"]).") (respawn time : ".
translate_time($row["respawntime"]).")<ul>";
$query="SELECT $tbspawnentry.npcID,$tbnpctypes.name,$tbspawnentry.chance,$tbnpctypes.level
FROM $tbspawnentry,$tbnpctypes
WHERE $tbspawnentry.npcID=$tbnpctypes.id
AND $tbspawnentry.spawngroupID=".$row["id"]."
ORDER BY $tbnpctypes.name ASC";
$result2=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
while ($res=mysql_fetch_array($result2))
{
print "<li><a href=npc.php?id=".$res["npcID"].">".$res["name"]."</a>, chance ".$res["chance"]."%";
print " (level ".$res["level"].")";
}
print "</ul>";
}
}
else
{
print "<center><br><b>No Spawns Found</b></center>";
}
print "<center>";
}
} // end spawngroups
if ($mode=="forage") {
$query="SELECT $tbitems.Name,$tbitems.id
FROM $tbitems,$tbforage,$tbzones
WHERE $tbitems.id=$tbforage.itemid
AND $tbforage.zoneid=$tbzones.zoneidnumber
AND $tbzones.short_name='$name'
ORDER BY $tbitems.Name ASC";
$result=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
print "<center>";
if (mysql_num_rows($result) > 0)
{
print "<p>Forageable Items<p><table border=1><tr>
<td class=tab_title>Name</a></td>
</tr>";
while ($row=mysql_fetch_array($result))
{
print "<tr><td><a href=item.php?id=".$row["id"].">".$row["Name"]."</a></td></tr>";
}
print "</table>";
}
else
{
print "<br><b>No Forageable Items Found</b>";
}
print "</center>";
} // end forage
if ($mode=="tasks") {
if ($DisplayTaskInfo==TRUE)
{
$ZoneID = GetFieldByQuery("zoneidnumber","SELECT zoneidnumber FROM zone WHERE short_name = '$name'");
$query="SELECT $tbtasks.id, $tbtasks.title, $tbtasks.startzone, $tbtasks.minlevel, $tbtasks.maxlevel, $tbtasks.reward, $tbtasks.rewardid, $tbtasks.rewardmethod
FROM $tbtasks
WHERE $tbtasks.startzone=$ZoneID
ORDER BY $tbtasks.id ASC";
$result=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
print "<center>";
if (mysql_num_rows($result) > 0)
{
print "<table border=0 width=100% cellpadding='5' cellspacing='0'><tr valign=top><td width=100%>";
print "<center><table border=0 cellpadding='5' cellspacing='0'><tr>
<td class='menuh'>Task Name</td>
<td class='menuh'>Task ID</td>
<td class='menuh'>MinLevel</td>
<td class='menuh'>MaxLevel</td>
<td class='menuh'>Reward</td>
";
$RowClass = "lr";
while ($row=mysql_fetch_array($result))
{
$Reward = $row["reward"];
if ($row["rewardmethod"] == 0)
{
if ($row["rewardid"] > 0)
{
$ItemID = $row["rewardid"];
$ItemName = GetFieldByQuery("Name","SELECT Name FROM items WHERE id = $ItemID");
$Reward = "<a href=item.php?id=".$ItemID.">".$ItemName."</a>";
}
}
print "<tr class='" .$RowClass. "'>
<td><a href=task.php?id=".$row["id"].">".$row["title"]."</a></td>
<td align=center valign='top'>".$row["id"]."</td>
<td align=center valign='top'>".$row["minlevel"]."</td>
<td align=center valign='top'>".$row["maxlevel"]."</td>
<td>".$Reward."</td>
</tr>";
if ($RowClass == "lr"){
$RowClass = "dr";
}
else{
$RowClass = "lr";
}
}
print "</table></center>";
print "</td><td width=0% nowrap>";
print "</td></tr></table>";
}
else
{
print "<br><b>No Tasks Found</b>";
}
print "</center>";
}
} // end Tasks
print "</td><td width=0% nowrap>"; // end first column
print "<p class=menuh>Resources:</p>";
print "<li><a href=$PHP_SELF?name=$name&mode=npcs>".$zone["long_name"]." Bestiary List</a>";
if ($DisplayNamedNPCsInfo==TRUE)
{
print "<li><a href=zonenameds.php?name=$name&mode=npcs>".$zone["long_name"]." Named Mobs List</a>";
}
print "<li><a href=$PHP_SELF?name=$name&mode=items>".$zone["long_name"]." Equipment List </a>";
if (file_exists($maps_dir.$name.".jpg")) {
print "<li><a href=".$maps_url.$name.".jpg>".$zone["long_name"]." Map</a>";
}
if ($DisplaySpawnGroupInfo==TRUE)
{
print "<li><a href=$PHP_SELF?name=$name&mode=spawngroups>".$zone["long_name"]." Spawn Groups</a>";
}
print "<li><a href=$PHP_SELF?name=$name&mode=forage>".$zone["long_name"]." Forageable items</a>";
if ($DisplayTaskInfo==TRUE)
{
print "<li><a href=$PHP_SELF?name=$name&mode=tasks>".$zone["long_name"]." Tasks</a>";
}
if ($AllowQuestsNPC==TRUE) {
print "<li><a href=$root_url"."quests/zones.php?aZone=$name>".$zone["long_name"]." Quest NPCs</a>";
}
print "</td></tr></table>";
include($includes_dir."footers.php");
?>