Jump to content

Recommended Posts

Posted

How can i recalculate the position of a player on server ?

I have the database "characters" and their i have 5 columns ( for positions ):

Position_x | Position_y | Position_z | map | orientation

______________________________________________

-3064,61 | 2525,7 | 61,89 | 530 | 2,17

Now i wanna the x and y position of a player on the map.

Can somebody calculate position of this player and describe me then how he calculate it.

Thank you

Posted
Position_x | Position_y | Position_z | map | orientation

______________________________________________

-3064,61 | 2525,7 | 61,89 | 530 | 2,17

Now i wanna the x and y position of a player on the map.

Would it not be -3064.61 and 2525.7?

Posted

what that means for me now :S ... sry it is a stupid question, but can u tell me the final coords for this player ( x, y ) ?

Thank you

EDIT:

Position_x | Position_y | Position_z | map | orientation

______________________________________________

-3064,61 | 2525,7 | 61,89 | 530 | 2,17

Now i wanna the x and y position of a player on the map.

Would it not be -3064.61 and 2525.7?

x= -3064.61 , y = 2525.7 .... how can a coordinate be negative :S

Posted
x= -3064.61 , y = 2525.7 .... how can a coordinate be negative :S

Teleport to 0,0 on the map. The origin is not always a corner of the map, it's in the middle. On 530 this is most likely in some netherspace area between Outland and BC starting zones. On 0 it is in the Alterac Mountains.

Posted

Patman thank you for reply ...

Hmm... know i have one problem i wanna convert this values in values like cartographer addon ... when i look in my database and see value of a player than i wanna convert it into x,y ( cartographer coordinates ) - than i can simple see ... ah the player is here and here

Posted

yes, as I said: affin linear transformation from R^2 -> R^2

all you need is to get the 4 entries of the corresponding matrix (for each map) and 2 entries for the affin part

(though infact the matrix looks like (0,a,b,0))

that's easiest handled with flying to {0%, 100%}^2 and then do .gps

then only you need to solve a system of linear equations.

You can simplify this if you retreat to 2 linear functions, px(y) = a*y + s and py(x) = b*x + t

(remark these funny blizzard developer somehow managed to go the y-axis from right to left, and the x-axis from south to north ;)

Posted

Or to put it into simpler terms, here is the mangos function for converting map co-ords (like the ones in DB) into zone co-ords (like Cartographer)

bool Map2ZoneCoordinates(float& x,float& y,uint32 zone)
{
   WorldMapAreaEntry const* maEntry = sWorldMapAreaStore.LookupEntry(zone);

   // if not listed then map coordinates (instance)
   if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
       return false;

   x = (x-maEntry->x1)/((maEntry->x2-maEntry->x1)/100);
   y = (y-maEntry->y1)/((maEntry->y2-maEntry->y1)/100);    // client y coord from top to down
   std::swap(x,y);                                         // client have map coords swapped

   return true;
}

You need to look up the zone in WorldMapArea.dbc. This will give you 4 co-ordinates: x1, x2, y1, and y2. These are the limits for the zone's map. To get the zone co-ordinates, simply run:

x = (x1)/((x2-x1)/100);

y = (y1)/((y2-y1)/100);

and then switch x and y. (If you want to know which columns are x1, x2, etc, see struct WorldMapAreaEntry in DBCStructure.h)

×
×
  • 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