2 -- 2020 Aleksi Blinnikka
4 local UnitGUID, UnitIsEnemy = UnitGUID, UnitIsEnemy;
7 local guids = addon.FrameGuids;
9 [260741] = true, -- Jagged Nettles (Waycrest Manor)
12 local frame = CreateFrame("Frame", "kehysIncoming");
14 local function event(_, event, target, cast, id)
15 if event == "PLAYER_REGEN_ENABLED" then
16 for _, f in pairs(guids) do
21 if abilities[id] and UnitIsEnemy("player", target) then
22 local f = guids[UnitGUID(target .. "target")];
24 if event == "UNIT_SPELLCAST_START" then
25 if f.incoming[id] then
26 f.incoming[id] = f.incoming[id] + 1;
30 elseif event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_CHANNEL_START" then
31 if f.incoming[id] then
32 f.incoming[id] = f.incoming[id] - 1;
33 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_STOP");
48 frame:RegisterEvent("PLAYER_REGEN_ENABLED");
51 frame:SetScript("OnEvent", setup);
52 frame:RegisterEvent("PLAYER_LOGIN");