Quantcast
WoWInterface: SVN - fernir_UI - Rev 2 - /oUF/elements/assistant.lua

WoWInterface SVN fernir_UI

[/] [oUF/] [elements/] [assistant.lua] - Rev 2

Compare with Previous | Blame | View Log

local parent, ns = ...
local oUF = ns.oUF

local Update = function(self, event)
        local unit = self.unit
        if(UnitInRaid(unit) and UnitIsRaidOfficer(unit) and not UnitIsPartyLeader(unit)) then
                self.Assistant:Show()
        else
                self.Assistant:Hide()
        end
end

local Enable = function(self)
        local assistant = self.Assistant
        if(assistant) then
                self:RegisterEvent("PARTY_MEMBERS_CHANGED", Update)

                if(assistant:IsObjectType"Texture" and not assistant:GetTexture()) then
                        assistant:SetTexture[[Interface\GroupFrame\UI-Group-AssistantIcon]]
                end

                return true
        end
end

local Disable = function(self)
        local assistant = self.Assistant
        if(assistant) then
                self:UnregisterEvent("PARTY_MEMBERS_CHANGED", Update)
        end
end

oUF:AddElement('Assistant', Update, Enable, Disable)

Compare with Previous | Blame