changeset 116:bf4a36378bb9

- Fixed flight map pins jumping about
author Nenue
date Fri, 24 Nov 2017 23:51:44 -0500
parents f4dedbad7a11
children a4dfdd4f1cf3
files FlightMap.lua MapFrame.lua QuestPOI.lua
diffstat 3 files changed, 44 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/FlightMap.lua	Wed Nov 22 20:45:16 2017 -0500
+++ b/FlightMap.lua	Fri Nov 24 23:51:44 2017 -0500
@@ -162,8 +162,9 @@
 function WorldPlanDataPinMixin:OnUpdate()
   local pin = self.pin
   if pin and pin.isStale then
-    print(pin.questID, 'is stale')
-    pin:SetAnchor(nil, nil, nil, nil, nil, pin.filtered and 0.5 or 1)
+    -- print(pin.questID, 'is stale')
+    -- no longer needed
+    -- pin:SetAnchor(nil, nil, nil, nil, nil, pin.filtered and 0.5 or 1)
     if pin.isNew then
       pin:OnShow()
     end
--- a/MapFrame.lua	Wed Nov 22 20:45:16 2017 -0500
+++ b/MapFrame.lua	Fri Nov 24 23:51:44 2017 -0500
@@ -135,7 +135,7 @@
       fs:SetText(tostring(region:GetName()))
     end
 
-
+--[[
     if region.SetColorTexture then
       region:SetColorTexture(r,g,b,a)
       print('===', region.GetName and region:GetName() or tostring(region), string.format("|cFF%2X%2X%2X%f,%f,%f", r*255, g*255, b*255, r,g,b))
@@ -147,6 +147,7 @@
         b = b + .25
       end
     end
+    ]]
 
   end
 
--- a/QuestPOI.lua	Wed Nov 22 20:45:16 2017 -0500
+++ b/QuestPOI.lua	Fri Nov 24 23:51:44 2017 -0500
@@ -616,6 +616,7 @@
 
 --- Returns true if data has changed (either from loading in or qualifications changed)
 function QuestPOI:UpdateRewards()
+  dprint('UpdateRewards()', self.questTitle)
   local questID = self.questID
   if not HaveQuestRewardData(questID) then
     C_TaskQuest.RequestPreloadRewardData(questID);
@@ -643,7 +644,7 @@
         rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01"
         rewardCount = artifactXP
         rewardType = REWARD_ARTIFACT_POWER
-        --dprint('  artifactXP', artifactXP)
+        dprint('  artifactXP', artifactXP)
         foundPrimary = true
       end
 
@@ -684,19 +685,21 @@
 
           if itemID then
             local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID);
-            if ( classID == LE_ITEM_CLASS_WEAPON or classID == LE_ITEM_CLASS_ARMOR or (classID == LE_ITEM_CLASS_GEM and subclassID == LE_ITEM_GEM_ARTIFACTRELIC) ) then
-              rewardType = REWARD_GEAR
-              rewardIcon = texture
-              rewardName = name
-              rewardCount = numItems
-              foundPrimary = true
-            elseif IsArtifactPowerItem(itemID) then
+            if IsArtifactPowerItem(itemID) then
               rewardType = REWARD_ARTIFACT_POWER
               rewardIcon = texture
               rewardName = name
               rewardCount = self:UpdateArtifactPower(itemLink)
               foundPrimary = true
               --dprint('is an AP token')
+
+
+            elseif ( classID == LE_ITEM_CLASS_WEAPON or classID == LE_ITEM_CLASS_ARMOR or (classID == LE_ITEM_CLASS_GEM and subclassID == LE_ITEM_GEM_ARTIFACTRELIC) ) then
+              rewardType = REWARD_GEAR
+              rewardIcon = texture
+              rewardName = name
+              rewardCount = numItems
+              foundPrimary = true
             elseif classID == LE_ITEM_CLASS_TRADEGOODS then
               rewardType = REWARD_REAGENT
               rewardIcon = texture
@@ -704,7 +707,7 @@
               rewardCount = numItems
               foundPrimary = true
             end
-            --dprint('  reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID)
+            dprint('  reward', i, name, " |T"..tostring(texture)..":12:12|t", rewardCount, rewardType, isUsable, itemID)
             tinsert(rewardItems, {
               name = name,
               texture = texture,
@@ -744,7 +747,15 @@
 end
 
 
+local ap_strings = {
+  '([%d%.]+) billion ' .. ARTIFACT_POWER,
+  '([%d%.]+) million ' .. ARTIFACT_POWER,
+  '([%d]+) ' .. ARTIFACT_POWER,
+}
+local ap_factors = {1000000000, 1000000, 1}
+
 function QuestPOI:UpdateArtifactPower(rewardLink)
+  dprint('UpdateArtifactPower')
   if not (rewardLink or self.rewardLink) then
     return
   end
@@ -757,18 +768,20 @@
   for i = 1, WorldPlanTooltip:NumLines() do
     local line = _G['WorldPlanTooltipTextLeft' .. i]
     local text = line and line:GetText()
-    local multiplier = (text:match('million') and 1000000) or 1
+
     if text then
+
       text = text:gsub(',', '')
-      local ap = text:match('([%d]+) '..ARTIFACT_POWER)
-      if not ap then
-        ap = text:match('([%d%.]+) million '..ARTIFACT_POWER)
+      for j, format in ipairs(ap_strings) do
+
+        local ap = text:match(format)
         if ap then
-          ap = tonumber(ap) * 1000000
+
+          rewardCount = tonumber(ap) * ap_factors[j]
+          dprint('  ap text', format,  tonumber(ap), ap_factors[j], rewardCount)
+          break
         end
-      end
-      if ap then
-        rewardCount = tonumber(ap)
+
       end
     end
   end
@@ -778,6 +791,8 @@
 -- Applies position and sizing parameters to the pin data
 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor)
   --dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used)
+  --dprint(debugstack(1,1))
+  --dprint(self:GetPoint(1))
   if not self.used then
     self.hideReason = 'SetAnchor() on an unused frame.'
     self:HideOrShowFrames(false)
@@ -934,13 +949,13 @@
 
   local style = DEFAULT_STYLE
   if self.filtered or db.IgnoreTimers[self.questID] then
-    print('choose minimized')
+    print('minimized type')
     style = MINIMIZED_STYLE
   elseif self.dataLoaded then
-    print('choose reward type')
+    print('reward type', self.rewardType)
     style = REWARD_TYPE_STYLES[self.rewardType]
   else
-    print('choose default')
+    print('default type')
   end
 
   local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth
@@ -977,8 +992,10 @@
   if self.itemName then
     if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then
       local numberString = self.itemNumber
-      if self.itemNumber >= 1000000 then
-        numberString = (floor(self.itemNumber/100000)/10) .. 'M'
+      if self.itemNumber >= 1000000000 then
+        numberString = (floor(self.itemNumber/100000000)/10) .. '|cFFFF8800B|r'
+      elseif self.itemNumber >= 1000000 then
+        numberString = (floor(self.itemNumber/100000)/10) .. '|cFFFFFF00M|r'
       elseif self.itemNumber >= 10000 then
         numberString = floor(self.itemNumber/1000) .. 'k'
       elseif self.itemNumber >= 1000 then