diff WorldQuests.lua @ 62:abcdef801db5

- more region hiding fixes
author Nick@Zahhak
date Sat, 11 Feb 2017 14:25:57 -0500
parents a133ee697ca2
children 8e130c92698f
line wrap: on
line diff
--- a/WorldQuests.lua	Wed Feb 08 13:11:07 2017 -0500
+++ b/WorldQuests.lua	Sat Feb 11 14:25:57 2017 -0500
@@ -89,10 +89,10 @@
   end
 end
 
-function Module:OnUpdateQuestBonusObjectives()
-  print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
+local SpellCanTargetQuest = SpellCanTargetQuest
+function Module:UpdateBlizzButtons()
+
   local func = SpellCanTargetQuest() and InternalShowButton or InternalHideButton
-  print(SpellCanTargetQuest())
   for i = 1, NUM_WORLDMAP_TASK_POIS do
     local button = _G['WorldMapFrameTaskPOI'..i]
     if button and button.worldQuest then
@@ -101,9 +101,13 @@
   end
 end
 
+function Module:OnUpdateQuestBonusObjectives()
+  print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
+  self:UpdateBlizzButtons()
+end
+
 function Module:OnClickWorldMapActionButton()
-  self.IsTargeting = SpellCanTargetQuest()
-  self:OnUpdateQuestBonusObjectives()
+  self:UpdateBlizzButtons()
 end
 
 local defaults = {}
@@ -130,6 +134,7 @@
   self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL')
   self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
   self:RegisterEvent('SKILL_LINES_CHANGED')
+  self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
 end
 
 function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID)
@@ -160,7 +165,7 @@
       questPOI.isStale = true
       self.isStale = true
     else
-      self:Refresh(true)
+      self:Refresh()
     end
     print('WorldMapFrame', WorldMapFrame:IsVisible(), 'hasUpdates:', self.isStale)
   elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
@@ -170,14 +175,19 @@
       rprint('|cFFFF4400release|r', questID)
     end
   elseif event == 'SKILL_LINES_CHANGED' then
-    self:Refresh(true)
+    self:Refresh()
+  elseif event == 'CURRENT_SPELL_CAST_CHANGED' then
+
+    self:Refresh()
   elseif event == 'ARTIFACT_UPDATE' then
     local ak = C_ArtifactUI.GetArtifactKnowledgeMultiplier()
     if ak and (ak ~= self.akLevel) then
+      print('push artifact knowledge update', self.akLevel, 'to', ak)
       self.akLevel = ak
-      self.ArtifactPowerDirty = true
-      -- artifact knowledge changed
-      self:Refresh(true)
+      for index, pin in pairs( db.QuestsByID) do
+        pin.dataLoaded = nil
+      end
+      self:Refresh()
     end
   end
 end
@@ -235,7 +245,7 @@
     end
   end
 
-  if (not pin.dataLoaded) or self.ArtifactPowerDirty then
+  if (not pin.dataLoaded) then
     pin:GetData()
   end
 
@@ -259,9 +269,7 @@
     end
     db.TasksByID[id] = nil
   end
-  pin:SetShown(false)
-  pin.Overlay:SetShown(false)
-  pin.timeLabel:SetShown(false)
+  pin:HideFrames()
   tinsert(db.FreePins, pin)
 
   print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
@@ -448,8 +456,11 @@
     pin.used = nil
   end
 
-  self:UpdateAnchors(nil)
-
+  if SpellCanTargetQuest() then
+    self:UpdateBlizzButtons()
+  else
+    self:UpdateAnchors(nil)
+  end
 
   print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
   rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
@@ -466,14 +477,12 @@
       if oV == true then
         print('|cFFFF4400 -|r', questID, pin.title)
       end
-      pin:SetShown(false)
+      pin:HideFrames()
     end
   end
 
   self.isStale = nil
   self.sizesDirty = nil
-
-  self.ArtifactPowerDirty = nil
 end
 
 -- update visibility states of all pins
@@ -539,6 +548,7 @@
     return
   end
 
+
   numPins = 0
   local taskInfo = TQ_GetQuestsForPlayerByMapID(self.currentMapID)
   if taskInfo then