Mercurial > wow > buffalo2
changeset 121:1f68c46bc4de
BuffFrame:
- Added interface framework for selectively hiding certain buff's auxiliary values.
author | Nenue |
---|---|
date | Mon, 17 Jul 2017 11:51:31 -0400 |
parents | 5f1ba488c395 |
children | ea2c616a3b4f |
files | Modules/ArtifactPower.lua Modules/BuffFrame.lua Modules/BuffFrame.xml Modules/FriendsFrame.lua Modules/GuildInfo.lua Modules/GuildInfo.xml Modules/TalkingHead.lua Templates.lua Templates.xml Veneer.lua |
diffstat | 10 files changed, 345 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/ArtifactPower.lua Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/ArtifactPower.lua Mon Jul 17 11:51:31 2017 -0400 @@ -14,9 +14,10 @@ worldQuestAP = 0, worldQuestItems = {}, ItemButtons = {}, + anchorGroup = 'TOP', anchorPoint = 'TOP', anchorPriority = 3, - anchorFrom = 'TOP', + anchorFrom = 'BOTTOMLEFT', moduleName = 'Artifactor', HideCombat = true }
--- a/Modules/BuffFrame.lua Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/BuffFrame.lua Mon Jul 17 11:51:31 2017 -0400 @@ -47,7 +47,8 @@ Buttons = {}, DetectedFrames = {}, - AuraCache = {} + AuraCache = {}, + ValueMasks = {} } VeneerBuffFrameButtonMixin = {} local Facade = VeneerBuffFrameButtonMixin @@ -70,6 +71,7 @@ local expirationCache = {} local visibility = {} local isHooked = {} +local valueMasks plugin.options = { nameString = 'Buff Frames', @@ -303,13 +305,32 @@ self:SetupButton('TempEnchant'..i) _G['TempEnchant'..i..'Border']:SetVertexColor(0.5,0,1,1) end + + VeneerData.BuffFrame = VeneerData.BuffFrame or {} + VeneerData.BuffFrame.ValueMasks = VeneerData.BuffFrame.ValueMasks or {} + valueMasks = VeneerData.BuffFrame.ValueMasks end function plugin:SetHidden(region) if not self.hiddenRegions[region] then self.hiddenRegions[region] = true region:SetShown(false) - hooksecurefunc(region) + + end +end + +local lastAuditName = '' +local lastAuditIndex = '' +local Audit_OnClick = function(self) + + local facade = self:GetParent() + local index = self.index + local name = facade.buffName + if name then + DEFAULT_CHAT_FRAME:AddMessage('|cFF00FFFFVeneer|r: Hiding |cFF00FF88'..name..' value'..index..'|r, type /vn buffs reset to undo.') + valueMasks[name] = valueMasks[name] or {} + valueMasks[name][index] = false + print('AuditClick', name, index, false) end end @@ -366,6 +387,16 @@ facade:SetShown(isShown) end) + facade.Audit = facade.Audit or {} + for i = 1, 3 do + local button = CreateFrame('Button', nil, facade, 'VeneerBuffAuditTemplate') + button.index = i + button:RegisterForClicks('AnyUp') + button:SetScript('OnClick', Audit_OnClick) + button:SetPoint('TOPLEFT', 0, (i-1) * 16 * -1) + facade.Audit[i] = button + end + facade.IsAcquired = true facade:SetParent(UIParent) facade:SetAllPoints(frame) @@ -374,6 +405,7 @@ --- Set widgets to reflect the passed parameters +local values = {} function plugin:UpdateButton (name, duration, expires) local frame = _G[name] local facade = self:Acquire(name) @@ -382,7 +414,6 @@ print('|cFFFF4400detected', name) self:SetupButton(name) end - print(facade:GetParent():GetName(), facade:GetPoint(1)) --[[ if frame.count then frame.count:SetText('test') @@ -391,8 +422,11 @@ --]] local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, _, nameplateShowAll, timeMod, value1, value2, value3 = UnitAura(frame.unit, frame:GetID(), frame.filter) + values[1] = value1 + values[2] = value2 + values[3] = value3 - + facade.buffName = name if expires and duration then if duration ~= 0 then @@ -425,13 +459,13 @@ end) - facade.cooldown:Show() - facade.cooldown:SetCooldown(startTime, duration) + --facade.cooldown:Show() + --facade.cooldown:SetCooldown(startTime, duration) else print('|cFF00FF88'..frame:GetName()..'|r', 'duration zero') facade.progress:SetScript('OnUpdate', nil) facade.progress:Hide() - facade.cooldown:Hide() + --facade.cooldown:Hide() end if count and count > 1 then @@ -442,15 +476,22 @@ facade.count:Hide() end + for i, button in ipairs(facade.Audit) do + local isShown = (values[i] and true) + if valueMasks[name] and valueMasks[name][i] ~= nil then + print(':: use value mask', name, i) + isShown = (values[i] == 1) and true or false + end - facade.overlay.Value1:SetText(value1) - facade.overlay.Value2:SetText(value2) - facade.overlay.Value3:SetText(value3) + facade.Audit[i]:SetShown(isShown) + facade.Audit[i].Value:SetText(values[i]) + end + else facade.progress:Hide() - facade.cooldown:SetCooldown(0,0) - facade.cooldown:Hide() + --facade.cooldown:SetCooldown(0,0) + --facade.cooldown:Hide() print('|cFF88FF00'..frame:GetName()..'|r', 'nil duration') end facade:Show()
--- a/Modules/BuffFrame.xml Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/BuffFrame.xml Mon Jul 17 11:51:31 2017 -0400 @@ -6,6 +6,23 @@ <Size x="20" y="20" /> </Frame> + + <Button name="VeneerBuffAuditTemplate" parentArray="Audit" virtual="true"> + <Size x="32" y="16" /> + <Layers> + <Layer level="OVERLAY"> + <FontString parentKey="Value" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="LEFT" /> + </Anchors> + </FontString> + </Layer> + </Layers> + <HighlightTexture setAllPoints="true"> + <Color a=".2" r="1" g="1" b="1" /> + </HighlightTexture> + </Button> + <Frame name="VeneerBuffTemplate" virtual="true" mixin="VeneerBuffFrameButtonMixin" inherits="VeneerStatusButtonTemplate" hidden="true"> <Scripts> <OnLoad method="OnLoad" /> @@ -33,11 +50,6 @@ </Layer> </Layers> </Frame> - <Cooldown name="$parentCooldown" parentKey="cooldown" inherits="CooldownFrameTemplate" reverse="true" setAllPoints="true"> - <EdgeTexture> - <Color a="0" r="0" g="0" b="0" /> - </EdgeTexture> - </Cooldown> <Frame name="$parentProgress" parentKey="progress" frameStrata="MEDIUM"> <Layers> <Layer level="BACKGROUND">
--- a/Modules/FriendsFrame.lua Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/FriendsFrame.lua Mon Jul 17 11:51:31 2017 -0400 @@ -3,9 +3,8 @@ -- Created: 10/27/2016 8:50 PM -- %file-revision% -- - -VeneerLFGMixin = {} -local Module = VeneerLFGMixin +local m = {} +VeneerLFGMixin = m local _, db = ... local print = DEVIAN_WORKSPACE and function(...) print('VnTweaks', ...) end or nop @@ -76,4 +75,4 @@ -end) \ No newline at end of file +end)
--- a/Modules/GuildInfo.lua Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/GuildInfo.lua Mon Jul 17 11:51:31 2017 -0400 @@ -2,10 +2,12 @@ local print = DEVIAN_WORKSPACE and function(...) print('VnRoster', ...) end or nop VeneerRosterKunMixin = { - addonTrigger = 'Blizzard_GuildUI', + anchorFrame = 'LFGListFrame', + anchorPoint = 'TOPLEFT', - anchorFrame = 'GuildFrame', - anchorPoint = 'TOPLEFT', + AchievementsDirty = true, + GuildInfoDirty = true, + blocks = {}, } @@ -13,18 +15,35 @@ function module:OnLoad() Veneer:AddHandler(self, self.anchorPoint) - self:RegisterEvent('GUILD_ROSTER_UPDATE') - self:RegisterEvent('GUILD_TRADESKILL_UPDATE') + --self:RegisterEvent('GUILD_ROSTER_UPDATE') + --self:RegisterEvent('GUILD_TRADESKILL_UPDATE') self:RegisterEvent('LFG_LIST_SEARCH_RESULT_UPDATED') - self:RegisterEvent('LFG_LIST_SEARCH_RESULTS_RECEIVED') - self:RegisterEvent('LFG_LIST_AVAILABILITY_UPDATE') - self:RegisterEvent('LFG_LIST_LOCK_INFO_RECEIVED') + --self:RegisterEvent('LFG_LIST_SEARCH_RESULTS_RECEIVED') + --self:RegisterEvent('LFG_LIST_AVAILABILITY_UPDATE') + --self:RegisterEvent('LFG_LIST_LOCK_INFO_RECEIVED') + self:RegisterEvent('ADDON_LOADED') + + hooksecurefunc("LFGListSearchPanel_SelectResult", function(obj) + print('LFGListSearchPanel_SelectResult') + self.selectedID = obj.selectedResult + print('selected =', self.selectedID) + self:UpdateAchievementLinks() + end) + hooksecurefunc("LFGListSearchPanel_SignUp", function(obj) + print('LFGListSearchPanel_SignUp', obj.selectedResult) + + + self.selectedID = obj.selectedResult + print('selected =', self.selectedID) + self:UpdateAchievementLinks() + end) end function module:Setup() VeneerHandlerMixin.Setup(self) - self:SetParent(GuildFrame) + self:SetParent(LFGListFrame) + self:SetPoint('TOPLEFT', LFGListFrame,'TOPRIGHT') self:SetShown(true) end @@ -33,31 +52,149 @@ self:Update() else self.GuildInfoDirty = true + self.AchievementsDirty = true end end - +local firstLoad = true function module:OnShow() print('|cFF00FFFFOnShow()|r') - if self.GuildInfoDirty then - self:UpdateGuildInfo() - end + self:Update(firstLoad) + firstLoad = nil end function module:UpdateGuildInfo() local numMembers = GetNumGuildMembers() print(numMembers) for i = 1, numMembers do - print(GetGuildRosterInfo(i)) + --print(GetGuildRosterInfo(i)) + end + self.GuildInfoDirty = nil +end + +-- cheevos to link +local cheevos = { + -- Mythic Prog: Tomb + { + 11781, -- kj + 11780, -- avatar + 11779, -- maiden + 11776, -- mistress + 11777, -- sisters + 11778, -- host, + 11775, -- harjatan, + 11774, -- di, + 11773, -- goroth + }, + -- Completion: Tomb + { + 11875, -- CE KJ + 11874, -- AotC KJ + 11790 -- Deceiver's Fall, + + + }, + -- Mythic+ + { + 11162, -- master + 11185, -- conqueror + } +} + +local cheev = {} + +function cheev:OnClick() + local resultID = LFGListFrame.SearchPanel.selectedResult or self:GetParent().selectedID + print('current selection = ', resultID) + if ACTIVE_CHAT_EDIT_BOX then + ChatEdit_InsertLink(self.link) + elseif resultID then + local id, activityID, name, comment, voiceChat, iLvl, honorLevel, age, numBNetFriends, numCharFriends, numGuildMates, isDelisted, leaderName = C_LFGList.GetSearchResultInfo(resultID); + --print(name, comment, leaderName) + ChatFrame_OpenChat("/w "..leaderName.." "..self.link, DEFAULT_CHAT_FRAME) end end -function module:Update() end +function module:UpdateAchievementLinks() + print('UpdateAchievementLinks()') + + local resultID = LFGListFrame.SearchPanel.selectedResult or self.selectedID + self:Show() + + + local index = 0 + local lastBlock + local contentsHeight = 0 + for _, group in ipairs(cheevos) do + for _, id in ipairs(group) do + local _, name, points, completed, month, day, year, description, flags, icon = GetAchievementInfo(id) + if completed then + index = index + 1 + --print(index) + local block =self.blocks[index] + if not block then + block = CreateFrame('Button', 'VeneerRosterKunBlock'..index, self, 'VeneerRosterKunBlock') + block:SetScript('OnClick', cheev.OnClick) + block:SetID(index) + self.blocks[index] = block + end + + block.link = GetAchievementLink(id) + block.Icon:SetTexture(icon) + block.Label:SetText(name) + block:ClearAllPoints() + if lastBlock then + block:SetPoint('TOPLEFT', lastBlock, 'BOTTOMLEFT', 0, 0) + else + block:SetPoint('TOPLEFT') + end + --print(block:GetHeight(), block:GetPoint(1)) + block:Show() + + contentsHeight = contentsHeight + block:GetHeight() + + --print(index, name, icon) + lastBlock = block + break; + end + end + end + + --print(index, #self.blocks) + if index < #self.blocks then + for i = index+1, #self.blocks do + --print('hiding', i) + self.blocks[i]:Hide() + end + + end + + self:SetHeight(contentsHeight) + +end + +function module:Update(forced) + + + if self.GuildInfoDirty or forced then + self:UpdateGuildInfo() + end + if self.AchievementsDirty or forced then + self:UpdateAchievementLinks() + end + +end +function module:SetupGuildUI() + self:UnregisterEvent('ADDON_LOADED') +end function module:OnEvent(event, ...) print('|cFFFF0088OnEvent()|r', event, ...) - if event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then + if event == 'ADDON_LOADED' then + local addon = ... + if addon == 'Blizzard_GuildUI' then + self:SetupGuildUI() + end + elseif event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then elseif event == 'LFG_LIST_SEARCH_RESULT_UPDATED' then - elseif event == 'GUILD_ROSTER_UPDATE' then - self:SetDirty() end -end \ No newline at end of file +end
--- a/Modules/GuildInfo.xml Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/GuildInfo.xml Mon Jul 17 11:51:31 2017 -0400 @@ -4,7 +4,41 @@ <Frame name="$parentRosterKun" mixin="VeneerRosterKunMixin" parent="Veneer" inherits="VeneerHandlerTemplate"> + <Size x="200"/> + <Layers> + <Layer level="BACKGROUND"> + <Texture setAllPoints="true"> + <Color a="0.5" r="0" g="0" b="0" /> + </Texture> + </Layer> + </Layers> + </Frame> + <Button name="VeneerRosterKunBlock" parent="VeneerRosterKun" parentArray="blocks" virtual="true"> + <Size x="200" y="36" /> + <Layers> + <Layer level="BACKGROUND"> + <Texture parentKey="Icon"> + <Anchors> + <Anchor point="TOPLEFT" /> + + </Anchors> + <Size x="36" y="36" /> + </Texture> + </Layer> + <Layer level="OVERLAY"> + <FontString inherits="GameFontNormal" parentKey="Label"> + <Anchors> + <Anchor point="LEFT" relativePoint="RIGHT" relativeKey="$parent.Icon" x="4" y="0" /> + </Anchors> + </FontString> + </Layer> + </Layers> + <HighlightTexture> + <Color a="0.2" r="0" g="0" b="1" /> + </HighlightTexture> + </Button> + </Ui> \ No newline at end of file
--- a/Modules/TalkingHead.lua Sun Jun 04 18:20:40 2017 -0400 +++ b/Modules/TalkingHead.lua Mon Jul 17 11:51:31 2017 -0400 @@ -5,32 +5,34 @@ -- local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop - -VeneerTalkingHeadMixin = { +local thf = TalkingHeadFrame +local m = { anchorPoint = 'BOTTOMLEFT', anchorFrom = 'TOPLEFT', anchorX = -4, anchorY = 96, anchorFrame = 'ChatFrame1', - addonTrigger = 'Blizzard_TalkingHeadUI' } +VeneerTalkingHeadMixin = m local qf = {} -function VeneerTalkingHeadMixin:OnLoad() +function m:OnLoad() Veneer:AddHandler(self, self.anchorPoint) + -- force this so we can implant + LoadAddOn('Blizzard_TalkingHeadUI') + thf = TalkingHeadFrame end -function VeneerTalkingHeadMixin:Setup() - print('|cFF00AAFF'..self:GetName()..'|r:Setup()', TalkingHeadFrame:IsShown(), self:IsShown()) +function m:Setup() + print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown()) - self:SetSize(TalkingHeadFrame:GetSize()) - self:SetParent(TalkingHeadFrame) + self:SetSize(thf:GetSize()) - hooksecurefunc(TalkingHeadFrame, 'SetPoint', function(...) + hooksecurefunc(thf, 'SetPoint', function(...) print('SetPoint', ...) print(debugstack()) end) @@ -39,44 +41,44 @@ self:ClearAnchor() end -function VeneerTalkingHeadMixin:ClearAnchor() +function m:ClearAnchor() UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do - if alertSubSystem.anchorFrame == TalkingHeadFrame then + if alertSubSystem.anchorFrame == thf then tremove(AlertFrame.alertFrameSubSystems, i) return end end end -function VeneerTalkingHeadMixin:OnShow() - if TalkingHeadFrame then - print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', TalkingHeadFrame:IsShown(), self:IsShown()) +function m:OnShow() + if thf then + print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown()) print(debugstack()) self:Update() end end -function VeneerTalkingHeadMixin:Reanchor() +function m:Reanchor() self:ClearAllPoints() self:SetPoint('BOTTOMLEFT', _G[self.anchorFrame], 'TOPLEFT', -4, 24) self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0) -- independent module, end -function VeneerTalkingHeadMixin:OnHide() - if TalkingHeadFrame then - print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', TalkingHeadFrame:IsShown(), self:IsShown()) +function m:OnHide() + if thf then + print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown()) end Veneer:Reanchor() end -function VeneerTalkingHeadMixin:Update() +function m:Update() - print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', TalkingHeadFrame:IsShown(), self:IsShown()) - TalkingHeadFrame:ClearAllPoints() - TalkingHeadFrame:SetAllPoints(self) + print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown()) + thf:ClearAllPoints() + thf:SetAllPoints(self) Veneer:InternalReanchor(self) end
--- a/Templates.lua Sun Jun 04 18:20:40 2017 -0400 +++ b/Templates.lua Mon Jul 17 11:51:31 2017 -0400 @@ -22,6 +22,9 @@ Veneer.ConfigLayerBase = ConfigLayer Veneer.AnimationBase = Animation +local ANCHOR_BUTTON_TYPES = { + 'TOPLEFT', 'TOP', 'TOPRIGHT', 'RIGHT', 'LEFT', 'CENTER', 'BOTTOMLEFT', 'BOTTOM', 'BOTTOMRIGHT' +} function ConfigLayer:OnLoad() local handler = self:GetParent() @@ -30,6 +33,43 @@ for i, region in ipairs(handler.ConfigLayers) do region:SetShown(Veneer.ConfigMode) end + self.handler = handler +end + +function ConfigLayer:OnShow() + self:Update() +end + +function ConfigLayer:Update() + if not self.anchorButtons then + self.anchorButtons = {} + for _, anchorPoint in ipairs(ANCHOR_BUTTON_TYPES) do + local button = CreateFrame('Button', nil, self, 'VeneerAnchorButtonTemplate') + button.anchorPoint = anchorPoint + button:SetScript('OnMouseDown', function() end) + button:SetScript('OnMouseUp', function() end) + button:SetPoint(anchorPoint) + button:SetSize(16,16) + + self.anchorButtons[anchorPoint] = button + end + end + + for anchorPoint, button in pairs(self.anchorButtons) do + if anchorPoint == self.handler.anchorPoint then + button:GetNormalTexture():SetColorTexture(0,1,0,1) + else + button:GetNormalTexture():SetColorTexture(0.5,0.5,0.5,1) + end + end + + self:RegisterForDrag('LeftButton') +end + +function ConfigLayer:OnDragStart() + +end +function ConfigLayer:OnDragStop() end
--- a/Templates.xml Sun Jun 04 18:20:40 2017 -0400 +++ b/Templates.xml Mon Jul 17 11:51:31 2017 -0400 @@ -74,6 +74,15 @@ </Frames> </Frame> + <Button name="VeneerAnchorButtonTemplate" virtual="true"> + <NormalTexture> + <Color a="1" r=".25" g=".25" b=".25" /> + </NormalTexture> + <HighlightTexture> + <Color r="1" g=".5" b="0" a="0.5" /> + </HighlightTexture> + </Button> + <!-- same as above, but with a progress bar --> <Frame name="VeneerStatusBarTemplate" virtual="true" hidden="true" inherits="VeneerMixinScripts"> <Scripts> @@ -140,6 +149,12 @@ </Frame> <Frame name="VeneerHandlerTemplate" inherits="VeneerAnimations" hidden="true" parent="UIParent" virtual="true"> + <Scripts> + <OnLoad method="OnLoad" /> + <OnEvent method="OnEvent" /> + <OnShow method="OnShow" /> + <OnHide method="OnHide" /> + </Scripts> <Layers> <Layer level="BACKGROUND"> <Texture parentKey="Background" setAllPoints="true" parentArray="ConfigLayer"> @@ -147,12 +162,6 @@ </Texture> </Layer> </Layers> - <Scripts> - <OnLoad method="OnLoad" />> - <OnEvent method="OnEvent" /> - <OnShow method="OnShow" /> - <OnHide method="OnHide" /> - </Scripts> <Frames> <Frame name="$parentConfigHandler" setAllPoints="true" mixin="VeneerConfigLayerMixin" enableMouse="true" parentArray="ConfigLayer"> <Scripts>