changeset 52:6439015d74b1

- Set and use callbacks for the BountyBoard and ActionButton elements. - Check BountyBoard selections when updating pin visual - Check SpellCanTargetQuest() when determining pin visibility states
author Nenue
date Fri, 30 Dec 2016 18:31:32 -0500
parents 8f6960d50026
children 44baf4f35c7c
files FlightMap.lua QuestPOI.lua WorldQuests.lua
diffstat 3 files changed, 36 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/FlightMap.lua	Thu Dec 29 13:36:40 2016 -0500
+++ b/FlightMap.lua	Fri Dec 30 18:31:32 2016 -0500
@@ -97,7 +97,6 @@
               print(pin:GetID(), pin.used, pin.filtered)
 
               if pin.used then
-                print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha())
                 pinsToRemove[info.questId] = nil;
 
                 local frame = self.activePins[info.questId]
@@ -114,13 +113,18 @@
                 frame:SetPosition(info.x, info.y)
                 frame.pin = pin
 
-                pin.owningFrame = frame:GetMap()
+                -- sticking it onto the MapCanvas pin
                 pin.throttle = 1
                 pin.isStale = true
-
                 pin:SetParent(frame)
                 pin:ClearAllPoints()
-                pin:SetPoint('CENTER', frame, 'CENTER')
+                pin:SetPoint('CENTER')
+                pin.Overlay:SetParent(frame)
+                pin.Overlay:ClearAllPoints()
+                pin.Overlay:SetPoint('TOPLEFT', pin, 'TOPLEFT', 0, 4)
+                pin.Overlay:SetPoint('BOTTOMRIGHT', pin, 'BOTTOMRIGHT', 0, -4)
+                pin.Overlay:SetShown(true)
+                --print(pin.Overlay:IsShown(), pin.Overlay:GetPoint(1))
               end
               pin:SetShown(pin.used)
             end
@@ -161,6 +165,8 @@
 end
 
 function WorldPlanDataPinMixin:OnMouseEnter ()
+
+  WorldMap_HijackTooltip(self:GetMap())
 end
 
 function WorldPlanDataPinMixin:OnMouseLeave ()
--- a/QuestPOI.lua	Thu Dec 29 13:36:40 2016 -0500
+++ b/QuestPOI.lua	Fri Dec 30 18:31:32 2016 -0500
@@ -189,7 +189,6 @@
 
 function QuestPOI:OnEnter()
   if not WorldMapFrame:IsVisible() then
-    WorldMap_HijackTooltip(self.owningFrame)
   end
   if self.filtered then
     return
@@ -426,7 +425,7 @@
 end
 
 local overlayBaseIndex = 1300
-function QuestPOI:SetAnchor(dX, dY, mapWidth, mapHeight)
+function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
   local oX, oY = self.x, self.y
   if not (dX and dY) then
     local dX, dY = TQ_GetQuestLocation(self.questID)
@@ -440,7 +439,7 @@
     end
   end
   if not (mapHeight and mapWidth) then
-    mapWidth, mapHeight = self:GetParent():GetSize()
+    mapWidth, mapHeight = owner:GetSize()
   end
   local pX = (dX * mapWidth)
   local pY = (-dY * mapHeight)
@@ -448,11 +447,12 @@
 
   self.x = dX
   self.y = dY
+  self:SetParent(owner)
   self:ClearAllPoints()
-  self:SetPoint('CENTER', self:GetParent(), 'TOPLEFT', pX, pY)
+  self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY)
   self:SetShown(self.used)
 
-  self.Overlay:SetParent(self.owningFrame)
+  self.Overlay:SetParent(owner)
   self.Overlay:ClearAllPoints()
   self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4)
   self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4)
@@ -545,7 +545,7 @@
 
   local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType
   local style,subStyle =  self:GetTypeInfo(self.rewardType)
-  if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then
+  if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) then
     subStyle = style.minimized
   end
   self.style = style
@@ -563,6 +563,7 @@
   local trackingBorder = self.HighlightBorder
   local icon = self.icon
   local count = self.count
+  local isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID)
 
   if self.itemName then
 
@@ -604,7 +605,12 @@
 
   iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
   iconBorder:SetTexture(PENDING_BORDER)
-  iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
+  if isBounty then
+    iconBorder:SetVertexColor(0,.4,.9)
+  else
+    iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
+  end
+
   iconBorder:SetDesaturated(true)
   iconBorder:SetAlpha(subStyle.alpha or 1)
 
@@ -658,7 +664,10 @@
     return self.used, self.filtered
   end
   self.used = TQ_IsActive(self.questID)
-  if qType == LE_QUEST_TAG_TYPE_PROFESSION then
+  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
     end
--- a/WorldQuests.lua	Thu Dec 29 13:36:40 2016 -0500
+++ b/WorldQuests.lua	Fri Dec 30 18:31:32 2016 -0500
@@ -47,6 +47,10 @@
   end
 end
 
+local InternalDoRefresh = function (self)
+  WorldPlanQuests:Refresh(true)
+end
+
 function Module:Setup()
   print('|cFFFF4400'..self:GetName()..':Setup()')
 
@@ -57,6 +61,10 @@
   hooksecurefunc("ClickWorldMapActionButton", function () self:OnClickWorldMapActionButton() end)
   hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function () self:Refresh() end)
   hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function () self:OnUpdateQuestBonusObjectives() end)
+
+
+  WorldMapFrame.UIElementsFrame.BountyBoard:SetSelectedBountyChangedCallback(InternalDoRefresh);
+  WorldMapFrame.UIElementsFrame.ActionButton:SetOnCastChangedCallback(InternalDoRefresh);
 end
 
 function Module:OnConfigUpdate()
@@ -457,12 +465,9 @@
   if x and y then
     pin.x = x
     pin.y = y
-    pin.owningFrame = self.hostFrame
     pin.throttle = 1
-
-    pin:SetParent(self.hostFrame)
     pin:SetFrameLevel(PinBaseIndex+pin:GetID())
-    pin:SetAnchor(pin.x, pin.y, self.hostWidth, self.hostHeight)
+    pin:SetAnchor(self.hostFrame, pin.x, pin.y, self.hostWidth, self.hostHeight)
     tinsert(self.UsedPositions, pin)
   end