View Single Post
  #26  
Unread 08-20-2005, 05:06 AM
taco-man's Avatar
taco-man taco-man is offline
EQ2MAP Updater Author
This person is a EQ2Map developer.
Interface Author - Click to view interfaces
 
Join Date: Nov 2004
Server: Antonia Bayle
Posts: 1,349
Default

im not quite sure i understand you correctly, but but heres a slightly simplified version of the function i wrote for the site that takes the pathfind location and zonerect and gives you the x,y coordinates on the map
incase mean is lost in translation this function is
need: pathfind location, zonerect
returns: x,y location on map.
PHP Code:
function GetCoords($PathfindLocation$ZoneRect){
            
//Assume Map images size
            
$MAP_1x 436;
            
$MAP_1y 506;
            
//the 2 below should always be zero
            
$MAP_0x 0;
            
$MAP_0y 0;
            
//Set Icons Width and height
            
$IconW 12;
            
$IconH 12;
            
//split the pathfind location into 2 variables (assumes there is no Z coordinate given in pathfind location
            //normally i have a check that splits it differently depending on if there is 1 comma or 2.
            
list($LOC_x$LOC_y) = explode(",",$PathfindLocation);
            
//split the zonerect up so i can use each value
            
list($LOC_0x$LOC_0y$LOC_1x$LOC_1y) = explode(",",$ZoneRect);
            
$LOC_0x $LOC_0x * -1;
            
//Calculate WDPP_X and WDPP_Y
            
$wdpp_x = ((-$LOC_1x $LOC_0x) / $MAP_1x);
            
$wdpp_y = (($LOC_1y $LOC_0y) / $MAP_1y);
            
//calculate Location
            
$MAP_x = (((-$LOC_0x $LOC_x) / $wdpp_x) + $MAP_0x) - ($IconW 2);
            
$MAP_y = (((-$LOC_0y $LOC_y) / $wdpp_y) + $MAP_0y) - ($IconH 2);
            
//round the Location so that there are no decimals
            
$MAP_x round($MAP_x0);
            
$MAP_y round($MAP_y0);
            
$xml_loc "$MAP_x,$MAP_y";
            
//return location in format x,y
            
return($xml_loc);
            
//end calculations

does this help at all?
__________________
EQ2MAP Updater Download
EQ2MAP Website
How to Install a custom interface

Last edited by taco-man : 08-20-2005 at 05:13 AM.
Reply With Quote