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 #2 (https://www.wowinterface.com/forums/showthread.php?t=56533)

Thon 08-13-18 02:04 AM

World Map Icon Addon Update #2
 
Hello all!

I've popped in from time to time to get some help with a custom addon you guys wrote for me a couple years ago. The function is mainly to hide flight path icons on the world map (not the flight map), though it tends to catch a few other icons too, such as cities/towns, PvP vendors, even Sentinax and similar things. Unfortunately since 8.0 it doesn't work anymore, not even the macro I have for identifying Map POIs.

I'm certainly no addon developer (though I really should learn the basics at this stage so I don't have to keep pestering you all), but you guys have been such tremendous help to me in the past. If you have the time, mind helping an old fan out to update his addon for the expansion launch? :)

This is the current code:
Code:

hooksecurefunc("WorldMapFrame_Update", function()
    for i = 1, GetNumMapLandmarks() do
        local landmarkType, name = C_WorldMap.GetMapLandmarkInfo(i)
        if landmarkType == 0 or landmarkType == 5 or landmarkType == 6 or landmarkType == 9 or landmarkType == 46 or landmarkType == 48 or landmarkType == 178 or landmarkType == 179 or landmarkType == 180 or landmarkType == 188 or landmarkType == 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)

hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function()
        local mapAreaID = GetCurrentMapAreaID()
        local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(mapAreaID)
        local numTaskPOIs = 0;
        if(taskInfo ~= nil) then
                numTaskPOIs = #taskInfo;
        end
        local taskIconCount = 1;
        if ( numTaskPOIs > 0 ) then
                for _, info  in next, taskInfo do
                        local taskPOIName = "WorldMapFrameTaskPOI"..taskIconCount;
                        local taskPOI = _G[taskPOIName];
                        taskPOI:Hide();
                        taskIconCount = taskIconCount + 1;
                end
        end
end)

And here's the macro to scan the map for POIs:
Code:

/run for i = 1, GetNumMapLandmarks() do local _, name, _, textureIndex = GetMapLandmarkInfo(i) print(i, textureIndex, name) end
Sometimes I've been able to change the POIs to fix it on my own, but this time nothing works. The macro doesn't return anything. From what I can tell, the only icon change to the maps are the added zeppelin/boat world travel markers, but there must be some underlying syntax change that's beyond my capabilities. Any ideas?

p3lim 08-13-18 07:36 AM

Try this:
Lua Code:
  1. for provider in next, WorldMapFrame.dataProviders do
  2.     if(provider.ShouldShowTaxiNode) then
  3.         WorldMapFrame:RemoveDataProvider(provider)
  4.         break
  5.     end
  6. end

It's not the best solution, but it's pretty much the only way we can get the correct provider until Blizzard improves the data provider system.

Thon 08-13-18 04:03 PM

That didn't seem to work, I'm afraid. It's quite different from the older code; no mention of landmarks or POIs. Have they changed the functionality completely?

p3lim 08-13-18 08:08 PM

The whole map system was rewritten from scratch in 8.0, so yes.
Any icon on the map is provided by "data providers", there's one for each type, and the example above is for removing the flightpoint provider.

Thon 08-13-18 08:53 PM

Interesting. I do know they've switched to higher resolution maps where they can. I suppose it must've been part of the same process. What do you mean by Blizzard needing to improve the data provider system?

While it didn't work for me for now, is there a list of data providers so I could add more stuff (if I have enough know-how) to the code? Would something akin to the old macro be able to function in the new system? As a sidenote, the old code also hid Bonus Objectives, like the ones you'd see in Draenor. Are they still separate from the other icons?

p3lim 08-13-18 10:22 PM

Quote:

Originally Posted by Thon (Post 329552)
What do you mean by Blizzard needing to improve the data provider system?

The fact that we have to "guess" to get the data provider instead of using something like its name.

Quote:

Originally Posted by Thon (Post 329552)
While it didn't work for me for now, is there a list of data providers so I could add more stuff (if I have enough know-how) to the code?

Take a look at Blizzard_SharedMapDataProviders, it will probably answer your questions.

Thon 08-14-18 03:38 AM

Quote:

Originally Posted by p3lim (Post 329554)
Take a look at Blizzard_SharedMapDataProviders, it will probably answer your questions.

You've lost me already :p Can it be found on an online repository, or somewhere in the game files or some such?

Xruptor 08-14-18 06:02 AM

Quote:

Originally Posted by Thon (Post 329556)
You've lost me already :p Can it be found on an online repository, or somewhere in the game files or some such?

https://github.com/tomrus88/Blizzard...pDataProviders

Have fun! Their new map system is god awful. I've been going over it and it's one convoluted mess.

Thon 08-14-18 09:28 PM

Quote:

Originally Posted by Xruptor (Post 329558)
https://github.com/tomrus88/Blizzard...pDataProviders

Have fun! Their new map system is god awful. I've been going over it and it's one convoluted mess.

Thanks! This is pretty interesting, it looks as if they've finally separated the different icons so I can pick and choose what to hide! It used to be just a catch-all. They've also incorporated Bonus Objectives and Dungeon Journal Boss Icons into the system so I don't need extra code to hide those as well.

I can pick out most of them, but I don't know what all of the providers are referring to. I guess it would take some experimenting. (Unless I'm misunderstanding it and they're all hiding under AreaPOIDataProvider)

Some of them seem to have an OnShow and OnHide function, and sometimes there's a Mixin section and a Pin section, though I can't say I know what either of them do.

I think this is still quite a bit over my head. I can somewhat identify certain icons (or their respective data provider) that I wish to hide, but I wouldn't even know where to begin with the coding. If any of you addon coders or enthusiasts out there want to take a crack at it, I'd be much appreciative. :)


All times are GMT -6. The time now is 04:41 PM.

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