View Single Post
02/18/19, 03:28 AM   #13
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
From the API functions sirinsidiator provided one should iterate over all map locations, check if it is visible, and get the icon name. Check if the icon name contains something like city and then hide it I assume.

Lua Code:
  1. for mapLocationIndex=1, GetNumMapLocations(), 1 do
  2.  if IsMapLocationVisible(mapLocationIndex) then
  3.    local iconNameLower = GetMapLocationIcon(mapLocationIndex):lower()
  4.    if string.find(iconNameLower , "city") ~= nil then
  5.       --Hide the mapLocation at mapLocationIndex. I don't know how to get the "control" of that mapLocation though and so I'm not able to use :SetHidden() on it :-(
  6.    end
  7.  end
  8. end

Maybe someone else who got more map expeience is able to help here

Just talked to Votan and there does not seem to be a gogd way so here is another approach:

if we are inside any subzone of the map (which will be a city, a dungeon, whatever) we can let the function IsMapLocationVisible always return false so the pins won't be shown/added anymore. This should affect all pins hopefully.


Lua Code:
  1. ZO_PreHook("IsMapLocationVisible", function()
  2.  if GetParentZoneId ~= nil then
  3.     local zoneId, subZoneId
  4.     zoneId = GetParentZoneId ()
  5.     if zoneId ~= nil then
  6.        local zoneIndex = GetUnitZoneIndex("player")
  7.        if zoneIndex ~= nil then
  8.           subZoneId = GetZoneId(zoneIndex)
  9.           if subZoneId ~= nil then return true end
  10.        end
  11.     end
  12.  end
  13.  return false
  14. end)


Insert this function into the small addon's "HideMe v3" code via a text editor and try it. It should be placed inside the function for event_addon_loaded
"local function Addon_Loaded(eventCode, addOnName)", at the end before the closing end:

Lua Code:
  1. local function Addon_Loaded(eventCode, addOnName)
  2.         if addOnName ~= HideMe.name then return end
  3.                 ...
  4.  
  5. ZO_PreHook("IsMapLocationVisible", function()
  6.  if GetParentZoneId ~= nil then
  7.     local zoneId, subZoneId
  8.     zoneId = GetParentZoneId ()
  9.     if zoneId ~= nil then
  10.        local zoneIndex = GetUnitZoneIndex("player")
  11.        if zoneIndex ~= nil then
  12.           subZoneId = GetZoneId(zoneIndex)
  13.           if subZoneId ~= nil then return true end
  14.        end
  15.     end
  16.  end
  17.  return false
  18.  
  19. end

Last edited by Baertram : 02/18/19 at 04:33 AM.
  Reply With Quote