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)