From: <lpa...@us...> - 2024-10-01 20:42:55
|
Revision: 10024 http://sourceforge.net/p/planeshift/code/10024 Author: lpancallo Date: 2024-10-01 20:42:54 +0000 (Tue, 01 Oct 2024) Log Message: ----------- where books Added Paths: ----------- www/webconsole-new/items/wherebooks.php Added: www/webconsole-new/items/wherebooks.php =================================================================== --- www/webconsole-new/items/wherebooks.php (rev 0) +++ www/webconsole-new/items/wherebooks.php 2024-10-01 20:42:54 UTC (rev 10024) @@ -0,0 +1,104 @@ +<?php +function wherebooks() +{ + if (!checkaccess('items', 'read')) + { + echo '<p class="error">You are not authorized to use these functions</p>'; + return; + } + + // check if sort is specified + if (isset($_GET['sort'])) { + if ($_GET['sort'] == 'sector') { + $sortBy = ' ORDER BY secname'; + } else { + $sortBy = ' ORDER BY is2.name'; + } + } + + echo '<h1> Official books not yet present in game anywhere (no instances)</h1>'."\n"; + + $query = "select is2.id as statid, is2.name, iinst.id, iinst.char_id_owner, iinst.parent_item_id, iinst.flags from item_stats is2 LEFT JOIN item_instances iinst ON is2.id = iinst.item_stats_id_standard where is2.item_type='BOOK' and iinst.id is NULL order by is2.name"; + + $result = mysql_query2($query); + + echo "Found ".sqlNumRows($result)." results<br/>"; + if (sqlNumRows($result) > 0) + { + echo '<table border="1">'."\n"; + echo '<tr><th>ID</th><th>Name</th>'; + + while ($row = fetchSqlAssoc($result)) + { + echo '<tr>'; + echo '<td>'.$row['statid'].'</td>'; + echo '<td><a href="./index.php?do=listitems&item='.$row['statid'].'">'.$row['name'].'</a></td>'; + echo '</tr>'."\n"; + } + echo '</table>'; + } + + echo '<h1> Location of Official books in the world (ground)</h1>'."\n"; + + $query = "select is2.id as statid, iinst.id as instid, is2.name,s.name as secname, iinst.flags, iinst.loc_x, iinst.loc_y, iinst.loc_z from item_stats is2 , item_instances iinst , sectors s + where is2.id = iinst.item_stats_id_standard and s.id = iinst.loc_sector_id + and is2.id!='101' and is2.item_type='BOOK' and (iinst.char_id_owner is NULL or iinst.char_id_owner = 0) ".$sortBy; + + $result = mysql_query2($query); + + echo "Found ".sqlNumRows($result)." results<br/>"; + if (sqlNumRows($result) > 0) + { + echo '<table border="1">'."\n"; + echo '<tr><th>Stats ID</th><th>Instance ID</th><th><a href="./index.php?do='.$_GET['do'].'&sort=name">Name</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=sector">Sector</a></th><th>Flags</th><th>Location</th>'; + + while ($row = fetchSqlAssoc($result)) + { + echo '<tr>'; + echo '<td>'.$row['statid'].'</td>'; + echo '<td>'.$row['instid'].'</td>'; + echo '<td><a href="./index.php?do=listitems&item='.$row['statid'].'">'.$row['name'].'</a></td>'; + echo '<td>'.$row['secname'].'</td>'; + echo '<td>'.$row['flags'].'</td>'; + echo '<td>'.$row['loc_x'].' '.$row['loc_y'].' '.$row['loc_z'].'</td>'; + echo '</tr>'."\n"; + } + echo '</table>'; + } + + echo '<h1> Location of Official books in the world (in Containers)</h1>'."\n"; + + $query = "select is2.id as statid, iinst.id as instid, is2.name,iinst.flags, iinst.parent_item_id from item_stats is2 , item_instances iinst +where is2.id = iinst.item_stats_id_standard and iinst.parent_item_id IS NOT NULL + and is2.id!='101' and is2.item_type='BOOK' and (iinst.char_id_owner is NULL or iinst.char_id_owner = 0) order by is2.name"; + + $result = mysql_query2($query); + + echo "Found ".sqlNumRows($result)." results<br/>"; + if (sqlNumRows($result) > 0) + { + echo '<table border="1">'."\n"; + echo '<tr><th>Stats ID</th><th>Instance ID</th><th>Name</th><th>Flags</th><th>Parent Sector</th><th>Parent Location</th>'; + + while ($row = fetchSqlAssoc($result)) + { + // extract parent item (container) data + $queryContainer = "select iinst.item_name, s.name as secname, iinst.flags, iinst.loc_x, iinst.loc_y, iinst.loc_z from item_instances iinst , sectors s +where s.id = iinst.loc_sector_id and iinst.id=" . $row['parent_item_id']; + $resultContainer = mysql_query2($queryContainer); + $rowContainer = fetchSqlAssoc($resultContainer); + + echo '<tr>'; + echo '<td>'.$row['statid'].'</td>'; + echo '<td>'.$row['instid'].'</td>'; + echo '<td><a href="./index.php?do=listitems&item='.$row['statid'].'">'.$row['name'].'</a></td>'; + echo '<td>'.$row['flags'].'</td>'; + echo '<td>'.$rowContainer['secname'].'</td>'; + echo '<td>'.$rowContainer['loc_x'].' '.$rowContainer['loc_y'].' '.$rowContainer['loc_z'].'</td>'; + echo '</tr>'."\n"; + } + echo '</table>'; + } + +} +?> Property changes on: www/webconsole-new/items/wherebooks.php ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |