arkanes@0: local _, kbf = ... arkanes@0: arkanes@0: KBF = kbf -- make global for debugging arkanes@0: arkanes@0: local kbf = LibStub("AceAddon-3.0"):NewAddon(kbf, "KBF", "AceEvent-3.0", "AceConsole-3.0") arkanes@0: arkanes@0: arkanes@0: function kbf:OnInitialize() arkanes@10: self.debuffFrames = {} arkanes@0: self:RegisterEvent("UNIT_AURA") arkanes@27: self:RegisterEvent("UNIT_ENTERING_VEHICLE", "PollForVehicleChange") arkanes@27: self:RegisterEvent("UNIT_EXITING_VEHICLE", "PollForVehicleChange") arkanes@38: self:RegisterChatCommand("kbf", "ToggleAnchor") arkanes@38: end arkanes@38: arkanes@38: function kbf:OnEnable() arkanes@38: self.anchor, self.secureHeader, self.consolidateHeader, self.consolidateProxy = self:CreateCoreFrames() arkanes@38: -- set up the countdown timer arkanes@4: -- TODO: Fancy enable/disable based on whether you have any timed buffs. arkanes@4: -- Not a big deal, how often do you care about that arkanes@8: -- also TODO: Maybe should bucket OnUpdates somehow arkanes@18: -- AceTimer repeating events can only happen at 0.1 seconds, which is probably arkanes@18: -- fast enough for updating, but makes the animation look jerky arkanes@27: -- need to experiment with using animation groups arkanes@18: self.update = CreateFrame("FRAME") arkanes@18: self.update:SetScript("OnUpdate", function() self:OnUpdate() end) arkanes@7: self.dirty = true -- force an immediate scan on login arkanes@14: self:HideBlizzardBuffFrames() arkanes@0: end arkanes@1: -- naming convention arkanes@17: -- a "frame" is the top-level button (secure button from the header, or one I make myself) arkanes@17: -- that will contain the UI information about the buff arkanes@17: -- a "bar" is a frame that has the icon, status bar, ect associated with it arkanes@0: arkanes@20: -- Secure aura header doesn't self-bind to vehicle, arkanes@27: -- so this only works out of combat. But thats better than nothing... arkanes@27: function kbf:PollForVehicleChange(event, unit) arkanes@20: if unit ~= "player" then return end arkanes@20: self.dirty = true arkanes@20: -- hax until SAH supports vehicles - do the swap after we come out of combat arkanes@27: -- always poll instead of insta-swapping OOC in order to simplify the UnitHasVehicleUI logic arkanes@27: self.pollForUnitChange = true arkanes@20: end arkanes@20: arkanes@8: function kbf:HideBlizzardBuffFrames() arkanes@8: local function HideBlizFrame(frame) arkanes@8: if not frame then return end arkanes@8: frame:UnregisterAllEvents() arkanes@8: frame:SetScript("OnUpdate", nil) arkanes@8: frame:Hide() arkanes@8: frame.Show = function() end arkanes@8: end arkanes@8: HideBlizFrame(BuffFrame) arkanes@8: HideBlizFrame(ConsolidatedBuffs) arkanes@18: HideBlizFrame(TemporaryEnchantFrame) arkanes@8: arkanes@8: end arkanes@8: arkanes@4: function kbf:OnUpdate() arkanes@20: if self.pollForUnitChange and not InCombatLockdown() then arkanes@20: if UnitHasVehicleUI("player") then arkanes@27: -- only swap if we're in a "real" vehicle with its own actions arkanes@27: -- There is possibly a timing issue here where arkanes@27: -- we have set the poll flag but the unit is not arkanes@27: -- actually "in" the vehicle yet. I'm hoping thats arkanes@27: -- handled by using exited/entered events instead of exiting/entering arkanes@38: self.secureHeader:SetAttribute("unit", "vehicle") arkanes@20: else arkanes@38: self.secureHeader:SetAttribute("unit", "player") arkanes@20: end arkanes@20: self.pollForUnitChange = nil arkanes@20: end arkanes@38: local unit = self.secureHeader:GetAttribute("unit") arkanes@10: local buffCount = 0 arkanes@4: for idx=1,99 do arkanes@38: local frame = self.secureHeader:GetAttribute("child"..idx) arkanes@10: if not (frame and frame:IsShown()) then break end arkanes@10: buffCount = buffCount + 1 arkanes@6: if self.dirty then arkanes@10: if self:BindBarToBuff(frame, unit) then break end arkanes@9: end arkanes@10: self:UpdateBarExpirationTime(frame) arkanes@12: -- Don't forget to refresh shown tooltips arkanes@12: if ( GameTooltip:IsOwned(frame) ) then arkanes@15: self:OnEnter(frame) arkanes@12: end arkanes@10: end arkanes@37: arkanes@37: -- consolidated buffs arkanes@37: if self.consolidateProxy:IsShown() then arkanes@38: --self.consolidateHeader:Show() -- *** STATE DRIVEN arkanes@37: for idx=1,99 do arkanes@37: local frame = self.consolidateHeader:GetAttribute("child"..idx) arkanes@37: if not (frame and frame:IsShown()) then break end arkanes@37: if self.dirty then arkanes@37: if self:BindBarToBuff(frame, unit) then break end arkanes@37: end arkanes@37: self:UpdateBarExpirationTime(frame) arkanes@37: -- Don't forget to refresh shown tooltips arkanes@37: if ( GameTooltip:IsOwned(frame) ) then arkanes@37: self:OnEnter(frame) arkanes@37: end arkanes@37: end arkanes@37: else arkanes@38: --self.consolidateHeader:Hide() -- *** STATE DRIVEN arkanes@37: end arkanes@37: arkanes@10: -- temporary enchants arkanes@38: local tempEnchant = self.secureHeader:GetAttribute("tempEnchant1") arkanes@17: if tempEnchant and tempEnchant:IsShown() then arkanes@17: if self.dirty or true then arkanes@17: self:BindBarToWeaponEnchant(tempEnchant, 16) arkanes@17: end arkanes@17: self:UpdateBarExpirationTime(tempEnchant) arkanes@19: buffCount = buffCount + 1 arkanes@17: end arkanes@38: tempEnchant = self.secureHeader:GetAttribute("tempEnchant2") arkanes@17: if tempEnchant and tempEnchant:IsShown() then arkanes@17: if self.dirty or true then arkanes@17: self:BindBarToWeaponEnchant(tempEnchant, 17) arkanes@17: end arkanes@17: self:UpdateBarExpirationTime(tempEnchant) arkanes@19: buffCount = buffCount + 1 arkanes@28: -- SAH binds the offhand enchant to the main hand for removal purposes. arkanes@28: -- fix it up if we're out of combat arkanes@28: -- TODO: maybe this should only happen if we're dirty arkanes@28: if not InCombatLockdown() then arkanes@28: tempEnchant:SetAttribute('target-slot', 17) arkanes@28: end arkanes@17: end arkanes@24: -- there's also a third temp enchant for thrown weapons, which the arkanes@24: -- current SAH doesn't support at all. arkanes@24: -- Since I can't insert bars into the flow, can't support this arkanes@24: -- until I either go to multiple secure headers & figure out how to position them arkanes@24: -- or blizz fixes SAH arkanes@10: arkanes@10: -- debuffs arkanes@11: -- Since debuffs aren't cancellable, don't need to use the secure header arkanes@11: -- for them. This could be rewritten to support useful features like arkanes@11: -- sorting & scaling and stuff. Honestly, should at least be alphabetical. arkanes@10: for idx=1,99 do arkanes@10: local frame = self.debuffFrames[idx] arkanes@10: if self.dirty then arkanes@10: local name, rank, icon, stacks, debuffType, duration, expirationTime = UnitAura(unit, idx, "HARMFUL") arkanes@10: if not name then arkanes@10: -- out of debuffs, hide all the rest of them arkanes@10: for jdx = idx, 99 do arkanes@10: local bar = self.debuffFrames[jdx] arkanes@10: if bar then bar:Hide() else break end arkanes@10: end arkanes@10: break arkanes@10: end arkanes@10: if not frame then arkanes@10: frame = self:ConstructBar(nil, 1, 0, 0) arkanes@10: self.debuffFrames[idx] = frame arkanes@10: end arkanes@10: self:SetBarAppearance(frame, name, icon, stacks, duration, expirationTime) arkanes@10: frame:ClearAllPoints() arkanes@10: -- position it under all the buffs, with a half-bar spacing arkanes@19: frame:SetPoint("TOP", self.anchor, "BOTTOM", 0, (buffCount * -16)) arkanes@10: frame:Show() arkanes@13: frame.filter = "HARMFUL" arkanes@13: frame.unit = unit arkanes@16: frame.index = idx arkanes@13: frame:SetScript("OnEnter", function() kbf:OnEnter(frame) end) arkanes@13: frame:SetScript("OnLeave", function() GameTooltip:Hide() end) arkanes@23: frame:EnableMouse(true) arkanes@10: buffCount = buffCount + 1 arkanes@10: else arkanes@10: -- not dirty, so no frame means we're done arkanes@10: if not frame then break end arkanes@6: end arkanes@10: self:UpdateBarExpirationTime(frame) arkanes@13: if ( GameTooltip:IsOwned(frame) ) then arkanes@15: self:OnEnter(frame) arkanes@13: end arkanes@4: end arkanes@6: self.dirty = nil arkanes@4: end arkanes@4: arkanes@0: function kbf:UNIT_AURA(event, unit) arkanes@38: if unit ~= self.secureHeader:GetAttribute("unit") then return end arkanes@6: self.dirty = true arkanes@0: end arkanes@0: arkanes@10: function kbf:UpdateBarExpirationTime(frame) arkanes@10: if frame.expirationTime then arkanes@10: local remaining = frame.expirationTime - GetTime() arkanes@10: remaining = math.max(0, remaining) arkanes@10: local perc = remaining / frame.duration arkanes@10: frame.timertext:SetText(self:FormatTimeText(remaining)) arkanes@10: frame.statusbar:SetValue(remaining) arkanes@10: end arkanes@10: end arkanes@10: arkanes@17: function kbf:BindBarToWeaponEnchant(parentFrame, slotOverride) arkanes@17: local index = parentFrame:GetAttribute("index") arkanes@17: -- allow passing of explicit slot in order to work around aura header bug arkanes@17: local slot = slotOverride or parentFrame:GetAttribute("target-slot") arkanes@17: local itemIndex = slot - 15 -- 1MH, 2OF arkanes@17: local RETURNS_PER_ITEM = 3 arkanes@17: local hasEnchant, remaining, enchantCharges = select(RETURNS_PER_ITEM * (itemIndex - 1) + 1, GetWeaponEnchantInfo()) arkanes@17: -- remaining time is in milliseconds arkanes@26: if not hasEnchant then return end -- this should never happen arkanes@17: local remaining = remaining / 1000 arkanes@17: local icon = GetInventoryItemTexture("player", slot) arkanes@17: -- this is terrible, but I hate myself and everyone else. arkanes@17: -- We're going to assume that the duration of the temp enchant arkanes@17: -- is either 60 minutes, or however long is left, because poisons are 1 hour arkanes@17: local duration = max((60 * 60), remaining) arkanes@17: local expirationTime = GetTime() + remaining arkanes@17: -- TODO arkanes@17: local name = GetItemInfo(GetInventoryItemID("player", slot)) arkanes@17: if not parentFrame.icon then arkanes@17: self:ConstructBar(parentFrame, 1, 0, 1) arkanes@17: end arkanes@17: self:SetBarAppearance(parentFrame, name, icon, enchantCharges, duration, expirationTime) arkanes@17: end arkanes@17: arkanes@3: function kbf:BindBarToBuff(parentFrame, unit) arkanes@3: local index = parentFrame:GetAttribute("index") arkanes@3: local filter = parentFrame:GetAttribute("filter") arkanes@10: local name, rank, icon, stacks, debuffType, duration, expirationTime, arkanes@3: unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, index, filter) arkanes@10: if not name then return end arkanes@2: if not parentFrame.icon then arkanes@2: self:ConstructBar(parentFrame) arkanes@0: end arkanes@10: self:SetBarAppearance(parentFrame, name, icon, stacks, duration, expirationTime) arkanes@10: end arkanes@10: arkanes@10: function kbf:SetBarAppearance(parentFrame, name, icon, stacks, duration, expirationTime) arkanes@2: parentFrame.icon:SetNormalTexture(icon) arkanes@0: if stacks and stacks > 0 then arkanes@2: parentFrame.text:SetText(string.format("%s(%d)", name, stacks)) arkanes@0: else arkanes@2: parentFrame.text:SetText(name) arkanes@0: end arkanes@4: parentFrame.timertext:SetText(self:FormatTimeText(duration)) arkanes@4: -- store duration information arkanes@6: if duration and duration > 0 then arkanes@4: parentFrame.expirationTime = expirationTime arkanes@4: parentFrame.duration = duration arkanes@4: parentFrame.statusbar:SetMinMaxValues(0, duration) arkanes@4: else arkanes@4: parentFrame.expirationTime = nil arkanes@4: parentFrame.duration = 0 arkanes@4: parentFrame.statusbar:SetMinMaxValues(0,1) arkanes@4: parentFrame.statusbar:SetValue(1) arkanes@4: end arkanes@4: end arkanes@4: arkanes@17: -- expects time seconds arkanes@4: function kbf:FormatTimeText(time) arkanes@4: if not time or time == 0 then return "" end arkanes@4: local timetext arkanes@4: local h = floor(time/3600) arkanes@4: local m = time - (h*3600) arkanes@4: m = floor(m/60) arkanes@4: local s = time - ((h*3600) + (m*60)) arkanes@4: if h > 0 then arkanes@4: timetext = ("%d:%02d"):format(h, m) arkanes@4: elseif m > 0 then arkanes@4: timetext = string.format("%d:%02d", m, floor(s)) arkanes@4: elseif s < 10 then arkanes@4: timetext = string.format("%1.1f", s) arkanes@4: else arkanes@4: timetext = string.format("%.0f", floor(s)) arkanes@4: end arkanes@4: return timetext arkanes@0: end arkanes@0: arkanes@12: function KBF:OnEnter(button, motion) arkanes@12: -- this is for the secure buttons, so use the attributes arkanes@26: local unit = SecureButton_GetModifiedUnit(button) or button.unit -- will perform vehicle toggle arkanes@21: local filter = button:GetAttribute("filter") or button.filter arkanes@15: local index = button:GetAttribute("index") or button.index arkanes@17: if unit and filter and index then arkanes@21: -- I'd like a better place to position this but it's funky for right now, handle it later arkanes@17: GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT"); arkanes@17: GameTooltip:SetFrameLevel(button:GetFrameLevel() + 2); arkanes@17: GameTooltip:SetUnitAura(unit, index, filter); arkanes@17: return arkanes@17: end arkanes@17: local slot = button:GetAttribute("target-slot") -- temp enchant arkanes@12: GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT"); arkanes@13: GameTooltip:SetFrameLevel(button:GetFrameLevel() + 2); arkanes@21: GameTooltip:SetInventoryItem(unit, slot) arkanes@12: end arkanes@12: arkanes@1: -- creates a icon + statusbar bar arkanes@10: function kbf:ConstructBar(frame, r, g, b) arkanes@0: local texture = "Interface\\TargetingFrame\\UI-StatusBar" arkanes@1: -- Because of secureframe suckiness, these height & width numbers arkanes@1: -- have to be consistent with the stuff in KBF.xml arkanes@0: local height = 16 arkanes@1: local width = 200 -- this is the width *without* the icon arkanes@22: local font, _, style = GameFontHighlight:GetFont() arkanes@10: local r = r or 0 arkanes@10: local g = g or 1 arkanes@10: local b = b or 0 arkanes@10: local bgcolor = {r, g, b, 0.5} arkanes@10: local color = {r, g, b, 1} arkanes@0: local fontsize = 11 arkanes@0: local timertextwidth = fontsize * 3.6 arkanes@0: local textcolor = {1, 1, 1, 1} arkanes@0: local timertextcolor = {1, 1, 1, 1} arkanes@10: if not frame then arkanes@10: frame = CreateFrame("Button", nil, UIParent) -- the "top level" frame that represents the bar as a whole arkanes@10: frame:SetHeight(16) arkanes@23: frame:SetWidth(200 + 16) arkanes@10: end arkanes@1: local bar = frame arkanes@0: bar.icon = CreateFrame("Button", nil, bar) -- the icon arkanes@0: bar.statusbarbg = CreateFrame("StatusBar", nil, bar) -- the bars background arkanes@0: bar.statusbar = CreateFrame("StatusBar", nil, bar) -- and the bars foreground arkanes@0: bar.text = bar.statusbar:CreateFontString(nil, "OVERLAY") -- the label text arkanes@0: bar.timertext = bar.statusbar:CreateFontString(nil, "OVERLAY") -- and the timer text arkanes@0: arkanes@0: -- the icon arkanes@0: bar.icon:ClearAllPoints() arkanes@0: bar.icon:SetPoint("LEFT", bar, "LEFT", 0, 0) arkanes@0: -- icons are square arkanes@0: bar.icon:SetWidth(height) arkanes@0: bar.icon:SetHeight(height) arkanes@2: --bar.icon:EnableMouse(false) arkanes@0: -- the status bar background & foreground arkanes@0: local function setupStatusBar(sb, color) arkanes@0: sb:ClearAllPoints() arkanes@0: sb:SetHeight(height) arkanes@0: sb:SetWidth(width) arkanes@0: -- offset the height of the frame on the x-axis for the icon. arkanes@0: sb:SetPoint("TOPLEFT", bar, "TOPLEFT", height, 0) arkanes@0: sb:SetStatusBarTexture(texture) arkanes@0: sb:GetStatusBarTexture():SetVertTile(false) arkanes@0: sb:GetStatusBarTexture():SetHorizTile(false) arkanes@0: sb:SetStatusBarColor(unpack(color)) arkanes@0: sb:SetMinMaxValues(0,1) arkanes@0: sb:SetValue(1) arkanes@0: end arkanes@0: setupStatusBar(bar.statusbarbg, bgcolor) arkanes@0: setupStatusBar(bar.statusbar, color) arkanes@0: bar.statusbarbg:SetFrameLevel(bar.statusbarbg:GetFrameLevel()-1) -- make sure the bg frame stays in the back arkanes@0: -- timer text arkanes@0: bar.timertext:SetFontObject(GameFontHighlight) arkanes@0: bar.timertext:SetFont(GameFontHighlight:GetFont()) arkanes@0: bar.timertext:SetHeight(height) arkanes@0: bar.timertext:SetWidth(timertextwidth) arkanes@24: bar.timertext:SetPoint("LEFT", bar.statusbar, "LEFT", 2, 0) arkanes@24: bar.timertext:SetJustifyH("LEFT") arkanes@0: bar.timertext:SetText("time") arkanes@0: bar.timertext:SetTextColor(timertextcolor[1], timertextcolor[2], timertextcolor[3], timertextcolor[4]) arkanes@0: arkanes@0: -- and the label text arkanes@0: bar.text:SetFontObject(GameFontHighlight) arkanes@0: bar.text:SetFont(GameFontHighlight:GetFont()) arkanes@0: bar.text:SetHeight(height) arkanes@24: bar.text:SetPoint("LEFT", bar.timertext, "RIGHT", 0, 0) arkanes@0: bar.text:SetPoint("RIGHT", bar.statusbar, "RIGHT", 0, 0) arkanes@0: bar.text:SetJustifyH("LEFT") arkanes@0: bar.text:SetText("text") arkanes@0: bar.text:SetTextColor(textcolor[1], textcolor[2], textcolor[3], textcolor[4]) arkanes@0: return bar arkanes@0: end arkanes@0: arkanes@38: function kbf:CreateCoreFrames() arkanes@38: -- this is the visible anchor frame that the user interacts with arkanes@38: -- to move the buffs around arkanes@0: local anchor = CreateFrame("FRAME", "KBFAnchorFrame", UIParent) arkanes@0: anchor:SetClampedToScreen(true) arkanes@0: anchor:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", arkanes@0: edgeFile = "Interface/Tooltips/UI-Tooltip-Border", arkanes@18: tile = true, tileSize = 16, edgeSize = 12, arkanes@0: insets = { left = 4, right = 4, top = 4, bottom = 4 }, arkanes@0: }) arkanes@0: local text = anchor:CreateFontString(nil, "OVERLAY") -- the label text arkanes@0: text:SetFontObject(GameFontHighlight) arkanes@0: text:SetFont(GameFontHighlight:GetFont()) arkanes@0: text:SetPoint("TOPLEFT", anchor, "TOPLEFT", 0, 0) arkanes@0: text:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 0, 0) arkanes@0: text:SetText("KBF ANCHOR") arkanes@18: anchor:SetWidth(200 +16) arkanes@18: anchor:SetHeight(16) arkanes@0: -- movability arkanes@0: anchor:EnableMouse(true) arkanes@0: anchor:SetMovable(true) arkanes@0: anchor:RegisterForDrag("LeftButton") arkanes@0: anchor:SetScript("OnDragStart", anchor.StartMoving) arkanes@0: anchor:SetScript("OnDragStop", anchor.StopMovingOrSizing) arkanes@0: anchor:ClearAllPoints() arkanes@22: anchor:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0) arkanes@0: anchor:Hide() arkanes@38: -- this is the parent & host for the secure aura buttons. arkanes@0: arkanes@38: local secureHeader = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") arkanes@38: self:SetCommonSecureHeaderAttributes(secureHeader) arkanes@38: secureHeader:SetAttribute("consolidateTo", 1) arkanes@38: secureHeader:SetPoint("TOP", anchor, "TOP", 0, 0) arkanes@38: arkanes@38: -- this is the "button" in the aura flow that represents the consolidated buffs. arkanes@38: -- pre-creating it here in order to perform customization arkanes@38: local consolidateProxy = self:ConstructBar() arkanes@38: secureHeader:SetAttribute("consolidateProxy", consolidateProxy) arkanes@38: secureHeader:SetAttribute("frameref-proxy", GetFrameHandle(consolidateProxy)) arkanes@38: -- this is the equivilent of the secureHeader for the consolidated buffs arkanes@38: -- pre-creating again, so we can customize/size/position it arkanes@38: local consolidateHeader = CreateFrame("FRAME", "KBFConsolidatedAnchorFrame", consolidateProxy) arkanes@38: self:SetCommonSecureHeaderAttributes(consolidateHeader) arkanes@38: secureHeader:SetAttribute("consolidateHeader", consolidateHeader) arkanes@38: -- position it relative to the proxy, so it can appear where we want it arkanes@38: consolidateHeader:SetPoint("TOPRIGHT", consolidateProxy, "TOPLEFT", 0, 0) arkanes@38: consolidateHeader:SetWidth(200 +16) arkanes@38: consolidateHeader:SetHeight(16) arkanes@38: consolidateHeader:Show() arkanes@38: consolidateProxy:SetAttribute("header", consolidateHeader); arkanes@38: consolidateProxy:SetAttribute("frameref-header", GetFrameHandle(consolidateHeader)) arkanes@38: return anchor, secureHeader, consolidateHeader, consolidateProxy arkanes@37: end arkanes@37: arkanes@38: --- sets the attributes needed by all the headers arkanes@38: function kbf:SetCommonSecureHeaderAttributes(frame) arkanes@0: frame:SetAttribute("filter", "HELPFUL") arkanes@20: frame:SetAttribute("toggleForVehicle", true) -- this doesn't actually work right now, but maybe it eventually will arkanes@0: frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") arkanes@3: frame:SetAttribute("point", "TOP") arkanes@0: frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header arkanes@2: frame:SetAttribute("xOffset", 0) arkanes@3: frame:SetAttribute("yOffset", -16) arkanes@3: frame:SetAttribute("minWidth", 216) arkanes@3: frame:SetAttribute("minHeight", 16) arkanes@25: frame:SetAttribute("unit", "player") arkanes@3: frame:SetAttribute("sortMethod", "NAME") arkanes@3: frame:SetAttribute("sortOrder", "-") arkanes@10: -- TODO: SecureAuraHeader doesn't correcltly implement the temp enchants arkanes@17: frame:SetAttribute("weaponTemplate", "KBFSecureUnitAuraTemplate") arkanes@17: frame:SetAttribute("includeWeapons", 1) arkanes@5: frame:Show() -- has to be shown, otherwise the child frames don't show arkanes@37: return frame arkanes@0: end arkanes@18: arkanes@18: function kbf:ShowAnchor() arkanes@38: self.secureHeader:ClearAllPoints() arkanes@38: self.secureHeader:SetPoint("TOP", self.anchor, "BOTTOM", 0, 0) arkanes@18: self.anchor:Show() arkanes@18: end arkanes@18: arkanes@18: function kbf:HideAnchor() arkanes@38: self.secureHeader:ClearAllPoints() arkanes@38: self.secureHeader:SetPoint("TOP", self.anchor, "TOP", 0, 0) arkanes@18: self.anchor:Hide() arkanes@18: end arkanes@18: arkanes@18: function kbf:ToggleAnchor() arkanes@18: if self.anchor:IsShown() then arkanes@18: self:HideAnchor() arkanes@18: else arkanes@18: self:ShowAnchor() arkanes@18: end arkanes@18: end