Back to Home

ESO Lua File v101050

ingame/vengeance/vengeance_templates.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ZO_VENGEANCE_PERK_TILE_ICON_DIMENSIONS = 52
ZO_VENGEANCE_PERK_TILE_ICON_BORDER_DIMENSIONS = 104
-----------------------------
-- Vengeance Perk Framed Icon
-----------------------------
ZO_VengeancePerk_Icon = ZO_InitializingObject:Subclass()
function ZO_VengeancePerk_Icon:Initialize(control)
    self.control = control
    control.object = self
    self.icon = control:GetNamedChild("Icon")
    self.border = control:GetNamedChild("Border")
    self.background = control:GetNamedChild("Background")
end
-- Setting this will set the border to the specified slot, otherwise the perk slot will be used.
function ZO_VengeancePerk_Icon:SetPerkSlot(slot)
    self.slot = slot
end
function ZO_VengeancePerk_Icon:SetPerkData(perkData)
    if perkData then
        self.icon:SetTexture(perkData:GetIcon())
        if self.slot then
            self.border:SetTexture(ZO_VENGEANCE_MANAGER:GetPerkBorderBySlot(self.slot))
            self.background:SetTexture(ZO_VENGEANCE_MANAGER:GetPerkBackgroundBySlot(self.slot))
        else
            self.border:SetTexture(perkData:GetBorderTexture())
            self.background:SetTexture(perkData:GetBackgroundTexture())
        end
    elseif self.slot then
        self.icon:SetTexture(ZO_VENGEANCE_MANAGER:GetEmptyPerkIconBySlot(self.slot))
        self.border:SetTexture(ZO_VENGEANCE_MANAGER:GetPerkBorderBySlot(self.slot))
        self.background:SetTexture(ZO_VENGEANCE_MANAGER:GetPerkBackgroundBySlot(self.slot))
    else
        -- Default to red if no slot
        self.icon:SetTexture(ZO_VENGEANCE_MANAGER:GetEmptyPerkIconBySlot(VENGEANCE_PERK_SLOT_RED))
        self.border:SetTexture(ZO_VENGEANCE_MANAGER:GetPerkBorderBySlot(VENGEANCE_PERK_SLOT_RED))
        self.background:SetTexture(ZO_VENGEANCE_MANAGER:GetPerkBackgroundBySlot(VENGEANCE_PERK_SLOT_RED))
    end
    self.perkData = perkData
end
function ZO_VengeancePerk_Icon:SetPerkDisabled(isDisabled)
    local desaturation = isDisabled and 1 or 0
    self.icon:SetDesaturation(desaturation)
    self.border:SetDesaturation(desaturation)
end
-----------------------------
-- Global XML Functions
-----------------------------
function ZO_VengeancePerk_Icon.OnControlInitialized(control)
    ZO_VengeancePerk_Icon:New(control)
end