Code: Select all
if ($mode=="items") {
$items=array(); $itemtypes=array();
$query="SELECT $tbnpctypes.id
FROM $tbnpctypes,$tbspawn2,$tbspawnentry,$tbspawngroup
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.name";
$result=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
while ($row=mysql_fetch_array($result)) { # For each NPC in the zone...
$query="SELECT $tbitems.id,$tbitems.name,$tbitems.itemtype,$tbitems.bagslots
FROM $tbitems,$tbloottableentries,$tbnpctypes,$tblootdropentries
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";
$result2=mysql_query($query) or message_die('zone.php','MYSQL_QUERY',$query,mysql_error());
while ($res=mysql_fetch_array($result2)) {
$items[$res["id"]]=$res["name"];
if ($res["itemtype"]>0) {
$itemtypes[$res["id"]]=$dbitypes[$res["itemtype"]];
} else {
if ($res["bagslots"]>0) { $itemtypes[$res["id"]]="Bag"; }
else { $itemtypes[$res["id"]]=$dbitypes[$res["itemtype"]]; }
}
}
}
print "<p>Equipment List<p><table border=1><tr>
<td class=tab_title><a href=$PHP_SELF?name=$name&mode=items&order=name>Name</a></td>
<td class=tab_title><a href=$PHP_SELF?name=$name&mode=items&order=itemtype>Item type</a></td>
</tr>";
asort($itemtypes,SORT_STRING); asort($items,SORT_STRING);
reset($itemtypes); reset($items);
do {
if ($order=="itemtype") {
$id=key($itemtypes);
$go=next($itemtypes);
} else {
$id=key($items);
$go=next($items);
}
print "<tr>
<td><a href=item.php?id=$id>".str_replace('_',' ',$items[$id])."</a></td>
<td>".$itemtypes[$id]."</td>
</tr>";
} while ($go);
print "</table><p></center>";
} // end items
I don't have a working database / server up and running to tell what fields are being returned but it doesn't seem like it would be to hard to show the slot field, and would definatly speed up finding that item you are missing. just a thought.
I might need get something running just to test some code out =/