comparison KBF.lua @ 13:be6c10697c59

tooltips on my debuffs too
author Chris Mellon <arkanes@gmai.com>
date Wed, 13 Oct 2010 11:29:56 -0500
parents 5f07c89cb6af
children 1cee96433b0f
comparison
equal deleted inserted replaced
12:5f07c89cb6af 13:be6c10697c59
80 self:SetBarAppearance(frame, name, icon, stacks, duration, expirationTime) 80 self:SetBarAppearance(frame, name, icon, stacks, duration, expirationTime)
81 frame:ClearAllPoints() 81 frame:ClearAllPoints()
82 -- position it under all the buffs, with a half-bar spacing 82 -- position it under all the buffs, with a half-bar spacing
83 frame:SetPoint("TOP", self.anchor, "BOTTOM", 0, (buffCount * -16) - 8) 83 frame:SetPoint("TOP", self.anchor, "BOTTOM", 0, (buffCount * -16) - 8)
84 frame:Show() 84 frame:Show()
85 frame:SetID(idx)
86 frame.filter = "HARMFUL"
87 frame.unit = unit
88 frame:SetScript("OnEnter", function() kbf:OnEnter(frame) end)
89 frame:SetScript("OnLeave", function() GameTooltip:Hide() end)
85 buffCount = buffCount + 1 90 buffCount = buffCount + 1
86 else 91 else
87 -- not dirty, so no frame means we're done 92 -- not dirty, so no frame means we're done
88 if not frame then break end 93 if not frame then break end
89 end 94 end
90 self:UpdateBarExpirationTime(frame) 95 self:UpdateBarExpirationTime(frame)
96 if ( GameTooltip:IsOwned(frame) ) then
97 GameTooltip:SetUnitAura(unit, idx, "HARMFUL");
98 end
91 end 99 end
92 self.dirty = nil 100 self.dirty = nil
93 end 101 end
94 102
95 function kbf:UNIT_AURA(event, unit) 103 function kbf:UNIT_AURA(event, unit)
160 end 168 end
161 169
162 function KBF:OnEnter(button, motion) 170 function KBF:OnEnter(button, motion)
163 -- this is for the secure buttons, so use the attributes 171 -- this is for the secure buttons, so use the attributes
164 -- I'd like a better place to position this but it's funky for right now, handle it later 172 -- I'd like a better place to position this but it's funky for right now, handle it later
173 local unit = button.unit or button:GetAttribute("unit")
174 local filter = button.filter or button:GetAttribute("filter")
165 GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT"); 175 GameTooltip:SetOwner(button, "ANCHOR_BOTTOMLEFT");
166 GameTooltip:SetFrameLevel(button:GetFrameLevel() + 2); 176 GameTooltip:SetFrameLevel(button:GetFrameLevel() + 2);
167 GameTooltip:SetUnitAura(button:GetAttribute("unit"), button:GetID(), button:GetAttribute("filter")); 177 GameTooltip:SetUnitAura(unit, button:GetID(), filter);
168
169 end 178 end
170 179
171 -- creates a icon + statusbar bar 180 -- creates a icon + statusbar bar
172 function kbf:ConstructBar(frame, r, g, b) 181 function kbf:ConstructBar(frame, r, g, b)
173 local texture = "Interface\\TargetingFrame\\UI-StatusBar" 182 local texture = "Interface\\TargetingFrame\\UI-StatusBar"