comparison KBF.lua @ 3:bb1143608eb4

Correctly pull the index from the secure attribute in order to bind the right buff to the right frame
author Chris Mellon <arkanes@gmai.com>
date Tue, 12 Oct 2010 17:16:28 -0500
parents cf6e612a1c7e
children 75634f25a762
comparison
equal deleted inserted replaced
2:cf6e612a1c7e 3:bb1143608eb4
22 function kbf:UNIT_AURA(event, unit) 22 function kbf:UNIT_AURA(event, unit)
23 if unit ~= self.secureFrame:GetAttribute("unit") then return end 23 if unit ~= self.secureFrame:GetAttribute("unit") then return end
24 for idx=1,99 do 24 for idx=1,99 do
25 local frame = self.secureFrame:GetAttribute("child"..idx) 25 local frame = self.secureFrame:GetAttribute("child"..idx)
26 if not frame then break end 26 if not frame then break end
27 self:BindBarToBuff(idx, frame, unit, "HELPFUL") 27 self:BindBarToBuff(frame, unit)
28 end 28 end
29 end 29 end
30 30
31 function kbf:BindBarToBuff(idx, parentFrame, unit, filter) 31 function kbf:BindBarToBuff(parentFrame, unit)
32 local index = parentFrame:GetAttribute("index")
33 local filter = parentFrame:GetAttribute("filter")
32 local name, rank, icon, count, debuffType, duration, expirationTime, 34 local name, rank, icon, count, debuffType, duration, expirationTime,
33 unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, idx, "HELPFUL") 35 unitCaster, isStealable, shouldConsolidate, spellId = UnitAura(unit, index, filter)
34 -- This shouldn't be neccesary as the bar is parented to the frame, which is 36 -- This shouldn't be neccesary as the bar is parented to the frame, which is
35 -- hidden by the group handler 37 -- hidden by the group handler
36 if not parentFrame.icon then 38 if not parentFrame.icon then
37 self:ConstructBar(parentFrame) 39 self:ConstructBar(parentFrame)
38 end 40 end
143 145
144 local frame = CreateFrame("FRAME", "KBFBuffFrame", anchor, "SecureAuraHeaderTemplate") 146 local frame = CreateFrame("FRAME", "KBFBuffFrame", anchor, "SecureAuraHeaderTemplate")
145 --local frame = anchor 147 --local frame = anchor
146 frame:SetAttribute("filter", "HELPFUL") 148 frame:SetAttribute("filter", "HELPFUL")
147 frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") 149 frame:SetAttribute("template", "KBFSecureUnitAuraTemplate")
148 frame:SetAttribute("point", "CENTER") 150 frame:SetAttribute("point", "TOP")
149 frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header 151 frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header
150 frame:SetAttribute("consolidateTo", nil) 152 frame:SetAttribute("consolidateTo", nil)
151 --frame:SetAttribute("wrapXOffset", 0) 153 --frame:SetAttribute("wrapXOffset", 0)
152 --frame:SetAttribute("wrapYOffset", -34) 154 --frame:SetAttribute("wrapYOffset", -34)
153 frame:SetAttribute("xOffset", 0) 155 frame:SetAttribute("xOffset", 0)
154 frame:SetAttribute("yOffset", 16) 156 frame:SetAttribute("yOffset", -16)
155 frame:SetAttribute("minWidth", 32) 157 frame:SetAttribute("minWidth", 216)
156 frame:SetAttribute("minHeight", 32) 158 frame:SetAttribute("minHeight", 16)
157 frame:SetAttribute("unit", "player") -- TODO: figure out the vehicle swapping stuff 159 frame:SetAttribute("unit", "player") -- TODO: figure out the vehicle swapping stuff
158 frame:SetPoint("BOTTOM", anchor, "TOP", 0, 0) 160 frame:SetAttribute("sortMethod", "NAME")
161 frame:SetAttribute("sortOrder", "-")
162 frame:SetPoint("TOP", anchor, "BOTTOM", 0, 0)
159 frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", 163 frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
160 edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 164 edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
161 tile = true, tileSize = 16, edgeSize = 16, 165 tile = true, tileSize = 16, edgeSize = 16,
162 insets = { left = 4, right = 4, top = 4, bottom = 4 }, 166 insets = { left = 4, right = 4, top = 4, bottom = 4 },
163 }) 167 })