WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   PTR General Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=172)
-   -   Map changes. (https://www.wowinterface.com/forums/showthread.php?t=56204)

Yukyuk 05-06-18 02:51 AM

Map changes.
 
In my addon I log newly discovred area's.
Worked just fine using the code below.
But in the Beta GetCurrentMapContinent() throws an error.

Does anybody know where I can find the new Api commands related to the maps?

The prints statements are there for debugging reasons only :)


Lua Code:
  1. function private_table.eventFrame:UI_INFO_MESSAGE(...)
  2.     local arg1, arg2 = ...
  3.     print(arg1)
  4.     print(arg2)
  5.     addon:Check_Dates()
  6.     if arg1 == 370 then
  7.         local zone = {}
  8.         zone.time = time()
  9.         print(zone.time)
  10.         zone.continent = GetCurrentMapContinent()
  11.         print(zone.continent)
  12.         zone.zoneName = GetZoneText()
  13.         print(zone.zoneName)
  14.         zone.subzoneName = GetSubZoneText()
  15.         print(zone.subzoneName)    
  16.         table.insert(HistoriaLocalDb.Area, zone)
  17.         --  Insert new area in the dates table
  18.         table.insert(HistoriaLocalDb.Dates[addon.YS][addon.MS][addon.DS].Area, zone)
  19.     end    
  20. end

Rilgamon 05-06-18 03:32 AM

The Map is heavily changing.
With BfA there is a new ingame help for commands
Code:

/api mapui
or https://github.com/Ellypse/wow-ui-so...umentation.lua

Yukyuk 05-07-18 02:22 PM

Map changes.
 
Thx Rilgamon.
Very usefull information.

Haven't found a way to get the current Continent though.
Will continue the search.

Xrystal 05-07-18 03:58 PM

This is what I got out of the C_Map api

Code:

api C_Map list

functions:
string name = C_Map.GetAreaInfo(areaID)
number uiMapID = C_Map.GetBestMapForUnit(unitToken)
number uiMapID = C_Map.GetCurrentMapID()
string atlasName = C_Map.GetMapArtBackgroundAtlas(uiMapID)
MapCanvasPosition position = C_Map.GetMapArtHelpTextPosition(uiMapID)
table textures { numbers values} = C_Map.GetMapArtLayerTextures(uiMapID, layerIndex)
table layerInfo { uiMapLayerInfo values } C_Map.GetMapArtLayers(uiMapID)
table info {uiMapDetails values } C_Map.GetMapChildrenInfo(uiMapID, opt mapType, opt allDescendants)
bool hideIcons = C_Map.GetMapDisplayInfo(uiMapID)
number uiMapGroupID = C_Map.GetMapGroupID(uiMapID)
table info {uiMapGroupMemberInfo values } = C_Map.GetMapGroupMembersInfo(uiMapGroupID)
fileDataID, texturePercentageX, texturePercentageY, textureX, textureY, scrollChildX, scrollChildY = C_Map.GetMapHighlightInfoAtPosition(uiMapID, x,y)
uiMapDetails info = C_Map.GetMapInfo(uiMapID)
uiMapDetails info = C_Map.GetMapInfoAtPosition(uiMapID,x,y)
playerMinLevel, playerMaxLevel, petMinLevel, petMaxLevel = C_Map.GetMapLevels(uiMapID)
minX, maxX, minY, maxY = C_Map.GetMapRectOnMap(uiMapID,topUIMapID)
C_Map.RequestPreloadMap(uiMapID)
C_Map.SetMap(uiMapID)

enumerations:
Enum.MapCanvasPosition { None, BottomLeft, BottomRight, TopLeft, TopRight }
Enum.UIMapType { Cosmic, World, Continent, Zone, Dungeon, Micro, Orphan }
Enum.UIMapSystem { World, Taxi, Adventure }

structures:
UIMapLayerInfo { layerWidth, layerHeight, tileWidth, tileHeight, minScale, maxScale, additionalZoomSteps }
UIMapDetails { mapID, name, mapType, parentMapID }
UIMapGroupMemberInfo { mapID, relativeHeightIndex, name }


Nimhfree 05-07-18 09:23 PM

To get the current continent the player is in you can use the following:
Code:

local currentMapId, TOP_MOST = C_Map.GetBestMapForUnit('player'), true
local currentContinentInfo = MapUtil.GetMapParentInfo(currentMapId, Enum.UIMapType.Continent, TOP_MOST)

That info contains both the mapID and name.

Yukyuk 05-10-18 02:41 AM

Quote:

Originally Posted by Nimhfree (Post 327922)
To get the current continent the player is in you can use the following:
Code:

local currentMapId, TOP_MOST = C_Map.GetBestMapForUnit('player'), true
local currentContinentInfo = MapUtil.GetMapParentInfo(currentMapId, Enum.UIMapType.Continent, TOP_MOST)

That info contains both the mapID and name.

Took me a few days but works like a charm :)
Thank you Nimhfree

Lua Code:
  1. local currentMapId, TOP_MOST = C_Map.GetBestMapForUnit('player'), true
  2. local currentContinentInfo = MapUtil.GetMapParentInfo(currentMapId, Enum.UIMapType.Continent, TOP_MOST)
  3. zone.continent = currentContinentInfo.name

Ellypse 05-10-18 09:48 AM

For info, C_Map.GetCurrentMapID() has been removed in the latest build. Instead you should use WorldMapFrame:GetMapID() to get the ID of the map currently displayed inside the frame. Note that this will return nil if the map has not been opened yet (and not the current map ID).


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

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