Back to Home

ESO Lua File v101044

ingame/dyeing/dyeingtoolsample.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
ZO_DyeingToolSample = ZO_DyeingToolBase:Subclass()
function ZO_DyeingToolSample:New(...)
    return ZO_DyeingToolBase.New(self, ...)
end
function ZO_DyeingToolSample:Initialize(owner)
   ZO_DyeingToolBase.Initialize(self, owner)
end
function ZO_DyeingToolSample:Activate(fromTool, suppressSounds)
    if fromTool and not suppressSounds then
        PlaySound(SOUNDS.DYEING_TOOL_SAMPLE_SELECTED)
    end
end
function ZO_DyeingToolSample:HasSwatchSelection()
    return false
end
function ZO_DyeingToolSample:OnLeftClicked(restyleSlotData, dyeChannel)
    local dyeId = select(dyeChannel, restyleSlotData:GetPendingDyes())
    self:ProcessDyeId(dyeId)
end
function ZO_DyeingToolSample:OnSavedSetLeftClicked(dyeSetIndex, dyeChannel)
    local dyeId = select(dyeChannel, GetSavedDyeSetDyes(dyeSetIndex))
    self:ProcessDyeId(dyeId)
end
function ZO_DyeingToolSample:ProcessDyeId(dyeId)
    if dyeId > INVALID_DYE_ID then
        local playerDyeInfo = ZO_DYEING_MANAGER:GetPlayerDyeInfoById(dyeId)
        if playerDyeInfo and playerDyeInfo.known then
            local SUPPRESS_SOUNDS = true
            self.owner:SwitchToDyeingWithDyeId(dyeId, SUPPRESS_SOUNDS)
            PlaySound(SOUNDS.DYEING_TOOL_SAMPLE_USED)
        elseif not playerDyeInfo then
            ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.GENERAL_ALERT_ERROR, SI_DYEING_CANNOT_SAMPLE_NON_PLAYER_DYE)
        else
            ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.GENERAL_ALERT_ERROR, SI_DYEING_CANNOT_SAMPLE_LOCKED_DYE)
        end
    else
        ZO_Alert(UI_ALERT_CATEGORY_ERROR, SOUNDS.GENERAL_ALERT_ERROR, SI_DYEING_CANNOT_SAMPLE)
    end
end
function ZO_DyeingToolSample:GetCursorType()
    return MOUSE_CURSOR_SAMPLE
end
function ZO_DyeingToolSample:GetToolActionString()
    return SI_DYEING_TOOL_SAMPLE_TOOLTIP
end