Quantcast
How to get the size in yards of a given map? - WoWInterface
Thread Tools Display Modes
08-18-08, 11:55 AM   #1
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
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.
  Reply With Quote
08-19-08, 02:46 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
No one? No even an idea?
  Reply With Quote
08-19-08, 03:42 PM   #3
Freki
A Deviate Faerie Dragon
 
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
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!
  Reply With Quote
08-19-08, 03:59 PM   #4
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
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.
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote
08-19-08, 04:09 PM   #5
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
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.

Last edited by Duugu : 08-19-08 at 04:12 PM.
  Reply With Quote
08-19-08, 04:11 PM   #6
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Dreadlorde View Post
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.

Last edited by Duugu : 08-19-08 at 04:13 PM.
  Reply With Quote
08-19-08, 04:23 PM   #7
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,929
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.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-19-08, 04:57 PM   #8
Freki
A Deviate Faerie Dragon
 
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
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.
  Reply With Quote
08-19-08, 05:20 PM   #9
ra1d3n
A Cyclonian
 
ra1d3n's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 44
Originally Posted by Duugu View Post
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.
  Reply With Quote
08-19-08, 05:27 PM   #10
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,929
Originally Posted by ra1d3n View Post
Did you ever think about that they may have opened the map files with a viewer and looked up the size directly?
Originally Posted by Duugu View Post
... 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...
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-19-08, 07:46 PM   #11
ra1d3n
A Cyclonian
 
ra1d3n's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 44
Originally Posted by SDPhantom View Post
Question answered...
Damn, sorry i was just reading answers for too long.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to get the size in yards of a given map?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off