# HG changeset patch # User Chris Mellon # Date 1286920367 18000 # Node ID cf6e612a1c7e6b48ce9684f8730294a9086bb6db # Parent 3d4128c790745d9d447506029a7c649b1fc2b208 finish mergeing the bars with the secure buttons. Almost done! Just minor housekeeping to take care of at this point diff -r 3d4128c79074 -r cf6e612a1c7e KBF.lua --- a/KBF.lua Tue Oct 12 16:36:58 2010 -0500 +++ b/KBF.lua Tue Oct 12 16:52:47 2010 -0500 @@ -11,61 +11,39 @@ barHeight = 16 + 8 } self.anchor = self:CreateAnchorFrame() - self.buffFrames = {} + self.buffBars = {} self.anchor:Show() self:RegisterEvent("UNIT_AURA") - self.unit = "player" -- TODO: Vehicle support end -- naming convention -- "frame" is the secure aura button created by the group handler -- "bar" is the set of icon + status bars that we create to show the buff time function kbf:UNIT_AURA(event, unit) - if unit ~= self.unit then return end - for idx=1,9 do + if unit ~= self.secureFrame:GetAttribute("unit") then return end + for idx=1,99 do local frame = self.secureFrame:GetAttribute("child"..idx) if not frame then break end - local name, rank, icon, count, debuffType, duration, expirationTime, - unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(self.unit, idx, "HELPFUL") - frame:SetNormalTexture(icon) - self:BindFrameToBuff + self:BindBarToBuff(idx, frame, unit, "HELPFUL") end end -function kbf:BindBarToBuff(idx, parentFrame) +function kbf:BindBarToBuff(idx, parentFrame, unit, filter) local name, rank, icon, count, debuffType, duration, expirationTime, - unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(self.unit, idx, "HELPFUL") - if not name then - if self.buffFrames[idx] then - self.buffFrames[idx]:Hide() - end - return nil + unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, idx, "HELPFUL") +-- This shouldn't be neccesary as the bar is parented to the frame, which is +-- hidden by the group handler + if not parentFrame.icon then + self:ConstructBar(parentFrame) end - local frame = self.buffFrames[idx] or self:ConstructBuffFrame(idx) - frame.icon:SetNormalTexture(icon) + parentFrame.icon:SetNormalTexture(icon) if stacks and stacks > 0 then - frame.text:SetText(string.format("%s(%d)", name, stacks)) + parentFrame.text:SetText(string.format("%s(%d)", name, stacks)) else - frame.text:SetText(name) + parentFrame.text:SetText(name) end - frame:Show() - return frame end -function kbf:ConstructBuffFrame(idx) - local frame = self:ConstructFrame() - frame:RegisterForClicks("RightButtonUp") - frame:SetAttribute("type*", "cancelaura" ) - frame:SetAttribute("unit", "player") - frame:SetAttribute("index", idx) - -- position - local parent = self.buffFrames[idx-1] or self.anchor - frame:SetPoint("TOP", parent, "BOTTOM", 0, 0) - self.buffFrames[idx] = frame - return frame -end - - -- creates a icon + statusbar bar function kbf:ConstructBar(frame) local texture = "Interface\\TargetingFrame\\UI-StatusBar" @@ -94,7 +72,7 @@ -- icons are square bar.icon:SetWidth(height) bar.icon:SetHeight(height) - bar.icon:EnableMouse(false) + --bar.icon:EnableMouse(false) -- the status bar background & foreground local function setupStatusBar(sb, color) sb:ClearAllPoints() @@ -172,11 +150,11 @@ frame:SetAttribute("consolidateTo", nil) --frame:SetAttribute("wrapXOffset", 0) --frame:SetAttribute("wrapYOffset", -34) - frame:SetAttribute("xOffset", 32) - frame:SetAttribute("yOffset", 0) + frame:SetAttribute("xOffset", 0) + frame:SetAttribute("yOffset", 16) frame:SetAttribute("minWidth", 32) frame:SetAttribute("minHeight", 32) - frame:SetAttribute("unit", "player") + frame:SetAttribute("unit", "player") -- TODO: figure out the vehicle swapping stuff frame:SetPoint("BOTTOM", anchor, "TOP", 0, 0) frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border",