changeset 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 07fe8fae8ca8
files Modules/ArtifactPower.lua Modules/ArtifactPower.xml Modules/Currency.lua Modules/Currency.xml Modules/TalkingHead.lua Modules/TalkingHead.xml Veneer.lua
diffstat 7 files changed, 112 insertions(+), 86 deletions(-) [+]
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
--- a/Modules/ArtifactPower.xml	Mon Aug 21 22:15:46 2017 -0400
+++ b/Modules/ArtifactPower.xml	Tue Sep 05 02:56:33 2017 -0400
@@ -37,7 +37,18 @@
     <HighlightTexture file="Interface\Buttons\ButtonHilight-Square" setAllPoints="true" alphaMode="ADD" />
     <Layers>
       <Layer level="BACKGROUND">
-        <Texture name="$parentIcon" parentKey="Icon" setAllPoints="true" />
+        <Texture name="$parentIcon" parentKey="Icon" setAllPoints="true">
+                <TexCoords left="0.15" right=".85" top=".15" bottom=".85" />
+        </Texture>
+      </Layer>
+      <Layer level="ARTWORK">
+        <Texture parentKey="XPBackground">
+          <Anchors>
+            <Anchor point="TOPRIGHT" x="6" y="-2" relativePoint="TOPLEFT" />
+            <Anchor point="BOTTOMLEFT" x="2" y="2" />
+          </Anchors>
+          <Color a="1" r="0" g="0" b="0" />
+        </Texture>
       </Layer>
 
       <Layer level="OVERLAY">
@@ -68,39 +79,22 @@
           <Color r="0" g="1" b="0" />
         </FontString>
 
-        <Texture parentKey="CurrentProgress" alphaMode="BLEND">
+        <Texture parentKey="CurrentProgress" alphaMode="ADD">
           <Anchors>
             <Anchor point="BOTTOM" x="0" y="0" />
-            <Anchor point="LEFT" x="4" y="0" />
-            <Anchor point="RIGHT" relativePoint="LEFT" x="8" />
+            <Anchor point="LEFT" x="2" y="0" />
+            <Anchor point="RIGHT" relativePoint="LEFT" x="6" />
           </Anchors>
             <Color a="1" r="1" g=".25" b="0" />
         </Texture>
-        <Texture parentKey="AdjustedProgress" alphaMode="BLEND">
+        <Texture parentKey="AdjustedProgress" alphaMode="ADD">
           <Anchors>
-            <Anchor point="LEFT" x="4" />
-            <Anchor point="RIGHT" relativePoint="LEFT" x="8" />
+            <Anchor point="BOTTOM" x="0" y="0" />
+            <Anchor point="LEFT" x="2" y="0" />
+            <Anchor point="RIGHT" relativePoint="LEFT" x="6" />
           </Anchors>
           <Color a="1" r="1" g="1" b="1" />
         </Texture>
-        <Texture parentKey="AdjustedLine">
-          <Size y="1" />
-          <Anchors>
-            <Anchor point="TOP" relativeKey="$parent.AdjustedProgress" />
-            <Anchor point="RIGHT" relativeKey="$parent.AdjustedProgress" />
-            <Anchor point="LEFT" relativeKey="$parent.AdjustedProgress" />
-          </Anchors>
-          <Color a="0.25" r="1" g="1" b="1" />
-        </Texture>
-        <Texture parentKey="ProgressLine">
-          <Size y="1" />
-          <Anchors>
-            <Anchor point="TOP" relativeKey="$parent.CurrentProgress" />
-            <Anchor point="RIGHT" relativeKey="$parent.CurrentProgress" />
-            <Anchor point="LEFT" relativeKey="$parent.CurrentProgress" />
-          </Anchors>
-          <Color a="0.25" r="0" g="1" b="0" />
-        </Texture>
       </Layer>
     </Layers>
   </Button>
