2 -- 2020 Aleksi Blinnikka
4 local UnitGUID, UnitIsEnemy = UnitGUID, UnitIsEnemy;
7 local guids = addon.FrameGuids;
9 [260741] = true, -- Jagged Nettles (Waycrest Manor)
10 [342675] = true, -- Bone Spear (Theater of Pain)
11 [320788] = true, -- Frozen Binds (Necrotic Wake)
14 local frame = CreateFrame("Frame", "kehysIncoming");
16 local function event(_, event, target, cast, id)
17 if event == "PLAYER_REGEN_ENABLED" then
18 for _, f in pairs(guids) do
23 if abilities[id] and UnitIsEnemy("player", target) then
24 local f = guids[UnitGUID(target .. "target")];
26 if event == "UNIT_SPELLCAST_START" then
27 if f.incoming[id] then
28 f.incoming[id] = f.incoming[id] + 1;
32 elseif f.incoming[id] then
33 f.incoming[id] = f.incoming[id] - 1;
34 if f.incoming[id] == 0 then
42 local function setup()
43 frame:UnregisterAllEvents();
44 frame:SetScript("OnEvent", event);
45 frame:RegisterEvent("UNIT_SPELLCAST_START");
46 frame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START");
47 frame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP");
48 frame:RegisterEvent("UNIT_SPELLCAST_STOP");
49 frame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED");
50 frame:RegisterEvent("UNIT_SPELLCAST_FAILED");
51 frame:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET");
52 frame:RegisterEvent("PLAYER_REGEN_ENABLED");
55 frame:SetScript("OnEvent", setup);
56 frame:RegisterEvent("PLAYER_LOGIN");