From: <lpa...@us...> - 2024-10-01 20:40:58
|
Revision: 10023 http://sourceforge.net/p/planeshift/code/10023 Author: lpancallo Date: 2024-10-01 20:40:56 +0000 (Tue, 01 Oct 2024) Log Message: ----------- added spawn mesh for natural resources Added wherebooks page Modified Paths: -------------- www/webconsole-new/crafting/resources.php www/webconsole-new/index.php www/webconsole-new/items/itemmain.php www/webconsole-new/rules/draw_map.php Added Paths: ----------- www/webconsole-new/items/searchbooks.php Modified: www/webconsole-new/crafting/resources.php =================================================================== --- www/webconsole-new/crafting/resources.php 2024-08-30 21:53:16 UTC (rev 10022) +++ www/webconsole-new/crafting/resources.php 2024-10-01 20:40:56 UTC (rev 10023) @@ -1,7 +1,10 @@ <?php function listresources(){ if (checkaccess('natres', 'read')){ + if (isset($_POST['commit']) && (checkaccess('natres', 'edit'))){ + + // COMMIT EDIT NATURAL RESOURCE if ($_POST['commit'] == "Commit Edit"){ $id = escapeSqlString($_POST['id']); $loc_sector_id = escapeSqlString($_POST['loc_sector_id']); @@ -31,6 +34,8 @@ unset($_POST); listresources(); return; + + // COMMIT CREATE NATURAL RESOURCE }else if($_POST['commit'] == "Commit New" && checkaccess('natres', 'create')){ $loc_sector_id = escapeSqlString($_POST['loc_sector_id']); $loc_x = escapeSqlString($_POST['loc_x']); @@ -54,6 +59,8 @@ unset($_POST); listresources(); return; + + // DELETE COMMIT NATURAL RESOURCE }else if($_POST['commit'] == "Confirm Delete" && checkaccess('natres', 'delete')){ $id = escapeSqlString($_POST['id']); $query = "DELETE FROM natural_resources WHERE id='$id'"; @@ -63,6 +70,7 @@ listresources(); return; } + // EDIT NATURAL RESOURCE }else if (isset($_POST['action']) && (checkaccess('natres', 'edit'))){ if ($_POST['action'] == 'Edit'){ $id = escapeSqlString($_POST['id']); @@ -93,6 +101,8 @@ echo '<tr><td>Max Random:<br/>(if amount not null, <br/>maximum random interval modifier in msecs</td><td><input type="text" name="max_random" value="'.$row['max_random'].'" /></td></tr>'; echo '</table><div><input type="hidden" name="id" value="'.$row['id'].'" /><input type="submit" name="commit" value="Commit Edit" /></div>'; echo '</form>'; + + // CREATE NATURAL RESOURCE }else if ($_POST['action'] == 'Create New' && checkaccess('natres', 'create')){ $Sectors = PrepSelect('sectorid'); $Category = PrepSelect('category'); @@ -115,6 +125,8 @@ echo '<td>Reward Nickname:<br/>(Name used after action)</td><td><input type="text" name="reward_nickname" /></td></tr>'; echo '</table><div><input type="submit" name="commit" value="Commit New" /></div>'; echo '</form>'; + + // DELETE NATURAL RESOURCE }else if ($_POST['action'] == 'Delete' && checkaccess('natres', 'delete')){ $id = escapeSqlString($_POST['id']); $query = "SELECT r.reward_nickname, s.name FROM natural_resources AS r LEFT JOIN sectors AS s ON r.loc_sector_id=s.id WHERE r.id='$id'"; @@ -127,8 +139,10 @@ }else{ echo '<p class="error">Unknown Action - Returning to List</p>'; } + + // LIST NATURAL RESOURCES }else{ - $query = "SELECT r.id, r.loc_sector_id, s.name AS sector, r.loc_x, r.loc_y, r.loc_z, r.radius, r.visible_radius, r.probability, r.skill, sk.name AS skill_name, r.skill_level, r.item_cat_id, c.name AS category, r.item_quality, r.animation, r.anim_duration_seconds, r.item_id_reward, i.name AS item, r.reward_nickname, r.action, r.amount, r.interval, r.max_random FROM natural_resources AS r LEFT JOIN sectors AS s ON r.loc_sector_id=s.id LEFT JOIN item_stats AS i on i.id=r.item_id_reward LEFT JOIN item_categories AS c ON r.item_cat_id=c.category_id LEFT JOIN skills AS sk on sk.skill_id=r.skill"; + $query = "SELECT r.id, r.loc_sector_id, s.name AS sector, r.loc_x, r.loc_y, r.loc_z, r.radius, r.visible_radius, r.probability, r.skill, sk.name AS skill_name, r.skill_level, r.item_cat_id, c.name AS category, r.item_quality, r.animation, r.anim_duration_seconds, r.item_id_reward, i.name AS item, r.reward_nickname, r.action, r.amount, r.interval, r.max_random, r.trace_mesh, r.spawn_mesh FROM natural_resources AS r LEFT JOIN sectors AS s ON r.loc_sector_id=s.id LEFT JOIN item_stats AS i on i.id=r.item_id_reward LEFT JOIN item_categories AS c ON r.item_cat_id=c.category_id LEFT JOIN skills AS sk on sk.skill_id=r.skill"; if (isset($_GET['id'])) { $id = escapeSqlString($_GET['id']); @@ -148,15 +162,23 @@ } } $result = mysql_query2($query); - echo '<table border="1"><tr><th>ID</th><th><a href="./index.php?do=resource&sort=loc">Location</a></th><th>Radius</th><th>Visible Radius</th><th>Probability</th><th><a href="./index.php?do=resource&sort=skill">Skill</a></th><th>Skill Level</th><th><a href="./index.php?do=resource&sort=tool">Tool Category</a></th><th>Item Quality</th><th>Animation</th><th>Animation Duration</th><th><a href="./index.php?do=resource&sort=item">Item</a></th><th>Resource "Nickname"</th><th>Amount (1)</th><th>Interval (2)</th><th>Max Random (3)</th>'; + echo '<table border="1"><tr><th>ID</th><th><a href="./index.php?do=resource&sort=loc">Location</a></th><th>Radius</th><th>Visible Radius</th><th>Probability</th><th><a href="./index.php?do=resource&sort=skill">Skill</a></th><th>Skill Level</th><th><a href="./index.php?do=resource&sort=tool">Tool Category</a></th><th>Item Quality</th><th>Animation</th><th>Animation Duration</th><th><a href="./index.php?do=resource&sort=item">Item</a></th><th>Resource "Nickname"</th><th>Amount (1)</th><th>Interval (2)</th><th>Max Random (3)</th><th>Trace Mesh (4)</th><th>Spawn Mesh (5)</th>'; if (checkaccess('natres', 'edit')){ echo '<th>Actions</th>'; } echo '</tr>'; while ($row = fetchSqlAssoc($result)){ + // get a more readable name + $spawnMesh = $row['spawn_mesh']; + $lastDotPosition = strrpos($spawnMesh, '.'); + // Extract the part after the last dot + if ($lastDotPosition !== false) { + $spawnMesh = substr($spawnMesh, $lastDotPosition + 1); + } + echo '<tr>'; echo '<td>'.$row['id'].'</td>'; - echo '<td>'.$row['sector'].'/'.$row['loc_x'].'/'.$row['loc_y'].'/'.$row['loc_z'].'</td>'; + echo '<td>'.$row['sector'].' '.$row['loc_x'].' '.$row['loc_y'].' '.$row['loc_z'].'</td>'; echo '<td>'.$row['radius'].'</td>'; echo '<td>'.$row['visible_radius'].'</td>'; echo '<td>'.$row['probability'].'</td>'; @@ -171,6 +193,8 @@ echo '<td>'.$row['amount'].'</td>'; echo '<td>'.$row['interval'].'</td>'; echo '<td>'.$row['max_random'].'</td>'; + echo '<td>'.$row['trace_mesh'].'</td>'; + echo '<td>'.$spawnMesh.'</td>'; if (checkaccess('natres', 'edit')){ echo '<td><form action="./index.php?do=resource" method="post">'; echo '<div><input type="hidden" name="id" value="'.$row['id'].'" />'; Modified: www/webconsole-new/index.php =================================================================== --- www/webconsole-new/index.php 2024-08-30 21:53:16 UTC (rev 10022) +++ www/webconsole-new/index.php 2024-10-01 20:40:56 UTC (rev 10023) @@ -169,6 +169,12 @@ itemmain(); searchbooks(); break; + case 'wherebooks': + include('./items/itemmain.php'); + include('./items/wherebooks.php'); + itemmain(); + wherebooks(); + break; case 'editcategory': include('./items/itemmain.php'); include('./items/editcategory.php'); Modified: www/webconsole-new/items/itemmain.php =================================================================== --- www/webconsole-new/items/itemmain.php 2024-08-30 21:53:16 UTC (rev 10022) +++ www/webconsole-new/items/itemmain.php 2024-10-01 20:40:56 UTC (rev 10023) @@ -15,6 +15,7 @@ } echo "<hr/>"; echo '<a href="./index.php?do=searchbooks">Search Books</a> <br/>'."\n"; + echo '<a href="./index.php?do=wherebooks">Where are the Books?</a> <br/>'."\n"; echo "<hr/>"; echo '<a href="./index.php">Return to main page.</a>'."\n"; echo '</div><div class="main">'."\n"; Added: www/webconsole-new/items/searchbooks.php =================================================================== --- www/webconsole-new/items/searchbooks.php (rev 0) +++ www/webconsole-new/items/searchbooks.php 2024-10-01 20:40:56 UTC (rev 10023) @@ -0,0 +1,57 @@ +<?php +function searchbooks() +{ + if (!checkaccess('items', 'read')) + { + echo '<p class="error">You are not authorized to use these functions</p>'; + return; + } + + echo '<p class="bold">Search one word contained in official books<br/></p>'."\n"; + echo '<form action="./index.php?do=searchbooks" method="post"><table>'."\n"; + echo '<tr><td>Word: </td><td><input type="text" name="word1" value="'.$_POST['word1'].'"/></td></tr>'."\n"; + echo '<tr><td>AND</td></tr>'."\n"; + echo '<tr><td>Word: </td><td><input type="text" name="word2" value="'.$_POST['word2'].'"/></td></tr>'."\n"; + echo '<tr><td><input type="submit" name="commit" value="Search" /></td><td></td></tr>'; + echo '</table></form>'; + + if(isset($_POST['word1']) && $_POST['word1'] != "") + { + $escSearch1 = escapeSqlString($_POST['word1']); + $query = "SELECT i.id, i.name, i.creative_definition FROM item_stats as i WHERE creative_definition like '%". $escSearch1 . "%'"; + + $escSearch2 = escapeSqlString($_POST['word2']); + + if ($escSearch2 != "") + $query = $query . " AND creative_definition like '%". $escSearch2 . "%'"; + + $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><th>Text</th>'; + + while ($row = fetchSqlAssoc($result)) + { + echo '<tr>'; + echo '<td>'.$row['id'].'</td>'; + echo '<td><a href="./index.php?do=listitems&item='.$row['id'].'">'.$row['name'].'</a></td>'; + + // highlight the words found. + $word1Replace = "<span style='color:white;font-weight: bold;'>".$escSearch1."</span>"; + $resultingText = str_ireplace($escSearch1, $word1Replace, $row['creative_definition']); + + $word2Replace = "<span style='color:orange;font-weight:bold;'>".$escSearch2."</span>"; + $resultingText = str_ireplace($escSearch2, $word2Replace, $resultingText); + + echo '<td>'.$resultingText.'</td>'; + echo '</tr>'."\n"; + } + echo '</table>'; + } + } + +} +?> Property changes on: www/webconsole-new/items/searchbooks.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 Modified: www/webconsole-new/rules/draw_map.php =================================================================== --- www/webconsole-new/rules/draw_map.php 2024-08-30 21:53:16 UTC (rev 10022) +++ www/webconsole-new/rules/draw_map.php 2024-10-01 20:40:56 UTC (rev 10023) @@ -432,12 +432,14 @@ function draw_locations($im,$sectors,$centerx,$centery,$scalefactorx,$scalefactory,$fg_color){ $query = "select id,x,y,z,radius,id_prev_loc_in_region from sc_locations where " . $sectors; $res = mysql_query2($query); - + // exit if there is no data $num = sqlNumRows($res); if ($num==0) - return; - + { + return; + } + $i=0; while ($line = fetchSqlRow($res)){ $id = $line[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |