diff QuestPOI.lua @ 35:26dfa661daa7

WorldPlan: - Quest pins will appear in the flight map. They follow the filter settings applied from the world map. - Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it. - Fixed filter bar info falling out of sync after player-triggered world map updates. - Code stuff: -- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there -- WorldQuests module re-factored outside of the top level frame script. ClassPlan: - Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author Nenue
date Thu, 03 Nov 2016 17:29:15 -0400
parents 0100d923d8c3
children 21bcff08b0f4
line wrap: on
line diff
--- a/QuestPOI.lua	Wed Nov 02 19:04:47 2016 -0400
+++ b/QuestPOI.lua	Thu Nov 03 17:29:15 2016 -0400
@@ -4,7 +4,6 @@
 -- %file-revision%
 --
 
-WorldPlanPOIMixin = {}
 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
@@ -168,6 +167,7 @@
 end
 
 function WorldPlanPOIMixin:OnEnter()
+  WorldMap_HijackTooltip(self)
   local completed = select(4,GetAchievementInfo(familiars_id))
   if not completed then
     if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
@@ -223,6 +223,7 @@
   TaskPOI_OnEnter(self)
 end
 function WorldPlanPOIMixin:OnLeave()
+  WorldMap_RestoreTooltip()
   TaskPOI_OnLeave(self)
 end
 function WorldPlanPOIMixin:OnMouseDown()
@@ -243,7 +244,7 @@
     if info.x and info.y then
       self.x = info.x or self.x
       self.y = info.y or self.y
-      qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
+      --qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
     end
 
   end
@@ -330,9 +331,9 @@
     self.isPending = isPending
 
 
-    qprint('  |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending)
-    qprint('  ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
-    qprint('  ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
+    --qprint('  |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown())
+    --qprint('  ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
+    --qprint('  ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
   end
   self.cheevos = familiars[self.questID]
 
@@ -346,28 +347,27 @@
 
 -- run from OnShow if .isNew is set
 function WorldPlanPOIMixin:OnNew()
-  self:SetAlpha(0)
 
-  if WorldPlan.db.FadeWhileGrouped then
-    self.FadeIn.FadeIn:SetToAlpha(0.15)
-    self.PendingFade.FadeIn:SetToAlpha(0.15)
-    self.PendingFade.FadeIn:SetFromAlpha(0.15)
-  else
-    self.FadeIn.FadeIn:SetToAlpha(1)
-    self.PendingFade.FadeIn:SetToAlpha(1)
-    self.PendingFade.FadeIn:SetFromAlpha(1)
-  end
   if not self.isAnimating then
+    --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.')
+    self:SetAlpha(0)
+    if WorldPlan.db.FadeWhileGrouped then
+      self.FadeIn.FadeIn:SetToAlpha(0.15)
+      self.PendingFade.FadeIn:SetToAlpha(0.15)
+      self.PendingFade.FadeOut:SetFromAlpha(0.15)
+    else
+      self.FadeIn.FadeIn:SetToAlpha(1)
+      self.PendingFade.FadeIn:SetToAlpha(1)
+      self.PendingFade.FadeOut:SetFromAlpha(1)
+    end
     self.isAnimating = true
-    WorldPlan:OnNext(function()
-      self.isNew = nil
-      self.FadeIn:Play()
-    end)
+    self.isNew = nil
+    self.FadeIn:Play()
   end
 end
 
 function WorldPlanPOIMixin:OnShow ()
-  qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
+  qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
   -- pop this on principle
 
   if self.isNew or self.isStale then
@@ -377,22 +377,20 @@
 
   -- is it a new quest?
   if self.isNew then
-    WorldPlan:print('|cFF0088FF', self.title, '|r', self.isNew and 'new', self.isStale and 'stale', self.isAnimating and 'animating')
+    print('|cFFFFFF00popping new pin handler')
     self:OnNew()
-    -- trap new but animating pins here
-  else
-    -- hard show existing self
-    --print('refresh #', questID, 'filtered:', self.filtered, 'hasUpdate', self.hasUpdate)
-    self:Show()
+  elseif not self.isAnimating then
+    self:SetAlpha(1)
   end
 
+  --WorldPlan:print(self:GetAlpha())
 
 end
 function WorldPlanPOIMixin:OnHide()
-  qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
+  --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
   if not self:IsShown() then
     self.isAnimating = nil
-    self:SetAlpha(0)
+    self:SetAlpha(1)
   end
 
 end
@@ -439,11 +437,9 @@
 local PIN_UPDATE_DELAY = .016
 local TOP_PIN_ID
 function WorldPlanPOIMixin:OnUpdate (sinceLast)
-
-  if self.isStale then
-    print('|cFFFFFF00push poi update')
-    self:Refresh()
-    return
+  if self.isNew then
+    print('|cFFFFFF00push new poi stuff')
+    self:OnNew()
   end
   -- control update check intervals
   self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
@@ -453,6 +449,11 @@
   else
     return
   end
+  if self.isStale and not self.isAnimating then
+    print('|cFFFFFF00push poi update')
+    self:Refresh()
+    return
+  end
 
   -- query for reward data if it wasn't found in the original scan
   local questID = self.questID
@@ -505,7 +506,7 @@
 
 
   local questID = self:GetID()
-  local style,subStyle =  self:GetTypeInfo(self.rewardType)
+  local style,subStyle =  WorldPlanQuests:GetTypeInfo(self.rewardType)
   if self.filtered then
     subStyle = style.minimized
   end
@@ -582,10 +583,18 @@
 
 
   self:UpdateSize()
+
   self.isStale = nil
+
 end
 
-
+local cvar_check = {
+  [REWARD_CASH] = 'worldQuestFilterGold',
+  [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower',
+  [REWARD_CURRENCY] = 'worldQuestFilterOrderResources',
+  [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials',
+  [REWARD_GEAR] = 'worldQuestFilterEquipment',
+}
 
 
 function QuestPOI:IsShowable ()
@@ -598,14 +607,16 @@
 
 
   self.questId  = self:GetID()
-  if not (WorldMap_DoesWorldQuestInfoPassFilters(self, false, true)) then
-    self.filtered = true
-  end
-
-  for filterKey, value in pairs(WorldPlan.UsedFilters) do
-    if self[filterKey] ~= value then
+  if self.rewardType then
+    if cvar_check[self.rewardType] and not GetCVarBool(cvar_check[self.rewardType]) then
       self.filtered = true
     end
+  else
+    for filterKey, value in pairs(WorldPlan.UsedFilters) do
+      if self[filterKey] ~= value then
+        self.filtered = true
+      end
+    end
   end
 
   if not TQ_IsActive(self.questID) then
@@ -678,7 +689,9 @@
     tag:Hide()
   end
 
-  --qprint('using mask:', mask, self.name )
+  qprint('using mask:', pinMask, self.name )
   iconBorder:SetMask(pinMask)
   trackingBorder:SetMask(pinMask)
+  iconBorder:SetTexture(iconBorder:GetTexture())
+  trackingBorder:SetTexture(trackingBorder:GetTexture())
 end
\ No newline at end of file