# HG changeset patch
# User Nenue
# Date 1484664555 18000
# Node ID dadddb8a551f5de0143f2a045723c5ec8b84ad0b
# Parent 5476337198ec5cdb8d86a923d2f71d5d5fce6aac
- bag scan intervals
- progress visualization
- artifact xp updates
diff -r 5476337198ec -r dadddb8a551f Modules/ArtifactPower.lua
--- a/Modules/ArtifactPower.lua Mon Jan 16 20:24:12 2017 -0500
+++ b/Modules/ArtifactPower.lua Tue Jan 17 09:49:15 2017 -0500
@@ -13,6 +13,19 @@
local ap = VeneerArtifactPowerMixin
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
+}
function ap:OnLoad()
self:RegisterEvent('BAG_UPDATE') -- use to obtain bag IDs to scan
@@ -20,15 +33,26 @@
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_UPDATE_XP') -- when artifact xp has changed (but not necessarily data)
+ self:RegisterEvent('ARTIFACT_XP_UPDATE') -- when artifact xp has changed (but not necessarily data)
self:RegisterEvent('MODIFIER_STATE_CHANGED')
self:RegisterEvent('PLAYER_REGEN_ENABLED')
self:RegisterEvent('PLAYER_REGEN_DISABLED')
Veneer:AddHandler(self, self.anchorPoint, true)
SLASH_VENEER_AP1 = "/vap"
SLASH_VENEER_AP2 = "/veneerap"
- SlashCmdList.VENEER_AP = function()
- self:Show()
+ SlashCmdList.VENEER_AP = function(arg)
+ if arg == 'fishing' then
+ if VeneerData.ArtifactPower.EnableFishing then
+ VeneerData.ArtifactPower.EnableFishing = nil
+ else
+ VeneerData.ArtifactPower.EnableFishing = true
+ end
+ self:Print('Show Underlight Angler:', (VeneerData.ArtifactPower.EnableFishing and 'ON' or 'OFF'))
+ self:Update()
+
+ else
+ self:Show()
+ end
end
self.tooltip = CreateFrame('GameTooltip', TOOLTIP_NAME, self, 'GameTooltipTemplate')
@@ -46,7 +70,6 @@
self.profile = VeneerData.ArtifactPower[guid]
self.profile.bagslots = self.profile.bagslots or {}
self.profile.artifacts = self.profile.artifacts or {}
- self:GetCurrentArtifact(true)
self.updateSummary = true
-- Bagnon compatibility
@@ -76,30 +99,41 @@
end
local UNDERLIGHT_ANGLER_ID = 133755
-function ap:GetCurrentArtifact(newItem)
+function ap:SetArtifact(itemID, name, texture, currentXP, pointsSpent)
+ print('|cFF00FF00SetArtifact()|r')
if not self.profile then
return
end
local artifacts = self.profile.artifacts
- local itemID, altItemID, name, texture, currentXP, pointsSpent, _, _, artifactAppearanceID, appearanceModID, itemAppearanceID, altItemAppearanceID, altOnTop = C_ArtifactUI:GetArtifactInfo()
if itemID then
+ artifacts[itemID] = artifacts[itemID] or {}
+ table.wipe(artifacts[itemID])
+ local artifact = artifacts[itemID]
+ artifact.name = name
+ artifact.texture = texture
+ artifact.currentXP = currentXP
+ artifact.level = pointsSpent
+ local cost = C_ArtifactUI.GetCostForPointAtRank(pointsSpent)
+ artifact.cost = cost
+ local pointsAvailable = pointsSpent
+ local actualCost = cost
+ local actualXP = currentXP
+ while actualXP >= actualCost do
+ pointsAvailable = pointsAvailable + 1
+ actualXP = actualXP - actualCost
+ print(pointsAvailable, '-', actualCost, '=', actualXP)
+ actualCost = C_ArtifactUI.GetCostForPointAtRank(pointsAvailable)
+ end
+ print('updating', itemID, name, currentXP, pointsSpent, pointsAvailable, actualXP)
+ artifact.actualXP = actualXP
+ artifact.actualLevel = pointsAvailable
+ artifact.actualCost = actualCost
-
- print('updating', itemID, name, currentXP, pointsSpent, pointsAvailable, adjustedXP)
- table.wipe(artifacts[itemID])
- artifacts[itemID] = artifacts[itemID] or {}
- artifacts[itemID].name = name
- artifacts[itemID].texture = texture
- artifacts[itemID].currentXP = currentXP
- artifacts[itemID].level = pointsSpent
end
-
-
- self:Update()
end
function ap:QueueBag(containerID)
containerID = tonumber(containerID)
@@ -137,26 +171,26 @@
local containerID = ...
self:QueueBag(containerID)
elseif event == 'PLAYER_BANKSLOTS_CHANGED' then
- self:QueueBag(BANK_CONTAINER)
+ self:ScanAllBags(true)
+ self:Update()
elseif event == 'BAG_UPDATE_DELAYED' then
- self:ScanAllBags()
+ self:ScanAllBags(self.bankAccess)
elseif event == 'BANKFRAME_OPENED' then
self.bankAccess = true
- self:QueueBag(BANK_CONTAINER)
- for i = 1, GetNumBankSlots() do
- self:QueueBag(i+NUM_BAG_SLOTS)
- end
- self:ScanAllBags()
+ self:ScanAllBags(true)
elseif event == 'BANKFRAME_CLOSED' then
self.bankAccess = false
- self:Update()
elseif event == 'ARTIFACT_UPDATE' then
- self:GetCurrentArtifact(...)
- elseif event == 'ARTIFACT_UPDATE_XP' then
- self:GetCurrentArtifact(...)
- self:Update()
- elseif event == 'MODIFIER_STATE_CHANGED' then
- self:Update()
+ 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)
+ 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)
elseif event == 'PLAYER_REGEN_ENABLED' then
if self.enabled then
self:Show()
@@ -182,7 +216,16 @@
if not (self.bankAP and self.bagAP) then
bankText = '|cFFFF0000Open bank frame to count all AP|r '
else
- bankText = '|cFFFFFFFFAP:|r' .. tostring(self.bagAP + self.bankAP) .. ' |cFFFFFF00('..tostring(self.bankAP)..' banked)|r'
+ if (self.bagAP + self.bankAP) == 0 then
+ bankText = '|cFF00FFFFNo Items|r'
+ else
+ if self.bagAP and (self.bagAP > 0) then
+ bankText = '|cFFFFFFFF' .. tostring(self.bagAP) .. '|r'
+ end
+ if self.bankAP and (self.bankAP > 0) then
+ bankText = (bankText and (bankText .. ' | ') or '') .. '|cFFFFFF00'..tostring(self.bankAP)..'|r'
+ end
+ end
end
self.SummaryHeader:SetText(bankText)
@@ -190,52 +233,39 @@
local equippedID = C_ArtifactUI.GetEquippedArtifactInfo()
local numButtons = 0
local lastFrame
+ local fishingRod, fishingID, fishingData
+ local index, button
for itemID, artifact in pairs(self.profile.artifacts) do
- print(artifact.name, artifact.texture, artifact.currentXP)
- numButtons = numButtons + 1
- local button = self.Artifact[numButtons]
+ local isFishingRod = (itemID == UNDERLIGHT_ANGLER_ID)
+ if isFishingRod then
+ if VeneerData.ArtifactPower.EnableFishing then
+ fishingID = itemID
+ fishingData = artifact
+ end
- button:SetID(itemID)
- for k,v in pairs(artifact) do
- --print('::',k,v)
- button[k] = v
+ else
+ numButtons = numButtons + 1
+ button = self.Artifact[numButtons]
+ lastFrame = button:SetButton(itemID, artifact, lastFrame)
end
+ end
- local pointsAvailable = button.level
- local cost = C_ArtifactUI.GetCostForPointAtRank(pointsAvailable)
- local adjustedXP = button.currentXP
- if itemID ~= UNDERLIGHT_ANGLER_ID then
- adjustedXP = adjustedXP + (self.bankAP or 0) + (self.bagAP or 0)
- print('not UL angler', adjustedXP)
- else
- print('UL angler', adjustedXP)
- end
+ if fishingData then
+ numButtons = numButtons + 1
+ local button = self.Artifact[GetNumSpecializations()+1]
+ button:SetButton(fishingID, fishingData, lastFrame)
+ end
- while adjustedXP >= cost do
- pointsAvailable = pointsAvailable + 1
- adjustedXP = adjustedXP - cost
- print(pointsAvailable, '-', cost, '=', adjustedXP)
- cost = C_ArtifactUI.GetCostForPointAtRank(pointsAvailable)
- end
- button.adjustedXP = adjustedXP
- button.actualLevel = pointsAvailable
-
- button.isEquipped = (equippedID == itemID)
- button.relativeFrame = lastFrame
- button:Update()
- lastFrame = button
- button:Show()
- end
- for i = numButtons+1, #self.Artifact do
+ for i = numButtons+ (fishingRod and 2 or 1), #self.Artifact do
print('hide', i)
self.Artifact[i]:Hide()
end
- self:SetWidth(64*3+ 16)
- self:SetHeight(8 + self.SummaryHeader:GetHeight() + 64)
+ self:SetWidth(64*numButtons + 4 * (numButtons+1))
+ self:SetHeight(12 + self.SummaryHeader:GetHeight() + 64)
self:Reanchor()
end
@@ -272,11 +302,11 @@
print(link, '-', tonumber(text))
local itemAP = tonumber(text)
if itemAP then
+ requiresUpdate = true
bagData.numItems = (bagData.numItems or 0) + 1
bagData.totalAP = (bagData.totalAP or 0) + itemAP
bagData.items = bagData.items or {}
if not bagData.items[itemID] then
- requiresUpdate = true
bagData.numUnique = (bagData.numUnique or 0) + 1
end
bagData.items[itemID] = (bagData.items[itemAP] or 0) + 1
@@ -295,41 +325,78 @@
end
- return requiresUpdate
end
-function ap:ScanAllBags()
+local BAG_SLOTS = {0, 1, 2, 3, 4 }
+local BANK_SLOTS = {-1, 5, 6,7, 8, 9, 10, 11, 12}
+
+function ap:ScanAllBags(checkBank)
print('|cFFFF0088ScanAllBags()|r')
- local bagID = tremove(BAGS_TO_SCAN, 1)
- while bagID do
- self.updateSummary = self:ScanBag(bagID) or self.updateSummary
- bagID = tremove(BAGS_TO_SCAN, 1)
+ for _, bagID in ipairs(BAG_SLOTS) do
+ self:ScanBag(bagID)
end
- if self.updateSummary then
- print('tripped updater')
- self.bankAP = 0
- self.bagAP = 0
- for id, bagData in pairs(self.profile.bagslots) do
- print(id, GetBagName(id), bagData.totalAP)
- id = tonumber(id)
- if bagData.totalAP then
- if (id == BANK_CONTAINER) or (id >= 5) then
- self.bankAP = self.bankAP + bagData.totalAP
- else
- self.bagAP = self.bagAP + bagData.totalAP
- end
+ if checkBank then
+ for _, bagID in ipairs(BANK_SLOTS) do
+ self:ScanBag(bagID)
+ end
+ end
+
+ self.bankAP = 0
+ self.bagAP = 0
+ for id, bagData in pairs(self.profile.bagslots) do
+ print(id, GetBagName(id), bagData.totalAP)
+ id = tonumber(id)
+ if bagData.totalAP then
+ if (id == BANK_CONTAINER) or (id >= 5) then
+ self.bankAP = self.bankAP + bagData.totalAP
+ else
+ self.bagAP = self.bagAP + bagData.totalAP
end
+ end
- end
- self.lastUpdate = GetTime()
- self:Update()
end
+ self.lastUpdate = GetTime()
+ self:Update()
self.updateSummary = nil
end
VeneerArtifactButtonMixin = {}
+
+function VeneerArtifactButtonMixin:SetButton(itemID, artifact, lastFrame)
+ print(artifact.name, artifact.texture, artifact.currentXP)
+ self:SetID(itemID)
+ for k,v in pairs(artifact) do
+ --print('::',k,v)
+ self[k] = v
+ end
+
+ -- this can change between artifact parses
+ local potentialPoints = self.actualLevel
+ local totalAP = (itemID == UNDERLIGHT_ANGLER_ID) and ((self:GetParent().bankAP or 0) + (self:GetParent().bagAP or 0)) or (self.fishingAP or 0)
+ local potentialXP = self.actualXP + totalAP
+ self.potentialXP = potentialXP
+ local potentialCost = C_ArtifactUI.GetCostForPointAtRank(potentialPoints)
+ while potentialXP >= potentialCost do
+ potentialXP = potentialXP - potentialCost
+ potentialPoints = potentialPoints + 1
+ print('inc estimate', potentialXP, potentialPoints)
+ potentialCost = C_ArtifactUI.GetCostForPointAtRank(potentialPoints)
+ end
+ self.potentialCost = potentialCost
+ self.potentialLevel = potentialPoints
+ self.potentialAdjustedXP = potentialXP
+
+
+
+ self.isEquipped = (equippedID == itemID)
+ self.relativeFrame = lastFrame
+ self:Update()
+ self:Show()
+ return self
+end
+
function VeneerArtifactButtonMixin:Update()
if self.actualLevel ~= self.level then
@@ -354,27 +421,84 @@
self:ClearAllPoints()
if self.relativeFrame then
- self:SetPoint('BOTTOMLEFT', self.relativeFrame, 'BOTTOMRIGHT', 4, 0)
+ self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPRIGHT', 4, 0)
else
- self:SetPoint('BOTTOMLEFT', 4, 4)
+ self:SetPoint('TOPLEFT', 4, -4)
end
+ local currentProgress = (self.currentXP < self.cost) and (self.currentXP / self.cost) or 1
+ if self.level <= 53 then
+ self.CurrentProgress.animateFrom = self.CurrentProgress:GetHeight() or 1
+ self.CurrentProgress.animateTo = currentProgress * self:GetHeight()
+ self.CurrentProgress:Show()
+ else
+ self.CurrentProgress:Hide()
+ end
+ print(currentProgress)
+ if self.potentialXP > self.currentXP then
+ local projectedProgress = (self.potentialAdjustedXP < self.potentialCost) and (self.potentialAdjustedXP / self.potentialCost) or 1
+ print(projectedProgress)
+ if (projectedProgress > currentProgress) then
+ self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP')
+ projectedProgress = projectedProgress - currentProgress
+ print(projectedProgress)
+ else
+ self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM')
+ end
+ self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1
+ self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight()
-
+ self.AdjustedProgress:Show()
+ else
+ self.AdjustedProgress:Hide()
+ end
self.Icon:SetTexture(self.texture)
self.Name:SetText(self.name)
self:SetSize(64,64)
end
+
+function VeneerArtifactButtonMixin:AnimateProgress(region)
+ local cTime = GetTime()
+ if not region.animateStart then
+ region.animateStart = cTime
+ end
+ local progressTo, progressFrom = region.animateTo, region.animateFrom
+ local elapsed = cTime - region.animateStart
+ if elapsed >= .5 then
+ region:SetHeight(progressTo)
+ region.animateTo = nil
+ region.animateStart = nil
+ region.animateFrom = nil
+ else
+ local progress = elapsed / .5
+ local height = (progressFrom + (progressTo - progressFrom) * progress)
+ --print(self:GetName(), progressTo, progressFrom, (progressTo - progressFrom), ceil(progress*10)/10, ceil(height))
+ region:SetHeight(height)
+ end
+end
+
+function VeneerArtifactButtonMixin:OnUpdate(sinceLast)
+ if self.CurrentProgress.animateTo then
+ self:AnimateProgress(self.CurrentProgress)
+ end
+
+ if self.AdjustedProgress.animateTo then
+ self:AnimateProgress(self.AdjustedProgress)
+ end
+
+end
+
function VeneerArtifactButtonMixin:OnEnter()
GameTooltip:SetOwner(self, 'ANCHOR_CURSOR')
GameTooltip:SetText(self.name)
- GameTooltip:AddLine(self.currentXP, 1, 1, 0)
- if self.adjustedXP ~= self.currentXP then
- GameTooltip:AddLine(self.adjustedXP, 0, 1, 1)
+ GameTooltip:AddLine(tostring(self.currentXP) .. ' / '..tostring(self.cost), 1, 1, 0)
+ if self.potentialXP > self.currentXP then
+ GameTooltip:AddLine(tostring(self.potentialXP) .. ' potential XP', 0, 1, 1)
+ if self.adjustedXP ~= self.potentialXP then
+ GameTooltip:AddLine(tostring(self.potentialAdjustedXP) .. ' / ' .. tostring(self.potentialAdjustedCost).. ' after spending', 0, 1, 0)
+ end
end
-
-
GameTooltip:Show()
end
function VeneerArtifactButtonMixin:OnLeave()
diff -r 5476337198ec -r dadddb8a551f Modules/ArtifactPower.xml
--- a/Modules/ArtifactPower.xml Mon Jan 16 20:24:12 2017 -0500
+++ b/Modules/ArtifactPower.xml Tue Jan 17 09:49:15 2017 -0500
@@ -8,6 +8,7 @@
+
@@ -37,6 +38,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -57,7 +73,7 @@
-
+
@@ -68,6 +84,7 @@
+
diff -r 5476337198ec -r dadddb8a551f Modules/WorldState.lua
--- a/Modules/WorldState.lua Mon Jan 16 20:24:12 2017 -0500
+++ b/Modules/WorldState.lua Tue Jan 17 09:49:15 2017 -0500
@@ -155,8 +155,7 @@
end
function VeneerOrderHallMixin:OnLoad()
-
- Veneer:AddHandler(VeneerOrderHallHandler, 'TOP', true)
+ Veneer:AddHandler(self, 'TOP', true)
end
function VeneerOrderHallMixin:OnEvent(event, ...)
@@ -170,7 +169,7 @@
print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', OrderHallCommandBar:IsShown(), self:IsShown())
self:Update()
end
- Veneer:InternalReanchor(self)
+ Veneer:DynamicReanchor(self)
end
function VeneerOrderHallMixin:OnHide()
@@ -197,7 +196,7 @@
print('|cFF00AAFF'..self:GetName()..'|r:Update()', OrderHallCommandBar:IsVisible(), self:IsShown())
print(debugstack(6))
-
+ Veneer:DynamicReanchor()
end
function VeneerWorldStateCurrencyMixin:OnLoad ()
diff -r 5476337198ec -r dadddb8a551f Templates.lua
--- a/Templates.lua Mon Jan 16 20:24:12 2017 -0500
+++ b/Templates.lua Tue Jan 17 09:49:15 2017 -0500
@@ -54,4 +54,13 @@
if not anchorAll then
Veneer:InternalReanchor(self)
end
+end
+
+function VeneerHandlerMixin:Print(...)
+ local txt = '|cFFFFFF00'..self:GetName()..'|r:'
+ for i = 1, select('#', ...) do
+ txt = txt .. ' '.. tostring(select(i, ...))
+ end
+
+ DEFAULT_CHAT_FRAME:AddMessage(txt)
end
\ No newline at end of file
diff -r 5476337198ec -r dadddb8a551f Veneer.lua
--- a/Veneer.lua Mon Jan 16 20:24:12 2017 -0500
+++ b/Veneer.lua Tue Jan 17 09:49:15 2017 -0500
@@ -112,7 +112,7 @@
function VeneerCore:OnEvent(event, ...)
print('|cFFFF0088OnEvent()|r',event, ...)
- if event == 'PLAYER_LOGIN' then
+ if (event == 'PLAYER_LOGIN') or (event == 'ADDON_LOADED') then
print(IsLoggedIn(), self.initialized)
if IsLoggedIn() and not self.intialized then
self:Setup()
@@ -157,6 +157,8 @@
if doSetup then
frame:Setup()
frame.initialized = true
+ else
+ Veneer:RegisterEvent('ADDON_LOADED')
end
end