Quantcast
WoWInterface - View Single Post - Error with hiding WorldMapFrame WorldQuests
View Single Post
08-13-18, 07:14 AM   #5
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,698
This is how I do it:
Lua Code:
  1. local function OrigProviderOnRemoved(self, mapCanvas)
  2.     -- temporary fix to prevent error when removing the original world quest provider, I've notified
  3.     -- Blizzard developers directly about this issue and it should be resolved soon™
  4.     local Map = self:GetMap()
  5.     Map:UnregisterCallback('SetFocusedQuestID', self.setFocusedQuestIDCallback)
  6.     Map:UnregisterCallback('ClearFocusedQuestID', self.clearFocusedQuestIDCallback)
  7.     Map:UnregisterCallback('SetBountyQuestID', self.setBountyQuestIDCallback)
  8.  
  9.     MapCanvasDataProviderMixin.OnRemoved(self, mapCanvas)
  10. end
  11.  
  12. for provider in next, WorldMapFrame.dataProviders do
  13.     if(provider.GetPinTemplate and provider.GetPinTemplate() == 'WorldMap_WorldQuestPinTemplate') then
  14.         -- BUG: the OnRemoved method is broken, so we replace it before we remove the provider
  15.         provider.OnRemoved = OrigProviderOnRemoved
  16.         WorldMapFrame:RemoveDataProvider(provider)
  17.     end
  18. end

The reason I overwrite OnRemoved is because of a bug with the order of execution within it.
Whenever that is fixed, you can just do this:
Lua Code:
  1. for provider in next, WorldMapFrame.dataProviders do
  2.     if(provider.GetPinTemplate and provider.GetPinTemplate() == 'WorldMap_WorldQuestPinTemplate') then
  3.         WorldMapFrame:RemoveDataProvider(provider)
  4.     end
  5. end
  Reply With Quote