Files
wow-weakauras/Complete Projects/BFA/Stun Counter.lua
2024-08-24 22:43:07 +02:00

160 lines
4.4 KiB
Lua

--COMBAT_LOG_EVENT_UNFILTERED RESET GROUP_ROSTER_UPDATE
function(...)
local e = select(1, ...)
if e == "COMBAT_LOG_EVENT_UNFILTERED" then
local se = select(3, ...)
if se == "SPELL_CAST_SUCCESS" then
local caster = select(6, ...)
if UnitName(caster) then
if UnitInParty(caster) or UnitName(caster) == UnitName("player") then
local spell = select(14, ...)
if aura_env.spells[spell] then
caster = caster:gsub("%-.+", "")
caster = caster:gsub(" ", "")
if not aura_env.stuns[caster] then aura_env.stuns[caster] = 1 else aura_env.stuns[caster] = aura_env.stuns[caster] + 1 end
local output1, output2 = "", ""
for k,v in pairs(aura_env.stuns) do
local class = UnitClass(k) or ""
output1 = output1 .. aura_env.classColor(class) .. k .. "|r\n"
output2 = output2 .. aura_env.classColor(class) .. v .. "|r\n"
end
aura_env.region.text2:SetText(output1)
aura_env.region.text3:SetText(output2)
end
end
end
end
elseif e == "GROUP_ROSTER_UPDATE" then
aura_env.stuns = nil
aura_env.stuns = {}
aura_env.region.text2:SetText("")
aura_env.region.text3:SetText("")
elseif e == "RESET" then
aura_env.stuns = nil
aura_env.stuns = {}
aura_env.region.text2:SetText("")
aura_env.region.text3:SetText("")
end
end
--INIT
if not aura_env.region.text2 then
local text2 = aura_env.region:CreateFontString(nil, "OVERLAY")
aura_env.region.text2 = text2
end
aura_env.region.text2:SetFont(aura_env.region.text:GetFont())
aura_env.region.text2:SetTextColor(1,1,1,1)
aura_env.region.text2:SetPoint("CENTER", aura_env.region, "CENTER", 0, 0)
aura_env.region.text2:SetJustifyH("LEFT")
aura_env.region.text2:SetText("")
aura_env.region.text2:Show()
if not aura_env.region.text3 then
local text3 = aura_env.region:CreateFontString(nil, "OVERLAY")
aura_env.region.text3 = text3
end
aura_env.region.text3:SetFont(aura_env.region.text:GetFont())
aura_env.region.text3:SetTextColor(1,1,1,1)
aura_env.region.text3:SetPoint("CENTER", aura_env.region, "CENTER", 100, 0)
aura_env.region.text3:SetJustifyH("LEFT")
aura_env.region.text3:SetText("")
aura_env.region.text3:Show()
aura_env.stuns = {}
aura_env.spells =
{
--DK
["Asphyxiate"] = 1,
["Gnaw"] = 1,
["Monstrous Blow"] = 1,
["Blinding Sleet"] = 1,
["Death Grip"] = 1,
["Gorefiend's Grasp"] = 1,
["Mind Freeze"] = 1,
["Shambling Rush"] = 1,
--DH
["Chaos Nova"] = 1,
["Fel Eruption"] = 1,
["Sigil of Misery"] = 1,
["Sigil of Chains"] = 1,
["Disrupt"] = 1,
--Druid
["Maim"] = 1,
["Mighty Bash"] = 1,
["Rake"] = 1,
["Typhoon"] = 1,
["Ursol's Vortex"] = 1,
["Skull Bash"] = 1,
--Hunter
["Intimidation"] = 1,
["Bursting Shot"] = 1,
["Muzzle"] = 1,
["Counter Shot"] = 1,
--Monk
["Leg Sweep"] = 1,
["Song of Chi-ji"] = 1,
["Ring of Peace"] = 1,
["Spear Hand Strike"] = 1,
--Mage
["Dragon's Breath"] = 1,
["Blast Wave"] = 1,
["Supernova"] = 1,
--Paladin
["Hammer of Justice"] = 1,
["Blinding Light"] = 1,
["Avenger's Shield"] = 1,
["Rebuke"] = 1,
--Priest
["Holy Word: Chastise"] = 1,
["Psychic Horror"] = 1,
["Mind Bomb"] = 1,
["Psychic Scream"] = 1,
["Silence"] = 1,
--Rogue
["Between the Eyes"] = 1,
["Cheap Shot"] = 1,
["Kidney Shot"] = 1,
["Blind"] = 1,
["Kick"] = 1,
--Shaman
["Capacitor Totem"] = 1,
["Pulverize"] = 1,
["Thunderstorm"] = 1,
["Wind Shear"] = 1,
--Warlock
["Axe Toss"] = 1,
["Shadowfury"] = 1,
["Summon Infernal"] = 1,
["Seduction"] = 1,
["Spell Lock"] = 1,
--Warrior
["Shockwave"] = 1,
["Storm Bolt"] = 1,
["Intimidating Shout"] = 1,
["Pummel"] = 1,
}
aura_env.classColor = function(class)
if class == "Death Knight" then return "|cFFC41F3B" elseif
class == "Demon Hunter" then return "|cFFA330C9" elseif
class == "Druid" then return "|cFFFF7D0A" elseif
class == "Hunter" then return "|cFFABD473" elseif
class == "Mage" then return "|cFF40C7EB" elseif
class == "Monk" then return "|cFF00FF96" elseif
class == "Paladin" then return "|cFFF58CBA" elseif
class == "Priest" then return "|cFFFFFFFF" elseif
class == "Rogue" then return "|cFFFFF569" elseif
class == "Shaman" then return "|cFF0070DE" elseif
class == "Warlock" then return "|cFF8787ED" elseif
class == "Warrior" then return "|cFFC79C6E" else
return "|cFFFFFFFF" end
end