local M = {};
OmaRFIndicators.Class["DRUID"] = M;
M.Auras = {
- ["Lifebloom"] = "TOPLEFT",
- ["Rejuvenation"] = "TR1",
- ["Cenarion Ward"] = "TR2",
- ["Spring Blossoms"] = "TR3",
- ["Rejuvenation (Germination)"] = "TR3",
- ["Regrowth"] = "TR4",
- ["Cultivation"] = "TR5",
+ [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
}
function M.Setup(base)
local inds = {};
- for _, pos in pairs({"TOPLEFT"}) do
- inds[pos] = base:CreateTexture(nil, "OVERLAY");
- inds[pos]:SetPoint(pos, base, pos);
- inds[pos]:SetWidth(indSize);
- inds[pos]:SetHeight(indSize);
- inds[pos]:SetTexture(rhomb);
- inds[pos]:SetVertexColor(0, 1, 0.5);
- inds[pos]:Hide();
- inds[pos].text = base:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- inds[pos].text:SetPoint("BOTTOMRIGHT", inds[pos], "BOTTOMRIGHT");
- inds[pos].text:Hide();
- end
+ inds["TOPLEFT"] = base:CreateTexture(nil, "OVERLAY");
+ inds["TOPLEFT"]:SetPoint("TOPLEFT", base, "TOPLEFT");
+ inds["TOPLEFT"]:SetWidth(indSize);
+ inds["TOPLEFT"]:SetHeight(indSize);
+ inds["TOPLEFT"]:SetTexture(rhomb);
+ inds["TOPLEFT"]:SetVertexColor(0, 1, 0.5);
+ inds["TOPLEFT"]:Hide();
+ inds["TOPLEFT"].text = base:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
+ inds["TOPLEFT"].text:SetPoint("BOTTOMRIGHT", inds["TOPLEFT"], "BOTTOMRIGHT");
+ inds["TOPLEFT"].text:Hide();
for _, pos in pairs({"TR1", "TR2", "TR3", "TR4", "TR5"}) do
inds[pos] = base:CreateTexture(nil, "OVERLAY");
inds[pos]:SetWidth(indSize/2);
M.UpdateHealAbsorb = updateHealAbsorb;
local function updateAuras(frame, unit)
- local alert = checkIndicators(frame, unit);
- if alert then
+ updateAuras(frame, unit); -- this is throttled
+ if updateMajorAuras(frame, unit) then
if frame.overlay.color ~= overlayColorAlert then
frame.overlay:SetVertexColor(unpack(overlayColorAlert));
frame.overlay.color = overlayColorAlert;
local Settings = OmaRFSettings;
local majorAuras = Settings.MajorAuras;
-local watchedAuras = {};
+local watchedAuras = {};
local updaters = {};
local updating = {};
+local updateAuras;
local M = {};
OmaRFIndicators = M;
tex.icon = true;
frame.majors[i] = tex;
end
+
+ frame.throttle = function()
+ frame.throttled = nil;
+ updateAuras(frame, frame.displayed);
+ end;
end
local function remaining(text, expires, current)
ind:Hide();
end
-function M.CheckIndicators(frame, unit)
+function M.UpdateAuras(frame, unit)
+ local current = GetTime();
+ if frame.throttled then
+ print("updateAuras throttled for ", unit); -- TODO debug print
+ return;
+ elseif frame.prevUpdate - current < 0.1 then
+ frame.throttled = true;
+ return CTimerAfter(0.1, frame.throttle);
+ end
+
for _, ind in pairs(frame.inds) do
hideInd(ind);
end
+ local icon, count, expires, id;
+ local showInds, needUpdate = false, false;
+ local i = 1;
+ while true do
+ _, _, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "PLAYER HELPFUL");
+ if not id then break end
+ local pos = watchedAuras[id];
+ if pos then
+ needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate;
+ showInds = true;
+ end
+ i = i + 1;
+ end
+
+ if showInds then
+ frame.indBase:Show();
+ if needUpdate and not updating[frame] then
+ updating[frame] = true; -- race?
+ -- create a function for updating the indicator
+ local func = updaters[frame];
+ if not func then
+ func = function() updateIndicators(frame) end;
+ updaters[frame] = func;
+ end
+ CTimerAfter(0.20, func);
+ end
+ else
+ frame.indBase:Hide();
+ end
+end
+updateAuras = M.UpdateAuras;
+
+function M.UpdateMajorAuras(frame, unit)
for _, ind in pairs(frame.majors) do
hideInd(ind);
end
- local name, icon, count, expires, caster, id;
- local showInds, showMajors, needUpdate = false, false, false;
+ local icon, count, expires, id;
+ local showMajors, needUpdate = false, false;
local majorPos = 1;
local alert = false; -- color the whole bar
local current = GetTime();
- for spell, pos in pairs(watchedAuras) do
- name, _, icon, count, _, _, expires = UnitAura(unit, spell, nil, "PLAYER HELPFUL");
- if name then
- needUpdate = showInd(frame.inds[pos], expires, current, count, icon) or needUpdate;
- showInds = true;
- end
- end
-
local i = 1;
while true do
- name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, "HARMFUL");
+ _, _, icon, count, _, _, expires, _, _, _, id = UnitAura(unit, i, "HARMFUL");
if not id or majorPos > 3 then break end
- local major = majorAuras[id] or majorAuras[name];
+ local major = majorAuras[id];
if major then
needUpdate = showInd(frame.majors[majorPos], expires, current, count, icon) or needUpdate;
if major.bar then alert = true end
i = i + 1;
end
- if showInds or showMajors then
- frame.indBase:Show();
+ if showMajors then
frame.majorBase:Show();
if needUpdate and not updating[frame] then
updating[frame] = true; -- race?
CTimerAfter(0.20, func);
end
else
- frame.indBase:Hide();
frame.majorBase:Hide();
end
-- PaladinIndicators.lua
-local pairs = pairs;
-
local indSize = OmaRFSettings.IndSize;
local rhomb = "Interface\\AddOns\\OmaRF\\images\\rhomb";
local M = {};
OmaRFIndicators.Class["PALADIN"] = M;
M.Auras = {
- ["Beacon of Light"] = "TOPRIGHT",
- ["Beacon of Faith"] = "TOPRIGHT",
- ["Beacon of Virtue"] = "TOPRIGHT",
- ["Tyr's Deliverance"] = "BOTTOMLEFT",
+ [53563] = "TOPRIGHT", -- Beacon of Light
+ [156910] = "TOPRIGHT", -- Beacon of Faith
+ [200025] = "TOPRIGHT", -- Beacon of Virtue
}
function M.Setup(base)
inds["TOPRIGHT"]:SetTexture(rhomb);
inds["TOPRIGHT"]:SetVertexColor(1, 0, 0);
inds["TOPRIGHT"]:Hide();
- inds["BOTTOMLEFT"] = base:CreateTexture(nil, "OVERLAY");
- inds["BOTTOMLEFT"]:SetPoint("BOTTOMLEFT", base, "BOTTOMLEFT");
- inds["BOTTOMLEFT"]:SetWidth(indSize);
- inds["BOTTOMLEFT"]:SetHeight(indSize);
- inds["BOTTOMLEFT"]:SetTexture(rhomb);
- inds["BOTTOMLEFT"]:SetVertexColor(1, 0.5, 0);
- inds["BOTTOMLEFT"]:Hide();
- inds["BOTTOMLEFT"].text = base:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
- inds["BOTTOMLEFT"].text:SetPoint("BOTTOMRIGHT", inds["BOTTOMLEFT"], "BOTTOMRIGHT");
- inds["BOTTOMLEFT"].text:Hide();
return inds;
end
-- PaladinIndicators.lua
-local pairs = pairs;
-
local indSize = OmaRFSettings.IndSize;
local rhomb = "Interface\\AddOns\\OmaRF\\images\\rhomb";
local M = {};
OmaRFIndicators.Class["SHAMAN"] = M;
M.Auras = {
- ["Riptide"] = "TOPRIGHT",
+ [61295] = "TOPRIGHT", -- Riptide
}
function M.Setup(base)