diff QuestPOI.lua @ 57:54aa7f8ebca8 v1.0-release

- fix profession quests showing when not enabled - fix profession quest time borders always coloring as urgent
author Nenue
date Fri, 20 Jan 2017 19:57:13 -0500
parents 0749e38081e7
children bc09961d5a98
line wrap: on
line diff
--- a/QuestPOI.lua	Tue Jan 03 20:04:16 2017 -0500
+++ b/QuestPOI.lua	Fri Jan 20 19:57:13 2017 -0500
@@ -191,10 +191,10 @@
 local GetFactionInfoByID, GetQuestObjectiveInfo = GetFactionInfoByID, GetQuestObjectiveInfo
 
 function QuestPOI:OnEnter()
-  WorldMap_HijackTooltip(self.owningFrame);
-  if self.filtered then
+  if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then
     return
   end
+  WorldMap_HijackTooltip(self.owningFrame);
   self:SetFrameLevel(pinBaseIndex+100)
   self.Overlay:SetFrameLevel(pinBaseIndex+101)
 
@@ -267,6 +267,9 @@
   --print(WorldMapTooltip:IsVisible())
 end
 function QuestPOI:OnLeave()
+  if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then
+    return
+  end
   WorldMap_RestoreTooltip()
   self.MouseGlow:Hide()
   WorldMapTooltip:Hide();
@@ -424,7 +427,7 @@
   end
 
   if not self.isAnimating then
-    self:SetAlpha(1) -- fix stuck alpha
+    self:SetAlpha(db.PinAlpha) -- fix stuck alpha
   end
   self.Overlay:SetShown(true)
 end
@@ -435,6 +438,7 @@
   self.Overlay:SetShown(false)
 end
 
+-- different from owningFrame
 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
   wqprint(self:GetName()..':SetAnchor', self.filtered, self.used)
   self:SetParent(owner)
@@ -469,11 +473,17 @@
   self.updateRate = PIN_REQUEST_DELAY
   self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
 
-  self:SetScript('OnMouseDown', TaskPOI_OnClick)
-
   self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4)
   self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4)
 end
+function QuestPOI:OnMouseDown(button)
+  if button == 'RightButton' then
+    SetSuperTrackedQuestID(nil)
+  else
+    TaskPOI_OnClick(self, button)
+  end
+end
+
 
 function QuestPOI:OnEvent(event, ...)
   if event == 'SUPER_TRACKED_QUEST_CHANGED' then
@@ -536,7 +546,7 @@
       end
     end
 
-    if timeLeft and (timeLeft < 120) then
+    if tl and (timeLeft < 120) then
       self.HighlightBorder:SetVertexColor(1,0,0,0.7)
     elseif self.isBounty then
       self.HighlightBorder:SetVertexColor(.25,.5,1,1)
@@ -550,7 +560,7 @@
 
 function QuestPOI:Refresh (fromUser)
 
-  --rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
+  rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
 
 
 
@@ -569,7 +579,7 @@
   self.maxAlertLevel = subStyle.maxAlertLevel
   self.NoIcon = subStyle.NoIcon
 
-  local questID = self:GetID()
+  local questID = self.questID
   local iconBorder = self.RewardBorder
   local trackingBorder = self.HighlightBorder
   local icon = self.icon
@@ -639,6 +649,9 @@
   self:UpdateSize()
   self:UpdateStatus()
   self.isStale = nil
+
+  -- signal filter info update
+  WorldPlanSummary.isStale = true
 end
 
 local cvar_check = {
@@ -649,43 +662,45 @@
   [REWARD_GEAR] = 'worldQuestFilterEquipment',
 }
 
-
-function QuestPOI:IsFiltered ()
-  local filtered
-  local usingFilters
-  for filterKey, value in pairs(db.UsedFilters) do
-    usingFilters = true
-    print('|cFFFF4400', filterKey, self[filterKey])
-    if self[filterKey] ~= value then
-      filtered = true
-    end
-  end
-  if self.rewardType  and cvar_check[self.rewardType] then
-    if not GetCVarBool(cvar_check[self.rewardType])  then
-      filtered = true
-    end
-  end
-  self.filtered = filtered
-end
-
-function QuestPOI:IsShowable ()
+function QuestPOI:CheckFilterRules ()
   local print = qprint
   local qType = self.worldQuestType
-
-  if not self.worldQuest then
-    --print('ignoring showable check')
-    return self.used, self.filtered
-  end
-  self.used = TQ_IsActive(self.questID)
+  local filtered
+  local canShow = TQ_IsActive(self.questID)
   if SpellCanTargetQuest() then
     -- hiding so player can click a valid target
     self.used = nil
   elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then
-    if (not self.isKnownProfession) and  (db.Config.ShowAllProfessionQuests == false) then
-      self.used = nil
+    if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then
+      canShow = nil
     end
   end
-  rprint('  '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title)
+  if canShow then
+    for filterKey, value in pairs(db.UsedFilters) do
+      if self[filterKey] ~= value then
+        if not self.filtered then
+          print('|cFFFF4400filtering', filterKey, value, '~=', self[filterKey], self.title)
+        end
+
+        filtered = true
+      end
+    end
+    if self.rewardType  and cvar_check[self.rewardType] then
+      if not GetCVarBool(cvar_check[self.rewardType])  then
+        filtered = true
+      end
+    end
+    if canShow and self.filtered ~= filtered then
+      self.isStale = true
+      print('  '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title)
+    end
+
+    self.filtered = filtered
+  end
+
+  self.used = canShow
+
+
 end
 
 --- Fixes icons upon size update
@@ -709,6 +724,12 @@
   self:SetSize(highlightWidth, highlightWidth)
   if self.questID == GetSuperTrackedQuestID() then
     highlightWidth = highlightWidth + 2
+    if self.filtered then
+      self:SetAlpha(db.PinAlpha * 0.5)
+    else
+      self:SetAlpha(db.PinAlpha)
+    end
+
   end
 
   if self.rarity and WORLD_QUEST_QUALITY_COLORS[self.rarity] then