WoWInterface SVN fernir_UI

[/] [oUF/] [elements/] [lfdrole.lua] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 Wildbreath-135052
local parent, ns = ...
2 Wildbreath-135052
local oUF = ns.oUF
3 Wildbreath-135052
 
4 Wildbreath-135052
local Update = function(self, event)
5 Wildbreath-135052
        local lfdrole = self.LFDRole
6 Wildbreath-135052
        local isTank, isHealer, isDamage = UnitGroupRolesAssigned(self.unit)
7 Wildbreath-135052
 
8 Wildbreath-135052
        if isTank then
9 Wildbreath-135052
                lfdrole:SetTexCoord(0, 19/64, 22/64, 41/64)
10 Wildbreath-135052
                lfdrole:Show()
11 Wildbreath-135052
        elseif isHealer then
12 Wildbreath-135052
                lfdrole:SetTexCoord(20/64, 39/64, 1/64, 20/64)
13 Wildbreath-135052
                lfdrole:Show()
14 Wildbreath-135052
        elseif isDamage then
15 Wildbreath-135052
                lfdrole:SetTexCoord(20/64, 39/64, 22/64, 41/64)
16 Wildbreath-135052
                lfdrole:Show()
17 Wildbreath-135052
        else
18 Wildbreath-135052
                lfdrole:Hide()
19 Wildbreath-135052
        end
20 Wildbreath-135052
end
21 Wildbreath-135052
 
22 Wildbreath-135052
local Enable = function(self)
23 Wildbreath-135052
        local lfdrole = self.LFDRole
24 Wildbreath-135052
        if(lfdrole) then
25 Wildbreath-135052
                if self.unit == "player" then
26 Wildbreath-135052
                        self:RegisterEvent("PLAYER_ROLES_ASSIGNED", Update)
27 Wildbreath-135052
                else
28 Wildbreath-135052
                        self:RegisterEvent("PARTY_MEMBERS_CHANGED", Update)
29 Wildbreath-135052
                end
30 Wildbreath-135052
 
31 Wildbreath-135052
                if(lfdrole:IsObjectType"Texture" and not lfdrole:GetTexture()) then
32 Wildbreath-135052
                        lfdrole:SetTexture[[Interface\LFGFrame\UI-LFG-ICON-PORTRAITROLES]]
33 Wildbreath-135052
                end
34 Wildbreath-135052
 
35 Wildbreath-135052
                return true
36 Wildbreath-135052
        end
37 Wildbreath-135052
end
38 Wildbreath-135052
 
39 Wildbreath-135052
local Disable = function(self)
40 Wildbreath-135052
        local lfdrole = self.LFDRole
41 Wildbreath-135052
        if(lfdrole) then
42 Wildbreath-135052
                self:UnregisterEvent("PLAYER_ROLES_ASSIGNED", Update)
43 Wildbreath-135052
                self:UnregisterEvent("PARTY_MEMBERS_CHANGED", Update)
44 Wildbreath-135052
        end
45 Wildbreath-135052
end
46 Wildbreath-135052
 
47 Wildbreath-135052
oUF:AddElement('LFDRole', Update, Enable, Disable)