changeset 117:589045559484 v720.0

ArtifactPower: - cleanup of tooltip stats - green = available with XP currently invested, blue = available with XP from inventory
author Nenue
date Wed, 17 May 2017 08:23:27 -0400
parents ddfe19d70a34
children a86b99c84ccc
files Modules/ArtifactPower.lua
diffstat 1 files changed, 60 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Modules/ArtifactPower.lua	Wed Apr 26 20:06:38 2017 -0400
+++ b/Modules/ArtifactPower.lua	Wed May 17 08:23:27 2017 -0400
@@ -897,26 +897,58 @@
 
   self.isFishing = fishing
   -- this can change between artifact parses
-  local totalAP = (itemID ~= UNDERLIGHT_ANGLER_ID) and ((self:GetParent().bankAP or 0) + (self:GetParent().bagAP or 0)) or (self:GetParent().fishingAP or 0)
-  print(totalAP)
+  local unusedXP = (itemID ~= UNDERLIGHT_ANGLER_ID) and ((self:GetParent().bankAP or 0) + (self:GetParent().bagAP or 0)) or (self:GetParent().fishingAP or 0)
+  print('unspent:', unusedXP)
 
-  -- currentXP  what has been spent on the artifact
-  -- actualXP   amount
-  -- totalXP
-  local actualXP = artifact.currentXP + totalAP
+  -- current    standing artifact XP (what appears in the artifact ui)
+  -- actual     artifact XP after any unlocked points are spent
+  -- total      total of invested and inventory XP
+  -- totalCost  total of costs between current and actual level
+  local actualXP = artifact.currentXP
   local actualLevel = artifact.level
   local actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier)
+  local totalXP = actualXP + unusedXP
+  local totalCost = actualCost
+  local totalLevel = actualLevel
 
+  print('tier:', artifact.tier)
+  print('current:', self.level, self.currentXP, '/', self.currentCost)
   while actualXP >= actualCost do
     actualXP = actualXP - actualCost
     actualLevel = actualLevel + 1
     actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier)
-    print('* ', actualLevel, actualXP, actualCost)
+
+    print('* ', actualLevel, actualXP, actualCost, totalCost)
   end
+  print('actual:', actualLevel, actualXP, '/', actualCost)
+
+
+  if unusedXP > 0 then
+    local remaining = totalXP
+    local nextCost = artifact.currentCost
+    totalCost = nextCost
+    while remaining > nextCost do
+      totalLevel = totalLevel + 1
+      totalCost = totalCost + nextCost
+      nextCost = C_ArtifactUI.GetCostForPointAtRank(totalLevel, artifact.tier)
+      remaining = remaining - nextCost
+      print('|cFFFFFF00+ ', totalLevel, remaining, '/', nextCost)
+    end
+
+  end
+  print('total:', totalLevel, totalXP, '/', totalCost)
+
+  self.currentLevel = self.level
+
+
   self.actualCost = actualCost
   self.actualLevel = actualLevel
   self.actualXP = actualXP
-  self.totalXP = artifact.currentXP + totalAP
+
+  self.totalXP = totalXP
+  self.totalCost = totalCost
+  self.totalLevel = totalLevel
+
 
 
   if index ~= 1 then
@@ -948,7 +980,7 @@
 
     levelText = self.actualLevel
     r1, g1, b1 = 0, 1, 0
-    r2, g2, b2 = 0, 1, 0
+    --r2, g2, b2 = 0, 1, 0
     xpText = ShortNumberString(self.actualXP)
     costText = ShortNumberString(self.actualCost)
     remainingText = ShortNumberString(self.actualCost-self.actualXP)
@@ -958,6 +990,8 @@
     costText = ShortNumberString(self.potentialCost)
     remainingText = ShortNumberString(self.potentialCost-self.potentialXP)
     --]]
+  elseif self.totalLevel ~= self.actualLevel then
+    r1, g1, b1 = 0, 1, 1
   end
 
   self.Level:SetText(levelText)
@@ -1007,6 +1041,16 @@
     self.AdjustedLine:Hide()
   end
 
+  if self.actualLevel ~= self.currentLevel then
+    self:SetNormalTexture([[Interface\Buttons\UI-Quickslot-Depress]], 'ADD')
+    self:GetNormalTexture():SetBlendMode('BLEND')
+    self:GetNormalTexture():SetVertexColor(1,1,1)
+  else
+    self:SetNormalTexture(nil, 'ADD')
+
+  end
+
+
 
 
   self.Icon:SetTexture(self.texture)
@@ -1047,17 +1091,16 @@
   GameTooltip:SetOwner(self, 'ANCHOR_CURSOR')
   GameTooltip:SetText(self.name)
   GameTooltip:AddLine(ShortNumberString(self.currentXP) .. ' / '..ShortNumberString(self.currentCost), 1, 1, 0)
-  if self.totalXP ~= self.currentXP then
-    GameTooltip:AddLine(ShortNumberString(self.totalXP) .. ' total XP', 0, 1, 1)
-    if self.actualXP ~= self.potentialXP then
-      GameTooltip:AddLine(ShortNumberString(self.actualXP) .. ' / ' .. ShortNumberString(self.actualCost).. ' after', 0, 1, 0)
-    end
-  end
   if self.actualLevel ~= self.level then
-    GameTooltip:AddLine(ShortNumberString(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 1)
+    GameTooltip:AddLine(ShortNumberString(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 0)
   end
   if self.currentXP < self.currentCost then
-    GameTooltip:AddLine(ShortNumberString(self.currentCost - self.currentXP) .. ' needed')
+    GameTooltip:AddLine(ShortNumberString(self.currentCost - self.currentXP) .. ' for level ' .. (self.currentLevel+1), 1, 1, 0)
+  else
+    GameTooltip:AddLine(ShortNumberString(self.actualCost - self.actualXP) .. ' for level ' .. (self.actualLevel+1), 0, 1, 0)
+  end
+  if self.totalLevel ~= self.actualLevel then
+    GameTooltip:AddLine('Level ' .. self.totalLevel .. ' with unspent tokens', 0, 1, 1)
   end
 
   GameTooltip:Show()