--- a/Modules/Currency.lua	Mon Aug 21 22:15:46 2017 -0400
+++ b/Modules/Currency.lua	Tue Sep 05 02:56:33 2017 -0400
@@ -9,6 +9,11 @@
 local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop
 local profileUpdate, needsUpdate
 
+
+local itemBlock =  {}
+local currencyBlock = {}
+
+
 local zoneEvents = {
   "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED"
 }
@@ -40,6 +45,12 @@
   },
   ["Nethershard"] = {
     currencyID = 1226,
+  },
+  ["Veiled Argunite"] = {
+    currencyID = 1508,
+  },
+  ["Argus Waystone"] = {
+    currencyID = 1506,
   }
 }
 local items, currencies = {}, {}
@@ -77,9 +88,11 @@
       frame[k] = v
     end
 
-    local debug = function(...)
+    frame.debug = function(...)
       print('|cFF0088FF<'..frame.name..'>|r', ...)
     end
+    frame.id = info.itemID or info.currencyID
+
 
     if info.itemID then
       local itemID = info.itemID
@@ -87,40 +100,22 @@
         count = 0,
         frame = frame
       }
-      frame.Update = function(block)
-        debug('Update [Item]')
-        if items[itemID].count >= 1 then
-          block.Icon:SetTexture(GetItemIcon(itemID))
-          block.Label:SetFormattedText("%d", items[itemID].count)
-          return true
-        end
-      end
+      frame.Update = itemBlock.Update
       RegisterEvents(self, itemEvents)
     elseif info.currencyID then
       local currencyID = info.currencyID
-      frame.Update = function (block)
-        debug('Update [Currency]')
-        local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(currencyID)
-        
-        block.Icon:SetTexture(texture)
-        if self.showMax then
-          block.Label:SetFormattedText("%d / %d", earned, totalMax)
-        else
-          block.Label:SetFormattedText("%d", earned)
-        end
-
-        block:SetWidth(block.Icon:GetWidth() + block.Label:GetStringWidth() + 6)
-        return true
-      end
-
+      frame.Update = currencyBlock.Update
       RegisterEvents(frame, currencyEvents)
     end
+
+
+
     if info.zones then
       RegisterEvents(frame, zoneEvents)
       local zones = info.zones
       local of = frame.Update
       frame.Update = function(block)
-        debug('Update [Zone]')
+        frame.debug('Update [Zone]')
         local zone = self.zoneText
         local canShow = (zone and block.zones[zone]) and true or false
         if of then
@@ -188,7 +183,7 @@
       lastBlock = block
 
       block:SetHeight(24)
-      block:SetWidth(block.Icon:GetWidth() + block.Label:GetWidth()+4)
+      block:SetWidth(block.Icon:GetWidth() + block.Label:GetStringWidth()+4)
       totalWidth = totalWidth + block:GetWidth()
     end
     print(block:IsShown(), '|cFF0088FF'..block.name..'|r', block:GetSize())
@@ -249,3 +244,26 @@
 function block:Setup()
 
 end
+function itemBlock:Update()
+  self.debug('Update [Item]')
+  if items[self.itemID].count >= 1 then
+    self.Icon:SetTexture(GetItemIcon(self.id))
+    self.Label:SetFormattedText("%d", items[self.id].count)
+    return true
+  end
+end
+
+function currencyBlock:Update()
+  self.debug('Update [Currency]')
+  local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(self.id)
+
+  self.Icon:SetTexture(texture)
+  if self.showMax then
+    self.Label:SetFormattedText("%d / %d", earned, totalMax)
+  else
+    self.Label:SetFormattedText("%d", earned)
+  end
+
+  --self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6)
+  return true
+end
\ No newline at end of file
--- a/Modules/Currency.xml	Mon Aug 21 22:15:46 2017 -0400
+++ b/Modules/Currency.xml	Tue Sep 05 02:56:33 2017 -0400
@@ -19,17 +19,18 @@
                 </Texture>
             </Layer>
             <Layer level="ARTWORK">
