# HG changeset patch # User contrebasse # Date 1292013747 -3600 # Node ID dd1ef3996d7f79ed7d1118642673447a30a6aa1f # Parent 06da6c8049fc50a99ea7126b2db4ca3bad97826c# Parent ddcb7021838b48f9d3fc519f4d15db8aa87100b4 Small change in UNIT_AURA diff -r ddcb7021838b -r dd1ef3996d7f .hgtags --- a/.hgtags Fri Dec 10 20:07:03 2010 +0100 +++ b/.hgtags Fri Dec 10 21:42:27 2010 +0100 @@ -1,2 +1,3 @@ 52e5a43002a87f0695607993bd03636617fe5e12 v1.0beta c627cef1c6d6f6c8af6065ad27abe60f1408fec3 v1.0beta2 +3b1123f50be4dab82386ed92d3a0dd6b3c18b7b6 v1.0beta3 diff -r ddcb7021838b -r dd1ef3996d7f Degaine.lua --- a/Degaine.lua Fri Dec 10 20:07:03 2010 +0100 +++ b/Degaine.lua Fri Dec 10 21:42:27 2010 +0100 @@ -31,6 +31,7 @@ local InCombatLockdown = InCombatLockdown local ToggleSheath = ToggleSheath local UnitName = UnitName +local IsMounted = IsMounted --------------------------------------------------------------- @@ -39,13 +40,14 @@ -- const local DegaineFrame = CreateFrame("Frame") local playername = UnitName("player") +local delay = 2 -- seconds -- vars local t_left = -1 -local delay = 2 -- seconds local isGossipClosed = true local wasGossipOpened = false local t_lastGossipClosed = 0 +local wasMounted = IsMounted() -- handle mounts with UNIT_AURA --------------------------------------------------------------- @@ -92,6 +94,16 @@ UNIT_SPELLCAST_FAILED = true, UNIT_SPELLCAST_INTERRUPTED = true, UNIT_SPELLCAST_SUCCEEDED = true, + UNIT_AURA = function() + if IsMounted() then + wasMounted = true + else + if wasMounted then + wasMounted = false + start() + end + end + end } local SpellBlackList = { -- spells that don't stealth weapons (works with events1player) [1784] = true, -- Stealth (Rogue) @@ -120,6 +132,33 @@ --------------------------------------------------------------- +-- Handle mounts with OnUpdate +--------------------------------------------------------------- +-- works with GupPet but not with the default interface... +-- I guess that's because a specific /cancelaura or alike is done +-- hooksecurefunc("Dismount",start); + +--[[ With OnUpdate +local handleMountsFrame = CreateFrame("frame") +local handleMountsOnUpdate +do + local IsMounted = IsMounted + local wasMounted = IsMounted() + function handleMountsOnUpdate(self,t_elapsed) + if IsMounted() then + wasMounted = true + else + if wasMounted then + start() + wasMounted = false + end + end + end +end +--]] + + +--------------------------------------------------------------- -- Launch drawing weapons --------------------------------------------------------------- -- Wait a few seconds before drawing, to be able to see the curren animation (and avoid bugs) @@ -156,12 +195,15 @@ --@end-debug@ end --@end-debug@ + handleMountsFrame:SetScript("OnUpdate",handleMountsOnUpdate) end local desactivate = function() + DegaineFrame:SetScript("OnUpdate", nil) + handleMountsFrame:SetScript("OnUpdate",nil) + t_left = -1 for k,_ in pairs(events) do DegaineFrame:UnregisterEvent(k) end for k,_ in pairs(events1player) do DegaineFrame:UnregisterEvent(k) end for k,_ in pairs(events2playername) do DegaineFrame:UnregisterEvent(k) end - DegaineFrame:SetScript("OnUpdate", nil) end Degaine_ToggleAuto = function() if Degaine_isAuto then @@ -175,6 +217,7 @@ end + --------------------------------------------------------------- -- Event/hooks functions --------------------------------------------------------------- @@ -193,7 +236,7 @@ end elseif events1player[event] then if arg1=="player" then - if not SpellBlackList[arg5] then -- arg5 is SpellID + if arg5==nil or not SpellBlackList[arg5] then -- arg5 is SpellID start() end end