ESO Lua File v100010

ingame/fence/gamepad/fencewindowlaunder_gamepad.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
ZO_GamepadFenceLaunder = ZO_GamepadFenceComponent:Subclass()
function ZO_GamepadFenceLaunder:New(...)
    return ZO_GamepadFenceComponent.New(self, ...)
end
function ZO_GamepadFenceLaunder:Initialize()
    ZO_GamepadFenceComponent.Initialize(self, ZO_MODE_STORE_LAUNDER, GetString(SI_FENCE_LAUNDER_TAB))
    self:InitializeKeybindStrip(GetString(SI_ITEM_ACTION_LAUNDER))
    self:CreateModeData(SI_FENCE_LAUNDER_TAB, self.mode, "EsoUI/Art/Vendor/vendor_tabIcon_fence_up.dds", fragment, self.keybindStripDescriptor)
    self.list:SetNoItemText(GetString(SI_GAMEPAD_NO_STOLEN_ITEMS_LAUNDER))
end
function ZO_GamepadFenceLaunder:Confirm()
    local totalLaunders, laundersUsed = GetFenceLaunderTransactionInfo()
    if laundersUsed == totalLaunders then
        ZO_Alert(UI_ALERT_CATEGORY_ALERT, SOUNDS.NEGATIVE_CLICK, GetString("SI_ITEMLAUNDERRESULT", ITEM_LAUNDER_RESULT_AT_LIMIT))
        return
    end
    local selectedData = self.list:GetSelectedData()
    local bag, index = ZO_Inventory_GetBagAndIndex(selectedData)
    if self.confirmationMode then
        local quantity = STORE_WINDOW_GAMEPAD:GetSpinnerValue()
        if quantity > 0 then
            LaunderItem(bag, index, quantity)
            self:UnselectItem()
        end
    else
        if selectedData.stackCount > 1 then
            self:SelectItem()
            STORE_WINDOW_GAMEPAD:SetupSpinner(selectedData.stackCount, selectedData.stackCount, selectedData.launderPrice, selectedData.currencyType1)
        else
            LaunderItem(bag, index, 1)
        end
    end
end
function ZO_GamepadFenceLaunder:SetupEntry(control, data, selected, selectedDuringRebuild, enabled, activated)
    local price = self.confirmationMode and selected and data.launderPrice * STORE_WINDOW_GAMEPAD:GetSpinnerValue() or data.launderPrice
    self:SetupStoreItem(control, data, selected, selectedDuringRebuild, enabled, activated, price, not ZO_STORE_FORCE_VALID_PRICE, self.mode)
end
function ZO_GamepadFenceLaunder:OnSuccess()
    if not self.control:IsControlHidden() then
        PlaySound(SOUNDS.ITEM_MONEY_CHANGED)
        PlaySound(SOUNDS.FENCE_ITEM_LAUNDERED)
        STORE_WINDOW_GAMEPAD:RefreshHeaderData()
    end
end
    FENCE_LAUNDER_GAMEPAD = ZO_GamepadFenceLaunder:New()
    STORE_WINDOW_GAMEPAD:AddComponent(FENCE_LAUNDER_GAMEPAD)
end