Jump to content

Get ZoneID From DB Coordinates


Recommended Posts

Thanks for your code sample.

If i understand this correctly, you display a playermap.

Getting the correct coordinates for a player on a map is relative easy, since the zoneid(mapid) is stored for each player. And therefore you can use the following formula:

Orional post (Map coorts to zone ones)

$vars[$i]['x'] = ($row['y']-$y_min)/(($y_max-$y_min)/100);

$vars[$i]['y'] = ($row['x']-$x_min)/(($x_max-$x_min)/100);

or

$vars[$i]['x'] = 100 - ($row['y']-$y_min)/(($y_max-$y_min)/100);

$vars[$i]['y'] = 100 - ($row['x']-$x_min)/(($x_max-$x_min)/100);

The y_min, y_max, x_min and x_max can be retrieved from WorldMapArea.dbc.

This still leaves me with the problem that i am not able to distill the zoneid from a coordinate set(x,y) stored in the database.

If i am incorrect let me know since in this case i really want to be wrong ^_^

Link to comment
Share on other sites

  • 39 years later...

Hi,

I am trying to create a wowhead like system where u visually can see where a creature/gameobject/player is spawned/located.

Calculating the zone specific coordinates goes fine using the formula's from the core.

My main problem which sounds easy is getting the zoneid, i thought using the values from the WorldMapArea and matching those against the coordinates in the database would get me the zone.

After this i have been browsing through the code and bumped into the grid system which is way to large for my simple needs.

A good read of the core maybe would give me the awnser but i am not that familiar with it so it would take me a long time.

Therefore i ask if there is some sort of formula to get the zoneid from the coordiantes stored in the database.

ps: already searched several times with no usable results, if there is an awnser post the link please.

Link to comment
Share on other sites

i written alread a playermap with zonebase, all values are calculated manuelly so it could be wrong calculation and not exactly position, but doesn't matter to have 100% correct locations;)

if you would like i could give you a link to the preview :)

Link to comment
Share on other sites

http://user.orangevir.us/~ferkel/zm2/playermap.php

a small preview of the site ( the aktual version is not loaded so the lvl is not displayed :/ )

$left=$zone[$id]['y_offset']-(round($chars[$i]['position_y']/$zone[$id]['y']));

$top=$zone[$id]['x_offset']-(round($chars[$i]['position_x']/$zone[$id]['x']));

i calculateted for every zone an offset and a zoom faktor

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use