Forum > Software Development

[C++] Get server coords with cursor from map

(1/1)

dm666:
Hi all. How to i can get coords with cursor?
For example:
I move cursor to Goldshire and want to get server coords.
Help with algorithm pls. What i must load, rendering etc?
Sry for my bad english.

schlumpf:
There is no API to do that ingame. You will need to read the data from WorldMap*.dbc and make them available in lua. Then, determine which map you are on (not sure if there is an API for that or if you'll have Tomas that yourself as well), and determine the coordinates by simple maths (position of cursor in percentage mapped to the rect spanned by the DB. Convert the position from map to server coordinates.

dm666:
Thanks for ur answer.
I want to choose location and get coords of the cursor position. Then convert their to server coords(yet it's not necessary).
I want to do something like this

--- Code: ---
statusbarInfo << "tile: " << std::floor(gWorld->camera.x / TILESIZE) << " " << std::floor(gWorld->camera.z / TILESIZE)
<< "; coordinates: client (x: " << gWorld->camera.x << ", y: " << gWorld->camera.z << ", z: " << gWorld->camera.y
<< "), server (x: " << (ZEROPOINT - gWorld->camera.z) << ", y:" << (ZEROPOINT - gWorld->camera.x) << ", z:" << (gWorld->camera.y) << ")";


--- End code ---

But how i can get camera x, y, z? I must load adt file? Or dbc file?

schlumpf:

--- Quote from: "schlumpf" ---You will need to read the data from WorldMap*.dbc
--- End quote ---

Amaroth:
WorldMapArea.dbc sets coords of borders of maps. Check DBCs documentation for more info. Combination of these coords and coords of mouse cursor should be good enough for getting coords of place, where mouse hovers over.

Navigation

[0] Message Index

Go to full version