Modcraft - The community dedicated to quality WoW modding!

Projects => Software Development => Topic started by: dm666 on March 06, 2016, 09:36:52 am

Title: [C++] Get server coords with cursor from map
Post by: dm666 on March 06, 2016, 09:36:52 am
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.
Title: Re: [C++] Get server coords with cursor from map
Post by: schlumpf on March 06, 2016, 10:35:28 am
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.
Title: Re: [C++] Get server coords with cursor from map
Post by: dm666 on March 06, 2016, 11:28:49 am
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: [Select]

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) << ")";


But how i can get camera x, y, z? I must load adt file? Or dbc file?
Title: Re: [C++] Get server coords with cursor from map
Post by: schlumpf on March 06, 2016, 11:43:26 am
Quote from: "schlumpf"
You will need to read the data from WorldMap*.dbc
Title: Re: [C++] Get server coords with cursor from map
Post by: Amaroth on March 06, 2016, 07:24:28 pm
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.