local UnitIsCharmed = UnitIsCharmed;
local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
local SPELL_POWER_MANA = SPELL_POWER_MANA;
+local checkIndicators = OmaCheckIndicators;
local CFrame = CreateFrame("Frame", "OmaCFrame", UIParent);
local party = {};
-- configurable settings
local width, height = 80, 40;
-local anchorX, anchorY = 0, -200;
+local anchorX, anchorY = 0, -330;
local indSize = 14;
local bgColor = {0.7, 0.7, 0.7};
-local bgColorDispel = {1, 0.5, 0};
local healthColor = {0.3, 0.3, 0.3};
-local healthColorDispel = {0.8, 0.4, 0};
local shieldColor = {0, 0.7, 1};
local shieldhlColor = {0.5, 0.8, 1};
local healpredColor = {0.5, 0.6, 0.5};
local healabsorbColor = {0.1, 0.1, 0.1};
+local overlayColorDispel = {1, 0.5, 0, 0.5};
+local overlayColorCharm = {0.8, 0, 1, 0.5};
+local overlayColorAlert = {1, 0, 0, 0.5};
local powerColors = {
[SPELL_POWER_MANA] = {0, 0.5, 1},
[SPELL_POWER_RAGE] = {1, 0.2, 0},
end
local function updateAuras(frame, unit)
+ checkIndicators(frame, unit);
if UnitDebuff(unit, 1, "RAID") ~= nil then
-- something dispellable
- if frame.health.color ~= healthColorDispel then
- -- TODO change to a texture layered on top tinting whole bar
- frame.health:SetStatusBarColor(unpack(healthColorDispel));
- frame.background:SetColorTexture(unpack(bgColorDispel));
- frame.health.color = healthColorDispel;
+ if frame.overlay.color ~= overlayColorDispel then
+ frame.overlay:SetColorTexture(unpack(overlayColorDispel));
+ frame.overlay:Show();
+ frame.overlay.color = overlayColorDispel;
end
elseif UnitIsCharmed(unit) then
- -- TODO purple
+ if frame.overlay.color ~= overlayColorCharm then
+ frame.overlay:SetColorTexture(unpack(overlayColorCharm));
+ frame.overlay:Show();
+ frame.overlay.color = overlayColorCharm;
+ end
else
- if frame.health.color ~= healthColor then
- frame.health:SetStatusBarColor(unpack(healthColor));
- frame.background:SetColorTexture(unpack(bgColor));
- frame.health.color = healthColor;
+ if frame.overlay.color ~= nil then
+ frame.overlay:Hide();
+ frame.overlay.color = nil;
end
end
end
updateAuras(self, arg1);
updateShield(self, arg1);
updateHealPred(self, arg1);
+ updateHealAbsorb(self, arg1);
updateMaxHealth(self, arg1);
updateMaxPower(self, arg1);
updatePowerColor(self, arg1);
frame.inds[pos]:SetWidth(indSize);
frame.inds[pos]:SetHeight(indSize);
frame.inds[pos]:SetTexture("Interface\\AddOns\\OmaRF\\images\\rhomb");
+ frame.inds[pos]:Hide();
+ end
+ frame.major = CreateFrame("Frame", nil, frame);
+ frame.major:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -indSize + 4);
+ frame.major:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT");
+ for i = 1,3 do
+ frame.major[i] = frame.major:CreateTexture(nil, "OVERLAY");
+ if i == 1 then
+ frame.major[i]:SetPoint("TOPLEFT", frame.major, "TOPLEFT");
+ else
+ frame.major[i]:SetPoint("TOPLEFT", frame.major[i-1], "TOPLEFT");
+ end
+ frame.major[i]:SetWidth(indSize*2);
+ frame.major[i]:SetHeight(indSize*2);
+ frame.major[i]:Hide();
end
end
frame.health.bar:SetTexture("Interface\\RaidFrame\\Raid-Bar-Hp-Fill");
frame.health:SetStatusBarTexture(frame.health.bar);
frame.health:SetStatusBarColor(unpack(healthColor));
- frame.health.color = healthColor;
frame.shield = frame.health:CreateTexture(nil, "ARTWORK");
frame.shield:SetPoint("TOPLEFT", frame.health.bar, "TOPRIGHT");
frame.shield:SetPoint("BOTTOMLEFT", frame.health.bar, "BOTTOMRIGHT");
frame.mana.bar = frame.mana:CreateTexture(nil, "ARTWORK");
frame.mana.bar:SetColorTexture(1, 1, 1);
frame.mana:SetStatusBarTexture(frame.mana.bar);
+ frame.overlay = frame.health:CreateTexture(nil, "ARTWORK", nil, 2);
+ frame.overlay:SetAllPoints();
+ frame.overlay:Hide();
frame.name = frame.health:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
frame.name:SetPoint("TOPLEFT", frame.background, "TOPLEFT");
local name = UnitName(unit);
--- /dev/null
+-- Indicators.lua
+local pairs, ipairs = pairs, ipairs;
+local GetTime = GetTime;
+local UnitAura = UnitAura;
+local UnitIsPlayer = UnitIsPlayer;
+local CTimerAfter = C_Timer.After;
+
+local watchedAuras = {
+ [53563] = "TOPRIGHT",
+ [156910] = "TOPRIGHT",
+ [200025] = "TOPRIGHT",
+ [200654] = "BOTTOMLEFT",
+};
+local majorAuras = {
+ ["Psychic Assault"] = true,
+ ["Everburning Flames"] = true,
+ ["Corrupt"] = true,
+ ["Sleep Canister"] = true,
+ ["Misery"] = true,
+ ["Necrotic Embrace"] = true,
+ ["Fulminating Pulse"] = true,
+ ["Chilled Blood"] = true,
+ ["Soulblight"] = true,
+ ["Soulburst"] = true,
+ ["Soulbomb"] = true,
+ ["Aqua Bomb"] = true,
+};
+
+local updaters = {};
+local positions = {"TOPRIGHT", "BOTTOMLEFT"};
+local auraFilters = {"HELPFUL", "HARMFUL"};
+
+-- TODO text
+--[[local function remaining(expires, current)
+ if expires == 0 then return "" end
+ local remain = expires - current;
+ if remain > 60 then
+ return format("%dm", ceil(remain/60));
+ end
+ return floor(remain+0.5);
+end]]
+
+--[[local function updateIndicators(frame, unit)
+ if not frame:IsShown() then
+ return;
+ elseif not UnitIsConnected(unit) or UnitIsDeadOrGhost(unit) then
+ if frame.inds:IsShown() then frame.inds:Hide() end
+ return;
+ elseif not frame.inds:IsShown() then
+ frame.inds:Show();
+ end
+
+ local current = GetTime();
+ for pos, ind in pairs(frame.inds) do
+ if ind.expires ~= nil then
+ if OmaRF.db.profile.indicators[pos].showText then
+ ind.text:SetText(remaining(ind.expires, current));
+ end
+ else
+ if ind.icon:IsShown() then ind.icon:Hide() end
+ if ind.text:IsShown() then ind.text:Hide() end
+ end
+ end
+ for _, ind in ipairs(frame.majorInds) do
+ if ind.expires ~= nil then
+ ind.expireText:SetText(remaining(ind.expires, current));
+ else
+ if ind.icon:IsShown() then ind.icon:Hide() end
+ if ind.expireText:IsShown() then ind.expireText:Hide() end
+ if ind.stackText:IsShown() then ind.stackText:Hide() end
+ end
+ end
+end]]
+
+--local function showIndicator(ind, caster, expires, current, config)
+local function showIndicator(ind, caster)
+ --if not config.mine or UnitIsPlayer(caster) then
+ if UnitIsPlayer(caster) then
+ --if config.showIcon and not ind:IsShown() then
+ if not ind:IsShown() then
+ ind:Show();
+ end
+ --ind.expires = expires;
+ --[[if config.showText then
+ ind.text:SetText(remaining(expires, current));
+ if not ind.text:IsShown() then ind.text:Show() end
+ end]]
+ end
+end
+
+function OmaCheckIndicators(frame, unit)
+ for _, pos in pairs(positions) do
+ --ind.expires = nil;
+ if frame.inds[pos]:IsShown() then frame.inds[pos]:Hide() end
+ end
+ for i = 1,3 do
+ --ind.expires = nil;
+ if frame.major[1]:IsShown() then frame.major[1]:Hide() end
+ end
+ frame.showInds = false;
+ frame.showMajors = false;
+
+ local name, icon, count, expires, caster, id;
+ local majorPos = 1;
+ local current = GetTime();
+ for _, filter in ipairs(auraFilters) do
+ local i = 1;
+ while true do
+ name, _, icon, count, _, _, expires, caster, _, _, id = UnitAura(unit, i, filter);
+ if not id then break end
+ local pos = watchedAuras[id] or watchedAuras[name];
+ if pos then
+ frame.showInds = true;
+ if UnitIsPlayer(caster) and not frame.inds[pos]:IsShown() then
+ frame.inds[pos]:Show();
+ end
+ end
+ if (majorAuras[id] or majorAuras[name]) and majorPos <= 3 then
+ frame.major[majorPos]:SetTexture(icon);
+ frame.major[majorPos]:Show();
+ frame.showMajors = true;
+ majorPos = majorPos + 1;
+ end
+ i = i + 1;
+ end
+ end
+ if frame.showInds then
+ if not frame.inds:IsShown() then frame.inds:Show() end
+ -- create a function for updating the indicator each second
+ --[[local func = updaters[frame];
+ if not func then
+ func = function() updateIndicators(frame, unit) end;
+ updaters[frame] = func;
+ end
+ CTimerAfter(1, func);]]
+ elseif frame.inds:IsShown() then
+ frame.inds:Hide();
+ end
+ if frame.showMajors then
+ if not frame.major:IsShown() then frame.major:Show() end
+ elseif frame.major:IsShown() then
+ frame.major:Hide();
+ end
+end
+