# HG changeset patch # User Nenue # Date 1504594593 14400 # Node ID b3c0258b419dc176019cd7bbd6ecf1ccbeb15c2f # Parent ea2c616a3b4f97e5958575dc4469de0aff493b9c 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) diff -r ea2c616a3b4f -r b3c0258b419d Modules/ArtifactPower.lua --- 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 diff -r ea2c616a3b4f -r b3c0258b419d Modules/ArtifactPower.xml --- 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 @@ - + + + + + + + + + + + + @@ -68,39 +79,22 @@ - + - - + + - + - - + + + - - - - - - - - - - - - - - - - - - diff -r ea2c616a3b4f -r b3c0258b419d Modules/Currency.lua --- 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 diff -r ea2c616a3b4f -r b3c0258b419d Modules/Currency.xml --- 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 @@ - - + + - + + - + diff -r ea2c616a3b4f -r b3c0258b419d Modules/TalkingHead.lua --- 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 diff -r ea2c616a3b4f -r b3c0258b419d Modules/TalkingHead.xml --- 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 @@ - + diff -r ea2c616a3b4f -r b3c0258b419d Veneer.lua --- 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()