Files
wow-weakauras/WeakAuras/Projects/Hydra Shot 2.lua

70 lines
2.8 KiB
Lua

--UNIT_AURA
--Event that fires off whenever an aura is applied or removed -- probably overkill for this application but it should work relatively fine
--Can also use combatlog event for cast success of hydra shot but am unsure if that would work
--The basic idea of this setup is to minimize the time it's calculating stuff to make it as efficient, to do that we only enable the aura while hydra shot is active; To find when it is active we get the time when it was cast and add 8 seconds to that (Don't know why 8, previous aura said so)
--We find what auras are applied after the cast has begun and see for each if it's the one we're looking for (hydra shot)
--Theoretically SHOULD PROBABLY *LIKELY* work but practically probably isn't going to
function()
if (aura_env.startCast + 12) < GetTime() then
local spell = GetSpellInfo(230139) --hydra shot 230139
local spell2 = GetSpellInfo(239375) --fish 239375
local spell3 = GetSpellInfo(230214) -- tank debuff
local j = 0
for i = 1, GetNumGroupMembers() do
local name = GetRaidRosterInfo(i)
if not UnitDebuff(name, spell) and not UnitDebuff(name, spell2) and not UnitDebuff(name, spell3) then
if name == UnitName("player") and j < 2 then
aura_env.output = "|cffffd00cStar|r"
return 0
end
if name == UnitName("player") and j >= 2 and j < 5 then
aura_env.output = "cff4baf1cTriangle|r"
return 0
end
if name == UnitName("player") and j >= 5 and j < 8 then
aura_env.output = "cfff6802cCircle|r"
return 0
end
if name == UnitName("player") and j >= 8 and j < 11 then
aura_env.output = "cfff0098cDiamond|r"
return 0
end
j = j + 1
end
end
aura_env.output = "Whatever"
return 0
end
end
--DISPLAY
function() --It's more efficient to only return a value every frame instead of calculating for it as well as returning it
return aura_env.output
end
--EVERY FRAME TRIGGER
--The trigger that will be actually showing the aura
function() --Enables the weakaura for 8 seconds after the cast
if (aura_env.startCast + 12) < GetTime() then --If the time of cast + 8 seconds is < current time the aura will be shown (aka for the next 8 seconds after the cast)
return true
else
return false
end
end
--COMBAT_LOG_EVENT_UNFILTERED
function(...) --Enables the weakaura for 8 seconds after the cast
local subevent = select(3, ...)
if subevent == "SPELL_CAST_START" then --If there was a spell cast (in the combat log)
local caster = select(6, ...) --Found who cast it
local spell = select(14, ...) --And what was cast
if caster:match("Mistress") and spell == "Hydra Shot" then --If the spell is Hydra Shot and Mistress cast it then
aura_env.startCast = GetTime() --Get the time when it was cast
end
end
end
--INIT
--Defines protected variables which are the output and the cast time for the timer
aura_env.startCast = 0
aura_env.output = ""