Back to Home

ESO Lua File v100032

ingame/giftinventory/keyboard/giftinventorythanked_keyboard.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
ZO_GiftInventoryThanked_Keyboard = ZO_GiftInventoryCategory_Keyboard:Subclass()
function ZO_GiftInventorySent_Keyboard:New(...)
    return ZO_GiftInventoryCategory_Keyboard.New(self, ...)
end
function ZO_GiftInventoryThanked_Keyboard:Initialize(control)
    ZO_GiftInventoryCategory_Keyboard.Initialize(self, control, "thanked")
    
    local THANKED_TYPE = 1
    self:AddSupportedGiftState(GIFT_STATE_THANKED, THANKED_TYPE, "ZO_GiftInventoryThanked_Keyboard_Row", 52, function(control, data) self:SetupThanked(control, data) end)
    self.sortHeaderGroup:SelectHeaderByKey("seen")
    self:SetSortFunction(function(leftEntry, rightEntry) return ZO_GiftInventory_Manager.CompareSent(leftEntry.data, rightEntry.data, self.currentSortKey, self.currentSortOrder) end)
    self:SetEmptyText(GetString(SI_GIFT_INVENTORY_NO_SENT_GIFTS))
        alignment = KEYBIND_STRIP_ALIGN_RIGHT,
        -- Delete gift
        {
            name = GetString(SI_GIFT_INVENTORY_DELETE_KEYBIND),
            keybind = "UI_SHORTCUT_NEGATIVE",
            visible = function()
                return self.mouseOverRow ~= nil
            end,
            callback = function()
                local gift = ZO_ScrollList_GetData(self.mouseOverRow)
                if gift then
                    gift:View()
                    ZO_Dialogs_ShowDialog("CONFIRM_DELETE_GIFT_KEYBOARD", gift)
                end
            end,
        },
        -- View gift
        {
            name = GetString(SI_GIFT_INVENTORY_VIEW_KEYBIND),
            keybind = "UI_SHORTCUT_PRIMARY",
            visible = function()
                if self.mouseOverRow then
                    local gift = ZO_ScrollList_GetData(self.mouseOverRow)
                    return gift:GetNote() ~= ""
                end
                return false
            end,
            callback = function()
                self:ViewGift()
            end,
        },
    })
end
function ZO_GiftInventoryThanked_Keyboard:SetupThanked(control, gift)
    self:SetupRow(control, gift)
    local newTexture = control:GetNamedChild("New")
    newTexture:SetHidden(gift:HasBeenSeen())
    local iconTexture = control:GetNamedChild("Icon")
    iconTexture:SetTexture(gift:GetIcon())
    self:SetupStackCount(control, gift)
    local nameLabel = control:GetNamedChild("Name")
    nameLabel:SetText(gift:GetFormattedName())
    local recipientNameLabel = control:GetNamedChild("RecipientName")
    recipientNameLabel:SetText(gift:GetUserFacingPlayerName())
    local expiresLabel = control:GetNamedChild("Expires")
    local noteButton = control:GetNamedChild("Note")
    noteButton:SetHidden(gift:GetNote() == "")
end
function ZO_GiftInventoryThanked_Keyboard:ViewGift()
    if self.mouseOverRow then
        local gift = ZO_ScrollList_GetData(self.mouseOverRow)
        if gift:GetNote() ~= "" then
            GIFT_INVENTORY_VIEW_KEYBOARD:SetupAndShowGift(gift)
        end
    end
end
-- Begin Global XML Functions --
    GIFT_INVENTORY_THANKED_KEYBOARD:Row_OnMouseEnter(self)
end
    GIFT_INVENTORY_THANKED_KEYBOARD:Row_OnMouseExit(self)
end
    GIFT_INVENTORY_THANKED_KEYBOARD:Row_OnMouseUp(self, button, upInside)
end
    if button == MOUSE_BUTTON_INDEX_LEFT then
        GIFT_INVENTORY_THANKED_KEYBOARD:ViewGift()
    end
end
    GIFT_INVENTORY_THANKED_KEYBOARD = ZO_GiftInventoryThanked_Keyboard:New(self)
end
-- End Global XML Functions --