# HG changeset patch # User Nenue # Date 1490698946 14400 # Node ID 8c94bee4fdfcb8470b418d3c92ed06bc4b1d3914 # Parent 6748c98a6c6cf7c96449e206d270f8407006ddcb - AddHandler simplified - Centralized combat start/stop hooks - WorldState removed diff -r 6748c98a6c6c -r 8c94bee4fdfc Modules/ArtifactPower.lua --- a/Modules/ArtifactPower.lua Mon Mar 27 00:39:29 2017 -0400 +++ b/Modules/ArtifactPower.lua Tue Mar 28 07:02:26 2017 -0400 @@ -13,7 +13,10 @@ scanQueue = {}, ItemButtons = {}, anchorPoint = 'TOP', + anchorPriority = 2, anchorFrom = 'TOP', + moduleName = 'Artifactor', + HideCombat = true } local defaultSettings = { firstUse = true, @@ -53,7 +56,7 @@ self:RegisterEvent('PLAYER_REGEN_DISABLED') self:RegisterEvent('PLAYER_ENTERING_WORLD') self:RegisterEvent('ITEM_LOCK_CHANGED') -- use to clear bag slot cache data - Veneer:AddHandler(self, self.anchorPoint, 2) + Veneer:AddHandler(self) SLASH_VENEER_AP1 = "/vap" SLASH_VENEER_AP2 = "/veneerap" SlashCmdList.VENEER_AP = function(arg) diff -r 6748c98a6c6c -r 8c94bee4fdfc Modules/BuffFrame.lua --- a/Modules/BuffFrame.lua Mon Mar 27 00:39:29 2017 -0400 +++ b/Modules/BuffFrame.lua Tue Mar 28 07:02:26 2017 -0400 @@ -41,10 +41,10 @@ VeneerBuffFrameMixin = { moduleName = 'Buff Frames', - defaultCluster = 'TOPRIGHT', + anchorPoint = 'TOPRIGHT', anchorX = BUFF_FRAMES_X, anchorY = BUFF_FRAMES_Y, - anchorPoint = 'TOPRIGHT', + Buttons = {}, DetectedFrames = {}, AuraCache = {} @@ -288,12 +288,12 @@ end function plugin:OnLoad() - Veneer:AddHandler(self, self.defaultCluster) + print(self:GetName(), 'OnLoad()') + Veneer:AddHandler(self) end function plugin:Setup() - - + print(self:GetName(), 'Setup()') hooksecurefunc("BuffFrame_Update", function(...) self:OnBuffFrameUpdate(...) end) hooksecurefunc("AuraButton_UpdateDuration", function(...) self:OnUpdateDuration(...) end) hooksecurefunc("AuraButton_Update", function(...) self:OnAuraButton_Update(...) end) diff -r 6748c98a6c6c -r 8c94bee4fdfc Modules/Currency.lua --- a/Modules/Currency.lua Mon Mar 27 00:39:29 2017 -0400 +++ b/Modules/Currency.lua Tue Mar 28 07:02:26 2017 -0400 @@ -7,6 +7,7 @@ -- local print = DEVIAN_WORKSPACE and function(...) print('VnWorldState', ...) end or nop +local profileUpdate, needsUpdate local zoneEvents = { "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED" @@ -31,13 +32,19 @@ itemID = 124124, } } -local items = {} +local items, currencies = {}, {} -VeneerWorldStateCurrencyMixin = { Blocks = {} } -VeneerWorldStateCurrencyBlockMixin = {} -local module = VeneerWorldStateCurrencyMixin -local block = VeneerWorldStateCurrencyBlockMixin +VeneerCurrencyMixin = { + Blocks = {}, + HideCombat = true, + EventList = {'PLAYER_ENTERING_WORLD'}, + moduleName = 'Currency Watch', + anchorPoint = 'TOP', +} +VeneerCurrencyBlockMixin = {} +local module = VeneerCurrencyMixin +local block = VeneerCurrencyBlockMixin @@ -49,9 +56,7 @@ end function module:OnLoad () - self:RegisterEvent("PLAYER_ENTERING_WORLD"); - self:RegisterEvent('PLAYER_REGEN_ENABLED') - self:RegisterEvent('PLAYER_REGEN_DISABLED') + Veneer:AddHandler(self) for name, info in pairs(blocks) do local frame = CreateFrame('Frame', nil, self, 'VeneerCurrencyTemplate') @@ -138,15 +143,16 @@ local texture, count = GetContainerItemInfo(i,j) if items[itemID] then items[itemID].count = items[itemID].count + (count or 1) - items[itemID].texture = texture - print('tracked currency tally', items[itemID].count, '|T'..texture..':16:16|t') - items[itemID].frame.Icon:SetTexture(texture) + if not items[itemID].texture then + items[itemID].texture = texture + print('tracked currency tally', items[itemID].count, '|T'..texture..':16:16|t') + items[itemID].frame.Icon:SetTexture(texture) + end end end end - for itemID, info in pairs(items) do - end + local lastBlock local totalWidth = 0 @@ -170,21 +176,36 @@ totalWidth = totalWidth + block:GetWidth() end print(block:IsShown(), '|cFF0088FF'..block.name..'|r', block:GetSize()) - end + self:UpdateProfile() self:SetWidth(totalWidth) - self.needsUpdate = nil + needsUpdate = nil print(self:IsShown(), '|cFF00FF88'..self:GetName()..'|r', self:GetSize()) self:SetShown(canShow) - VeneerWorldState:Reanchor(true) + Veneer:DynamicReanchor() +end + +function module:UpdateProfile() + if not self.profile then + profileUpdate = true + return + end + + for itemID, info in pairs(items) do + self.profile.Items = self.profile.Items or {} + self.profile.Items[itemID] = info + end end function module:OnUpdate() - if self.needsUpdate then + if needsUpdate then self:Update() + elseif profileUpdate then + self:UpdateProfile() end + end function block:OnEnter() diff -r 6748c98a6c6c -r 8c94bee4fdfc Modules/Currency.xml --- a/Modules/Currency.xml Mon Mar 27 00:39:29 2017 -0400 +++ b/Modules/Currency.xml Tue Mar 28 07:02:26 2017 -0400 @@ -2,7 +2,7 @@ ..\FrameXML\UI.xsd">