/
recentcast = GetTime() |
end |
end) |
Stuf:AddEvent("UNIT_POWER", manatick) |
Stuf:AddEvent("UNIT_POWER_UPDATE", manatick) |
uf.refreshfuncs["manatick"] = manatick |
Stuf:RegisterElementRefresh(uf, "manatick", "powercolorelements", true) |
end |
local function UNIT_SPELLCAST_START(unit) |
local f = castunits[unit] |
if not f then return end |
local spell, rank, displayName, icon, startTime, endTime, istrade, castid, notInterruptible = UnitCastingInfo(unit) |
local spell, displayName, icon, startTime, endTime, istrade, castid, notInterruptible = UnitCastingInfo(unit) |
if not spell then return end |
f.endtime = endTime * 0.001 |
local function UNIT_SPELLCAST_CHANNEL_START(unit) |
local f = castunits[unit] |
if not f then return end |
local spell, rank, displayName, icon, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo(unit) |
local spell, displayName, icon, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo(unit) |
if not spell then return end |
f.endtime = endTime * 0.001 |
local function UNIT_SPELLCAST_DELAYED(unit) |
local f = castunits[unit] |
if not f then return end |
local spell, rank, displayName, icon, startTime, endTime = UnitCastingInfo(unit) |
local spell, displayName, icon, startTime, endTime = UnitCastingInfo(unit) |
if not startTime then |
f:Hide() |
else |
local function UNIT_SPELLCAST_CHANNEL_UPDATE(unit) |
local f = castunits[unit] |
if not f then return end |
local spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(unit) |
local spell, displayName, icon, startTime, endTime = UnitChannelInfo(unit) |
if not startTime then |
f:Hide() |
else |
f:Show() |
end |
end |
Stuf:AddEvent("UNIT_POWER", uf.refreshfuncs[name]) |
Stuf:AddEvent("UNIT_POWER_UPDATE", uf.refreshfuncs[name]) |
Stuf:RegisterElementRefresh(uf, name, "metroelements", true) |
end |
if db.fade and not f.barfade then |
if not uf or uf.hidden then return end |
local allow, clr, bfilter, dfilter, onlymineb, onlymined = true, nil, nil, nil, nil, nil |
local name, rank, icon, count, atype, duration, endtime, ismine, isstealable |
local name, icon, count, atype, duration, endtime, ismine, isstealable |
local cache = uf.cache |
local dispellicon, buffgroup, debuffgroup, auratimers = uf.dispellicon, uf.buffgroup, uf.debuffgroup, uf.auratimers |
for i = 1, 32, 1 do -- update buffgroup |
if allow then -- prevents calling UnitBuff when it's useless |
name, rank, icon, count, atype, duration, endtime, ismine, isstealable = UnitBuff(unit, i, bfilter) |
name, icon, count, atype, duration, endtime, ismine, isstealable = UnitBuff(unit, i, bfilter) |
ismine = ismine == "player" or ismine == "vehicle" or (showpet and ismine == "pet") |
allow = name and (not onlymineb or ismine) |
end |
allow = true |
for i = 1, 40, 1 do -- update debuffgroup |
if allow then -- prevents calling UnitDebuff when it's useless |
name, rank, icon, count, atype, duration, endtime, ismine, isstealable = UnitDebuff(unit, i, dfilter) |
name, icon, count, atype, duration, endtime, ismine, isstealable = UnitDebuff(unit, i, dfilter) |
ismine = ismine == "player" or ismine == "vehicle" or (showpet and ismine == "pet") |
clr = dbgaura[atype or "none"] or dbgaura.none |
allow = name and (not onlymined or ismine) |
end |
Stuf:AddEvent("UNIT_HEALTH", UpdateHealth) |
Stuf:AddEvent("UNIT_MAXHEALTH", UpdateHealth) |
Stuf:AddEvent("UNIT_POWER", UpdatePower) |
Stuf:AddEvent("UNIT_POWER_UPDATE", UpdatePower) |
Stuf:AddEvent("UNIT_MAXPOWER", UpdatePower) |
Stuf:AddEvent("UNIT_DISPLAYPOWER", UpdatePowerType) |
core.RemoveEvent("UNIT_HEAL_PREDICTION", UpdateHealth) |
end |
if not layout.mpbar.hide or not layout.mptext.hide then |
core.AddEvent("UNIT_POWER", UpdatePower) |
core.AddEvent("UNIT_POWER_UPDATE", UpdatePower) |
core.AddEvent("UNIT_MAXPOWER", UpdatePower) |
core.AddEvent("UNIT_DISPLAYPOWER", UpdatePowerType) |
elseif changed then |
core.RemoveEvent("UNIT_POWER", UpdatePower) |
core.RemoveEvent("UNIT_POWER_UPDATE", UpdatePower) |
core.RemoveEvent("UNIT_MAXPOWER", UpdatePower) |
core.RemoveEvent("UNIT_DISPLAYPOWER", UpdatePowerType) |
end |
core.RemoveEvent("UNIT_HEAL_PREDICTION", UpdateHealth) |
end |
if not layout.mpbar.hide or not layout.mptext.hide then |
core.AddEvent("UNIT_POWER", UpdatePower) |
core.AddEvent("UNIT_POWER_UPDATE", UpdatePower) |
core.AddEvent("UNIT_MAXPOWER", UpdatePower) |
core.AddEvent("UNIT_DISPLAYPOWER", UpdatePowerType) |
elseif changed then |
core.RemoveEvent("UNIT_POWER", UpdatePower) |
core.RemoveEvent("UNIT_POWER_UPDATE", UpdatePower) |
core.RemoveEvent("UNIT_MAXPOWER", UpdatePower) |
core.RemoveEvent("UNIT_DISPLAYPOWER", UpdatePowerType) |
end |