Mercurial > wow > kbf
diff KBF.lua @ 20:54e30adde56b
as good of vehicle support as we can get right now
author | Chris Mellon <arkanes@gmai.com> |
---|---|
date | Sun, 17 Oct 2010 08:45:13 -0500 |
parents | a6f5a0f2d429 |
children | c2ff66c87521 |
line wrap: on
line diff
--- a/KBF.lua Sat Oct 16 00:56:40 2010 -0500 +++ b/KBF.lua Sun Oct 17 08:45:13 2010 -0500 @@ -9,6 +9,8 @@ self.debuffFrames = {} self.anchor = self:CreateAnchorFrame() self:RegisterEvent("UNIT_AURA") + self:RegisterEvent("UNIT_ENTERED_VEHICLE") + self:RegisterEvent("UNIT_EXITED_VEHICLE") -- set up the countdown timer -- TODO: Fancy enable/disable based on whether you have any timed buffs. -- Not a big deal, how often do you care about that @@ -27,6 +29,30 @@ -- a "bar" is a frame that has the icon, status bar, ect associated with it +-- Secure aura header doesn't self-bind to vehicle, +-- so this probably only works out of combat. But thats better than nothing... +function kbf:UNIT_ENTERED_VEHICLE(event, unit) + if unit ~= "player" then return end + self.dirty = true + -- hax until SAH supports vehicles - do the swap after we come out of combat + if not InCombatLockdown() then + self.secureFrame:SetAttribute("unit", "vehicle") + else + self.pollForUnitChange = true + end +end + +function kbf:UNIT_EXITED_VEHICLE(event, unit) + if unit ~= "player" then return end + self.dirty = true + -- hax until SAH supports vehicles - do the swap after we come out of combat + if not InCombatLockdown() then + self.secureFrame:SetAttribute("unit", "player") + else + self.pollForUnitChange = true + end +end + function kbf:HideBlizzardBuffFrames() local function HideBlizFrame(frame) if not frame then return end @@ -42,6 +68,14 @@ end function kbf:OnUpdate() + if self.pollForUnitChange and not InCombatLockdown() then + if UnitHasVehicleUI("player") then + self.secureFrame:SetAttribute("unit", "vehicle") + else + self.secureFrame:SetAttribute("unit", "player") + end + self.pollForUnitChange = nil + end local unit = self.secureFrame:GetAttribute("unit") local buffCount = 0 for idx=1,99 do @@ -339,6 +373,7 @@ local frame = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") --local frame = anchor frame:SetAttribute("filter", "HELPFUL") + frame:SetAttribute("toggleForVehicle", true) -- this doesn't actually work right now, but maybe it eventually will frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") frame:SetAttribute("point", "TOP") frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header