comparison KBF.lua @ 22:940628cd5bfc

use entering/exiting events for vehicles instead of entered/exited (drycode). Fix a typo causing a global to be used
author Chris Mellon <arkanes@gmai.com>
date Tue, 19 Oct 2010 14:05:46 -0500
parents c2ff66c87521
children b284fd451972
comparison
equal deleted inserted replaced
21:c2ff66c87521 22:940628cd5bfc
7 7
8 function kbf:OnInitialize() 8 function kbf:OnInitialize()
9 self.debuffFrames = {} 9 self.debuffFrames = {}
10 self.anchor = self:CreateAnchorFrame() 10 self.anchor = self:CreateAnchorFrame()
11 self:RegisterEvent("UNIT_AURA") 11 self:RegisterEvent("UNIT_AURA")
12 self:RegisterEvent("UNIT_ENTERED_VEHICLE") 12 self:RegisterEvent("UNIT_ENTERING_VEHICLE")
13 self:RegisterEvent("UNIT_EXITED_VEHICLE") 13 self:RegisterEvent("UNIT_EXITING_VEHICLE")
14 -- set up the countdown timer 14 -- set up the countdown timer
15 -- TODO: Fancy enable/disable based on whether you have any timed buffs. 15 -- TODO: Fancy enable/disable based on whether you have any timed buffs.
16 -- Not a big deal, how often do you care about that 16 -- Not a big deal, how often do you care about that
17 -- also TODO: Maybe should bucket OnUpdates somehow 17 -- also TODO: Maybe should bucket OnUpdates somehow
18 -- AceTimer repeating events can only happen at 0.1 seconds, which is probably 18 -- AceTimer repeating events can only happen at 0.1 seconds, which is probably
29 29
30 -- a "bar" is a frame that has the icon, status bar, ect associated with it 30 -- a "bar" is a frame that has the icon, status bar, ect associated with it
31 31
32 -- Secure aura header doesn't self-bind to vehicle, 32 -- Secure aura header doesn't self-bind to vehicle,
33 -- so this probably only works out of combat. But thats better than nothing... 33 -- so this probably only works out of combat. But thats better than nothing...
34 function kbf:UNIT_ENTERED_VEHICLE(event, unit) 34 function kbf:UNIT_ENTERING_VEHICLE(event, unit)
35 if unit ~= "player" then return end 35 if unit ~= "player" then return end
36 self.dirty = true 36 self.dirty = true
37 -- hax until SAH supports vehicles - do the swap after we come out of combat 37 -- hax until SAH supports vehicles - do the swap after we come out of combat
38 if not InCombatLockdown() then 38 if not InCombatLockdown() then
39 self.secureFrame:SetAttribute("unit", "vehicle") 39 self.secureFrame:SetAttribute("unit", "vehicle")
40 else 40 else
41 self.pollForUnitChange = true 41 self.pollForUnitChange = true
42 end 42 end
43 end 43 end
44 44
45 function kbf:UNIT_EXITED_VEHICLE(event, unit) 45 function kbf:UNIT_EXITING_VEHICLE(event, unit)
46 if unit ~= "player" then return end 46 if unit ~= "player" then return end
47 self.dirty = true 47 self.dirty = true
48 -- hax until SAH supports vehicles - do the swap after we come out of combat 48 -- hax until SAH supports vehicles - do the swap after we come out of combat
49 if not InCombatLockdown() then 49 if not InCombatLockdown() then
50 self.secureFrame:SetAttribute("unit", "player") 50 self.secureFrame:SetAttribute("unit", "player")
271 local texture = "Interface\\TargetingFrame\\UI-StatusBar" 271 local texture = "Interface\\TargetingFrame\\UI-StatusBar"
272 -- Because of secureframe suckiness, these height & width numbers 272 -- Because of secureframe suckiness, these height & width numbers
273 -- have to be consistent with the stuff in KBF.xml 273 -- have to be consistent with the stuff in KBF.xml
274 local height = 16 274 local height = 16
275 local width = 200 -- this is the width *without* the icon 275 local width = 200 -- this is the width *without* the icon
276 local font, _ style = GameFontHighlight:GetFont() 276 local font, _, style = GameFontHighlight:GetFont()
277 local r = r or 0 277 local r = r or 0
278 local g = g or 1 278 local g = g or 1
279 local b = b or 0 279 local b = b or 0
280 local bgcolor = {r, g, b, 0.5} 280 local bgcolor = {r, g, b, 0.5}
281 local color = {r, g, b, 1} 281 local color = {r, g, b, 1}
365 anchor:SetMovable(true) 365 anchor:SetMovable(true)
366 anchor:RegisterForDrag("LeftButton") 366 anchor:RegisterForDrag("LeftButton")
367 anchor:SetScript("OnDragStart", anchor.StartMoving) 367 anchor:SetScript("OnDragStart", anchor.StartMoving)
368 anchor:SetScript("OnDragStop", anchor.StopMovingOrSizing) 368 anchor:SetScript("OnDragStop", anchor.StopMovingOrSizing)
369 anchor:ClearAllPoints() 369 anchor:ClearAllPoints()
370 anchor:SetPoint("CENTER", UIParent, "CENTER", 0, 0) 370 anchor:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0)
371 anchor:Hide() 371 anchor:Hide()
372 372
373 local frame = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") 373 local frame = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate")
374 --local frame = anchor 374 --local frame = anchor
375 frame:SetAttribute("filter", "HELPFUL") 375 frame:SetAttribute("filter", "HELPFUL")