comparison KBF.lua @ 51:7d961c698b71

fixes for vehicle swapping, and add earthliving to known enchants
author Chris Mellon <arkanes@gmail.com>
date Sun, 05 Jun 2011 13:32:47 -0500
parents 95dfc062e583
children c4324144d380
comparison
equal deleted inserted replaced
50:12cd14fb43d0 51:7d961c698b71
44 -- Secure aura header doesn't self-bind to vehicle, 44 -- Secure aura header doesn't self-bind to vehicle,
45 -- so this only works out of combat. But thats better than nothing... 45 -- so this only works out of combat. But thats better than nothing...
46 function kbf:PollForVehicleChange(event, unit) 46 function kbf:PollForVehicleChange(event, unit)
47 if unit ~= "player" then return end 47 if unit ~= "player" then return end
48 self.dirty = true 48 self.dirty = true
49 -- hax until SAH supports vehicles - do the swap after we come out of combat 49 local function performSwap()
50 -- always poll instead of insta-swapping OOC in order to simplify the UnitHasVehicleUI logic 50 if UnitHasVehicleUI("player") then
51 self.pollForUnitChange = true 51 -- only swap if we're in a "real" vehicle with its own actions
52 -- There is possibly a timing issue here where
53 -- we have set the poll flag but the unit is not
54 -- actually "in" the vehicle yet. I'm hoping thats
55 -- handled by using exited/entered events instead of exiting/entering
56 self.secureHeader:SetAttribute("unit", "vehicle")
57 else
58 self.secureHeader:SetAttribute("unit", "player")
59 end
60 end
61 self:QueueForOOC(performSwap)
52 end 62 end
53 63
54 function kbf:HideBlizzardBuffFrames() 64 function kbf:HideBlizzardBuffFrames()
55 local function HideBlizFrame(frame) 65 local function HideBlizFrame(frame)
56 if not frame then return end 66 if not frame then return end
75 else 85 else
76 func() 86 func()
77 end 87 end
78 end 88 end
79 89
80 function kbf:OnUpdate() 90 function kbf:OnUpdate()
81 if self.pollForUnitChange and not InCombatLockdown() then
82 if UnitHasVehicleUI("player") then
83 -- only swap if we're in a "real" vehicle with its own actions
84 -- There is possibly a timing issue here where
85 -- we have set the poll flag but the unit is not
86 -- actually "in" the vehicle yet. I'm hoping thats
87 -- handled by using exited/entered events instead of exiting/entering
88 self.secureHeader:SetAttribute("unit", "vehicle")
89 else
90 self.secureHeader:SetAttribute("unit", "player")
91 end
92 self.pollForUnitChange = nil
93 end
94
95 -- TODO: only start this polling when we leave combat? 91 -- TODO: only start this polling when we leave combat?
96 while #self.oocQueue > 0 and not InCombatLockdown() do 92 while #self.oocQueue > 0 and not InCombatLockdown() do
97 func = table.remove(self.oocQueue) 93 local func = table.remove(self.oocQueue)
98 func() 94 func()
99 end 95 end
100 96
101 local unit = self.secureHeader:GetAttribute("unit") 97 local unit = self.secureHeader:GetAttribute("unit")
102 local buffCount = 0 98 local buffCount = 0
170 self.tempEnchant3:EnableMouse(true) 166 self.tempEnchant3:EnableMouse(true)
171 --TODO: queue up for setting when leaving combat 167 --TODO: queue up for setting when leaving combat
172 self:QueueForOOC(function() self.tempEnchant3:SetAttribute('target-slot', 18) end) 168 self:QueueForOOC(function() self.tempEnchant3:SetAttribute('target-slot', 18) end)
173 -- set up the tooltip 169 -- set up the tooltip
174 end 170 end
175 -- TODO: If we're out of combat and theres an OH enchant,
176 -- create a secure action button & position it relative
177 -- to that. What happens when the OH weapon enchant frame
178 -- is hidden by SAH?
179 -- most likely: it stays visible but stops moving. 171 -- most likely: it stays visible but stops moving.
180 -- in this case, maybe parent it to the OH enchant also 172 -- in this case, maybe parent it to the OH enchant also
181 -- so it vanishes and gets out of the way. 173 -- so it vanishes and gets out of the way.
182 174
183 self.tempEnchant3:Show() 175 self.tempEnchant3:Show()
282 -- try to figure out what the weapon enchant is 274 -- try to figure out what the weapon enchant is
283 -- tooltip string -> {spellid, duration} 275 -- tooltip string -> {spellid, duration}
284 local knownEnchants = { 276 local knownEnchants = {
285 ["Flametongue"] = {8024, 30*60}, 277 ["Flametongue"] = {8024, 30*60},
286 ["Frostbrand"] = {8033, 30*60}, 278 ["Frostbrand"] = {8033, 30*60},
279 ["Earthliving"] = {51730, 30*60},
287 ["Instant Poison"] = {8680, 60*60}, 280 ["Instant Poison"] = {8680, 60*60},
288 ["Wound Poison"] = {13218, 60*60}, 281 ["Wound Poison"] = {13218, 60*60},
289 ["Deadly Poison"] = {2823, 60*60}, 282 ["Deadly Poison"] = {2823, 60*60},
290 283
291 } 284 }