Only two types of coords can be handled.
- Game coords : ( Region, X, Z, Y )
- User coords : ( X, Y ) There is no Z
User coords can be used only if you are not at external map layer (caves/dungeon). As his name, it's only used by the player to know his location at the main world map.
Game coords, are used for everything. Most important,
Region will specify the map layer being used.
If it's lower then
short.MaxValue (32767) means that you are at the main world map, you can convert it to User coords. As example:
Game: R: 26959, X: 952, Z: 1074, Y: 83
User: PosX: -10657, PosY: 2603 (Constantinople, name given by the Region number)
How to ?
PHP Code:
byte ySector = (byte)(Region >> 8);
byte xSector = (byte)(Region & 0xFF);
if (Region < short.MaxValue) // At world map? convert it!
{
// 192px 1:10 scale, center (135,92)
PosX = (xSector - 135) * 192 + X / 10;
PosY = (ySector - 92) * 192 + Y / 10;
}
The
ySector, and
xSector as you noticed, it's the
{Y}x{X} image map from minimap files.
If the Region it's higher or equal than
short.MaxValue, the conversion will be different and the scale can change, also the center will be always defined (128,128).
I'm still learning about this conversions at dungeon layers so I can't help you more than this.