From: <wel...@us...> - 2009-08-07 14:37:13
|
Revision: 4199 http://planeshift.svn.sourceforge.net/planeshift/?rev=4199&view=rev Author: weltall2 Date: 2009-08-07 14:36:58 +0000 (Fri, 07 Aug 2009) Log Message: ----------- moved the images from /rules to /img Added viewnpcmap (assuming report.xml to be in /rules ) Fixed a bug in the links in (when clicking on the ball.gif) in waypointmap/locationmap. Fixed a bug in sorting pathpoint/waypoint patches by ravna Modified Paths: -------------- www/webconsole-new/commonfunctions.php www/webconsole-new/index.php www/webconsole-new/rules/draw_map.php www/webconsole-new/rules/locationmap.php www/webconsole-new/rules/locations.php www/webconsole-new/rules/pathpoints.php www/webconsole-new/rules/resourcemap.php www/webconsole-new/rules/resources.php www/webconsole-new/rules/rulesmain.php www/webconsole-new/rules/waypointlinks.php www/webconsole-new/rules/waypointmap.php www/webconsole-new/rules/waypoints.php Added Paths: ----------- www/webconsole-new/rules/img/ www/webconsole-new/rules/img/ball01m.gif www/webconsole-new/rules/img/ball04m.gif www/webconsole-new/rules/img/npcroom1.gif www/webconsole-new/rules/viewnpcmap.php Removed Paths: ------------- www/webconsole-new/rules/ball01m.gif www/webconsole-new/rules/ball04m.gif www/webconsole-new/rules/npcroom1.gif Modified: www/webconsole-new/commonfunctions.php =================================================================== --- www/webconsole-new/commonfunctions.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/commonfunctions.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -289,78 +289,91 @@ $data[2] = 180; $data[3] = 2.2; $data[4] = 2.2; + $data[5] = array('hydlaa_plaza', 'tavern_de_kadel'); } else if ($area=='hydlaa_jayose') { $data[0] = 'loc_sector_id=49 or loc_sector_id=40'; $data[1] = -250; $data[2] = -150; $data[3] = 3.2; $data[4] = 3.2; + $data[5] = array('hydlaa_jayose', 'jayose_inside'); } else if ($area=='hydlaa_winch') { $data[0] = 'loc_sector_id=72'; $data[1] = 200; $data[2] = -430; $data[3] = 2.2; $data[4] = 2.2; + $data[5] = array('hydlaa_winch'); } else if ($area=='sewers') { $data[0] = 'loc_sector_id>26 and loc_sector_id<38'; $data[1] = 645; $data[2] = 175; $data[3] = 2.5; $data[4] = 2.5; + $data[5] = array('swr-pink', 'swr-lightgreen', 'swr-yellow', 'swr-purple', 'swr-red', 'swr-blue', 'swr-orange', 'swr-darkgreen01', 'swr-darkgreen02', 'swr-lightblue01', 'swr-lightblue02'); } else if ($area=='laanxdungeon') { $data[0] = 'loc_sector_id>43 and loc_sector_id<49'; $data[1] = 1452; $data[2] = 815; $data[3] = 6.73; $data[4] = 6.73; + $data[5] = array('laanxdungeon', 'wtowerdung', 'wtower', 'wtowerexit', 'wtowertop'); } else if ($area=='arena') { $data[0] = 'loc_sector_id>3 and loc_sector_id<15'; $data[1] = 470; $data[2] = 456; $data[3] = 4.43; $data[4] = 4.43; + $data[5] = array('hall', 'trans1', 'dngn', 'cntr', 'trans2', 'merc', 'upper', 'entr', 'outer', 'hycorr1', 'hycorr2'); } else if ($area=='ojaroad1') { $data[0] = 'loc_sector_id=22'; $data[1] = 603; $data[2] = 600; $data[3] = 0.9; $data[4] = 0.9; + $data[5] = array('ojaroad1'); } else if ($area=="ojaroad2") { $data[0] = 'loc_sector_id=59'; $data[1] = 632; $data[2] = 625; $data[3] = 1; $data[4] = 1; + $data[5] = array('ojaroad2'); } else if ($area=='akkaio') { $data[0] = 'loc_sector_id>16 and loc_sector_id<20'; $data[1] = 445; $data[2] = 465; $data[3] = 5.3; $data[4] = 5.3; + $data[5] = array('ojapath', 'Akk-Central', 'Akk-East'); } else if ($area=='bdroad1') { $data[0] = 'loc_sector_id=60'; $data[1] = 491; $data[2] = 493; $data[3] = 0.76; $data[4] = 0.76; + $data[5] = array('bdroad1'); } else if ($area=='bdroad2') { $data[0] = 'loc_sector_id=61'; $data[1] = 669; $data[2] = 667; $data[3] = 1.07; $data[4] = 1.07; + $data[5] = array('bdroad2'); } else if ($area=='bdoorsout') { $data[0] = 'loc_sector_id=67'; $data[1] = 832; $data[2] = -749; $data[3] = 0.55; $data[4] = 0.55; + $data[5] = array('bdoorsout'); } else if ($area=='bdoorsin') { $data[0] = 'loc_sector_id=66'; $data[1] = 656; $data[2] = -977; $data[3] = 2.2; $data[4] = 2.2; + $data[5] = array('bdoorsin'); } else if ($area=='gugrontid') { $data[0] = 'loc_sector_id=77'; $data[1] = 240; @@ -373,12 +386,14 @@ $data[2] = -371.05; $data[3] = 3.22; $data[4] = 3.26; + $data[5] = array('NPCroom'); } else if ($area=='npcroom2') { $data[0] = 'loc_sector_id=6 or loc_sector_id=7'; $data[1] = 460; $data[2] = 318; $data[3] = 4; $data[4] = 4; + $data[5] = array('dngn', 'cntr'); } return $data; Modified: www/webconsole-new/index.php =================================================================== --- www/webconsole-new/index.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/index.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -457,6 +457,12 @@ rulesmain(); location_map(); break; + case 'viewnpcmap': + include('./rules/rulesmain.php'); + include('./rules/viewnpcmap.php'); + rulesmain(); + viewnpcmap(); + break; case 'skills': include('./rules/rulesmain.php'); include('./rules/skills.php'); Deleted: www/webconsole-new/rules/ball01m.gif =================================================================== (Binary files differ) Deleted: www/webconsole-new/rules/ball04m.gif =================================================================== (Binary files differ) Modified: www/webconsole-new/rules/draw_map.php =================================================================== --- www/webconsole-new/rules/draw_map.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/draw_map.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -27,14 +27,14 @@ function natural_resources_draw() { - $sector = isset($_GET['sector']) ? $_GET['sector'] : ""; - $type = isset($_GET['type']) ? $_GET['type'] : ""; + $sector = isset($_GET['sector']) ? $_GET['sector'] : ''; + $type = isset($_GET['type']) ? $_GET['type'] : ''; if (!checkAccess('rules', 'read')) // you can't actually see these echo's if you don't type this file directly in your browser. { echo 'You do not have access to view this image!'; return; } - if ($sector == "" || $type == "") + if ($sector == '' || $type == '') { echo 'You must supply a sector name and type.'; return; @@ -48,7 +48,7 @@ function draw_map($sector, $type) { - $image_name = $sector.".gif"; + $image_name = '../img/'.$sector.'.gif'; $data = getDataFromArea($sector); $sectors = $data[0]; @@ -71,22 +71,26 @@ $gray = imagecolorallocate($im, 228, 228, 228); $blue = imagecolorallocate($im, 0, 0, 128); - if ($type == "location") + if ($type == 'location') { draw_locations($im,$sectors,$centerx,$centery,$scalefactorx,$scalefactory,$red); } - elseif ($type == "waypoint") + elseif ($type == 'waypoint') { draw_waypoints($im,$sectors,$centerx,$centery,$scalefactorx,$scalefactory,$orange,$blue); } - elseif ($type == "path") + elseif ($type == 'path') { draw_paths($im,$sectors,$centerx,$centery,$scalefactorx,$scalefactory,$gray,$blue); } - elseif ($type == "resource") + elseif ($type == 'resource') { draw_natural_resources($im,$sectors,$centerx,$centery,$scalefactorx,$scalefactory,$green,$dark_green); } + elseif ($type == 'live') + { + draw_live_paths($im,$data[5],$centerx,$centery,$scalefactorx,$scalefactory, array($red, $green, $dark_green, $orange, $gray, $blue)); + } else // do nothing if we don't know the command. { } @@ -288,4 +292,47 @@ } } +function draw_live_paths($im,$sectors,$centerx,$centery,$scalefactorx,$scalefactory, $colors){ + $colorindex = 0; + + $dir = "../../psserver/tracking/"; + if($files = @scandir($dir)) { + foreach($files as $file) { + if($file == '.' || $file == '..') continue; + + $handle = @fopen($dir.$file,"r"); + if($handle) { + $prevx = 999.0; + $prevy = 999.0; + while(!feof($handle)) + { + $buffer = fgets($handle, 4096); + $pieces = explode(",", $buffer); + $found = FALSE; + foreach($sectors as $sectorname) + { + if(trim($pieces[2]) === $sectorname) + $found = TRUE; + } + if($found) + { + + $x = $centerx+($pieces[0]*$scalefactorx); + $y = $centery-($pieces[1]*$scalefactory); + if(!($prevx == 999.0 && $prevy == 999.0)) + { + imageline($im,$prevx,$prevy,$x,$y,$colors[$colorindex]); + } + $prevx = $x; + $prevy = $y; + } + } + fclose($handle); + // draw each npc as a different colour + $colorindex = ($colorindex + 1) % count($colors); + } + } + } +} + ?> Copied: www/webconsole-new/rules/img/ball01m.gif (from rev 3893, www/webconsole-new/rules/ball01m.gif) =================================================================== (Binary files differ) Property changes on: www/webconsole-new/rules/img/ball01m.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Copied: www/webconsole-new/rules/img/ball04m.gif (from rev 3893, www/webconsole-new/rules/ball04m.gif) =================================================================== (Binary files differ) Property changes on: www/webconsole-new/rules/img/ball04m.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Copied: www/webconsole-new/rules/img/npcroom1.gif (from rev 3893, www/webconsole-new/rules/npcroom1.gif) =================================================================== (Binary files differ) Property changes on: www/webconsole-new/rules/img/npcroom1.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Modified: www/webconsole-new/rules/locationmap.php =================================================================== --- www/webconsole-new/rules/locationmap.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/locationmap.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -4,13 +4,13 @@ function location_map(){ if (!checkAccess('rules', 'read')) { - echo "You do not have permission to use this page."; + echo 'You do not have permission to use this page.'; return; } - $sector = (isset($_POST['sector']) ? $_POST['sector'] : ""); + $sector = (isset($_POST['sector']) ? $_POST['sector'] : ''); - if ($sector!=null && $sector!="") { + if ($sector != null && $sector != '') { ?> @@ -136,9 +136,9 @@ //echo "query is $query"; $res = mysql_query2($query); - $result=""; + $result = ''; while ($line = mysql_fetch_array($res, MYSQL_NUM)){ - $elem = $line[0] . "|I: ".$line[0]." N:" . $line[6] . " R:".$line[4]." F:".$line[5]."|x|" . $line[1] . "|" . $line[2]."|".$line[3]."|".$line[7]."|".$line[8]; + $elem = $line[0] . '|I: '.$line[0].' N:' . $line[6] . ' R:'.$line[4].' F:'.$line[5].'|x|' . $line[1] . '|' . $line[2].'|'.$line[3].'|'.$line[7].'|'.$line[8]; $result .= ($elem . "\n"); } // get each line @@ -153,17 +153,17 @@ foreach($peoples as $people) { // skips commented lines - $pos = strstr($people, "#"); + $pos = strstr($people, '#'); - if ($pos=="0") { - $tok2 = strtok($people, "|"); + if ($pos == '0') { + $tok2 = strtok($people, '|'); $infos[] = ""; $count = 1; while ($tok2) { - $tok2 = str_replace("\n", "", $tok2); - $tok2 = str_replace("\r", "", $tok2); + $tok2 = str_replace("\n", '', $tok2); + $tok2 = str_replace("\r", '', $tok2); $infos[$count]=$tok2; - $tok2 = strtok("|"); + $tok2 = strtok('|'); $count++; } @@ -175,15 +175,15 @@ $x= $centerx+($infos[4]*$scalefactorx)-4; $y= $centery-($infos[6]*$scalefactory)-4; - if ($infos[7]=="-1" || $infos[7]=="0") { - $ball = "rules/ball01m.gif"; + if ($infos[7] == '-1' || $infos[7] == '0') { + $ball = 'img/ball01m.gif'; echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; - echo "<A HREF=index.php?page=listlocations&category=Rules_Functions&selected=$infos[1]><img border=0 src=$ball width=8 height=8></a></div>\n"; + echo "<A HREF=index.php?do=location&id=$infos[1]><img border=0 src=$ball width=8 height=8></a></div>\n"; } else { - $ball = "rules/ball04m.gif"; + $ball = 'img/ball04m.gif'; echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; - echo "<A HREF=index.php?page=listlocations&category=Rules_Functions&selectedtype=$infos[8]><img border=0 src=$ball width=10 height=10></a></div>\n"; + echo "<A HREF=index.php?do=location&type=$infos[8]><img border=0 src=$ball width=10 height=10></a></div>\n"; } } @@ -193,13 +193,13 @@ } $sectors_list = PrepSelect('sector'); - echo " <FORM action=\"index.php?do=locationmap\" METHOD=POST>"; - echo " <b>Select one area:</b> <br><br> Area: "; + echo ' <FORM action="index.php?do=locationmap" METHOD=POST>'; + echo ' <b>Select one area:</b> <br><br> Area: '; echo DrawSelectBox('sector', $sectors_list, 'sector', '', false); //SelectAreas('','sector'); - echo " <br><br><INPUT type=submit value=view><br><br>"; - echo "</FORM>"; - echo "</div>"; + echo ' <br><br><INPUT type=submit value=view><br><br>'; + echo '</FORM>'; + echo '</div>'; } Modified: www/webconsole-new/rules/locations.php =================================================================== --- www/webconsole-new/rules/locations.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/locations.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -87,6 +87,16 @@ } }else{ $query = "SELECT l.id, l.type_id, l.id_prev_loc_in_region, l.name, l.x, l.y, l.z, l.radius, l.angle, l.flags, l.loc_sector_id, s.name AS sector FROM sc_locations AS l LEFT JOIN sectors AS s ON l.loc_sector_id = s.id"; + if (isset($_GET['id'])) + { + $id = mysql_real_escape_string($_GET['id']); + $query .= " WHERE l.id='$id'"; + } + elseif (isset($_GET['type'])) + { + $type = mysql_real_escape_string($_GET['type']); + $query .= " WHERE l.type_id='$type'"; + } if (isset($_GET['sort'])){ switch ($_GET['sort']){ case 'name': Deleted: www/webconsole-new/rules/npcroom1.gif =================================================================== (Binary files differ) Modified: www/webconsole-new/rules/pathpoints.php =================================================================== --- www/webconsole-new/rules/pathpoints.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/pathpoints.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -5,7 +5,7 @@ { $query = "SELECT DISTINCT p.path_id, s.name AS sector, wl.wp1, wl.wp2, CONCAT(' X: ', w.x, ' Y: ', w.y, ' Z: ', w.z) AS wp1_coords, CONCAT(' X: ', ww.x, ' Y: ', ww.y, ' Z: ', ww.z) AS wp2_coords, w.name AS wp1_name, ww.name AS wp2_name FROM sc_path_points AS p LEFT JOIN sc_waypoint_links AS wl ON p.path_id=wl.id LEFT JOIN sc_waypoints AS w ON wl.wp1=w.id LEFT JOIN sc_waypoints AS ww ON wl.wp2=ww.id LEFT JOIN sectors AS s ON w.loc_sector_id=s.id"; - if (isset($_GET['sector']) && $_GET['sector'] != '') + if (isset($_GET['sector']) && $_GET['sector'] != '' && $_GET['sector'] != '0') { $sec = mysql_real_escape_string($_GET['sector']); $query = $query . " WHERE w.loc_sector_id='$sec'"; Modified: www/webconsole-new/rules/resourcemap.php =================================================================== --- www/webconsole-new/rules/resourcemap.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/resourcemap.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -4,13 +4,13 @@ function natural_resources_map(){ if (!checkAccess('rules', 'read')) { - echo "You do not have permission to use this page."; + echo 'You do not have permission to use this page.'; return; } - $sector = (isset($_POST['sector']) ? $_POST['sector'] : ""); + $sector = (isset($_POST['sector']) ? $_POST['sector'] : ''); - if ($sector!=null && $sector!="") { + if ($sector != null && $sector != '') { ?> @@ -123,7 +123,7 @@ <?PHP echo "<h1>Natural Resources Map View $sector</h1>"; -echo "Natural Resources painted in green<br>"; +echo 'Natural Resources painted in green<br>'; echo "<div id=Layer2 style=\"position:relative; \">"; //echo "<div id=Layer2 style=\"position:absolute; width:1968px; height:954px; z-index:1; left:0px; top:250px\">"; @@ -135,7 +135,7 @@ //echo "query is $query"; $res = mysql_query2($query); - $result=""; + $result = ''; while ($line = mysql_fetch_array($res, MYSQL_NUM)){ $elem = $line[0] . "|R:" . $line[5] . " P:".$line[6]." I:".$line[7]."|x|" . $line[1] . "|" . $line[3]."|".$line[6]; $result .= ($elem . "\n"); @@ -152,17 +152,17 @@ foreach($peoples as $people) { // skips commented lines - $pos = strstr($people, "#"); + $pos = strstr($people, '#'); - if ($pos=="0") { - $tok2 = strtok($people, "|"); - $infos[] = ""; + if ($pos == '0') { + $tok2 = strtok($people, '|'); + $infos[] = ''; $count = 1; while ($tok2) { - $tok2 = str_replace("\n", "", $tok2); - $tok2 = str_replace("\r", "", $tok2); + $tok2 = str_replace("\n", '', $tok2); + $tok2 = str_replace("\r", '', $tok2); $infos[$count]=$tok2; - $tok2 = strtok("|"); + $tok2 = strtok('|'); $count++; } @@ -171,18 +171,18 @@ $scalefactorx = $data[3]; $scalefactory = $data[4]; - $x= $centerx+($infos[4]*$scalefactorx); - $y= $centery-($infos[5]*$scalefactory); + $x = $centerx+($infos[4]*$scalefactorx); + $y = $centery-($infos[5]*$scalefactory); - if ($infos[6]=="Y") { - $ball = "rules/ball01m.gif"; + if ($infos[6] == 'Y') { + $ball = 'img/ball01m.gif'; echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; - echo "<A HREF=index.php?do=resource&selected=$infos[1]><img border=0 src=$ball width=8 height=8></a></div>\n"; + echo "<A HREF=index.php?do=resource&id=$infos[1]><img border=0 src=$ball width=8 height=8></a></div>\n"; } else { - $ball = "rules/ball04m.gif"; + $ball = 'img/ball04m.gif'; echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; - echo "<A HREF=index.php?do=resource&selected=$infos[1]><img border=0 src=$ball width=10 height=10></a></div>\n"; + echo "<A HREF=index.php?do=resource&id=$infos[1]><img border=0 src=$ball width=10 height=10></a></div>\n"; } } @@ -192,13 +192,13 @@ } $sectors_list = PrepSelect('sector'); - echo " <FORM action=\"index.php?do=resourcemap\" METHOD=POST>"; - echo " <b>Select one area:</b> <br><br> Area: "; + echo ' <FORM action="index.php?do=resourcemap" METHOD=POST>'; + echo ' <b>Select one area:</b> <br><br> Area: '; echo DrawSelectBox('sector', $sectors_list, 'sector', '', false); //SelectAreas('','sector'); - echo " <br><br><INPUT type=submit value=view><br><br>"; - echo "</FORM>"; - echo "</div>"; + echo ' <br><br><INPUT type=submit value=view><br><br>'; + echo '</FORM>'; + echo '</div>'; } Modified: www/webconsole-new/rules/resources.php =================================================================== --- www/webconsole-new/rules/resources.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/resources.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -123,6 +123,11 @@ } }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 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 = mysql_real_escape_string($_GET['id']); + $query .= " WHERE r.id='$id'"; + } if (isset($_GET['sort'])){ if ($_GET['sort'] == 'loc'){ $query = $query . ' ORDER BY sector, loc_x, loc_y, loc_z, item'; Modified: www/webconsole-new/rules/rulesmain.php =================================================================== --- www/webconsole-new/rules/rulesmain.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/rulesmain.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -22,6 +22,7 @@ echo '<a href="./index.php?do=listpathpoints">List Pathpoints</a><br/>'; echo '<a href="./index.php?do=location">List Locations</a><br/>'; echo '<a href="./index.php?do=locationmap">List Location Map</a><br/>'; + echo '<a href="./index.php?do=viewnpcmap">View NPC Map</a><br/>'; echo '<hr/><a href="./index.php?do=skills">List Skills</a><br/>'; echo '<a href="./index.php?do=factions">List Factions</a><br/>'; echo '<a href="./index.php?do=raceinfo">Race Info/Spawn Points</a><br/>'; Added: www/webconsole-new/rules/viewnpcmap.php =================================================================== --- www/webconsole-new/rules/viewnpcmap.php (rev 0) +++ www/webconsole-new/rules/viewnpcmap.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -0,0 +1,268 @@ +<?php +function viewnpcmap(){ + + $report = 'rules/report.xml'; // where this script expects the report.xml file to be. + + if (!checkAccess('rules', 'read')) + { + echo 'You do not have permission to use this page.'; + return; + } + + $sector = (isset($_GET['sector']) ? $_GET['sector'] : ''); + + if ($sector != null && $sector != '') { + + +?> + +<script language="JavaScript"> +<!-- +function MM_reloadPage(init) { //reloads the window if Nav4 resized + if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { + document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} + else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); +} +MM_reloadPage(true); +// --> +</script> + +<style type="text/css"> +#dhtmltooltip{ +position: absolute; +width: 150px; +border: 2px solid black; +padding: 2px; +background-color: lightyellow; +visibility: hidden; +z-index: 100; +/*Remove below line to remove shadow. Below line should always appear last within this CSS*/ +filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135); +} + +</style> + +</head> + +<body bgcolor="#FFFFFF" text="#000000"> + + +<div id="dhtmltooltip"></div> + +<script type="text/javascript"> + +/*********************************************** +* Cool DHTML tooltip script- \xA9 Dynamic Drive DHTML code library (www.dynamicdrive.com) +* This notice MUST stay intact for legal use +* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code +***********************************************/ + +var offsetxpoint=-60 //Customize x offset of tooltip +var offsetypoint=20 //Customize y offset of tooltip +var ie=document.all +var ns6=document.getElementById && !document.all +var enabletip=false +if (ie||ns6) +var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "" + +function ietruebody(){ +return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body +} + +function ddrivetip(thetext, thecolor, thewidth){ +if (ns6||ie){ +if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px" +if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor +tipobj.innerHTML=thetext +enabletip=true +return false +} +} + +function positiontip(e){ +if (enabletip){ +var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft; +var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop; +//Find out how close the mouse is to the corner of the window +var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20 +var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20 + +var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000 + +//if the horizontal distance isn't enough to accomodate the width of the context menu +if (rightedge<tipobj.offsetWidth) +//move the horizontal position of the menu to the left by it's width +tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px" +else if (curX<leftedge) +tipobj.style.left="5px" +else +//position the horizontal position of the menu where the mouse is positioned +tipobj.style.left=curX+offsetxpoint+"px" + +//same concept with the vertical position +if (bottomedge<tipobj.offsetHeight) +tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px" +else +tipobj.style.top=curY+offsetypoint+"px" +tipobj.style.visibility="visible" +} +} + +function hideddrivetip(){ +if (ns6||ie){ +enabletip=false +tipobj.style.visibility="hidden" +tipobj.style.left="-1000px" +tipobj.style.backgroundColor='' +tipobj.style.width='' +} +} +document.onmousemove=positiontip; + +</script> + +<?PHP +if(!isset($_GET['live'])){ +echo "<h1>NPC Map View $sector</h1>"; +} +else +{ +echo "<h1>LIVE Map View $sector</h1>"; +} + +echo "<div id=Layer2 style=\"position:relative; \">"; +//echo "<div id=Layer2 style=\"position:absolute; width:1968px; height:954px; z-index:1; left:0px; top:90px\">"; + +if(!isset($_GET['live'])) + echo "<img src=\"rules/draw_map.php?sector=$sector&type=path\" >"; +else + echo "<img src=\"rules/draw_map.php?sector=$sector&type=live\" >"; + +$data = getDataFromArea($sector); +$sectors = $data[0]; +$centerx = $data[1]; +$centery = $data[2]; +$scalefactorx = $data[3]; +$scalefactory = $data[4]; + +if(!isset($_GET['live'])){ + $query = "SELECT id,name,loc_x,loc_y,loc_z,loc_sector_id, npc_impervious_ind FROM characters WHERE npc_master_id>0 AND " . $sectors . " and npc_spawn_rule>0"; + $res = mysql_query2($query); + + $i=0; + $result = ''; + while ($line = mysql_fetch_array($res, MYSQL_NUM)){ + $elem = $line[0] . "|" . $line[1] . "|x|" . $line[2] . "|" . $line[4]."|".$line[6]; + $result .= $elem . "\n"; + } + // get each line + $tok = strtok($result, "\n"); + $peoples; + while ($tok) { + $peoples[]=$tok; + $tok = strtok("\n"); + } + + + // get all info for each line + foreach( $peoples as $people ) { + + // skips commented lines + $pos = strstr($people, '#'); + + if ($pos=="0") { + $tok2 = strtok($people, '|'); + $infos[] = ''; + $count = 1; + while ($tok2) { + $tok2 = str_replace("\n", '', $tok2); + $tok2 = str_replace("\r", '', $tok2); + $infos[$count]=$tok2; + $tok2 = strtok('|'); + $count++; + } + + + $x = $centerx+($infos[4]*$scalefactorx); + $y = $centery-($infos[5]*$scalefactory); + + if ($infos[6] == 'Y') { + $ball = 'img/ball01m.gif'; + echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; + echo "<A HREF=index.php?do=npc_details&sub=main&npc_id=$infos[1]><img border=0 src=$ball width=8 height=8></a></div>\n"; + + } else { + $ball = 'img/ball04m.gif'; + echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; + echo "<A HREF=index.php?do=npc_details&sub=main&npc_id=$infos[1]><img border=0 src=$ball width=10 height=10></a></div>\n"; + } + + } + } +} +else +{ + // Get Live position data + $handle = @fopen($report,"r"); + if($handle) { + while ( !feof($handle) ) + { + $buffer = fgets($handle, 4096); + if(preg_match("/npc name=\"(?P<name>.*?)\".*pos=\"(?P<x>.*?),.*?,(?P<z>.*?)\" sector=\"(?P<sector>.*?)\"/", $buffer, $matches)) { + $found = FALSE; + foreach($data[5] as $sectorname) + { + if($matches['sector'] === $sectorname) + $found = TRUE; + } + if($found) + { + $ball = 'img/ball01m.gif'; + $x= $centerx+($matches['x']*$scalefactorx); + $y= $centery-($matches['z']*$scalefactory); + echo "<div id=Layer1 onMouseover=\"ddrivetip('".$matches['name']."')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; + echo "<img border=0 src=$ball width=8 height=8></div>\n"; + } + } + elseif(preg_match("/player name=\"(?P<name>.*?)\".*pos=\"(?P<x>.*?),.*?,(?P<z>.*?)\" sector=\"(?P<sector>.*?)\"/", $buffer, $matches)) { + $found = FALSE; + foreach($data[5] as $sectorname) + { + if($matches['sector'] === $sectorname) + $found = TRUE; + } + if($found) + { + $ball = 'img/ball04m.gif'; + $x= $centerx+($matches['x']*$scalefactorx); + $y= $centery-($matches['z']*$scalefactory); + echo "<div id=Layer1 onMouseover=\"ddrivetip('".$matches['name']."')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; + echo "<img border=0 src=$ball width=10 height=10></div>\n"; + } + } + + } + } + else + { + echo '<p class="error">Could not open report.xml file in '.$report.'</p>'; + } + @fclose($handle); + +} +} + $sectors_list = PrepSelect('sector'); + echo ' <FORM action="index.php" METHOD="GET"><input type="hidden" name="do" value="viewnpcmap">'; + echo ' <b>Select one area:</b> <br><br> Area: '; + echo DrawSelectBox('sector', $sectors_list, 'sector', '', false); + //SelectAreas('','sector'); + echo ' <br><input type="checkbox" name="live" value="yes">LIVE view <br><br><INPUT type="submit" value="view"><br><br>'; + echo '</FORM>'; + echo '</div>'; +} +?> + + + + + Property changes on: www/webconsole-new/rules/viewnpcmap.php ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: www/webconsole-new/rules/waypointlinks.php =================================================================== --- www/webconsole-new/rules/waypointlinks.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/waypointlinks.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -6,7 +6,7 @@ { $query = "SELECT DISTINCT wl.id, wl.name, wl.type, wl.wp1, wl.wp2, wl.flags, CONCAT(' X: ', w.x, ' Y: ', w.y, ' Z: ', w.z) AS wp1_coords, CONCAT(' X: ', ww.x, ' Y: ', ww.y, ' Z: ', ww.z) AS wp2_coords, w.name AS wp1_name, ww.name AS wp2_name, !ISNULL(pp.id) AS has_path FROM sc_waypoint_links AS wl LEFT JOIN sc_waypoints AS w ON wl.wp1=w.id LEFT JOIN sc_waypoints AS ww ON wl.wp2=ww.id LEFT JOIN sc_path_points AS pp ON pp.path_id=wl.id"; - if (isset($_GET['sector']) && $_GET['sector'] != '') + if (isset($_GET['sector']) && $_GET['sector'] != '' && $_GET['sector'] != '0') { $sec = mysql_real_escape_string($_GET['sector']); $query = $query . " WHERE w.loc_sector_id='$sec'"; Modified: www/webconsole-new/rules/waypointmap.php =================================================================== --- www/webconsole-new/rules/waypointmap.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/waypointmap.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -4,13 +4,13 @@ function waypoint_map(){ if (!checkAccess('rules', 'read')) { - echo "You do not have permission to use this page."; + echo 'You do not have permission to use this page.'; return; } - $sector = (isset($_POST['sector']) ? $_POST['sector'] : ""); + $sector = (isset($_POST['sector']) ? $_POST['sector'] : ''); - if ($sector!=null && $sector!="") { + if ($sector != null && $sector != '') { ?> @@ -123,7 +123,7 @@ <?PHP echo "<h1>Waypoint Map View $sector</h1>"; -echo "NPC Waypoints painted in orange<br>"; +echo 'NPC Waypoints painted in orange<br>'; echo "<div id=Layer2 style=\"position:relative; \">"; //echo "<div id=Layer2 style=\"position:absolute; width:1968px; height:954px; z-index:1; left:0px; top:250px\">"; @@ -154,15 +154,15 @@ foreach($peoples as $people) { // skips commented lines - $pos = strstr($people, "#"); + $pos = strstr($people, '#'); if ($pos=="0") { - $tok2 = strtok($people, "|"); + $tok2 = strtok($people, '|'); $infos[] = ""; $count = 1; while ($tok2) { - $tok2 = str_replace("\n", "", $tok2); - $tok2 = str_replace("\r", "", $tok2); + $tok2 = str_replace("\n", '', $tok2); + $tok2 = str_replace("\r", '', $tok2); $infos[$count]=$tok2; $tok2 = strtok("|"); $count++; @@ -173,18 +173,18 @@ $scalefactorx = $data[3]; $scalefactory = $data[4]; - $x= $centerx+($infos[4]*$scalefactorx)-5; - $y= $centery-($infos[6]*$scalefactory)-5; + $x = $centerx+($infos[4]*$scalefactorx)-5; + $y = $centery-($infos[6]*$scalefactory)-5; - if ($infos[7]=="ALLOW_RETURN") { - $ball = "rules/ball04m.gif"; + if ($infos[7] == "ALLOW_RETURN") { + $ball = 'img/ball04m.gif'; echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; - echo "<A HREF=index.php?page=listwaypoints&selected=$infos[1]§or=$sector><img border=0 src=$ball width=8 height=8></a></div>\n"; + echo "<A HREF=index.php?do=waypoint&id=$infos[1]><img border=0 src=$ball width=8 height=8></a></div>\n"; } else { - $ball = "rules/ball01m.gif"; + $ball = 'img/ball01m.gif'; echo "<div id=Layer1 onMouseover=\"ddrivetip('$infos[2]')\"; onMouseout=\"hideddrivetip()\" style=\"position:absolute; offsetTop:20px; width:10px; height:10px; z-index:2; left:".$x."px; top:".$y."px\">"; - echo "<A HREF=index.php?page=listwaypoints&selected=$infos[1]§or=$sector><img border=0 src=$ball width=10 height=10></a></div>\n"; + echo "<A HREF=index.php?do=waypoint&id=$infos[1]><img border=0 src=$ball width=10 height=10></a></div>\n"; } } @@ -194,13 +194,13 @@ } $sectors_list = PrepSelect('sector'); - echo " <FORM action=\"index.php?do=waypointmap\" METHOD=POST>"; - echo " <b>Select one area:</b> <br><br> Area: "; + echo ' <FORM action="index.php?do=waypointmap" METHOD=POST>'; + echo ' <b>Select one area:</b> <br><br> Area: '; echo DrawSelectBox('sector', $sectors_list, 'sector', '', false); //SelectAreas('','sector'); - echo " <br><br><INPUT type=submit value=view><br><br>"; - echo "</FORM>"; - echo "</div>"; + echo ' <br><br><INPUT type=submit value=view><br><br>'; + echo '</FORM>'; + echo '</div>'; } Modified: www/webconsole-new/rules/waypoints.php =================================================================== --- www/webconsole-new/rules/waypoints.php 2009-08-07 06:03:47 UTC (rev 4198) +++ www/webconsole-new/rules/waypoints.php 2009-08-07 14:36:58 UTC (rev 4199) @@ -140,26 +140,30 @@ } }else{ $query = "SELECT w.id, w.name, w.wp_group, w.x, w.y, w.z, w.radius, w.flags, w.loc_sector_id, s.name AS sector FROM sc_waypoints AS w LEFT JOIN sectors AS s on s.id=w.loc_sector_id"; - if (isset($_GET['sector']) && $_GET['sector']!=""){ + if (isset($_GET['id']) && $_GET['id']!=''){ + $id = mysql_real_escape_string($_GET['id']); + $query .= " WHERE w.id='$id'"; + } + elseif (isset($_GET['sector']) && $_GET['sector']!=''){ $sec = mysql_real_escape_string($_GET['sector']); - $query = $query . " WHERE loc_sector_id='$sec'"; + $query .= " WHERE w.loc_sector_id='$sec'"; } if (isset($_GET['sort'])){ switch($_GET['sort']){ case 'name': - $query = $query . " ORDER BY w.name"; + $query .= ' ORDER BY w.name'; break; case 'group': - $query = $query . " ORDER BY w.wp_group"; + $query .= ' ORDER BY w.wp_group'; break; case 'sector': - $query = $query . " ORDER BY sector, name"; + $query .= ' ORDER BY sector, name'; break; default: - $query = $query . " ORDER BY sector, name"; + $query .= ' ORDER BY sector, name'; } }else{ - $query = $query . " ORDER BY sector, name"; + $query .= ' ORDER BY sector, name'; } if (isset($_GET['limit']) && is_numeric($_GET['limit'])){ $lim = $_GET['limit'] - 30; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |