diff QuestPOI.lua @ 100:fbd4ead2a19f v1.4.11

- More attempts to fix quest markers re-appearing when completed via the order hall spells. Hard to test due to cooldown.
author Nenue
date Thu, 18 May 2017 16:43:14 -0400
parents d594c5c4a4a3
children 4d1520186ea4 8cdd62e7a224
line wrap: on
line diff
--- a/QuestPOI.lua	Mon May 15 00:15:44 2017 -0400
+++ b/QuestPOI.lua	Thu May 18 16:43:14 2017 -0400
@@ -33,7 +33,6 @@
 local GetItemIcon = GetItemIcon
 
 local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop
-local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop
 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or nop
 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or nop
 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or nop
@@ -41,8 +40,8 @@
 local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or nop
 local QuestPOI = WorldPlanPOIMixin
 
-local pinBaseIndex = 1320
-local overlayBaseIndex = 1380
+local pinBaseIndex = 1520
+local overlayBaseIndex = 1580
 local previousHighlight
 
 local FADE_TIMING_MULTIPLIER = 3
@@ -288,7 +287,7 @@
 end
 
 function QuestPOI:OnLoad()
-  --qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
+  --print('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
   self.debugTimer = 4
   self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
   self.count = self.Overlay.count
@@ -296,7 +295,11 @@
   self.Description = self.Overlay.Description
   self.updateRate = PIN_REQUEST_DELAY
   self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
-
+  self.checkFilters = true
+  self.checkCriteria = true
+  self.checkCursor = true
+  self.worldQuest = true
+  self.isNew = true
 
   self.IconBackdrop:SetVertexColor(0,0,0,1)
   self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4)
@@ -415,8 +418,21 @@
 end
 
 function QuestPOI:OnMouseDown(button)
+
   if button == 'RightButton' then
-    SetSuperTrackedQuestID(nil)
+
+    local timers = db.IgnoreTimers
+    if timers[self.questID] then
+      timers[self.questID] = nil
+    else
+      local tl = TQ_GetQuestTimeLeftMinutes(self.questID)
+      if tl and (tl ~= 0) then
+        timers[self.questID] = time() + (tl * 60)
+      else
+        timers[self.questID] = 0
+      end
+    end
+    self:Refresh()
   else
     TaskPOI_OnClick(self, button)
   end
@@ -565,7 +581,7 @@
       local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex))
       if id then
         self.isKnownProfession = true
-        --qprint('profession' , self.title, id)
+        --print('profession' , self.title, id)
         tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
       end
     elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
@@ -828,10 +844,11 @@
 end
 
 -- Non-hieriarchical display states, checked separately from used/filtered states
-function QuestPOI:GetCriteriaState()
+function QuestPOI:OnCriteria()
+  self.checkCriteria = nil
   local isCriteria, isBounty, isSpellTarget
 
-
+  print('  ' ..self:GetID() .. ':|cFFFFFF00OnCriteria()' )
 
   for index, bounty in pairs(db.Bounties) do
     if (not IsQuestComplete(bounty.questID)) and IsQuestCriteriaForBounty(self.questID, bounty.questID) then
@@ -842,18 +859,20 @@
       --dprint('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty)
     end
   end
-  isSpellTarget = IsQuestIDValidSpellTarget(self.questID)
 
-  if (self.isBounty ~= isBounty) or (self.isCriteria ~= isCriteria) or (self.isSpellTarget ~= isSpellTarget) then
+  if (self.isBounty ~= isBounty) or (self.isCriteria ~= isCriteria) then
     --wqprint('|cFF00FF00criteria state changed')
     self.isBounty = isBounty
     self.isCriteria = isCriteria
     self.isSpellTarget = isSpellTarget
-    self.isStale = true
-    return true
   end
 end
 
+function QuestPOI:OnCursor()
+  self.checkCursor = nil
+  self.isSpellTarget = IsQuestIDValidSpellTarget(self.questID)
+end
+
 local cvar_check = {
   [REWARD_CASH] = 'worldQuestFilterGold',
   [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower',
@@ -863,11 +882,11 @@
 }
 
 
-function QuestPOI:CheckFilterRules ()
-  local print = qprint
+function QuestPOI:OnFilters ()
   local qType = self.worldQuestType
 
   self.canShow = false
+  self.checkFilters = nil
 
   if not TQ_IsActive(self.questID) then
     self.hideReason = 'Filter check ended because quest is inactive.'
@@ -900,7 +919,7 @@
     end
   end
 
-  print('  '..self.questID..':|cFFFFFF00CheckFilterRules()|r', filtered, self.title)
+  print('  '..self.questID..':|cFFFFFF00OnFilters()|r', filtered, self.title)
   if self.filtered ~= filtered then
     wqprint('|cFF00FF00filter changed')
     self.isStale = true
@@ -913,9 +932,24 @@
 function QuestPOI:Refresh (event)
   print('|cFF00FF88Refresh(|r'..self:GetID()..'|cFF00FF88)|r', event, self.title)
 
+  if not self:IsShown() then
+    print('queued for Refresh')
+    self.isStale = true
+    return nil
+  end
+
+  if self.checkCriteria then
+    self:OnCriteria()
+  end
+  if self.checkFilters then
+    self:OnFilters()
+  end
+  if self.checkCursor then
+    self:OnCursor()
+  end
 
   local style = DEFAULT_STYLE
-  if self.filtered then
+  if self.filtered or db.IgnoreTimers[self.questID] then
     print('choose minimized')
     style = MINIMIZED_STYLE
   elseif self.dataLoaded then
@@ -926,9 +960,6 @@
   end
 
   local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth
-
-
-
   local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth
   local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth
   local tagSize = style.TagSize or DEFAULT_STYLE.TagSize
@@ -1057,19 +1088,23 @@
   end
 
   if SpellCanTargetQuest() then
-    if IsQuestIDValidSpellTarget(self.questID) then
+    if self.isSpellTarget then
       icon:SetVertexColor(1,1,1)
+      self:EnableMouse(false)
     else
-      icon:SetVertexColor(1,0,0,1)
+      icon:SetVertexColor(0.5,0.5,0.5,1)
+      self:EnableMouse(true)
     end
-    self:EnableMouse(false)
   else
+    icon:SetVertexColor(1,1,1)
     self:EnableMouse(true)
   end
+
   self.isStale = nil
 
   -- signal filter info update
   WorldPlanSummary.isStale = true
+  return true
 end
 
 -- Called at static intervals and with Refresh
@@ -1080,6 +1115,7 @@
   local border = (self.isBounty or self.isCriteria) and self.RewardBorder or self.HighlightBorder
 
   if self.isActive then
+
     local tl = self.alertLevel
     local timeLeft = TQ_GetQuestTimeLeftMinutes(self.questID)
     if timeLeft > 0 then
@@ -1144,6 +1180,10 @@
   self:UnregisterEvent('QUEST_TURNED_IN')
   self:UnregisterEvent('QUEST_LOG_UPDATE')
 
+  self.checkCursor = true
+  self.checkFilters = true
+  self.checkCriteria = true
+
   for i, pin in ipairs(db.UsedPins) do
     if pin == self then
       print('|cFFFF4400cleared from UsedPins|r')