--- /dev/null
+-- auras.lua
+-- 2019 Aleksi Blinnikka
+local _, addon = ...;
+local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo;
+
+local watchedAuras = {
+ -- Battle of Dazar'alor
+ --[286988] = duration, -- Searing Embers
+ [257908] = {bar=false}, -- Oiled Blade
+ [268391] = {bar=false}, -- Mental Assault
+ [272571] = {bar=false}, -- Choking Waters
+ [268008] = {bar=false}, -- Snake Charm
+ [260741] = {bar=false}, -- Jagged Nettles
+ [280605] = {bar=false}, -- Brain Freeze
+ [268797] = {bar=false}, -- Transmute to Goo
+ [265889] = {bar=false}, -- Torch Strike
+ [266209] = {bar=false}, -- Wicked Frenzy
+ [258323] = {bar=false}, -- Infected Wound
+ [262513] = {bar=false}, -- Azerite Heartseeker
+ [53563] = "TOPRIGHT", -- Beacon of Light
+ [156910] = "TOPRIGHT", -- Beacon of Faith
+ [200025] = "TOPRIGHT", -- Beacon of Virtue
+ [33763] = "TOPLEFT", -- Lifebloom
+ [774] = "TR1", -- Rejuvenation
+ [102352] = "TR2", -- Cenarion Ward (102351 is the pre-buff)
+ [207386] = "TR3", -- Spring Blossoms (207385 is the talent)
+ [155777] = "TR3", -- Germination (either this or Spring Blossoms taken)
+ [8936] = "TR4", -- Regrowth
+ [200389] = "TR5", -- Cultivation
+};
+
+local auraEvents = {};
+auraEvents.SPELL_AURA_APPLIED = function(frame, id, _, _, _, amount)
+ if UnitDebuff(frame.unit, 1, "RAID") ~= nil then
+ -- update dispel indicator
+ frame:ColorOverlay("low", 1, 0.5, 0, 0.5);
+ end
+ if auras[id] then
+ if amount > 0 then
+ frame.auraStarts[id] = GetTime();
+ return updateApplication(frame, id, amount);
+ else
+ return updateRemoval(frame, id);
+ end
+ end
+end
+auraEvents.SPELL_AURA_APPLIED_DOSE = auraEvents.SPELL_AURA_APPLIED;
+auraEvents.SPELL_AURA_REFRESH = auraEvents.SPELL_AURA_APPLIED;
+auraEvents.SPELL_AURA_REMOVED = auraEvents.SPELL_AURA_APPLIED;
+auraEvents.SPELL_AURA_REMOVED_DOSE = auraEvents.SPELL_AURA_APPLIED;
+auraEvents.SPELL_AURA_BROKEN = function(frame, id)
+ return auraEvents.SPELL_AURA_APPLIED(frame, id, nil, nil, nil, 0);
+end
+auraEvents.SPELL_AURA_BROKEN_SPELL = auraEvents.SPELL_AURA_BROKEN;
+
+local counter = 0;
+local function clog(ts, event, _, _, _, _, _, dest, _, flags, _, spellid, ...)
+ if auraEvents[event] and watchedAuras[spellid] then
+ counter = counter + 1;
+ end
+end
+addon.Events.Clog = clog;
+
+local frame = CreateFrame("Frame");
+frame:Hide();
+frame:SetScript("OnEvent", function()
+ frame:UnregisterAllEvents();
+ frame:SetScript("OnEvent", function()
+ return clog(CombatLogGetCurrentEventInfo());
+ end);
+ frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
+end);
+frame:RegisterEvent("PLAYER_LOGIN");
local READY_CHECK_WAITING_TEXTURE = READY_CHECK_WAITING_TEXTURE;
local _, addon = ...;
+addon.Events = {};
local baseColor = {0, 0, 0};
local overlayColorDispel = {1, 0.5, 0, 0.5};
local overlayColorCharm = {0.8, 0, 1, 0.5};
frame:RegisterUnitEvent("UNIT_MAXHEALTH", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_NAME_UPDATE", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_AURA", frame.unit, displayed);
- frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", frame.unit, displayed);
+ --frame:RegisterUnitEvent("UNIT_HEAL_PREDICTION", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", frame.unit, displayed);
frame:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", frame.unit, displayed);
frame.text:Hide();
end
end
+addon.Events.UpdateText = updateText;
local function updateMaxHealth(frame, unit)
frame.health.max = UnitHealthMax(unit);
end
+addon.Events.UpdateMaxHealth = updateMaxHealth;
local function updateHealth(frame, unit)
local current, max = UnitHealth(unit), frame.health.max;
+ if current == frame.prev.health then
+ return false;
+ end
+ frame.prev.health = current;
if current > max or max <= 0 then
-- somehow current health has gone over the maximum (missed maxhealth event possibly)
-- just put health bar full and update max health for next event
frame.health:Show();
elseif current <= 0 or UnitIsDeadOrGhost(unit) then
frame.health:Hide();
- return updateText(frame, unit); -- update death
+ updateText(frame, unit); -- update death
else
local w = current/max*width;
frame.health:SetWidth(w);
frame.dead = nil;
updateText(frame, unit); -- update revive
end
+ return true;
end
+addon.Events.UpdateHealth = updateHealth;
local function updateName(frame, unit)
local name = UnitName(unit);
local color = RAID_CLASS_COLORS[class];
if color then frame.name:SetVertexColor(color.r, color.g, color.b) end
end
+addon.Events.UpdateName = updateName;
local function updateHealPred(frame, unit)
local incoming = UnitGetIncomingHeals(unit) or 0;
incoming = (incoming / frame.health.max) * width;
-- always at least 1 pixel space for heal prediction
frame.healpred:SetWidth(min(width - frame.health.width + 1, incoming));
- frame.healpred:Show();
+ if not frame.healpred:IsShown() then frame.healpred:Show() end
else
- frame.healpred:Hide();
+ if frame.healpred:IsShown() then frame.healpred:Hide() end
end
end
+addon.Events.UpdateHealPred = updateHealPred;
local function updateShield(frame, unit)
local shield = UnitGetTotalAbsorbs(unit) or 0;
local space = width - frame.health.width;
shield = (shield / frame.health.max) * width;
if space == 0 then
- frame.shield:Hide();
- frame.shieldhl:Show();
+ if frame.shield:IsShown() then frame.shield:Hide() end
+ if not frame.shieldhl:IsShown() then frame.shieldhl:Show() end
elseif space < shield then
frame.shield:SetWidth(space);
- frame.shield:Show();
- frame.shieldhl:Show();
+ if not frame.shield:IsShown() then frame.shield:Show() end
+ if not frame.shieldhl:IsShown() then frame.shieldhl:Show() end
else
frame.shield:SetWidth(shield);
- frame.shield:Show();
- frame.shieldhl:Hide();
+ if not frame.shield:IsShown() then frame.shield:Show() end
+ if frame.shieldhl:IsShown() then frame.shieldhl:Hide() end
end
else
- frame.shield:Hide();
- frame.shieldhl:Hide();
+ if frame.shield:IsShown() then frame.shield:Hide() end
+ if frame.shieldhl:IsShown() then frame.shieldhl:Hide() end
end
end
+addon.Events.UpdateShield = updateShield;
local function updateHealAbsorb(frame, unit)
local absorb = UnitGetTotalHealAbsorbs(unit) or 0;
frame.healabsorb:Hide();
end
end
+addon.Events.UpdateHealAbsorb = updateHealAbsorb;
local function updateAuras(frame, unit)
-- don't overlay charmed when in vehicle
- if UnitIsCharmed(unit) and unit == frame.unit then
+ --[[if UnitIsCharmed(unit) and unit == frame.unit then
if frame.overlay.color ~= overlayColorCharm then
frame.overlay:SetVertexColor(unpack(overlayColorCharm));
frame.overlay.color = overlayColorCharm;
frame.overlay:Show();
end
- elseif UnitDebuff(unit, 1, "RAID") ~= nil then
+ else--]]
+ if UnitDebuff(unit, 1, "RAID") ~= nil then
-- something dispellable
if frame.overlay.color ~= overlayColorDispel then
frame.overlay:SetVertexColor(unpack(overlayColorDispel));
frame.overlay.color = overlayColorDispel;
- frame.overlay:Show();
+ if not frame.overlay:IsShown() then frame.overlay:Show() end
end
else
if frame.overlay.color ~= nil then
frame.overlay.color = nil;
- frame.overlay:Hide();
+ if frame.overlay:IsShown() then frame.overlay:Hide() end
end
end
end
+addon.Events.UpdateAuras = updateAuras;
local function updateAggro(frame, unit)
local status = UnitThreatSituation(unit);
frame.base:SetVertexColor(unpack(baseColor));
end
end
+addon.Events.UpdateAggro = updateAggro;
local function updateVehicle(frame)
local shouldTargetVehicle = UnitHasVehicleUI(frame.unit) and
registerUnitEvents(frame);
end
end
+addon.Events.UpdateVehicle = updateVehicle;
local function updateRole(frame, unit)
local role = UnitGroupRolesAssigned(unit);
frame.role:Hide();
end
end
+addon.Events.UpdateRole = updateRole;
local function updateReadyCheck(frame, unit)
local status = GetReadyCheckStatus(unit);
frame.ready:Hide()
end
end
+addon.Events.UpdateReadyCheck = updateReadyCheck;
local function updateRaidMarker(frame, unit)
local index = GetRaidTargetIndex(unit);
frame.targeticon:Hide();
end
end
+addon.Events.UpdateRaidMarker = updateRaidMarker;
local eventFuncs = {
["UNIT_HEALTH"] = function(frame)
- updateHealth(frame, frame.displayed);
- updateShield(frame, frame.displayed);
- updateHealAbsorb(frame, frame.displayed);
- -- no heal prediction update, that doesn't overflow too much
+ if updateHealth(frame, frame.displayed) then
+ updateShield(frame, frame.displayed);
+ updateHealAbsorb(frame, frame.displayed);
+ -- no heal prediction update, that doesn't overflow too much
+ end
end,
["UNIT_AURA"] = function(frame)
updateAuras(frame, frame.displayed);
updateText(frame, frame.displayed);
updateAuras(frame, frame.displayed);
updateShield(frame, frame.displayed);
- updateHealPred(frame, frame.displayed);
+ --updateHealPred(frame, frame.displayed);
updateHealAbsorb(frame, frame.displayed);
updateAggro(frame, frame.displayed);
updateName(frame, frame.unit);