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

731 lines
17 KiB
Lua

--COMBAT_LOG_EVENT_UNFILTERED REMOVE_GUID NAME_PLATE_UNIT_ADDED NAME_PLATE_UNIT_REMOVED
function(allstates, e, ...)
if e == "COMBAT_LOG_EVENT_UNFILTERED" then
local se = select(2, CombatLogGetCurrentEventInfo())
if se == "SPELL_CAST_START" or se == "SPELL_CAST_SUCCESS" then
local spell = select(13, CombatLogGetCurrentEventInfo())
if aura_env.spells[spell] then
local ID = select(7, GetSpellInfo(aura_env.spells[spell].ID))
if ID == aura_env.spells[spell].ID then
local castTime = select(4, GetSpellInfo(aura_env.spells[spell].ID))
local GUID = select(4, CombatLogGetCurrentEventInfo())
if GUID then allstates[GUID] = {} end
if allstates[GUID].timer then allstates[GUID].timer:Cancel() end
local unit = ""
local target = select(9, CombatLogGetCurrentEventInfo())
if target and UnitIsPlayer(target) == true then
local targetClass = UnitClass(target) or ""
target = aura_env.classColor(targetClass) .. target
allstates[GUID].target = target
end
for i = 1, 30 do
if UnitExists("nameplate" .. i) then
if UnitGUID("nameplate" .. i) == GUID then
unit = "nameplate" .. i
break
end
end
end
-- unit = "player"
local LCG = LibStub("LibCustomGlow-1.0")
if castTime > 1000 and se == "SPELL_CAST_START" then
if unit == "player" or unit == "" then unit = "nameplate1" end
if allstates[GUID].timer then allstates[GUID].timer:Cancel() end
allstates[GUID].changed = true
allstates[GUID].show = true
allstates[GUID].showTime = GetTime()
allstates[GUID].ID = aura_env.spells[spell].ID
allstates[GUID].ins = aura_env.spells[spell].ins
allstates[GUID].unit = unit
allstates[GUID].GUID = GUID
allstates[GUID].progressType = "timed"
allstates[GUID].expirationTime = GetTime() + castTime / 1000
allstates[GUID].duration = castTime / 1000
allstates[GUID].timer = C_Timer.NewTimer(castTime / 1000, function() WeakAuras.ScanEvents("REMOVE_GUID", GUID); LCG.PixelGlow_Stop(nameplate); end)
return true
elseif castTime == 0 and se == "SPELL_CAST_SUCCESS" then
if unit == "player" or unit == "" then unit = "nameplate1" end
if allstates[GUID].timer then allstates[GUID].timer:Cancel() end
allstates[GUID].changed = true
allstates[GUID].show = true
allstates[GUID].showTime = GetTime()
allstates[GUID].ID = aura_env.spells[spell].ID
allstates[GUID].ins = aura_env.spells[spell].ins
allstates[GUID].unit = unit
allstates[GUID].GUID = GUID
allstates[GUID].expirationTime = GetTime() + 2
allstates[GUID].timer = C_Timer.NewTimer(2, function() WeakAuras.ScanEvents("REMOVE_GUID", GUID); LCG.PixelGlow_Stop(nameplate); end)
return true
end
end
end
elseif se == "SPELL_CAST_FAILED" then
local spell = select(13, CombatLogGetCurrentEventInfo())
if aura_env.spells[spell] then
local ID = select(7, GetSpellInfo(aura_env.spells[spell].ID))
if ID == aura_env.spells[spell].ID then
local LCG = LibStub("LibCustomGlow-1.0")
local GUID = select(4, CombatLogGetCurrentEventInfo())
if allstates[GUID].timer then allstates[GUID].timer:Cancel() end
local unit = ""
for i = 1, 30 do
if UnitExists("nameplate" .. i) then
if UnitGUID("nameplate" .. i) == GUID then
unit = "nameplate" .. i
break
end
end
end
--WeakAuras.ScanEvents("REMOVE_GUID", GUID)
local rem = allstates[GUID].expirationTime - GetTime()
local maxrem = allstates[GUID].expirationTime - allstates[GUID].showTime
allstates[GUID].changed = true
allstates[GUID].show = true
allstates[GUID].progressType = "static"
allstates[GUID].value = string.format("%.1f", rem)
allstates[GUID].total = maxrem
allstates[GUID].interrupted = true
allstates[GUID].timer = C_Timer.NewTimer(1, function() WeakAuras.ScanEvents("REMOVE_GUID", GUID) end)
if unit ~= "" then
local nameplate = C_NamePlate.GetNamePlateForUnit(unit)
LCG.PixelGlow_Stop(nameplate)
end
return true
end
end
elseif se == "UNIT_DIED" then
local GUID = select(8, CombatLogGetCurrentEventInfo())
if allstates[GUID] and allstates[GUID].expirationTime and not allstates[GUID].interrupted then
local rem = allstates[GUID].expirationTime - GetTime()
local maxrem = allstates[GUID].expirationTime - allstates[GUID].showTime
allstates[GUID].changed = true
allstates[GUID].show = true
allstates[GUID].progressType = "static"
allstates[GUID].value = rem
allstates[GUID].total = maxrem
allstates[GUID].interrupted = true
allstates[GUID].timer = C_Timer.NewTimer(1, function() WeakAuras.ScanEvents("REMOVE_GUID", GUID) end)
return true
end
end
elseif e == "REMOVE_GUID" then
local GUID = select(1, ...)
if allstates[GUID] then
allstates[GUID].show = false
allstates[GUID].changed = true
return true
end
elseif e == "NAME_PLATE_UNIT_ADDED" then
local u = select(1, ...)
if u then
local GUID = UnitGUID(u)
if allstates[GUID] then
local LCG = LibStub("LibCustomGlow-1.0")
local nameplate = C_NamePlate.GetNamePlateForUnit(u)
LCG.PixelGlow_Start(nameplate, {1, 1, 0, 1}, 100, 0, 200, 4, 0, -4)
end
end
elseif e == "NAME_PLATE_UNIT_REMOVED" then
local u = select(1, ...)
if u then
local GUID = UnitGUID(u)
local LCG = LibStub("LibCustomGlow-1.0")
local nameplate = C_NamePlate.GetNamePlateForUnit(u)
LCG.PixelGlow_Stop(nameplate)
end
end
end
--ON SHOW
local LCG = LibStub("LibCustomGlow-1.0")
local font, size, flags = aura_env.region.text:GetFont()
PlaySoundFile("Interface\\AddOns\\WeakAuras\\Media\\Sounds\\RobotBlip.ogg", "Master")
if not aura_env.region.text then
local text = aura_env.region:CreateFontString(nil, "OVERLAY")
aura_env.region.text = text
end
aura_env.region.text:SetFont(font, size, flags)
aura_env.region.text:SetTextColor(1,1,1,1)
aura_env.region.text:ClearAllPoints()
aura_env.region.text:SetPoint("CENTER", aura_env.region, "CENTER")
aura_env.region.text:SetJustifyH("CENTER")
aura_env.region.text:SetJustifyV("CENTER")
local output = aura_env.statee.ins
if aura_env.statee.target then output = output .. " > " .. aura_env.statee.target end
aura_env.region.text:SetText(output)
aura_env.region.text:Show()
local aura_env = aura_env
local nameplate = C_NamePlate.GetNamePlateForUnit(aura_env.statee.unit, true)
LCG.PixelGlow_Start(nameplate, {1, 1, 0, 1}, 100, 0, 200, 4, 0, -4)
local GUID = aura_env.statee.GUID
--ON HIDE
local LCG = LibStub("LibCustomGlow-1.0")
local nameplate = C_NamePlate.GetNamePlateForUnit(aura_env.statee.unit, true)
if nameplate then
LCG.PixelGlow_Stop(nameplate)
end
--ANIMATION
function()
if aura_env.statee and aura_env.statee.interrupted then return 0, 1, 0, 1 end
end
--INIT
aura_env.spells = {
-- ["Vivify"] =
-- {
-- ["ID"] = 116670,
-- ["ins"] = "Test",
-- },
["Brutal Backhand"] =
{
["ID"] = 257426,
["ins"] = "Brutal Backhand - Sidestep",
},
["Shattering Toss"] =
{
["ID"] = 274860,
["ins"] = "Shattering Toss - Brace"
},
["Suppression Slam"] =
{
["ID"] = 270003,
["ins"] = "Suppression Slam - Sidestep"
},
["Axe Barrage"] =
{
["ID"] = 270084,
["ins"] = "Axe Barrage - Stun"
},
["Poison Barrage"] =
{
["ID"] = 270507,
["ins"] = "Poison Barrage - Move with"
},
["Slobber Knocker"] =
{
["ID"] = 256627,
["ins"] = "Slobber Knocker - Sidestep"
},
["Heavy Slash"] =
{
["ID"] = 257292,
["ins"] = "Heavy Slash - Sidestep"
},
["Singing Steel"] =
{
["ID"] = 256709,
["ins"] = "Singing Steel - Sidestep"
},
["Crimson Swipe"] =
{
["ID"] = 268230,
["ins"] = "Crimson Swipe - Sidestep"
},
["Tail Thrash"] =
{
["ID"] = 265910,
["ins"] = "Tail Thrash - Mitigation"
},
["Debilitating Backhand"] =
{
["ID"] = 266237,
["ins"] = "Debilitating Backhand - Sidestep"
},
["Poison Nova"] =
{
["ID"] = 267273,
["ins"] = "Poison Nova - Interrupt"
},
["Blade Combo"] =
{
["ID"] = 268586,
["ins"] = "Blade Combo - Mitigation"
},
["Clear the Deck"] =
{
["ID"] = 269029,
["ins"] = "Clear the Deck - Sidestep"
},
["Viscous Slobber"] =
{
["ID"] = 272827,
["ins"] = "Viscous Slobber - Place out of group"
},
["Crashing Tide"] =
{
["ID"] = 261563,
["ins"] = "Crashing Tide - Face to wall"
},
["Noxious Breath"] =
{
["ID"] = 272657,
["ins"] = "Noxious Breath - Sidestep"
},
["Dust Cloud"] =
{
["ID"] = 268705,
["ins"] = "Dust Cloud - Move enemies"
},
["Shocking Claw"] =
{
["ID"] = 257337,
["ins"] = "Shocking Claw - Sidestep"
},
["Power Through"] =
{
["ID"] = 268415,
["ins"] = "Power Through - Face away"
},
["Cover"] =
{
["ID"] = 263275,
["ins"] = "Cover - Move enemies"
},
["Desperate Measures"] =
{
["ID"] = 263601,
["ins"] = "Desperate Measures - Mitigation"
},
["Blowtorch"] =
{
["ID"] = 263103,
["ins"] = "Blowtorch - Face away"
},
["Echo Blade"] =
{
["ID"] = 268846,
["ins"] = "Echo Blade - Face away"
},
["Charged Shot"] =
{
["ID"] = 269429,
["ins"] = "Charged Shot - Mitigation"
},
["Shockwave"] =
{
["ID"] = 272457,
["ins"] = "Shockwave - Mitigation"
},
["Maddening Gaze"] =
{
["ID"] = 272609,
["ins"] = "Maddening Gaze - Sidestep"
},
["Suppression Fire"] =
{
["ID"] = 258864,
["ins"] = "Suppression Fire - Face away"
},
["Shadow Cleave"] =
{
["ID"] = 265372,
["ins"] = "Shadow Cleave - Face away"
},
["Thorned Barrage"] =
{
["ID"] = 265760,
["ins"] = "Thorned Barrage - Mitigation"
},
["Crush"] =
{
["ID"] = 260508,
["ins"] = "Crush - Mitigation"
},
["Marking Cleave"] =
{
["ID"] = 263905,
["ins"] = "Marking Cleave - Sidestep"
},
["Warding Candles"] =
{
["ID"] = 263961,
["ins"] = "Warding Candles - Move enemies"
},
["Tectonic Smash"] =
{
["ID"] = 275907,
["ins"] = "Tectonic Smash - Sidestep"
},
["Heaving Blow"] =
{
["ID"] = 276268,
["ins"] = "Heaving Blow - Sidestep"
},
["Hindering Cleave"] =
{
["ID"] = 267899,
["ins"] = "Hindering Cleave - Sidestep"
},
["Mental Assault"] =
{
["ID"] = 268391,
["ins"] = "Mental Assault - Sidestep"
},
["Rotten Bile"] =
{
["ID"] = 265540,
["ins"] = "Rotten Bile - MOVE CUNT"
},
["Blade Barrage"] =
{
["ID"] = 257870,
["ins"] = "Blade Barrage - Mitigation"
},
["Skewer"] =
{
["ID"] = 249919,
["ins"] = "Skewer - Mitigation"
},
["Heavy Slash"] =
{
["ID"] = 257292,
["ins"] = "Heavy Slash - Sidestep"
},
["Broadside"] =
{
["ID"] = 268260,
["ins"] = "Broadside - Sidestep"
},
["Crushing Slam"] =
{
["ID"] = 272711,
["ins"] = "Crushing Slam - Sidestep"
},
["Slam"] =
{
["ID"] = 269266,
["ins"] = "Slam - Sidestep"
},
["Energy Lash"] =
{
["ID"] = 262794,
["ins"] = "Energy Lash - Reflect"
},
["Grasping Hex"] =
{
["ID"] = 300436,
["ins"] = "Grasping Hex - Interrupt",
},
["Stoneskin"] =
{
["ID"] = 300514,
["ins"] = "Stoneskin - Interrupt",
},
["Shockwave"] =
{
["ID"] = 300424,
["ins"] = "Shockwave - Sidestep",
},
["Charged Smash"] =
{
["ID"] = 297254,
["ins"] = "Charged Smash - Stack on tank",
},
["Rapid Fire"] =
{
["ID"] = 301667,
["ins"] = "Rapid Fire - Sidestep",
},
["Enlarge"] =
{
["ID"] = 301629,
["ins"] = "Enlarge - Interrupt",
},
["Shrink"] =
{
["ID"] = 284219,
["ins"] = "Shrink - Interrupt",
},
["Wreck"] =
{
["ID"] = 302279,
["ins"] = "Wreck - Mitigation",
},
["Pedal to the Metal"] =
{
["ID"] = 299164,
["ins"] = "Pedal to the Metal - Sidestep",
},
["Burnout"] =
{
["ID"] = 298571,
["ins"] = "Burnout - move from smoke",
},
["Bolt Buster"] =
{
["ID"] = 298940,
["ins"] = "Bolt Buster - Sidestep",
},
["Mega Taze"] =
{
["ID"] = 298718,
["ins"] = "Mega Taze - Run into smoke",
},
["Slimewave"] =
{
["ID"] = 300777,
["ins"] = "Slimewave - Sidestep",
},
["Toxic Wave"] =
{
["ID"] = 297834,
["ins"] = "Toxic Wave - Run to robot",
},
["Disassembling Protocol"] =
{
["ID"] = 301990,
["ins"] = "Disassembling Protocol - Mitigation",
},
["Gyro-Scrap"] =
{
["ID"] = 300159,
["ins"] = "Gyro-Scrap - Run away",
},
["Exhaust"] =
{
["ID"] = 300177,
["ins"] = "Exhaust - Move from smoke",
},
["Repair Protocol"] =
{
["ID"] = 300171,
["ins"] = "Repair Protocol - Interrupt",
},
["Shield Bash"] =
{
["ID"] = 273185,
["ins"] = "Shield Bash - Mitigation",
},
["Overclock"] =
{
["ID"] = 299588,
["ins"] = "Overclock - Interrupt",
},
["Repair"] =
{
["ID"] = 300087,
["ins"] = "Repair - Interrupt",
},
["Scrap Cannon"] =
{
["ID"] = 300188,
["ins"] = "Scrap Cannon - Sidestep",
},
["Detonate"] =
{
["ID"] = 301088,
["ins"] = "Detonate - Interrupt",
},
["Whirling Edge"] =
{
["ID"] = 285020,
["ins"] = "Whirling Edge - Run away",
},
["Maximum Thrust"] =
{
["ID"] = 283421,
["ins"] = "Maximum Thrust - Sidestep",
},
["Process Waste"] =
{
["ID"] = 294290,
["ins"] = "Process Waste - Sidestep",
},
["Venting Flames"] =
{
["ID"] = 291946,
["ins"] = "Venting Flames - Go behind cool cube",
},
["Capacitor Discharge"] =
{
["ID"] = 295169,
["ins"] = "Capacitor Discharge - Run to free floor",
},
["Tune-Up"] =
{
["ID"] = 293729,
["ins"] = "Tune-Up - Interrupt",
},
["Sonic Pulse"] =
{
["ID"] = 293986,
["ins"] = "Sonic Pulse - Sidestep",
},
["Skullcracker"] =
{
["ID"] = 300296,
["ins"] = "Skullcracker - Mitigation",
},
["Coalesce"] =
{
["ID"] = 297835,
["ins"] = "Coalesce - Run to robot",
},
["Maximum Thrust"] =
{
["ID"] = 283421,
["ins"] = "Maximum Thrust - Sidestep",
},
["Vent Jets"] =
{
["ID"] = 285388,
["ins"] = "Vent Jets - Run Away",
},
["Giga-Zap"] =
{
["ID"] = 291939,
["ins"] = "Giga-Zap - Face Away",
},
["Rock Lance"] =
{
["ID"] = 263202,
["ins"] = "Rock Lance - Send Help",
},
["Azerite Heartseeker"] =
{
["ID"] = 262513,
["ins"] = "Azerite Heartseeker - Help",
},
["Savage Cleave"] =
{
["ID"] = 265019,
["ins"] = "Savage Cleave - Sidestep",
},
["Decaying Mind"] =
{
["ID"] = 278961,
["ins"] = "Decaying Mind - Interrupt",
},
["Short Out"] =
{
["ID"] = 297128,
["ins"] = "Short Out - Run to bubble",
},
["Cyclone Strike"] =
{
["ID"] = 263573,
["ins"] = "Cyclone Strike - Sidestep",
},
["Power Shot"] =
{
["ID"] = 264574,
["ins"] = "Power Shot - Sidestep",
},
["Overflow"] =
{
["ID"] = 295346,
["ins"] = "Overflow - Run cunt",
},
["Crushing Reverberation"] =
{
["ID"] = 295332,
["ins"] = "Crushing Reverberation - Stack on tank cunt",
},
["Overwhelming Barrage"] =
{
["ID"] = 295138,
["ins"] = "Overwhelming Barrage - Dodge cunt",
},
["Frostshock Bolts"] =
{
["ID"] = 295601,
["ins"] = "Frostshock Bolts - Dodge cunt",
},
["Inversion"] =
{
["ID"] = 295791,
["ins"] = "Inversion - Spread cunt",
},
["Bioluminescent Cloud"] =
{
["ID"] = 292205,
["ins"] = "Bioluminescent Cloud - Get glowing cunt",
},
["Shock Pulse"] =
{
["ID"] = 292279,
["ins"] = "Shock Pulse - Run cunt",
},
["Arcane Bomb"] =
{
["ID"] = 296746,
["ins"] = "Arcane Bomb - Run cunt",
},
["Gale Buffet"] =
{
["ID"] = 296701,
["ins"] = "Gale Buffet - Run to stormy cunt",
},
["Arcanado Burst"] =
{
["ID"] = 296701,
["ins"] = "Arcanado Burst - Tornados cunt",
},
["Coral Growth"] =
{
["ID"] = 296555,
["ins"] = "Coral Growth - Run cunt",
},
["Briny Bubble"] =
{
["ID"] = 297333,
["ins"] = "Briny Bubble - Help cunt-s",
},
["Rippling Wave"] =
{
["ID"] = 296688,
["ins"] = "Rippling Wave - Soak - s l o w l y - cunt",
},
["Arcing Azerite"] =
{
["ID"] = 296944,
["ins"] = "Arcing Azerite - Destroy Corals cunt",
},
["Conductive Pulse"] =
{
["ID"] = 295822,
["ins"] = "Conductive Pulse - Interrupt cunt",
},
["Frenetic Charge"] =
{
["ID"] = 299914,
["ins"] = "Frenetic Charge - Soak cunt",
},
["Zealous Eruption"] =
{
["ID"] = 301807,
["ins"] = "Zealous Eruption - Run to safe boss cunt",
},
["Fanatical Verdict"] =
{
["ID"] = 296850,
["ins"] = "Fanatical Verdict - Spread cunt",
},
["Potent Spark"] =
{
["ID"] = 301947,
["ins"] = "Potent Spark - Botanist orbs cunt",
},
["Violent Outburst"] =
{
["ID"] = 297325,
["ins"] = "Violent Outburst - Run cunt",
},
}
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