local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
local castingColor = {1, 0.49, 0}; -- from Quartz defaults
local nointerruptColor = {0.6, 0.6, 0.6};
local channelingColor = {0.32, 0.3, 1};
local barTexture = "Interface\\AddOns\\OmaRF\\images\\minimalist";
local castingColor = {1, 0.49, 0}; -- from Quartz defaults
local nointerruptColor = {0.6, 0.6, 0.6};
local channelingColor = {0.32, 0.3, 1};
- if not bar:IsShown() then return end -- TODO little fadeout possibly
- local width = bar.icon:IsShown() and bar.cast.width or bar.cast.width; -- TODO fullwidth
+ if not bar.updating then return end
+ --local width = bar.icon:IsShown() and bar.cast.width or bar.cast.width; -- TODO fullwidth
local startTime, endTime = bar.startTime, bar.endTime;
local currentClamped = min(GetTime(), endTime);
local remaining = endTime - currentClamped;
local startTime, endTime = bar.startTime, bar.endTime;
local currentClamped = min(GetTime(), endTime);
local remaining = endTime - currentClamped;
if width <= 0 then
bar.cast:SetWidth(0.1);
else
bar.cast:SetWidth(width);
end
bar.time:SetFormattedText("%.1f", remaining);
if width <= 0 then
bar.cast:SetWidth(0.1);
else
bar.cast:SetWidth(width);
end
bar.time:SetFormattedText("%.1f", remaining);
local name, icon, startTime, endTime, noInterrupt, id;
if channeling then
name, _, _, icon, startTime, endTime, _, noInterrupt = UnitChannelInfo(unit);
local name, icon, startTime, endTime, noInterrupt, id;
if channeling then
name, _, _, icon, startTime, endTime, _, noInterrupt = UnitChannelInfo(unit);
else
_, _, name, icon, startTime, endTime, _, _, noInterrupt, id = UnitCastingInfo(unit);
else
_, _, name, icon, startTime, endTime, _, _, noInterrupt, id = UnitCastingInfo(unit);
bar.startTime = startTime / 1000;
bar.endTime = endTime / 1000;
-- don't show samwise for non-existent icons
bar.startTime = startTime / 1000;
bar.endTime = endTime / 1000;
-- don't show samwise for non-existent icons
end
bar.spell:SetText(ssub(name, 1, bar.spell.count));
bar.time:SetFormattedText("%.1f", (endTime - startTime)/1000);
end
bar.spell:SetText(ssub(name, 1, bar.spell.count));
bar.time:SetFormattedText("%.1f", (endTime - startTime)/1000);
local function applyDelay(bar, unit, channeling)
local startTime, endTime;
local function applyDelay(bar, unit, channeling)
local startTime, endTime;
else
_, _, _, _, startTime, endTime = UnitCastingInfo(unit);
end
else
_, _, _, _, startTime, endTime = UnitCastingInfo(unit);
end
+ ["PLAYER_TARGET_CHANGED"] = function(bar)
+ hideBar(bar);
+ if not startCast(bar, bar.unit) then
+ startCast(bar, bar.unit, true);
+ end
+ end,
["UNIT_SPELLCAST_CHANNEL_START"] = function(bar, unit)
startCast(bar, unit, true);
end,
["UNIT_SPELLCAST_CHANNEL_START"] = function(bar, unit)
startCast(bar, unit, true);
end,
local function onEvent(bar, event, unit)
if unit == bar.unit or (bar.unit == "player" and unit == "vehicle") then
local function onEvent(bar, event, unit)
if unit == bar.unit or (bar.unit == "player" and unit == "vehicle") then
bar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE");
bar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
bar:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
bar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE");
bar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE");
bar:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE");
-- trigger initial check
if not startCast(bar, bar.unit) then
startCast(bar, bar.unit, true);
-- trigger initial check
if not startCast(bar, bar.unit) then
startCast(bar, bar.unit, true);
bar.cast.fullwidth = bar:GetWidth() - 2; -- for casts without icon
bar.cast:SetWidth(bar.cast.width);
bar.cast:SetTexture(barTexture);
bar.cast.fullwidth = bar:GetWidth() - 2; -- for casts without icon
bar.cast:SetWidth(bar.cast.width);
bar.cast:SetTexture(barTexture);
bar.spell = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
bar.spell:SetPoint("LEFT", bar.icon, "RIGHT", 2, 0);
bar.spell.count = ceil(bar.cast:GetWidth()/10);
bar.time = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
bar.time:SetPoint("RIGHT", bar, "RIGHT", -2, 0);
bar:SetScript("OnEvent", onEvent);
bar.spell = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
bar.spell:SetPoint("LEFT", bar.icon, "RIGHT", 2, 0);
bar.spell.count = ceil(bar.cast:GetWidth()/10);
bar.time = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
bar.time:SetPoint("RIGHT", bar, "RIGHT", -2, 0);
bar:SetScript("OnEvent", onEvent);