local function onUpdate(bar)
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
local function onUpdate(bar)
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
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);
+ ["PLAYER_TARGET_CHANGED"] = function(bar)
+ bar:Hide();
+ 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,
if unit == bar.unit or (bar.unit == "player" and unit == "vehicle") then
--print(unit, event)
events[event](bar, unit);
if unit == bar.unit or (bar.unit == "player" and unit == "vehicle") then
--print(unit, event)
events[event](bar, unit);
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");
bar:SetScript("OnUpdate", onUpdate);
-- trigger initial check
if not startCast(bar, bar.unit) then
bar:SetScript("OnUpdate", onUpdate);
-- trigger initial check
if not startCast(bar, bar.unit) then
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.spell = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
bar.spell:SetPoint("LEFT", bar.icon, "RIGHT", 2, 0);
bar.spell.count = ceil(bar.cast:GetWidth()/10);