-                <Texture parentKey="Icon" >
-                    <Size x="20" y="20" />
+                <Texture parentKey="Icon"  alpha="0.7">
+                    <Size x="24" y="24" />
                     <Anchors>
-                        <Anchor point="LEFT" x="2" y="0" />
+                        <Anchor point="LEFT" x="0" y="0" />
                     </Anchors>
+                    <TexCoords left=".15" right=".85" top=".15" bottom=".85"   />
                 </Texture>
             </Layer>
             <Layer level="OVERLAY">
                 <FontString parentKey="Label" inherits="VeneerHeaderFont">
                     <Anchors>
-                        <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" relativeKey="$parent.Icon" x="2" y="0" />
+                        <Anchor point="BOTTOMLEFT" x="6" y="2" />
                     </Anchors>
                 </FontString>
             </Layer>
--- a/Modules/TalkingHead.lua	Mon Aug 21 22:15:46 2017 -0400
+++ b/Modules/TalkingHead.lua	Tue Sep 05 02:56:33 2017 -0400
@@ -7,7 +7,7 @@
 local FRAME_PADDING = 2
 
 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop
-local thf = TalkingHeadFrame
+local thf
 local m = {
 
   anchorPoint = 'TOPLEFT',
@@ -24,7 +24,6 @@
 
 function m:OnLoad()
   Veneer:AddHandler(self, self.anchorPoint)
-  -- force this so we can implant
   LoadAddOn('Blizzard_TalkingHeadUI')
   thf = TalkingHeadFrame
 end
@@ -32,17 +31,16 @@
 function m:Setup()
   print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())
 
-  self:SetSize(thf:GetSize())
 
   --hooksecurefunc(thf, 'SetPoint', function(...)
   --  print('SetPoint', ...)
   --  print(debugstack())
   --end)
 
-
   self.Name:SetAllPoints(thf.NameFrame.Name)
   self.Text:SetAllPoints(thf.TextFrame.Text)
   self.Portrait:SetAllPoints(thf.PortraitFrame.Portrait)
+  self:SetSize(thf:GetSize())
 
   self:ApplySettings()
 
@@ -51,6 +49,9 @@
 end
 
 function m:ApplySettings()
+  if not thf then
+    return
+  end
 
   thf.NameFrame.Name:ClearAllPoints()
   thf.TextFrame.Text:ClearAllPoints()
@@ -78,6 +79,9 @@
 end
 
 function m:ClearAnchor()
+  if not thf then
+    return
+  end
 
   UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
   for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do
@@ -111,6 +115,9 @@
 end
 
 function m:Update()
+  if not thf then
+    return
+  end
 
   Veneer:InternalReanchor(self)
 end
--- a/Modules/TalkingHead.xml	Mon Aug 21 22:15:46 2017 -0400
+++ b/Modules/TalkingHead.xml	Tue Sep 05 02:56:33 2017 -0400
@@ -9,7 +9,7 @@
         <Texture parentArray="ConfigLayer" parentKey="Name">
                 <Color a="0.5" r="1" g="1" b="0" />
         </Texture>
-        <Texture parentArray="ConfigLayer" parentKey="Text" >
+        <Texture parentArray="ConfigLayer" parentKey="Text">
           <Color a="0.5" r="0" g="1" b="1" />
         </Texture>
         <Texture parentArray="ConfigLayer" parentKey="Portrait">
--- a/Veneer.lua	Mon Aug 21 22:15:46 2017 -0400
+++ b/Veneer.lua	Tue Sep 05 02:56:33 2017 -0400
@@ -319,8 +319,8 @@
 end
 
 function Veneer:Reanchor()
-  self:ExecuteOnClusters(nil, 'Reanchor')
-  self:DynamicReanchor(self)
+  --self:ExecuteOnClusters(nil, 'Reanchor')
+  self:EvaluateAnchors()
 end
 
 function Veneer:Update()