Thread Tools Display Modes
05-06-18, 02:51 AM   #1
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
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
__________________
Better to fail then never have tried at all.
  Reply With Quote
05-06-18, 03:32 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
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
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
05-07-18, 02:22 PM   #3
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
Map changes.

Thx Rilgamon.
Very usefull information.

Haven't found a way to get the current Continent though.
Will continue the search.
__________________
Better to fail then never have tried at all.
  Reply With Quote
05-07-18, 03:58 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
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 }
__________________
  Reply With Quote
05-07-18, 09:23 PM   #5
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
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.
  Reply With Quote
05-10-18, 02:41 AM   #6
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
Originally Posted by Nimhfree View Post
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
__________________
Better to fail then never have tried at all.
  Reply With Quote
05-10-18, 09:48 AM   #7
Ellypse
Storyline and TRP dev.
 
Ellypse's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 9
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).
  Reply With Quote

WoWInterface » PTR » PTR General Discussion » Map changes.

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