WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR General Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=172)
-   -   Coordinates for BfA (https://www.wowinterface.com/forums/showthread.php?t=56169)

Voxxel 04-21-18 04:58 AM

Coordinates for BfA
 
Hey!

I know it's very early but do you guys know a coordinate addon for BfA-Alpha yet that actually works? I tried some like MapCoords, Coordinates, DCoords, but none of them works.

Seerah 04-21-18 11:35 AM

They changed how coordinates are gotten. We're still figuring this out. ;)

VincentSDSH 04-21-18 01:26 PM

The usual API functions (GetMapZones(), GetPlayerMapPosition(), GetCurrentMapAreaID(), etc) are missing and causing no end of headache.

Fizzlemizz 04-21-18 01:56 PM

In game type
Code:

/api mapui
click the pink MapUI text

or extract the code files and look in
\Addons\Blizzard_APIDocumentation\MapDocumentation.lua

VincentSDSH 04-21-18 04:26 PM

That helps with some things but functions like GetPlayerMapPosition() aren't defined there (doesn't exist in BfA and doesn't show in the extraction from live)

Nimhfree 04-21-18 05:36 PM

At the moment the key piece that is missing for me is the implementation of GetPlayerMapPosition. And using UnitPosition gives me values that are not percentage ranges within the map, but seem to be absolute points on the map. If only we could get the map dimensions we could probably simulate GetPlayerMapPosition well.

On a side note, it looks like C_Map.GetBestMapForUnit('player') is not ready early on in startup because nil is being returned.

Nevcairiel 04-21-18 06:08 PM

The entire Map API in general is still in development. Its one area that has seen an entire redesign in BfA and its not quite done yet. Give any map-related questions a bit more time to be figured out!

Do however note that any addons that accessed map or location information will need changes, and sometimes maybe even re-think their design as things change drastically. So be prepared for that.

Information we currently do have:
- Continent/Zone index numbers are gone without replacement (ie. what GetCurrentMapContinent/GetCurrentMapZone used to return)
- The map filename is also gone (map files use the numeric texture IDs now, not useful as identification anylonger)
- MapAreaId/Floor are gone, replaced by UiMapId (every map you see has its own unique id, no longer dealing with floors etc)
- All maps are hierarchical, which means they have a parent and any number of children. A continent has zones, a zone has dungeons and microdungeons, a dungeon has floors, and so on, and you can query this hierarchy to find dungeon floors etc.
- No stateful API anymore (ie. the map currently being shown by the map is tracked in Lua only, not by any hidden magic in C code) (this is still a work in progress)
- A translation from MapAreaId/Floor => UiMapId is not available in-game, however we've been given this data to do the translation manually, or include them in an addon

Whats still missing so far:
- Player position in zone coordinates (ie. what GetPlayerMapPosition was)
- Zone size and position data (what GetAreaMapInfo used to return)

I've been talking to Dan (Blizzard UI developer who hangs around IRC), and he has assured me that he will look into exporting Zone size data again. If this does not happen for some reason, the alternative is to extract that data from the games database files and dump it into a library.

Whichever method is required, I'll definitely be updating my HereBeDragons map library to provide the same amount of information it offers now (I use the term "update" losely, due to the drastic changes it'll probably be a rewrite and calling it "2.0"). But, all in good time once I know which course to even take based on which API we're getting, and which we're not.

VincentSDSH 04-21-18 07:23 PM

Quote:

Originally Posted by Nevcairiel (Post 327646)
A translation from MapAreaId/Floor => UiMapId is not available in-game, however we've been given this data to do the translation manually, or include them in an addon.

UIMapIDToWorldAreaID.lua in the /addons/Blizzard_Depricated export directory contains a mapping of new to old.

Lua Code:
  1. -- This is for the 8.x map transition.
  2. -- Previously maps were represented by either by a pair of WorldMapAreaID and DungeonFloor, or a DungeonMapID.
  3. -- In the new system all maps are represented by a UiMapID.
  4. -- The CSV formatted comment below holds mapping between the two systems at the time of transition.
  5. -- This file will be removed in a future patch.
  6.  
  7.  
  8. --[[
  9. UiMapID,WorldMapAreaID,DungeonMapID,DungeonFloor
  10. 1,4,,0
  11. 2,4,598,8
  12. 3,4,602,10
  13. 4,4,603,11
  14. 5,4,604,12
  15. 6,4,657,19
  16. ....

Nevcairiel 04-22-18 02:48 AM

Indeed, thats the data I was referring to. :)

Bluspacecow 05-12-18 11:12 AM

Here's a Macro -

/script px, py = C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit("player"), "player"):GetXY()
/script DEFAULT_CHAT_FRAME:AddMessage(format ("[ %s ] %.2f , %.2f",GetZoneText(),px*100,py*100));

Voxxel 05-16-18 04:08 AM

Quote:

Originally Posted by Bluspacecow (Post 327965)
Here's a Macro -

/script px, py = C_Map.GetPlayerMapPosition(C_Map.GetBestMapForUnit("player"), "player"):GetXY()
/script DEFAULT_CHAT_FRAME:AddMessage(format ("[ %s ] %.2f , %.2f",GetZoneText(),px*100,py*100));

Thanks!
Working fluently.

Cogwerkz 06-07-18 09:14 AM

Well this is stupid simple and I didn't really test it, but I half way copy pasted the code I'm currently using for my minimap coordinates on the BfA beta.

Didn't want to necro any threads, just thought it might be nice for people to have as a reference or something to play around with while trying to make sense of the beta API changes. :)

Just remember I drycoded it in 2 minutes. Here there might be bugs! And dragons!

Lua Code:
  1. local coords = CreateFrame("Frame", nil, Minimap)
  2. coords:SetFrameLevel(Minimap:GetFrameLevel() + 5)
  3. coords:SetAllPoints()
  4. coords.elapsed = 0
  5.  
  6. coords.msg = coords:CreateFontString()
  7. coords.msg:SetDrawLayer("OVERLAY")
  8. coords.msg:SetFontObject(GameFontNormal)
  9. coords.msg:SetPoint("BOTTOM", 0, 20)
  10.  
  11. coords.onUpdate = function(self, elapsed)
  12.     self.elapsed = self.elapsed + elapsed
  13.     if self.elapsed < .1 then
  14.         return
  15.     end
  16.  
  17.     local x, y
  18.     local mapID = C_Map.GetBestMapForUnit("player")
  19.     if mapID then
  20.         -- you don't get coordinates in instances
  21.         local mapPosObject = C_Map.GetPlayerMapPosition(mapID, "player")
  22.         if mapPosObject then
  23.             x, y = mapPosObject:GetXY()
  24.         end
  25.     end
  26.  
  27.     -- just to avoid checking for nil entries and stuff
  28.     x = x or 0
  29.     y = y or 0
  30.  
  31.     -- hide it when there aren't any coordinates
  32.     self.msg:SetShown(x + y > 0)
  33.     self.msg:SetFormattedText("%.1f %.1f", x*100, y*100)
  34.  
  35.     self.elapsed = 0
  36. end
  37.  
  38. coords:SetScript("OnEvent", function(self)
  39.     self:SetScript("OnUpdate", self.onUpdate)
  40. end)
  41. coords:RegisterEvent("PLAYER_ENTERING_WORLD")


All times are GMT -6. The time now is 12:58 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI