WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   How to get the size in yards of a given map? (https://www.wowinterface.com/forums/showthread.php?t=17771)

Duugu 08-18-08 11:55 AM

How to get the size in yards of a given map?
 
Since GetPlayerMapPosition() returns coordinates for instances with WotLK I'm current playing around with the coordinates and range checks.

My goal is to calculate the distance between the player and a specific unit in yards.

I realized that GetPlayerMapPosition() returns "the unit position relative to WorldMapDetailFrame". A number between 0 and 1.
So I used GetPlayerMapPosition() to get PlayerX, PlayerY and TargetX, TargetY.

So far so good. But how do I get the range in yards from this data? I've found the Astrolabe and LibTourist libs. Both calculate distances in yards based on GetPlayerMapPosition and additional tables with the size in yards of all zones.
eg. from Astrolabe:
Code:

Ashenvale = {
        height = 3843.722811451077,
        width = 5766.728884700476,
        ...
        }

So this is exactly what I need. But where the hell do I get these data from?
I've searched around for hours, did tests with map viewers, mpq data, looked at WorldMapFrame.lua, etc., etc. But I can't find any way to get, query or calculate the map size of a given map in yards. :(

I would really appreciate any help/idea on this topic.

Duugu 08-19-08 02:46 PM

No one? No even an idea? :o

Freki 08-19-08 03:42 PM

Well, if you're looking for ideas, I have an idea to work with (that could potentially be wrong :P). And since I'm bored and have way too much time on my hands, I made an image to illustrate



30 yards would be a measured distance (how? cast range maybe?) and at each end you get the coordinate. In this case, you get a distance of 30 yards between (30,40) and (30,45), meaning there was a change in 10% in the x-axis and a chance of 5% in the y-axis.

Oh, and my math could be completely wrong... hopefully it sparks an idea though!

Dreadlorde 08-19-08 03:59 PM

I don't know if this will help but I'm going to post it anyway.

TomTom can measure how far you are away from a way point in yards (or meters? I don't remember atm), you could look through TomTom's code, find how Clad coded it, and then rewrite it to suite your needs.

Duugu 08-19-08 04:09 PM

Thanks a lot for your reply Freki. Didn't checked the math, but I understand the idea. Actually this could be a way to get the zone size.

However this means I (and a second "surveying" character) will have to visit all individual zones, which will be very time-consuming. :/

Anyway ... I'll do that if I can't figure out a easier way. Thanks again.

Duugu 08-19-08 04:11 PM

Quote:

Originally Posted by Dreadlorde (Post 99471)
TomTom can measure how far you are away from a way point in yards (or meters? I don't remember atm), you could look through TomTom's code, find how Clad coded it, and then rewrite it to suite your needs.

Thanks Dreadlorde. Clad is using the Astrolabe lib. Astrolabe is the lib I took the example data in my initial post from.
Unfortunately I can't use Astrolabe as the lib has no data for WotLK or instances.

SDPhantom 08-19-08 04:23 PM

One thing to note.
Last I checked, casting range takes altitude into fact.
You might want to make sure both measuring points are on even ground.

Freki 08-19-08 04:57 PM

Cast range was just the first thing that popped into my mind. I'd hope that there would be a more precise way to measure it. You could always try sending a message to the author of Astrolabe (Esamynn) to see how he/she did it.

ra1d3n 08-19-08 05:20 PM

Quote:

Originally Posted by Duugu (Post 99473)
Thanks Dreadlorde. Clad is using the Astrolabe lib. Astrolabe is the lib I took the example data in my initial post from.
Unfortunately I can't use Astrolabe as the lib has no data for WotLK or instances.

Did you ever think about that they may have opened the map files with a viewer and looked up the size directly? :)
That is probably the reason the size is hardcoded.

SDPhantom 08-19-08 05:27 PM

Quote:

Originally Posted by ra1d3n (Post 99481)
Did you ever think about that they may have opened the map files with a viewer and looked up the size directly?

Quote:

Originally Posted by Duugu (Post 99344)
... I've searched around for hours, did tests with map viewers, mpq data, looked at WorldMapFrame.lua, etc., etc. But I can't find any way to get, query or calculate the map size of a given map in yards. ...

Question answered...

ra1d3n 08-19-08 07:46 PM

Quote:

Originally Posted by SDPhantom (Post 99482)
Question answered...

Damn, sorry i was just reading answers for too long. :)


All times are GMT -6. The time now is 09:08 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI