From: <wel...@us...> - 2009-07-26 23:55:46
|
Revision: 4136 http://planeshift.svn.sourceforge.net/planeshift/?rev=4136&view=rev Author: weltall2 Date: 2009-07-26 23:55:38 +0000 (Sun, 26 Jul 2009) Log Message: ----------- Added "List Item Icons" (ported from OLD) Added the option to exclude "private" zones (guild houses/NPCroom) from item instance searches. Also re-arranged the code to drop 2 redundant parts. Added gender to the lists of vuln/invuln NPCs Added "check npc triggers" which lists all NPCs with missing "greetings" "about you" or "how you" triggers. (ported from old) Added "check npc loaded" which lists all NPC's that are either not loaded as well as a list of npcs that are loaded in the NPC room or in a sector ID smaller than 1. Added .error to the stylesheet (only had p.error). This does the same, but is valid for all elements that chose that class. patch by ravna Modified Paths: -------------- www/webconsole-new/global.css www/webconsole-new/index.php www/webconsole-new/items/itemmain.php www/webconsole-new/items/locateitem.php www/webconsole-new/npcs/listnpcs.php www/webconsole-new/npcs/npcmain.php Added Paths: ----------- www/webconsole-new/items/listitemicons.php www/webconsole-new/npcs/checknpcloaded.php www/webconsole-new/npcs/checknpctriggers.php Modified: www/webconsole-new/global.css =================================================================== --- www/webconsole-new/global.css 2009-07-26 23:41:41 UTC (rev 4135) +++ www/webconsole-new/global.css 2009-07-26 23:55:38 UTC (rev 4136) @@ -104,6 +104,10 @@ font-weight:bold; } +.error{ + color:red; +} + p.error{ color:red; } Modified: www/webconsole-new/index.php =================================================================== --- www/webconsole-new/index.php 2009-07-26 23:41:41 UTC (rev 4135) +++ www/webconsole-new/index.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -119,6 +119,12 @@ itemmain(); listitems(); break; + case 'listitemicons': + include('./items/itemmain.php'); + include('./items/listitemicons.php'); + itemmain(); + listitemicons(); + break; case 'showitemusage': include('./items/itemmain.php'); include('./items/listitems.php'); @@ -309,6 +315,18 @@ npcmain(); ka_scripts(); break; + case 'checknpctriggers': + include('./npcs/npcmain.php'); + include('./npcs/checknpctriggers.php'); + npcmain(); + checknpctriggers(); + break; + case 'checknpcloaded': + include('./npcs/npcmain.php'); + include('./npcs/checknpcloaded.php'); + npcmain(); + checknpcloaded(); + break; case 'rules': include('./rules/rulesmain.php'); rulesmain(); Modified: www/webconsole-new/items/itemmain.php =================================================================== --- www/webconsole-new/items/itemmain.php 2009-07-26 23:41:41 UTC (rev 4135) +++ www/webconsole-new/items/itemmain.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -1,17 +1,23 @@ <?php -function itemmain(){ - if (checkaccess('items', 'read')){ - echo '<div class="menu_left">'."\n"; - echo '<a href="./index.php?do=listitems">List items</a> <br/>'."\n"; - echo '<a href="./index.php?do=finditem">Locate Items</a> <br/>'; - if (checkaccess('items', 'create')){ - echo '<a href="./index.php?do=createitem">Create Item</a> <br/>'; - echo '<a href="./index.php?do=editcategory">Edit Categories</a> <br/>'; +function itemmain() +{ + if (checkaccess('items', 'read')) + { + echo '<div class="menu_left">'."\n"; + echo '<a href="./index.php?do=listitems">List items</a> <br/>'."\n"; + echo '<a href="./index.php?do=listitemicons">List item icons</a> <br/>'."\n"; + echo '<a href="./index.php?do=finditem">Locate Items</a> <br/>'; + if (checkaccess('items', 'create')) + { + echo '<a href="./index.php?do=createitem">Create Item</a> <br/>'; + echo '<a href="./index.php?do=editcategory">Edit Categories</a> <br/>'; + } + echo '<a href="./index.php">Return to main page.</a>'."\n"; + echo '</div><div class="main">'."\n"; } - echo '<a href="./index.php">Return to main page.</a>'."\n"; - echo '</div><div class="main">'."\n"; - }else{ - echo '<p class="error">You are not authorized to use these functions</p>'; - } + else + { + echo '<p class="error">You are not authorized to use these functions</p>'; + } } ?> Added: www/webconsole-new/items/listitemicons.php =================================================================== --- www/webconsole-new/items/listitemicons.php (rev 0) +++ www/webconsole-new/items/listitemicons.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -0,0 +1,43 @@ +<?php + +function listitemicons() +{ + displayCategory("books"); + displayCategory("food"); + displayCategory("furniture"); + displayCategory("helms"); + displayCategory("items"); + displayCategory("jewelry"); + displayCategory("money"); + displayCategory("naturalres"); + displayCategory("potions"); + displayCategory("shields"); + displayCategory("tools"); + displayCategory("weapons"); +} + +function displayCategory ($category) +{ + if (checkaccess('items', 'read')) + { + + echo "<H1>".$category."</H1>"; + echo '<TABLE BORDER="1">'; + + $query = "SELECT * FROM common_strings WHERE string LIKE '%$category%' ORDER BY id"; + $result = mysql_query2($query); + + while ($row = mysql_fetch_array($result)) { + echo "<TR><TD>".$row['id'] . "</TD><TD> " . $row['string']; + $str = $row['string']; + $name = substr( $str, strrpos($str,"/")); + echo "</TD></TR>"; + } + echo '</TABLE>'; + } + else + { + echo '<p class="error">You are not authorized to use these functions</p>'; + } +} +?> Property changes on: www/webconsole-new/items/listitemicons.php ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: www/webconsole-new/items/locateitem.php =================================================================== --- www/webconsole-new/items/locateitem.php 2009-07-26 23:41:41 UTC (rev 4135) +++ www/webconsole-new/items/locateitem.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -1,102 +1,99 @@ <?php function locateitem(){ - if (checkaccess('items', 'read')){ - if (isset($_POST['search'])){ - if ($_POST['search'] == "Find Items"){ - echo 'Finding item'; - $itemstat = mysql_real_escape_string($_POST['itemid']); - $query = "SELECT i.id, s.name, i.char_id_owner, i.char_id_guardian, i.parent_item_id, i.location_in_parent, i.stack_count, sec.name as sector, i.loc_x, i.loc_y, i.loc_z, i.loc_xrot, i.loc_zrot, i.loc_instance, i.flags FROM item_instances AS i LEFT JOIN sectors AS sec ON i.loc_sector_id=sec.id LEFT JOIN item_stats AS s ON i.item_stats_id_standard=s.id WHERE item_stats_id_standard=$itemstat"; - $result = mysql_query2($query); - echo '<table border="1"><tr><th>Instance ID</th><th>Name</th><th>Owner ID</th><th>Guardian ID</th><th>Parent Item</th><th>Location in Parent</th><th>Stack Count</th><th>Sector</th><th>X</th><th>Y</th><th>Z</th><th>X rot</th><th>Z rot</th<th>Instance</th><th>Flags</th></tr>'."\n"; - while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ - echo '<tr><td>'.$row['id'].'</td>'; - echo '<td>'.$row['name'].'</td>'; - echo '<td>'.$row['char_id_owner'].'</td>'; - echo '<td>'.$row['char_id_guardian'].'</td>'; - echo '<td>'.$row['parent_item_id'].'</td>'; - echo '<td>'.LocationToString($row['location_in_parent']).'</td>'; - echo '<td>'.$row['stack_count'].'</td>'; - echo '<td>'.$row['sector'].'</td>'; - echo '<td>'.$row['loc_x'].'</td><td>'.$row['loc_y'].'</td><td>'.$row['loc_z'].'</td>'; - echo '<td>'.$row['loc_xrot'].'</td><td>'.$row['loc_zrot'].'</td>'; - echo '<td>'.$row['loc_instance'].'</td>'; - echo '<td>'.$row['flags'].'</td></tr>'."\n"; + if (checkaccess('items', 'read')) + { + $display_item = false; + if (isset($_POST['search'])) + { + $query = 'SELECT i.id, s.name, i.char_id_owner, i.char_id_guardian, i.parent_item_id, i.location_in_parent, i.stack_count, sec.name as sector, i.loc_x, i.loc_y, i.loc_z, i.loc_xrot, i.loc_zrot, i.loc_instance, i.flags FROM item_instances AS i LEFT JOIN sectors AS sec ON i.loc_sector_id=sec.id LEFT JOIN item_stats AS s ON i.item_stats_id_standard=s.id WHERE '; + if ($_POST['search'] == "Find Items") // these first 3 all give the same results with another "where", so we print them all at the end in the same code. + { + echo 'Finding item'; + $itemstat = mysql_real_escape_string($_POST['itemid']); + $query .= "item_stats_id_standard = $itemstat"; + if (isset($_POST['private'])) // The brackets in the SQL are intentional, and required for it's proper working. The sector names for guild houses are static/fixed for now (juli, 2009), but this may change in the future. + { + $query .= " AND (isnull(sec.name) OR i.loc_sector_id = '0' OR (sec.name != 'guildsimple' AND sec.name != 'guildlaw' AND sec.name != 'NPCroom'))"; + } + $display_item = true; + } + else if ($_POST['search'] == "Dropped Items") + { + echo 'Dropped Items'; + $query .= "i.char_id_owner = 0"; + if ($_POST['sectorid'] != '') + { + $sectorid = mysql_real_escape_string($_POST['sectorid']); + $query = $query . " AND i.loc_sector_id='$sectorid'"; + } + if (isset($_POST['private'])) + { + $query .= " AND sec.name != 'guildsimple' AND sec.name != 'guildlaw' AND sec.name != 'NPCroom'"; + } + $display_item = true; + } + else if ($_POST['search'] == "Find Instance") + { + $iid = mysql_real_escape_string($_POST['iid']); + $query .= "i.id='$iid'"; // "private" is not relevant when finding a specific instance. + $display_item = true; + } + else if ($_POST['search'] == "Find Merchants") // This one is different, so it gets it's own print. + { + $itemid = mysql_real_escape_string($_POST['vendoritemid']); // Don't make "is" "iss" (like it should logically be) since "is" is a reserved keyword in mysql. + $query = "SELECT DISTINCT c.id, c.name, c.lastname, iss.name AS item_name FROM merchant_item_categories AS m LEFT JOIN characters AS c ON c.id=m.player_id LEFT JOIN item_instances AS i ON i.char_id_owner=m.player_id LEFT JOIN item_stats AS iss ON iss.id=i.item_stats_id_standard WHERE i.location_in_parent > '15' AND i.item_stats_id_standard='$itemid' AND iss.category_id=m.category_id ORDER BY iss.name"; + $result = mysql_query2($query); + if (mysql_num_rows($result) == 0) + { + echo '<p class="error">No vendors found for this item.</p>'; + return; + } + $row = mysql_fetch_array($result, MYSQL_ASSOC); + echo '<p class="bold">Displaying vendors for '.$row['item_name'].' </p>'; + echo '<table>'; + do { + echo '<tr><td><a href="./index.php?do=npc_details&sub=main&npc_id='.$row['id'].'">'.$row['name'].' '.$row['lastname'].'</a></td></tr>'; + } while ($row = mysql_fetch_array($result, MYSQL_ASSOC)); + echo '</table>'; + } } - echo '</table>'; - }else if ($_POST['search'] == "Droped Items"){ - echo 'Droped Items'; - $query = "SELECT i.id, s.name, i.char_id_owner, i.char_id_guardian, i.parent_item_id, i.location_in_parent, i.stack_count, sec.name as sector, i.loc_x, i.loc_y, i.loc_z, i.loc_xrot, i.loc_zrot, i.loc_instance, i.flags FROM item_instances AS i LEFT JOIN sectors AS sec ON i.loc_sector_id=sec.id LEFT JOIN item_stats AS s ON i.item_stats_id_standard=s.id WHERE i.char_id_owner=0"; - if ($_POST['sectorid'] != ''){ - $sectorid = mysql_real_escape_string($_POST['sectorid']); - $query = $query . " AND i.loc_sector_id='$sectorid'"; + else // if there was no search, print the form + { + echo '<form action="./index.php?do=finditem" method="post"><table>'; + echo '<tr><td colspan="3"><input type="checkbox" name="private"> Exclude private zones (guild houses/NPC room) from the search?</td></tr>'; + echo '<tr><td>Find all instances of item: </td><td>'; + $itemresult = PrepSelect('items'); + echo DrawSelectBox('items', $itemresult, 'itemid', ''). '</td><td><input type="submit" name="search" value="Find Items"/></td></tr>'; + echo '<tr><td>Locate Instance ID: </td><td><input type="text" name="iid" /></td><td><input type="submit" name="search" value="Find Instance" /></td></tr>'; + $Sectors = PrepSelect('sectorid'); + echo '<tr><td>Locate All Items on floor (Limit to Sector: </td><td>'.DrawSelectBox('sectorid', $Sectors, 'sectorid', '', true).') </td><td><input type="submit" name="search" value="Dropped Items" /></td></tr>'; + echo '<tr><td>Find all vendors of item: </td><td>'.DrawSelectBox('items', $itemresult, 'vendoritemid', ''). '</td><td><input type="submit" name="search" value="Find Merchants"/></td></tr>'; + echo '</table></form>'; } - $result = mysql_query2($query); - echo '<table border="1"><tr><th>Instance ID</th><th>Name</th><th>Owner ID</th><th>Guardian ID</th><th>Parent Item</th><th>Location in Parent</th><th>Stack Count</th><th>Sector</th><th>X</th><th>Y</th><th>Z</th><th>X rot</th><th>Z rot</th><th>Instance</th><th>Flags</th></tr>'."\n"; - while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ - echo '<tr><td>'.$row['id'].'</td>'; - echo '<td>'.$row['name'].'</td>'; - echo '<td>'.$row['char_id_owner'].'</td>'; - echo '<td>'.$row['char_id_guardian'].'</td>'; - echo '<td>'.$row['parent_item_id'].'</td>'; - echo '<td>'.LocationToString($row['location_in_parent']).'</td>'; - echo '<td>'.$row['stack_count'].'</td>'; - echo '<td>'.$row['sector'].'</td>'; - echo '<td>'.$row['loc_x'].'</td><td>'.$row['loc_y'].'</td><td>'.$row['loc_z'].'</td>'; - echo '<td>'.$row['loc_xrot'].'</td><td>'.$row['loc_zrot'].'</td>'; - echo '<td>'.$row['loc_instance'].'</td>'; - echo '<td>'.$row['flags'].'</td></tr>'."\n"; - } - echo '</table>'; - }else if ($_POST['search'] == "Find Instance"){ - $iid = mysql_real_escape_string($_POST['iid']); - $query = "SELECT i.id, s.name, i.char_id_owner, i.char_id_guardian, i.parent_item_id, i.location_in_parent, i.stack_count, sec.name as sector, i.loc_x, i.loc_y, i.loc_z, i.loc_xrot, i.loc_zrot, i.loc_instance, i.flags FROM item_instances AS i LEFT JOIN sectors AS sec ON i.loc_sector_id=sec.id LEFT JOIN item_stats AS s ON i.item_stats_id_standard=s.id WHERE i.id='$iid'"; - $result = mysql_query2($query); - echo '<table border="1"><tr><th>Instance ID</th><th>Name</th><th>Owner ID</th><th>Guardian ID</th><th>Parent Item</th><th>Location in Parent</th><th>Stack Count</th><th>Sector</th><th>X</th><th>Y</th><th>Z</th><th>X rot</th><th>Z rot</th><th>Instance</th><th>Flags</th></tr>'."\n"; - while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ - echo '<tr><td>'.$row['id'].'</td>'; - echo '<td>'.$row['name'].'</td>'; - echo '<td>'.$row['char_id_owner'].'</td>'; - echo '<td>'.$row['char_id_guardian'].'</td>'; - echo '<td>'.$row['parent_item_id'].'</td>'; - echo '<td>'.LocationToString($row['location_in_parent']).'</td>'; - echo '<td>'.$row['stack_count'].'</td>'; - echo '<td>'.$row['sector'].'</td>'; - echo '<td>'.$row['loc_x'].'</td><td>'.$row['loc_y'].'</td><td>'.$row['loc_z'].'</td>'; - echo '<td>'.$row['loc_xrot'].'</td><td>'.$row['loc_zrot'].'</td>'; - echo '<td>'.$row['loc_instance'].'</td>'; - echo '<td>'.$row['flags'].'</td></tr>'."\n"; - } - echo '</table>'; - }else if ($_POST['search'] == "Find Merchants"){ - $itemid = mysql_real_escape_string($_POST['vendoritemid']); // Don't make "is" "iss" (like it should logically be) since "is" is a reserved keyword in mysql. - $query = "SELECT DISTINCT c.id, c.name, c.lastname, iss.name AS item_name FROM merchant_item_categories AS m LEFT JOIN characters AS c ON c.id=m.player_id LEFT JOIN item_instances AS i ON i.char_id_owner=m.player_id LEFT JOIN item_stats AS iss ON iss.id=i.item_stats_id_standard WHERE i.location_in_parent > '15' AND i.item_stats_id_standard='$itemid' AND iss.category_id=m.category_id ORDER BY iss.name"; - $result = mysql_query2($query); - if (mysql_num_rows($result) == 0) + if ($display_item) // if there was an item search, print it here. { - echo '<p class="error">No vendors found for this item.</p>'; - return; + $result = mysql_query2($query); + echo '<table border="1"><tr><th>Instance ID</th><th>Name</th><th>Owner ID</th><th>Guardian ID</th><th>Parent Item</th><th>Location in Parent</th><th>Stack Count</th><th>Sector</th><th>X</th><th>Y</th><th>Z</th><th>X rot</th><th>Z rot</th<th>Instance</th><th>Flags</th></tr>'."\n"; + while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ + echo '<tr><td>'.$row['id'].'</td>'; + echo '<td>'.$row['name'].'</td>'; + echo '<td>'.$row['char_id_owner'].'</td>'; + echo '<td>'.$row['char_id_guardian'].'</td>'; + echo '<td>'.$row['parent_item_id'].'</td>'; + echo '<td>'.LocationToString($row['location_in_parent']).'</td>'; + echo '<td>'.$row['stack_count'].'</td>'; + echo '<td>'.$row['sector'].'</td>'; + echo '<td>'.$row['loc_x'].'</td><td>'.$row['loc_y'].'</td><td>'.$row['loc_z'].'</td>'; + echo '<td>'.$row['loc_xrot'].'</td><td>'.$row['loc_zrot'].'</td>'; + echo '<td>'.$row['loc_instance'].'</td>'; + echo '<td>'.$row['flags'].'</td></tr>'."\n"; + } + echo '</table>'; } - $row = mysql_fetch_array($result, MYSQL_ASSOC); - echo '<p class="bold">Displaying vendors for '.$row['item_name'].' </p>'; - echo '<table>'; - do { - echo '<tr><td><a href="./index.php?do=npc_details&sub=main&npc_id='.$row['id'].'">'.$row['name'].' '.$row['lastname'].'</a></td></tr>'; - } while ($row = mysql_fetch_array($result, MYSQL_ASSOC)); - echo '</table>'; - } - }else{ - echo '<form action="./index.php?do=finditem" method="post">'; - echo 'Find all instances of item: '; - $itemresult = PrepSelect('items'); - echo DrawSelectBox('items', $itemresult, 'itemid', ''). '<input type="submit" name="search" value="Find Items"/><br/>'; - echo 'Locate Instance ID: <input type="text" name="iid" /><input type="submit" name="search" value="Find Instance" /><br/>'; - $Sectors = PrepSelect('sectorid'); - echo 'Locate All Items on floor (Limit to Sector: '.DrawSelectBox('sectorid', $Sectors, 'sectorid', '', true).') <input type="submit" name="search" value="Droped Items" /><br/>'; - echo 'Find all vendors of item: '.DrawSelectBox('items', $itemresult, 'vendoritemid', ''). '<input type="submit" name="search" value="Find Merchants"/><br/>'; - echo '</form>'; } - }else{ - echo '<p class="error">You are not authorized to use these functions</p>'; - } + else + { + echo '<p class="error">You are not authorized to use these functions</p>'; + } } ?> Added: www/webconsole-new/npcs/checknpcloaded.php =================================================================== --- www/webconsole-new/npcs/checknpcloaded.php (rev 0) +++ www/webconsole-new/npcs/checknpcloaded.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -0,0 +1,75 @@ +<?PHP +function checknpcloaded(){ + + if (checkaccess('npc', 'read')) + { + // extract all NPCs names that are not loaded in game + $query = "select c.id, c.name, c.lastname, sec.name, c.loc_x, c.loc_y, c.loc_z, c.npc_spawn_rule from characters as c, sectors as sec "; + $query = $query . " where npc_master_id !=0 and c.loc_sector_id=sec.id"; + $query = $query . " and character_type!=2 and npc_spawn_rule<1"; + $query = $query . " order by sec.name, c.name"; + + $result = mysql_query2($query); + + echo "<h3>All NPCs that are not loaded in game (Pets excluded)</h3>"; + echo " <TABLE BORDER=1>"; + echo " <TH> ID </TH> <TH> NAME</TH><TH> Sector</TH><TH> Position</TH><TH> Loaded in game?</TH>"; + + // for each NPC + while ($line = mysql_fetch_array($result, MYSQL_NUM)) + { + + $loaded = "yes"; + if ($line[7] == 0) + { + $loaded = '<span class="error">no</span>'; + } + + $fullname = $line[1] . " " . $line[2]; + $fullname = trim($fullname); + + echo "<TR><TD>$line[0] </TD><TD><A href='index.php?do=npc_details&sub=main&npc_id=".$line[0]."'>".$fullname."</a></TD><TD>$line[3]</TD><TD>$line[4]/$line[5]/$line[6]</TD>"; + echo "<TD>$loaded</TD></TR>"; + } + echo '</TABLE><br><br>'; + + echo '<br><br>'; + + echo "<h3>All NPC Loaded in NPCRoom or in wrong sector</h3>"; + // NPC Loaded in NPCRoom or in wrong sector + $query = "select c.id, c.name, c.lastname, sec.name, c.loc_x, c.loc_y, c.loc_z, c.npc_spawn_rule from characters as c, sectors as sec "; + $query = $query . " where npc_master_id !=0 and c.loc_sector_id=sec.id"; + $query = $query . " and npc_spawn_rule>0 and (loc_sector_id<1 or loc_sector_id=3)"; + $query = $query . " order by sec.name, c.name"; + + $result = mysql_query2($query); + + echo " <TABLE BORDER=1>"; + echo " <TH> ID </TH> <TH> NAME</TH><TH> Sector</TH><TH> Position</TH><TH> Loaded in game?</TH>"; + + // for each NPC + while ($line = mysql_fetch_array($result, MYSQL_NUM)) + { + + $loaded = "yes"; + if ($line[6] == 0) + { + $loaded = '<span class="error">no</span>'; + } + + $fullname = $line[1] . " " . $line[2]; + $fullname = trim($fullname); + + echo "<TR><TD>$line[0] </TD><TD><A href='index.php?do=npc_details&sub=main&npc_id=".$line[0]."'>".$fullname."</a></TD><TD>$line[3]</TD><TD>$line[4]/$line[5]/$line[6]</TD>"; + echo "<TD>$loaded</TD></TR>"; + } + echo '</TABLE><br><br>'; + echo '<br><br>'; + } + else + { + echo '<p class="error">You are not authorized to use these functions</p>'; + } +} + +?> Property changes on: www/webconsole-new/npcs/checknpcloaded.php ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: www/webconsole-new/npcs/checknpctriggers.php =================================================================== --- www/webconsole-new/npcs/checknpctriggers.php (rev 0) +++ www/webconsole-new/npcs/checknpctriggers.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -0,0 +1,78 @@ +<?PHP +function checknpctriggers(){ + + if (checkaccess('npc', 'read')) + { + // extract all invulnerable NPC names + $query = "select c.id, c.name, c.lastname, sec.name, c.loc_x, c.loc_y, c.loc_z, c.npc_spawn_rule from characters as c, sectors as sec "; + $query = $query . " where c.npc_master_id !=0 and c.loc_sector_id=sec.id"; + $query = $query . " and c.npc_impervious_ind='Y'"; + $query = $query . " order by sec.name, c.name"; + + $result = mysql_query2($query); + + echo " <TABLE BORDER=1>"; + echo " <TH> ID </TH> <TH> NAME</TH><TH> Sector</TH><TH> Position</TH><TH> Missing Triggers</TH><TH> Loaded in game?</TH>"; + + // for each NPC + while ($line = mysql_fetch_array($result, MYSQL_NUM)) + { + + $fullname = $line[1] . " " . $line[2]; + $fullname = trim($fullname); + // search his triggers + $query2 = "select count(*) from npc_triggers where area='$fullname' and trigger_text='greetings'"; + $result2 = mysql_query2($query2); + $line2 = mysql_fetch_array($result2, MYSQL_NUM); + $found1 = $line2[0]; + if ($found1=="0") { + $query2 = "select count(*) from npc_knowledge_areas where area like 'greetings%' and player_id=$line[0]"; + $result2 = mysql_query2($query2); + $line2 = mysql_fetch_array($result2, MYSQL_NUM); + $found1 = $line2[0]; + } + + $query2 = "select count(*) from npc_triggers where area='$fullname' and trigger_text='about you'"; + $result2 = mysql_query2($query2); + $line2 = mysql_fetch_array($result2, MYSQL_NUM); + $found2 = $line2[0]; + + $query2 = "select count(*) from npc_triggers where area='$fullname' and trigger_text='how you'"; + $result2 = mysql_query2($query2); + $line2 = mysql_fetch_array($result2, MYSQL_NUM); + $found3 = $line2[0]; + + $loaded = "yes"; + if ($line[7]==0) + { + $loaded = "<font color=red>no</font>"; + } + + if ($found1=="0" or $found2=="0" or $found3=="0") { + echo "<TR><TD>$line[0] </TD><TD><A href='index.php?do=npc_details&sub=main&npc_id=".$line[0]."'>".$fullname."</a></TD><TD>$line[3]</TD><TD>$line[4]/$line[5]/$line[6]</TD><TD>"; + if ($found1=="0") + { + echo "greetings <br>"; + } + if ($found2=="0") + { + echo "about you <br>"; + } + if ($found3=="0") + { + echo "how you <br>"; + } + echo "</TD><TD>$loaded</TD></TR>"; + } + } + echo '</TABLE><br><br>'; + + echo '<br><br>'; + } + else + { + echo '<p class="error">You are not authorized to use these functions</p>'; + } +} + +?> Property changes on: www/webconsole-new/npcs/checknpctriggers.php ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: www/webconsole-new/npcs/listnpcs.php =================================================================== --- www/webconsole-new/npcs/listnpcs.php 2009-07-26 23:41:41 UTC (rev 4135) +++ www/webconsole-new/npcs/listnpcs.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -2,8 +2,8 @@ function listnpcs($a, $b = NULL){ if (checkaccess('npcs', 'read')){ echo '<table border="1">'; - echo '<tr><th><a href="./index.php?do='.$_GET['do'].'&sort=id">ID</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=name">Name</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=race">Race</a></th><th>Description</th><th><a href="./index.php?do='.$_GET['do'].'&sort=spawn">Spawn</a>/<a href="./index.php?do='.$_GET['do'].'&sort=loot">Loot</a></th><th>Position</th><th><a href="./index.php?do='.$_GET['do'].'&sort=sector">Sector</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=behavior">Behavior</a></th><th>Region</th></tr>'; - $query = 'SELECT c.id, c.name, c.lastname, c.description, c.npc_spawn_rule, c.npc_addl_loot_category_id, s.name AS sector, c.loc_x, c.loc_y, c.loc_z, c.loc_instance, b.npctype AS behavior, b.region, r.name AS race FROM characters as c LEFT JOIN sectors AS s ON c.loc_sector_id=s.id LEFT JOIN sc_npc_definitions AS b ON c.id=b.char_id LEFT JOIN race_info AS r ON c.racegender_id=r.id WHERE c.character_type=1'; + echo '<tr><th><a href="./index.php?do='.$_GET['do'].'&sort=id">ID</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=name">Name</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=race">Race</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=sex">Gender</a></th><th>Description</th><th><a href="./index.php?do='.$_GET['do'].'&sort=spawn">Spawn</a>/<a href="./index.php?do='.$_GET['do'].'&sort=loot">Loot</a></th><th>Position</th><th><a href="./index.php?do='.$_GET['do'].'&sort=sector">Sector</a></th><th><a href="./index.php?do='.$_GET['do'].'&sort=behavior">Behavior</a></th><th>Region</th></tr>'; + $query = 'SELECT c.id, c.name, c.lastname, c.description, c.npc_spawn_rule, c.npc_addl_loot_category_id, s.name AS sector, c.loc_x, c.loc_y, c.loc_z, c.loc_instance, b.npctype AS behavior, b.region, r.name AS race, r.sex FROM characters as c LEFT JOIN sectors AS s ON c.loc_sector_id=s.id LEFT JOIN sc_npc_definitions AS b ON c.id=b.char_id LEFT JOIN race_info AS r ON c.racegender_id=r.id WHERE c.character_type=1'; if ($b != NULL){ $query = $query . $b; }else{ @@ -28,6 +28,8 @@ $query = $query . ' ORDER by behavior, name'; }else if ($_GET['sort'] == 'race'){ $query = $query . ' ORDER by race, sector, name'; + }else if ($_GET['sort'] == 'sex'){ + $query = $query . ' ORDER by sex, sector, name'; }else{ $query = $query . ' ORDER BY sector, name'; } @@ -46,6 +48,7 @@ echo '<td>'.$row['name'].' '.$row['lastname'].'</td>'; } echo '<td>'.$row['race'].'</td>'; + echo '<td>'.$row['sex'].'</td>'; echo '<td>'.$row['description'].'</td>'; echo '<td>(<a href="./index.php?do=listspawn&id='.$row['npc_spawn_rule'].'">'.$row['npc_spawn_rule'].'</a>)'; echo '/(<a href="./index.php?do=listloot&id='.$row['npc_addl_loot_category_id'].'">'.$row['npc_addl_loot_category_id'].'</a>)</td>'; Modified: www/webconsole-new/npcs/npcmain.php =================================================================== --- www/webconsole-new/npcs/npcmain.php 2009-07-26 23:41:41 UTC (rev 4135) +++ www/webconsole-new/npcs/npcmain.php 2009-07-26 23:55:38 UTC (rev 4136) @@ -14,6 +14,9 @@ echo '<a href="./index.php?do=synonyms">List Synonyms</a> <br/>'; echo '<a href="./index.php?do=ka_trigg">List Trigger KAs</a> <br/>'; echo '<a href="./index.php?do=ka_scripts">List KA Scripts</a> <br/>'; + echo '<hr/>'; + echo '<a href="./index.php?do=checknpctriggers">Check NPC Triggers</a> <br/>'; + echo '<a href="./index.php?do=checknpcloaded">Check NPC Loaded</a> <br/>'; echo '<hr/><a href="./index.php">Return to main page.</a>'; echo '</div><div class="main">'; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |