Back to Home

ESO Lua File v100035

ingame/giftinventory/keyboard/giftinventorydialogs_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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
-- Claim Gift
    local noteEdit = self:GetNamedChild("NoteEdit")
    local randomNoteButton = self:GetNamedChild("NoteRandomText"):GetNamedChild("Button")
    randomNoteButton:SetText(zo_iconFormat("EsoUI/Art/Market/Keyboard/giftMessageIcon_up.dds", "100%", "100%"))
    randomNoteButton:SetHandler("OnClicked", function()
        noteEdit:SetText(GetRandomGiftThankYouNoteText())
    end)
    ZO_Dialogs_RegisterCustomDialog("CONFIRM_CLAIM_GIFT_KEYBOARD",
    {
        canQueue = true,
        title =
        {
            text = SI_CONFIRM_CLAIM_GIFT_TITLE,
        },
      
        customControl = self,
        setup = function(dialog, gift)
            local noteHeaderLabel = dialog:GetNamedChild("NoteHeader")
            noteHeaderLabel:SetText(zo_strformat(SI_CONFIRM_CLAIM_GIFT_NOTE_ENTRY_HEADER, ZO_WHITE:Colorize(gift:GetUserFacingPlayerName())))
            dialog:GetNamedChild("NoteEdit"):SetText("")
        end,
        buttons =
        {
            -- Cancel Button
            {
                control = self:GetNamedChild("Cancel"),
                keybind = "DIALOG_NEGATIVE",
                text = GetString(SI_DIALOG_CANCEL),
            },
            -- Confirm Button
            {
                control = self:GetNamedChild("Confirm"),
                keybind = "DIALOG_PRIMARY",
                text = GetString(SI_DIALOG_CONFIRM),
                callback = function(dialog)
                    local noteText = dialog:GetNamedChild("NoteEdit"):GetText()
                    dialog.data:TakeGift(noteText)
                end,
                clickSound = SOUNDS.GIFT_INVENTORY_ACTION_CLAIM,
            },
        },
    })
end
-- Return Gift
    -- We don't have prewritten notes for returning gifts
    self:GetNamedChild("NoteRandomText"):SetHidden(true)
    ZO_Dialogs_RegisterCustomDialog("CONFIRM_RETURN_GIFT_KEYBOARD",
    {
        title =
        {
            text = SI_CONFIRM_RETURN_GIFT_TITLE,
        },
      
        customControl = self,
        setup = function(dialog, gift)
            dialog:GetNamedChild("NoteEdit"):SetText("")
        end,
        buttons =
        {
            -- Cancel Button
            {
                control = self:GetNamedChild("Cancel"),
                keybind = "DIALOG_NEGATIVE",
                text = GetString(SI_DIALOG_CANCEL),
            },
            -- Confirm Button
            {
                control = self:GetNamedChild("Confirm"),
                keybind = "DIALOG_PRIMARY",
                text = GetString(SI_DIALOG_CONFIRM),
                callback = function(dialog)
                    local noteText = dialog:GetNamedChild("NoteEdit"):GetText()
                    dialog.data:ReturnGift(noteText)
                end,
            },
        },
    })
end
-- Delete Gift
ZO_Dialogs_RegisterCustomDialog("CONFIRM_DELETE_GIFT_KEYBOARD",
{
    title =
    {
        text = SI_CONFIRM_DELETE_GIFT_TITLE,
    },
    mainText =
    {
        text = SI_CONFIRM_DELETE_GIFT_PROMPT,
    },
      
    buttons =
    {
        -- Confirm Button
        {
            keybind = "DIALOG_PRIMARY",
            text = GetString(SI_DIALOG_CONFIRM),
            callback = function(dialog)
                local gift = dialog.data
                gift:DeleteGift()
            end,
        },
        -- Cancel Button
        {
            keybind = "DIALOG_NEGATIVE",
            text = GetString(SI_DIALOG_CANCEL),
        },
    },
})
-- Claim Gift Notice
    local helpButton = control:GetNamedChild("HelpButton")
    ZO_Dialogs_RegisterCustomDialog("CLAIM_GIFT_NOTICE_KEYBOARD",
    {
        customControl = control,
        setup = function(dialog)
            local data = dialog.data
            helpButton:SetHidden(data.helpCategoryIndex == nil)
            helpButton:SetHandler("OnClicked", function()
                HELP:ShowSpecificHelp(data.helpCategoryIndex, data.helpIndex)
                ZO_Dialogs_ReleaseDialog(dialog)
            end)
        end,
        title =
        {
            text = SI_MARKET_PRODUCT_NAME_FORMATTER,
        },
        mainText =
        {
            text = SI_CLAIM_GIFT_NOTICE_BODY_FORMATTER,
        },
        buttons =
        {
            -- Continue Button
            {
                control = control:GetNamedChild("Continue"),
                keybind = "DIALOG_PRIMARY",
                text = GetString(SI_CLAIM_GIFT_NOTICE_CONTINUE_KEYBIND),
                callback = function(dialog)
                    ZO_Dialogs_ShowDialog("CONFIRM_CLAIM_GIFT_KEYBOARD", dialog.data.gift)
                end,
            },
            -- Cancel Button
            {
                control = control:GetNamedChild("Cancel"),
                keybind = "DIALOG_NEGATIVE",
                text = GetString(SI_DIALOG_CANCEL),
            }
        },
    })
end