You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
868 B

local parent, ns = ...
local oUF = ElvUF or oUF
local _G = _G
local UnitIsConnected = UnitIsConnected
local Update = function(self, event, unit)
if(self.unit ~= unit) or not unit then return end
local offline = self.Offline
local dc = not UnitIsConnected(unit)
if dc or _G[offline.Group].isForced then
offline:Show()
else
offline:Hide()
end
end
local Path = function(self, ...)
return (self.Offline.Override or Update) (self, ...)
end
local Enable = function(self, unit)
local offline = self.Offline
if(offline) then
offline.__owner = self
self:RegisterEvent('UNIT_CONNECTION', Path)
Update(self, nil, unit)
return true
end
end
local Disable = function(self)
local offline = self.Offline
if (offline) then
self:UnregisterEvent('UNIT_CONNECTION', Path)
self.Offline:Hide()
end
end
oUF:AddElement('SLE_Offline', Path, Enable, Disable)