changeset 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 68a695d725ed
files FilterBar.lua QuestPOI.lua WorldQuests.lua
diffstat 3 files changed, 83 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/FilterBar.lua	Tue Jan 03 20:04:16 2017 -0500
+++ b/FilterBar.lua	Fri Jan 20 19:57:13 2017 -0500
@@ -87,8 +87,16 @@
 end
 
 
-function Module:OnEvent(event)
+function Module:OnEvent(event, arg)
   print('|cFF00FF88'..self:GetName()..':OnEvent()', event)
+  if (event == 'QUEST_LOG_UPDATE') and arg then
+    if db.QuestsByID[arg] then
+      if db.QuestsByID[arg].factionID then
+
+      end
+    end
+  end
+
   self.isStale = true
 end
 
@@ -183,7 +191,7 @@
   local borderWidth = layout.iconWidth + (layout.borderWidth * 2)
   local highlightWidth = borderWidth + (layout.highlightWidth * 2)
   local mapQuests = db.QuestsByZone[db.currentMapID] or db.QuestsByID
-    local firstCvar, lastCvar
+  local firstCvar, lastCvar
   for index, info in ipairs(self.filterList) do
     local numQuestsHere = 0
     local numQuestsTotal = 0
@@ -253,9 +261,7 @@
   for i = numHeaders + 1, #blocks do
     if blocks[i] then
       blocks[i]:Hide()
-    end
-    if questResults[i] then
-      wipe(questResults[i])
+      wipe(blocks[i].questList)
     end
   end
 
--- 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
--- a/WorldQuests.lua	Tue Jan 03 20:04:16 2017 -0500
+++ b/WorldQuests.lua	Fri Jan 20 19:57:13 2017 -0500
@@ -170,7 +170,7 @@
       rprint('|cFFFF4400release|r', questID)
     end
   elseif event == 'SKILL_LINES_CHANGED' then
-    self:SetFilteredPins()
+    self:Refresh(true)
   end
 end
 
@@ -231,10 +231,7 @@
     pin:GetData()
   end
 
-
-
-  pin:IsFiltered()
-  pin:IsShowable()
+  pin:CheckFilterRules()
   pin.isStale = true
   rprint(pin:GetID(), pin.filtered, pin.used)
 
@@ -434,7 +431,7 @@
   if not self:IsVisible() then
     print('  not visible, flag for later')
     self.isStale = true
-    return
+    return self:MarkAllPins()
   end
   wprint('  |cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
 
@@ -449,8 +446,8 @@
 end
 
 -- update visibility states of all pins
-function Module:SetFilteredPins(pins)
-  print('  |cFFFFFF00'..self:GetName()..':SetFilteredPins()|r', pins)
+function Module:MarkAllPins(pins)
+  print('  |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins)
   pins = pins or db.QuestsByID
   for questID, pin in pairs(pins) do
     pin.isStale =  true
@@ -467,23 +464,21 @@
   end
 
 
-  --print('~ ', pin.mapID, pin.questID, pin.title)
-  rprint('|cFF00FF00update|r', x, y, pin.mapID, pin.questID, pin.title)
+  print('~ ', pin.mapID, pin.questID, pin.title)
+  rprint('|cFF00FF00update|r', pin.questID, pin.title)
 
   if x and y then
     pin.x = x
     pin.y = y
     pin:SetFrameLevel(PinBaseIndex+pin:GetID())
-    pin.owningFrame = self.hostFrame
-    pin:SetAnchor(self.hostFrame, pin.x, pin.y, self.hostWidth, self.hostHeight)
+    pin.owningFrame = WorldMapFrame
+    pin:SetAnchor(WorldMapPOIFrame, pin.x, pin.y, self.hostWidth, self.hostHeight)
     --tinsert(self.UsedPositions, pin)
   end
-  if self.sizesDirty then
-    if self:IsVisible() then
-      pin:Refresh()
-    else
-      pin.isStale = true
-    end
+  if self:IsVisible() then
+    pin:Refresh()
+  else
+    pin.isStale = true
   end
   if mapID then
     if not db.QuestsByZone[mapID] then
@@ -503,8 +498,7 @@
 function Module:UpdateAnchors (fromUser)
   wipe(self.UsedPositions)
   print('  |cFF00FF00'..self:GetName()..':UpdateAnchors()', fromUser)
-  self.hostFrame = WorldMapPOIFrame
-  self.hostWidth, self.hostHeight = self.hostFrame:GetSize()
+  self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize()
   self.nudgeThrescholdX = 16/self.hostWidth
   self.nudgeThrescholdY = 16/self.hostHeight
   local print = rprint