Mercurial > wow > kbf
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 19:a6f5a0f2d429 | 20:54e30adde56b |
|---|---|
| 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") | |
| 13 self:RegisterEvent("UNIT_EXITED_VEHICLE") | |
| 12 -- set up the countdown timer | 14 -- set up the countdown timer |
| 13 -- 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. |
| 14 -- Not a big deal, how often do you care about that | 16 -- Not a big deal, how often do you care about that |
| 15 -- also TODO: Maybe should bucket OnUpdates somehow | 17 -- also TODO: Maybe should bucket OnUpdates somehow |
| 16 -- 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 |
| 25 -- a "frame" is the top-level button (secure button from the header, or one I make myself) | 27 -- a "frame" is the top-level button (secure button from the header, or one I make myself) |
| 26 -- that will contain the UI information about the buff | 28 -- that will contain the UI information about the buff |
| 27 | 29 |
| 28 -- 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 |
| 29 | 31 |
| 32 -- Secure aura header doesn't self-bind to vehicle, | |
| 33 -- so this probably only works out of combat. But thats better than nothing... | |
| 34 function kbf:UNIT_ENTERED_VEHICLE(event, unit) | |
| 35 if unit ~= "player" then return end | |
| 36 self.dirty = true | |
| 37 -- hax until SAH supports vehicles - do the swap after we come out of combat | |
| 38 if not InCombatLockdown() then | |
| 39 self.secureFrame:SetAttribute("unit", "vehicle") | |
| 40 else | |
| 41 self.pollForUnitChange = true | |
| 42 end | |
| 43 end | |
| 44 | |
| 45 function kbf:UNIT_EXITED_VEHICLE(event, unit) | |
| 46 if unit ~= "player" then return end | |
| 47 self.dirty = true | |
| 48 -- hax until SAH supports vehicles - do the swap after we come out of combat | |
| 49 if not InCombatLockdown() then | |
| 50 self.secureFrame:SetAttribute("unit", "player") | |
| 51 else | |
| 52 self.pollForUnitChange = true | |
| 53 end | |
| 54 end | |
| 55 | |
| 30 function kbf:HideBlizzardBuffFrames() | 56 function kbf:HideBlizzardBuffFrames() |
| 31 local function HideBlizFrame(frame) | 57 local function HideBlizFrame(frame) |
| 32 if not frame then return end | 58 if not frame then return end |
| 33 frame:UnregisterAllEvents() | 59 frame:UnregisterAllEvents() |
| 34 frame:SetScript("OnUpdate", nil) | 60 frame:SetScript("OnUpdate", nil) |
| 40 HideBlizFrame(TemporaryEnchantFrame) | 66 HideBlizFrame(TemporaryEnchantFrame) |
| 41 | 67 |
| 42 end | 68 end |
| 43 | 69 |
| 44 function kbf:OnUpdate() | 70 function kbf:OnUpdate() |
| 71 if self.pollForUnitChange and not InCombatLockdown() then | |
| 72 if UnitHasVehicleUI("player") then | |
| 73 self.secureFrame:SetAttribute("unit", "vehicle") | |
| 74 else | |
| 75 self.secureFrame:SetAttribute("unit", "player") | |
| 76 end | |
| 77 self.pollForUnitChange = nil | |
| 78 end | |
| 45 local unit = self.secureFrame:GetAttribute("unit") | 79 local unit = self.secureFrame:GetAttribute("unit") |
| 46 local buffCount = 0 | 80 local buffCount = 0 |
| 47 for idx=1,99 do | 81 for idx=1,99 do |
| 48 local frame = self.secureFrame:GetAttribute("child"..idx) | 82 local frame = self.secureFrame:GetAttribute("child"..idx) |
| 49 if not (frame and frame:IsShown()) then break end | 83 if not (frame and frame:IsShown()) then break end |
| 337 anchor:Hide() | 371 anchor:Hide() |
| 338 | 372 |
| 339 local frame = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") | 373 local frame = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") |
| 340 --local frame = anchor | 374 --local frame = anchor |
| 341 frame:SetAttribute("filter", "HELPFUL") | 375 frame:SetAttribute("filter", "HELPFUL") |
| 376 frame:SetAttribute("toggleForVehicle", true) -- this doesn't actually work right now, but maybe it eventually will | |
| 342 frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") | 377 frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") |
| 343 frame:SetAttribute("point", "TOP") | 378 frame:SetAttribute("point", "TOP") |
| 344 frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header | 379 frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header |
| 345 frame:SetAttribute("consolidateTo", nil) | 380 frame:SetAttribute("consolidateTo", nil) |
| 346 frame:SetAttribute("xOffset", 0) | 381 frame:SetAttribute("xOffset", 0) |
