f.tankcd = {}; -- tank CD auras
f.stacks = {}; -- stacking aura tracking
f.buff1 = {}; -- custom buff indicator 1
+ f.incoming = {}; -- incoming ability indicator
+ f.rounds = 0;
-- set up periodic updates
updaters[f] = function()
if f.updating then
f.base:SetAllPoints();
f.base:SetColorTexture(1, 1, 1);
f.base:SetVertexColor(unpack(addon.Colors.Base));
- f.background = f:CreateTexture(nil, "BACKGROUND", nil, 1);
+ f.glow = f:CreateTexture(nil, "BACKGROUND", nil, 1);
+ f.glow:SetAllPoints();
+ f.glow:SetColorTexture(1, 1, 1);
+ f.glow:SetVertexColor(unpack(addon.Colors.Glow));
+ f.background = f:CreateTexture(nil, "BACKGROUND", nil, 2);
f.background:SetPoint("TOPLEFT", f, "TOPLEFT", 1, -1);
f.background:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -1, 1);
f.background:SetColorTexture(0.7, 0.7, 0.7);
--- /dev/null
+-- incoming.lua
+-- 2020 Aleksi Blinnikka
+local _;
+local UnitGUID, UnitIsEnemy = UnitGUID, UnitIsEnemy;
+
+local _, addon = ...;
+local guids = addon.FrameGuids;
+local abilities = {
+ [260741] = true, -- Jagged Nettles (Waycrest Manor)
+};
+
+local frame = CreateFrame("Frame", "kehysIncoming");
+
+local function event(_, event, target, cast, id)
+ if event == "PLAYER_REGEN_ENABLED" then
+ for _, f in pairs(guids) do
+ f.incoming = {};
+ end
+ return
+ end
+ if abilities[id] and UnitIsEnemy("player", target) then
+ local f = guids[UnitGUID(target .. "target")];
+ if f then
+ if event == "UNIT_SPELLCAST_START" then
+ if f.incoming[id] then
+ f.incoming[id] = f.incoming[id] + 1;
+ else
+ f.incoming[id] = 1;
+ end
+ elseif event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_CHANNEL_START" then
+ if f.incoming[id] then
+ f.incoming[id] = f.incoming[id] - 1;
+ if f.incoming[id] == 0 then
+ f.incoming[id] = nil;
+ end
+ end
+ end
+ end
+ end
+end
+
+local function setup()
+ frame:UnregisterAllEvents();
+ frame:SetScript("OnEvent", event);
+ frame:RegisterEvent("UNIT_SPELLCAST_START");
+ frame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START");
+ frame:RegisterEvent("UNIT_SPELLCAST_STOP");
+ frame:RegisterEvent("PLAYER_REGEN_ENABLED");
+end
+
+frame:SetScript("OnEvent", setup);
+frame:RegisterEvent("PLAYER_LOGIN");
frame.lua
raid.lua
auras.lua
+incoming.lua
addon.Colors = {
Base = {0, 0, 0},
+ Glow = {0.7, 1, 0.7},
HealthColor = {0.3, 0.3, 0.3},
ShieldColor = {0, 0.7, 1},
ShieldhlColor = {0.5, 0.8, 1},
[315176] = true, -- Grasping Tendrils
};
-local rounds = 0;
function addon.FrameUpdate(frame)
assert(type(frame) == "table", "FrameUpdate received invalid frame parameter!");
elseif frame.healpred:IsShown() then
frame.healpred:Hide();
end
- rounds = rounds + 1;
- if (rounds > 8) then
+ frame.rounds = frame.rounds + 1;
+ if (frame.rounds > 7) then
frame.tankcd = {};
frame.alert = {};
frame.stacks = {};
frame.heal = {};
frame.buff1 = {};
addon.SetAuras(frame.unit, frame.guid);
- rounds = 0;
+ frame.rounds = 0;
end
-- tank CD marker
if next(frame.tankcd) then
elseif frame.buffind1:IsShown() then
frame.buffind1:Hide();
end
+ -- incoming ability
+ if next(frame.incoming) then
+ if not frame.glow:IsShown() then frame.glow:Show() end
+ elseif frame.glow:IsShown() then
+ frame.glow:Hide();
+ end
-- overlays
if next(frame.alert) then
-- major