diff Modules/ArtifactPower.lua @ 123:b3c0258b419d v7.3.0-1

ArtifactPower: - XP progress bar fixes Currency: - More argus stuff - Block dimensions are calculated more consistently TalkingHead - Aesthetic changes - Default right-click behaviour restored (hides the text box)
author Nenue
date Tue, 05 Sep 2017 02:56:33 -0400
parents ea2c616a3b4f
children 3f4794dca91b
line wrap: on
line diff
--- a/Modules/ArtifactPower.lua	Mon Aug 21 22:15:46 2017 -0400
+++ b/Modules/ArtifactPower.lua	Tue Sep 05 02:56:33 2017 -0400
@@ -32,6 +32,8 @@
 local Module = VeneerArtifactPowerMixin
 local BAGS_TO_SCAN = {BACKPACK_CONTAINER}
 local TOOLTIP_NAME = 'VeneerAPScanner'
+local XP_INSET = 1
+local XP_WIDTH = 4
 local FISHING_MAX_TRAITS = 24
 local WEAPON_MAX_TRAITS = 92
 local FRAME_PADDING = 4
@@ -969,9 +971,6 @@
   local actualXP = artifact.currentXP
   local actualLevel = artifact.level
   local actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier)
-  local totalXP = actualXP
-  local totalCost = actualCost
-  local totalLevel = actualLevel
 
   print('tier:', artifact.tier)
   print('current:', self.level, self.currentXP, '/', self.currentCost)
@@ -985,10 +984,14 @@
   print('actual:', actualLevel, actualXP, '/', actualCost)
 
 
-  local remaining = totalXP + unusedXP
+  local totalXP = actualXP + unusedXP
+  local totalCost = actualCost
+  local totalLevel = actualLevel
+
+  local remaining = totalXP
   local nextCost = artifact.currentCost
+  print(totalXP, totalCost)
   if remaining > nextCost then
-    totalCost = nextCost
     while remaining >= nextCost do
       totalLevel = totalLevel + 1
       remaining = remaining - nextCost
@@ -1036,53 +1039,56 @@
   -- potential: total of ap on hand
   print(self.currentXP, self.actualXP, self.potentialXP)
 
-  local maxHeight = self:GetHeight() - 8
+  local maxHeight = self:GetHeight() - (XP_INSET*2)
   local currentHeight = self.CurrentProgress:GetHeight() or 1
   local offHeight = self.AdjustedProgress:GetHeight() or 1
 
 
+  self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0, XP_INSET)
   local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1
   local projectedProgress = (self.totalXP < self.totalCost) and (self.totalXP / self.totalCost) or 1
   if self.actualLevel ~= self.level then
     r3, g3, b3 = 0, 1, 1
   end
 
-  print('|cFFFF4400', currentProgress)
+  print('|cFFFF4400', currentProgress, projectedProgress, self.currentLevel, self.totalLevel)
   if self.level <= WEAPON_MAX_TRAITS then
     self.CurrentProgress.animateFrom = currentHeight or 1
     self.CurrentProgress.animateTo = currentProgress * maxHeight
     self.CurrentProgress:Show()
-    self.ProgressLine:Show()
   else
     self.CurrentProgress:Hide()
-    self.ProgressLine:Hide()
   end
 
-  if self.totalXP ~= self.currentXP then
-    print('|cFF00FFFF', projectedProgress)
-    if (projectedProgress > currentProgress) then
-      self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP')
-      projectedProgress = projectedProgress - currentProgress
-      print('show projected above', currentProgress, projectedProgress)
+  local nextLevel = (self.totalLevel ~= self.currentLevel)
+
+  if self.totalXP ~= self.currentXP or nextLevel then
+    print('project', 'xp test=', (self.totalXP ~= self.currentXP), 'lvl test=', (self.totalLevel ~= self.currentLevel))
+
+    local projectedPos = projectedProgress
+
+    if projectedProgress > currentProgress and (not nextLevel) then
+      projectedPos = (projectedProgress - currentProgress)
+      self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP', 0, 0)
+      print('  set above', projectedPos, self.CurrentProgress:GetPoint(3))
     else
-      self.CurrentProgress:Hide()
-      self.ProgressLine:Hide()
-      self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0 , 4)
-      print('show projected at bottom', currentProgress, projectedProgress)
+      self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0 , XP_INSET)
+      print('  set under', projectedPos)
     end
-
     self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1
-    self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight()
-    self.AdjustedLine:Show()
+    self.AdjustedProgress.animateTo = projectedPos * maxHeight
     self.AdjustedProgress:Show()
   else
-    self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0, 4)
+    print('nothing to project')
     self.AdjustedProgress:Hide()
-    self.AdjustedLine:Hide()
   end
+
+
   --print(self.CurrentProgress:GetPoint(3))
   --print(self.CurrentProgress:GetSize())
 
+  self.XPBackground:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', XP_INSET, XP_INSET)
+  self.XPBackground:SetPoint('TOPRIGHT', self, 'TOPLEFT', XP_INSET + XP_WIDTH, -XP_INSET)
   self.CurrentProgress:SetColorTexture(r3,g3,b3,1)
 
 end