WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   World Map Icon Addon Update (https://www.wowinterface.com/forums/showthread.php?t=55821)

Thon 10-24-17 01:44 PM

World Map Icon Addon Update
 
Hello everyone,

In the past I enlisted the help of this forum to make a custom addon that would hide flight path icons (and a few others I've added) from the world map. An awesome member named Phanx wrote it up for me free of charge, and I've used it ever since! I recently returned from a WoW hiatus and it seems to have broken somehow. I'm no addon coder by any means; could you help me update it again so it'll keep functioning? :)

I have an addon that does the main task of hiding the icons, and I also have a macro that scans the world map I'm in for landmark POI numbers. The problem I'm having now is that the icons aren't being hidden, and the macro returns a list of nil.

This is what the addon looks like currently:
Code:

hooksecurefunc("WorldMapFrame_Update", function()
    for i = 1, GetNumMapLandmarks() do
        local _, name, _, textureIndex = GetMapLandmarkInfo(i)
        if textureIndex == 0 or textureIndex == 5 or textureIndex == 6 or textureIndex == 46 or textureIndex == 48 or textureIndex == 178 or textureIndex == 179 or textureIndex == 180 or textureIndex == 188 or textureIndex == 194
then
            local poi = _G["WorldMapFramePOI"..i]
            if poi then
                -- The "if poi then" check is probably not needed, but better safe than sorry!
                poi:Hide()
            end
        end
    end
end)

And the macro is as follows:
Code:

/run for i = 1, GetNumMapLandmarks() do local _, name, _, textureIndex = GetMapLandmarkInfo(i) print(i, textureIndex, name) end
I'm guessing the POI or map system got changed in some way.
For reference, the initial thread request: http://www.wowinterface.com/forums/s...ad.php?t=44204
And once last year, when it needed updating: http://www.wowinterface.com/forums/s...ad.php?t=54004

Any ideas what I'd need to fix?

Fizzlemizz 10-24-17 02:51 PM

After making a copy, try changing:
Code:

local _, name, _, textureIndex = GetMapLandmarkInfo(i)
too
Code:

local landmarkType, name = C_WorldMap.GetMapLandmarkInfo(i)
and replace occurences of textureIndex with landmarkType

The macro becomes
Code:

/run for i = 1, GetNumMapLandmarks() do local landmarkType, name = C_WorldMap.GetMapLandmarkInfo(i) print(i, landmarkType, name) end
I'm not sure landmarkType is a direct correlation or can be mapped to what was the textureIndex but you're no worse off ;)

These are the landmarkType used in the WorldMapFrame (there may be more)

LE_MAP_LANDMARK_TYPE_TAMER = 1
LE_MAP_LANDMARK_TYPE_GOSSIP = 3
LE_MAP_LANDMARK_TYPE_TAXINODE = 5
LE_MAP_LANDMARK_TYPE_VIGNETTE = 6
LE_MAP_LANDMARK_TYPE_INVASION = 8
LE_MAP_LANDMARK_TYPE_DUNGEON_ENTRANCE = 9
LE_MAP_LANDMARK_TYPE_CONTRIBUTION = 10
LE_MAP_LANDMARK_TYPE_MAP_LINK = 11

Thon 10-25-17 07:56 PM

That did it! Thank you, Fizzlemizz! :D Seems I don't need a separate entry for neutral, horde and alliance flight points anymore.

This forum has been incredibly helpful, I can't thank you enough. <3


All times are GMT -6. The time now is 12:56 AM.

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