# HG changeset patch # User Nenue # Date 1503368146 14400 # Node ID ea2c616a3b4f97e5958575dc4469de0aff493b9c # Parent 1f68c46bc4de40f0d74f94692644a286f0e8fb0d Standardize anchor variables - anchorGroup sets general position, defers to anchorPoint - anchorPoint and anchorFrom are used in SetPoint, deferring to anchorGroup and its inverse Artifact Power: - scan and update triggers trimmed down BuffFrame: - extra values can be right clicked to hide for particular auras LFG: - Desolate Host link placed above Sisters when searching for best cheevos TalkingHead - Re-enable TalkingHeadFrame click behaviour diff -r 1f68c46bc4de -r ea2c616a3b4f Modules/ArtifactPower.lua --- a/Modules/ArtifactPower.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/ArtifactPower.lua Mon Aug 21 22:15:46 2017 -0400 @@ -15,32 +15,23 @@ worldQuestItems = {}, ItemButtons = {}, anchorGroup = 'TOP', - anchorPoint = 'TOP', + anchorPoint = 'TOPLEFT', anchorPriority = 3, anchorFrom = 'BOTTOMLEFT', moduleName = 'Artifactor', HideCombat = true } + +VeneerArtifactButtonMixin = {} +local Artifact = VeneerArtifactButtonMixin + local defaultSettings = { firstUse = true, autoHide = true, } local Module = VeneerArtifactPowerMixin -local BAGS_TO_SCAN = {BACKPACK_CONTAINER } +local BAGS_TO_SCAN = {BACKPACK_CONTAINER} local TOOLTIP_NAME = 'VeneerAPScanner' -local POINT_COSTS = { - 100, 300, 325, 350, 375, - 400, 425, 450, 525, 625, - 750, 875, 1000, 6840, 8830, - 11280, 14400, 18620, 24000, 30600, - 39520, 50880, 64800, 82500, 105280, - 138650, 182780, 240870, 325520, 417560, - 546000, 718200, 946660, 1245840, 1635200, - 191500, 2010000, 2110000, 2215000, 2325000, - 2440000, 2560000, 2690000, 2825000, 2965000, - 3115000, 3270000, 3435000, 3605000, 3785000, - 3975000, 4175000, 4385000, 4605000 -} local FISHING_MAX_TRAITS = 24 local WEAPON_MAX_TRAITS = 92 local FRAME_PADDING = 4 @@ -53,13 +44,13 @@ function Module:OnLoad() self:RegisterEvent('BAG_UPDATE') -- use to obtain bag IDs to scan self:RegisterEvent('BAG_UPDATE_DELAYED') -- use to trigger actual scan activity - self:RegisterEvent('BANKFRAME_OPENED') -- determine when bank info is available - self:RegisterEvent('BANKFRAME_CLOSED') -- " " " - self:RegisterEvent('ARTIFACT_UPDATE') -- when artifact data has changed - self:RegisterEvent('ARTIFACT_XP_UPDATE') -- when artifact xp has changed (but not necessarily data) - self:RegisterEvent('PLAYER_REGEN_ENABLED') - self:RegisterEvent('PLAYER_REGEN_DISABLED') - self:RegisterEvent('PLAYER_ENTERING_WORLD') + self:RegisterEvent('BANKFRAME_OPENED') -- bank info available + self:RegisterEvent('BANKFRAME_CLOSED') -- + self:RegisterEvent('ARTIFACT_UPDATE') -- visible data change + self:RegisterEvent('ARTIFACT_XP_UPDATE') -- xp for equipped artifact + self:RegisterEvent('PLAYER_REGEN_ENABLED') -- combat + self:RegisterEvent('PLAYER_REGEN_DISABLED') -- + self:RegisterEvent('PLAYER_ENTERING_WORLD') -- zone/instance transfer self:RegisterEvent('ITEM_LOCK_CHANGED') -- use to clear bag slot cache data Veneer:AddHandler(self) SLASH_VENEER_AP1 = "/vap" @@ -80,7 +71,16 @@ end self:Print('Cache data reset.') self:Update() + elseif arg:match('item') then + print('name', arg:match("^item (%S.+)")) + print('num', arg:match("Hitem:(%d+)")) + local linkOrID = arg:match("item:(%d+)") or arg:match("^item (%S+)") + if linkOrID then + local name, etc = GetItemInfo(linkOrID) + end + else + self:Show() end end @@ -90,7 +90,10 @@ end local ShortNumberString = function (value) - if value >= 1000000 then + if value >= 1000000000 then + + return tostring(floor(value/10000000)/100) .. 'B' + elseif value >= 1000000 then return tostring(floor(value/100000)/10) .. 'M' elseif value >= 100000 then return tostring(floor(value/1000)) .. 'k' @@ -354,6 +357,7 @@ self:ScanAllBags() elseif event == 'BAG_UPDATE_DELAYED' then if not self.firstHit then + -- prevent double call from login self.firstHit = true else self:ScanAllBags() @@ -367,13 +371,13 @@ local newItem = ... if newItem then local itemID, _, name, texture, currentXP, pointsSpent = C_ArtifactUI:GetArtifactInfo() - self:SetArtifact(itemID, name, texture, currentXP, pointsSpent) - self:ScanAllBags(self.bankAccess) + self:UpdateArtifact(itemID, name, texture, currentXP, pointsSpent) + --self:ScanAllBags(self.bankAccess) end elseif event == 'ARTIFACT_XP_UPDATE' then local itemID, _, name, texture, currentXP, pointsSpent = C_ArtifactUI:GetEquippedArtifactInfo() - self:SetArtifact(itemID, name, texture, currentXP, pointsSpent) - self:ScanAllBags(self.bankAccess) + self:UpdateArtifact(itemID, name, texture, currentXP, pointsSpent) + --self:ScanAllBags(self.bankAccess) elseif event == 'PLAYER_REGEN_ENABLED' then if self.queuedScan then @@ -417,7 +421,26 @@ print('|cFFFF4400Update()|r') return end - print('|cFF00FFFFUpdate()|r') + print('|cFFFFFF00pdate()|r') + + local numButtons = 0 + local contentsHeight = 16 + local contentsWidth = 400 + if self.profile.knowledgeMultiplier then + local artifactsWidth = self:UpdateArtifactButtons() + + if artifactsWidth ~= 0 then + contentsHeight = contentsHeight + 64 + end + + contentsWidth = max(contentsWidth, min(artifactsWidth, 400)) + + local itemsWidth, itemsHeight = self:UpdateItemButtons() + contentsHeight = contentsHeight + itemsHeight + contentsWidth = max(contentsWidth, itemsWidth) + end + + local bankText, bagText if not self.profile.knowledgeMultiplier then @@ -443,22 +466,8 @@ self.SummaryHeader:SetText(bankText) - - local numButtons = 0 - local contentsHeight = 16 + self.SummaryHeader:GetHeight() - local contentsWidth = 400 - if self.profile.knowledgeMultiplier then - local artifactsWidth = self:UpdateArtifactButtons() - - if artifactsWidth ~= 0 then - contentsHeight = contentsHeight + 64 - end - - contentsWidth = max(contentsWidth, min(artifactsWidth, 400)) - - local itemsWidth, itemsHeight = self:UpdateItemButtons() - contentsHeight = contentsHeight + itemsHeight - contentsWidth = max(contentsWidth, itemsWidth) + if not self.lastButton then + contentsHeight = contentsHeight + self.SummaryHeader:GetHeight() end @@ -534,6 +543,7 @@ -- Artifact icons, in no particular order self.equippedID = C_ArtifactUI.GetEquippedArtifactInfo() + self.lastButton = nil self.canAddAP = nil self.canAddFishingAP = nil local hasArtifacts @@ -547,13 +557,13 @@ numButtons = numButtons + 1 button = self.Artifact[numButtons] button.relativeFrame = self - lastFrame = button:SetButton(self.equippedID, equipped, numButtons, true, nil) - hasArtifacts = true - + if self.equippedID ~= button.itemID then + button:SetItem(self.equippedID, equipped, numButtons, true, nil) + hasArtifacts = true + end + lastFrame = button buttonsWidth = EQUIPPED_SIZE + (FRAME_PADDING * 2) end - - for itemID, artifact in pairs(self.profile.artifacts) do if (itemID == UNDERLIGHT_ANGLER_ID) then -- only add if we have fishing AP items and it's not being shown in the equipped slot @@ -577,13 +587,18 @@ numButtons = numButtons + 1 button = self.Artifact[numButtons] button.relativeFrame = lastFrame - lastFrame = button:SetButton(itemID, artifact, numButtons, (self.equippedID == itemID), nil) + if button.itemID ~= itemID then + button:SetItem(itemID, artifact, numButtons, (self.equippedID == itemID), nil) + end + lastFrame = button buttonsWidth = buttonsWidth + lastFrame:GetWidth() + FRAME_PADDING end end end end + self.lastButton = lastFrame + if fishingData and (self.fishingAP and self.fishingAP > 0) then numButtons = numButtons + 1 @@ -591,7 +606,8 @@ local button = self.Artifact[numButtons] button.relativeFrame = lastFrame button.isFishing = true - button:SetButton(fishingID, fishingData, numButtons, self.equippedID == fishingID) + button:SetItem(fishingID, fishingData, numButtons, self.equippedID == fishingID) + self.lastButton = button end self.hasArtifacts = hasArtifacts @@ -600,6 +616,14 @@ self.Artifact[i]:Hide() end + self.SummaryHeader:ClearAllPoints() + if self.lastButton then + self.SummaryHeader:SetPoint('TOPLEFT', self.lastButton, 'TOPRIGHT', 4, -2) + else + self.SummaryHeader:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 4, 4) + end + + return buttonsWidth end @@ -757,24 +781,14 @@ return self.cache.items[itemID], self.cache.fishing[itemID] end -function Module:SetArtifact(itemID, name, texture, currentXP, pointsSpent) - print('|cFF00FF00SetArtifact()|r') +function Module:UpdateArtifact(itemID, name, texture, currentXP, pointsSpent) + print('|cFF00FF00UpdateArtifact()|r') if not self.profile then return end local artifacts = self.profile.artifacts - local multi = C_ArtifactUI.GetArtifactKnowledgeMultiplier() - if multi and (self.profile.knowledgeMultiplier ~= multi) then - table.wipe(self.cache.items) - table.wipe(self.cache.fishing) - end - - self.profile.knowledgeMultiplier = multi or self.profile.knowledgeMultiplier - print('multiplier:', multi) - if itemID then - self.currentEquipped = itemID artifacts[itemID] = artifacts[itemID] or {} @@ -786,12 +800,17 @@ artifact.currentXP = currentXP artifact.level = pointsSpent artifact.tier = C_ArtifactUI.GetArtifactTier() or ((pointsSpent >= 36) and 2 or 1) + artifact.itemID = itemID print('tier', artifact.tier) local cost = C_ArtifactUI.GetCostForPointAtRank(pointsSpent, artifact.tier) artifact.currentCost = cost - + for index, frame in pairs(self.Artifact) do + if frame.itemID == itemID then + frame:SetItem(itemID, artifact, index, (itemID == self.equippedID), (itemID == UNDERLIGHT_ANGLER_ID)) + end + end end end @@ -924,13 +943,11 @@ self:TryToShow() end -VeneerArtifactButtonMixin = {} -local Artifact = VeneerArtifactButtonMixin -function Artifact:SetButton(itemID, artifact, index, equipped, fishing) - print(itemID, index) +function Artifact:SetItem(itemID, artifact, index, equipped, fishing) + print('|cFF00FFFFSetItem()|r', itemID, index) print(artifact.name, artifact.texture, artifact.currentXP) - self:SetID(itemID) + if not artifact.currentCost then artifact.currentCost = artifact.cost end @@ -1004,27 +1021,106 @@ self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPLEFT', 4, -4) end + self.itemID = itemID self.isEquipped = equipped self:Update() self:Show() + return self end +function Artifact:UpdateXPBar() + local r3, g3, b3 = 1, .5, 0 -- main xp bar + -- current: amount shown in blizz ui + -- actual: amount contributing the next level, will be same until current point cap is reached + -- potential: total of ap on hand + print(self.currentXP, self.actualXP, self.potentialXP) + + local maxHeight = self:GetHeight() - 8 + local currentHeight = self.CurrentProgress:GetHeight() or 1 + local offHeight = self.AdjustedProgress:GetHeight() or 1 + + + 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) + 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) + else + self.CurrentProgress:Hide() + self.ProgressLine:Hide() + self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0 , 4) + print('show projected at bottom', currentProgress, projectedProgress) + end + + self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1 + self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight() + self.AdjustedLine:Show() + self.AdjustedProgress:Show() + else + self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0, 4) + self.AdjustedProgress:Hide() + self.AdjustedLine:Hide() + end + --print(self.CurrentProgress:GetPoint(3)) + --print(self.CurrentProgress:GetSize()) + + self.CurrentProgress:SetColorTexture(r3,g3,b3,1) + +end + +function Artifact:OnLoad() + print('|cFFFF4400OnLoad()|r', self:GetName(), self:GetID()) + self:RegisterEvent('ARTIFACT_UPDATE') + self:RegisterEvent('PLAYER_LOGIN') +end + +function Artifact:OnEvent(event) + local itemID, _, _, nextCost = C_ArtifactUI.GetEquippedArtifactInfo() + print(self:GetID(), '|cFFFF4400OnEvent()|r', event, itemID, '=', self.itemID, (itemID == self.itemID)) + if itemID == self.itemID then + self:Update() + end +end + function Artifact:Update() - local r1, g1, b1 = 1, 1, 1 - local r2, g2, b2 = 1, 1, 0 + if not self.itemID then + return + end + + print(self:GetName(), '|ff00FFFFUpdate()|r') + local r1, g1, b1 = 1, 1, 1 -- top text + local r2, g2, b2 = 1, 1, 0 -- bottom text local levelText = self.level local xpText = ShortNumberString(self.currentXP) local costText = ShortNumberString(self.currentCost) local remainingText = ShortNumberString(self.currentCost - self.currentXP) - -- current: amount shown in blizz ui - -- actual: amount contributing the next level, will be same until current point cap is reached - -- potential: total of ap on hand - print(self.currentXP, self.actualXP, self.potentialXP) + + local maxHeight = self:GetHeight() - 4 + local currentHeight = self.CurrentProgress:GetHeight() or 1 + local offHeight = self.AdjustedProgress:GetHeight() or 1 + if self.actualLevel ~= self.level then levelText = self.actualLevel r1, g1, b1 = 0, 1, 0 - --r2, g2, b2 = 0, 1, 0 xpText = ShortNumberString(self.actualXP) costText = ShortNumberString(self.actualCost) remainingText = ShortNumberString(self.actualCost-self.actualXP) @@ -1034,8 +1130,6 @@ 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) @@ -1054,41 +1148,7 @@ self:SetNormalTexture(nil, 'ADD') end - local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1 - print('|cFFFF4400', currentProgress) - if self.level <= 92 then - self.CurrentProgress.animateFrom = self.CurrentProgress:GetHeight() or 1 - self.CurrentProgress.animateTo = currentProgress * self:GetHeight() - self.CurrentProgress:Show() - self.ProgressLine:Show() - else - self.CurrentProgress:Hide() - self.ProgressLine:Hide() - end - - if self.totalXP ~= self.currentXP then - local projectedProgress = (self.totalXP / self.totalCost) - print('|cFF00FFFF', projectedProgress) - if (projectedProgress > currentProgress) then - self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP') - projectedProgress = projectedProgress - currentProgress - else - self.CurrentProgress:Hide() - self.ProgressLine:Hide() - self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM') - end - print('show actual', currentProgress, projectedProgress) - self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1 - self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight() - self.AdjustedLine:Show() - self.AdjustedProgress:Show() - else - self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM') - self.AdjustedProgress:Hide() - self.AdjustedLine:Hide() - end - print(self.CurrentProgress:GetPoint(3)) - print(self.CurrentProgress:GetSize()) + self:UpdateXPBar() if self.actualLevel ~= self.currentLevel then self:SetNormalTexture([[Interface\Buttons\UI-Quickslot-Depress]], 'ADD') @@ -1171,4 +1231,4 @@ end end -end \ No newline at end of file +end diff -r 1f68c46bc4de -r ea2c616a3b4f Modules/ArtifactPower.xml --- a/Modules/ArtifactPower.xml Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/ArtifactPower.xml Mon Aug 21 22:15:46 2017 -0400 @@ -25,6 +25,8 @@ - + @@ -114,24 +116,21 @@ - + - - - -