Skip to content

Commit

Permalink
Fix provider hooks
Browse files Browse the repository at this point in the history
This was ripped out of handynotes-travelguide, thanks Belazor @ WoWUIDev
  • Loading branch information
p3lim committed Dec 19, 2024
1 parent bacf836 commit f264628
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
18 changes: 11 additions & 7 deletions provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ function provider:ShouldShowQuest(questInfo)
return addon:IsChildMap(mapID, questInfo.mapID)
end

-- remove the default provider
for dp in next, WorldMapFrame.dataProviders do
if not dp.GetPinTemplates and type(dp.GetPinTemplate) == 'function' then
if dp:GetPinTemplate() == 'WorldMap_WorldQuestPinTemplate' then
WorldMapFrame:RemoveDataProvider(dp)
break
end
end
end

-- add our own
WorldMapFrame:AddDataProvider(provider)

-- hook into changes
Expand All @@ -61,13 +72,6 @@ addon:RegisterOptionCallback('zoomFactor', updateVisuals)
addon:RegisterOptionCallback('showAzeroth', updateVisuals)
addon:RegisterOptionCallback('showEvents', updateVisuals)

-- remove the default provider
for dp in next, WorldMapFrame.dataProviders do
if dp.GetPinTemplate and dp.GetPinTemplate() == 'WorldMap_WorldQuestPinTemplate' then
WorldMapFrame:RemoveDataProvider(dp)
end
end

-- change visibility
local modifier
local function toggleVisibility()
Expand Down
9 changes: 6 additions & 3 deletions storms.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ local function updatePOIs(self)
end
end

for provider in next, WorldMapFrame.dataProviders do
if provider.GetPinTemplate and provider:GetPinTemplate() == 'AreaPOIPinTemplate' then
hooksecurefunc(provider, 'RefreshAllData', updatePOIs)
for dp in next, WorldMapFrame.dataProviders do
if not dp.GetPinTemplates and type(dp.GetPinTemplate) == 'function' then
if dp:GetPinTemplate() == 'AreaPOIPinTemplate' then
hooksecurefunc(dp, 'RefreshAllData', updatePOIs)
break
end
end
end

0 comments on commit f264628

Please sign in to comment.