ESO Lua File v100011

ingame/tradinghouse/gamepad/tradinghouse_sell_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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
TRADING_HOUSE_SELL_EVENT_NAMESPACE = "tradingHouseSellNamespace"
local ZO_GamepadTradingHouse_Sell = ZO_GamepadTradingHouse_ItemList:Subclass()
function ZO_GamepadTradingHouse_Sell:New(...)
    local sellStore = ZO_GamepadTradingHouse_ItemList.New(self, ...)
    return sellStore
end
function ZO_GamepadTradingHouse_Sell:Initialize(control)
    ZO_GamepadTradingHouse_ItemList.Initialize(self, control)
    GAMEPAD_TRADING_HOUSE_SELL_FRAGMENT = ZO_FadeSceneFragment:New(self.control)
    self:SetFragment(GAMEPAD_TRADING_HOUSE_SELL_FRAGMENT)
end
function ZO_GamepadTradingHouse_Sell:UpdateItemSelectedTooltip(selectedData)
    if selectedData then
        local bag, index = ZO_Inventory_GetBagAndIndex(selectedData)
        GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_MOVABLE_TOOLTIP, bag, index)
        local _, _, _, _, _, equipType = GetItemInfo(bag, index)
        local equipSlot = ZO_InventoryUtils_GetEquipSlotForEquipType(equipType)
        if equipSlot and GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_RIGHT_TOOLTIP, BAG_WORN, equipSlot) then
            ZO_InventoryUtils_UpdateTooltipEquippedIndicatorText(GAMEPAD_RIGHT_TOOLTIP, equipSlot)
            GAMEPAD_TOOLTIPS:SetStatusLabelHidden(GAMEPAD_RIGHT_TOOLTIP, false)
        else
            GAMEPAD_TOOLTIPS:SetStatusLabelHidden(GAMEPAD_RIGHT_TOOLTIP, true)
            GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
        end
    else
        GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_MOVABLE_TOOLTIP)
        GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
    end
end
function ZO_GamepadTradingHouse_Sell:SetupSelectedSellItem(selectedItem)
    local bag, index = ZO_Inventory_GetBagAndIndex(selectedItem)
    ZO_TradingHouse_CreateListing_Gamepad_BeginCreateListing(selectedItem, bag, index, selectedItem.stackSellPrice)
end
function ZO_GamepadTradingHouse_Sell:UpdateForGuildChange()
    if not self.control:IsHidden() then
        self:UpdateListForCurrentGuild()
    end
end
function ZO_GamepadTradingHouse_Sell:UpdateListForCurrentGuild()
    local guildId = GetSelectedTradingHouseGuildId()
    if CanSellOnTradingHouse(guildId) then
        self.itemList:Activate()
        self.listControl:SetHidden(false)
        self.messageControl:SetHidden(true)
    else
        self.itemList:Deactivate()
        self.listControl:SetHidden(true)
        self.messageControl:SetHidden(false)
    end
    self:UpdateKeybind()
end
local function SellItemSetupFunction(control, data, selected, selectedDuringRebuild, enabled, activated)
    ZO_SharedGamepadEntry_OnSetup(control, data, selected, selectedDuringRebuild, enabled, activated)
    local PRICE_INVALID = false
    local priceControl = control:GetNamedChild("Price")
    ZO_CurrencyControl_SetSimpleCurrency(priceControl, CURRENCY_TYPE_MONEY, data.stackSellPrice, GAMEPAD_INVENTORY_CURRENCY_OPTIONS, CURRENCY_SHOW_ALL, PRICE_INVALID)
end
function ZO_GamepadTradingHouse_Sell:OnSelectionChanged(list, selectedData, oldSelectedData)
    self:UpdateItemSelectedTooltip(selectedData) 
end
-- Overriden functions
function ZO_GamepadTradingHouse_Sell:InitializeList()
    local function OnSelectionChanged(...)
        self:OnSelectionChanged(...)
    end
    local USE_TRIGGERS = true
    local SORT_FUNCTION = nil
    local CATEGORIZATION_FUNCTION = nil
    local ENTRY_SETUP_CALLBACK = nil
    self.messageControl = self.control:GetNamedChild("StatusMessage")
    self.itemList = ZO_GamepadInventoryList:New(self.listControl, BAG_BACKPACK, SLOT_TYPE_ITEM, OnSelectionChanged, ENTRY_SETUP_CALLBACK, 
                                                    CATEGORIZATION_FUNCTION, SORT_FUNCTION, USE_TRIGGERS, "ZO_TradingHouse_Sell_Item_Gamepad", SellItemSetupFunction)
    self.itemList:SetItemFilterFunction(function(slot) return slot.quality ~= ITEM_QUALITY_TRASH and not slot.stolen end)
end
function ZO_GamepadTradingHouse_Sell:OnShowing()
end
function ZO_GamepadTradingHouse_Sell:OnShown()
    self:UpdateKeybind()
end
function ZO_GamepadTradingHouse_Sell:InitializeKeybindStripDescriptors()
    self.keybindStripDescriptor = {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        {
            name = function()
                local currentListings, maxListings = GetTradingHouseListingCounts()
                if(currentListings < maxListings) then
                    return zo_strformat(SI_GAMEPAD_TRADING_HOUSE_LISTING_CREATE, currentListings, maxListings)
                else
                    return zo_strformat(SI_GAMEPAD_TRADING_HOUSE_LISTING_CREATE_FULL, currentListings, maxListings)
                end
            end,
            keybind = "UI_SHORTCUT_PRIMARY",
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            callback = function()
                local selectedItem = self.itemList:GetSelectedData()
                self:SetupSelectedSellItem(selectedItem)
            end,
            visible = function()
                local guildId = GetSelectedTradingHouseGuildId()
                local selectedItem = self.itemList:GetSelectedData()
                return selectedItem and CanSellOnTradingHouse(guildId)
            end,
            enabled = function()
                local currentListings, maxListings = GetTradingHouseListingCounts()
                return currentListings < maxListings
            end
        },
        {
            name = GetString(SI_TRADING_HOUSE_GUILD_LABEL),
            keybind = "UI_SHORTCUT_TERTIARY",
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            callback = function()
                self:DisplayChangeGuildDialog()
            end,
        },
    }
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
end
function ZO_GamepadTradingHouse_Sell:GetFragmentGroup()
     return {GAMEPAD_TRADING_HOUSE_SELL_FRAGMENT}
end
function ZO_GamepadTradingHouse_Sell:OnHiding()
    GAMEPAD_TOOLTIPS:Reset(GAMEPAD_RIGHT_TOOLTIP)
end
function ZO_GamepadTradingHouse_Sell:DeactivateForResponse()
    ZO_GamepadTradingHouse_BaseList.DeactivateForResponse(self)
    self.messageControl:SetHidden(true)
end
    GAMEPAD_TRADING_HOUSE_SELL = ZO_GamepadTradingHouse_Sell:New(control)
end
---------------------------------
-- Trading House Create Listing
---------------------------------
local LISTING_PRICE_MODE = 1
local LISTING_FEE_MODE = 2
local LISTING_HOUSE_CUT_MODE = 3
local IS_PREVIEW = true
local LISTING_CURRENCY_ERROR_OPTIONS =
{
    showTooltips = false,
    useShortFormat = true,
    font = "ZoFontGamepad34",
    iconSide = RIGHT,
    iconSize = 28,
    overrideTexture = "EsoUI/Art/currency/gamepad/gp_gold.dds",
    color = ZO_ERROR_COLOR
}
ZO_GamepadTradingHouse_CreateListing = ZO_Object:Subclass()
function ZO_GamepadTradingHouse_CreateListing:New(...)
    local createListing = ZO_Object:New(self)
    createListing:Initialize(...)
    return createListing
end
function ZO_GamepadTradingHouse_CreateListing:Initialize(control)
    self.control = control
    self.isInitialized = false
    self.listingPrice = 0
    self.listingFee = 0
    self.focusMode = LISTING_PRICE_MODE
    TRADING_HOUSE_CREATE_LISTING_GAMEPAD_SCENE = ZO_InteractScene:New("gamepad_trading_house_create_listing", SCENE_MANAGER, ZO_TRADING_HOUSE_INTERACTION)
    TRADING_HOUSE_CREATE_LISTING_GAMEPAD_SCENE:RegisterCallback("StateChange", function(...) self:OnStateChanged(...) end)
end
function ZO_GamepadTradingHouse_CreateListing:PerformDeferredInitialization()
    if self.isInitialized then return nil end
    
    self:InitializeList()
    self.validPrice = true
    self.isInitialized = true
end
function ZO_GamepadTradingHouse_CreateListing:InitializeKeybindStripDescriptors()
    self.keybindStripDescriptor = {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        {
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            keybind = "UI_SHORTCUT_PRIMARY",
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            callback = function()
                self:FocusPriceSelector()
            end,
            visible = function() 
                return self.focusMode == LISTING_PRICE_MODE 
            end
        },
        {
            name = GetString(SI_GAMEPAD_TRADING_HOUSE_CREATE_LISTING_CONFIRM),
            keybind = "UI_SHORTCUT_SECONDARY",
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            callback = function()
                self:ShowListItemConfirmation()
            end,
            visible = function() 
                return self.validPrice
            end
        },
    }
    ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
    self.priceSelectorKeybindStripDescriptor = 
    {
        alignment = KEYBIND_STRIP_ALIGN_LEFT,
        KEYBIND_STRIP:GenerateGamepadBackButtonDescriptor(function() self:UnfocusPriceSelector() end),
        {
            name = GetString(SI_GAMEPAD_SELECT_OPTION),
            keybind = "UI_SHORTCUT_PRIMARY",
            visible = function()
                return self.validPrice
            end,
            callback = function()
                self:SetListingPrice(self.priceSelector:GetValue())
                self:UnfocusPriceSelector()
            end,
        }
    }
end
function ZO_GamepadTradingHouse_CreateListing:InitializeHeader()
    self.header = self.control:GetNamedChild("HeaderContainer").header
    ZO_GamepadGenericHeader_Initialize(self.header, ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE)
    local function GetGuildTitle(control)
          local _, guildName = GetCurrentTradingHouseGuildDetails()
          if guildName ~= "" then
               return GetString(SI_TRADING_HOUSE_GUILD_HEADER)
          else
               return nil
          end
     end
     local function GetGuildName(control)
         local _, guildName = GetCurrentTradingHouseGuildDetails()
          if guildName ~= "" then
               return guildName
          else
               return nil
          end
     end
    local function UpdateGold(control)
        ZO_CurrencyControl_SetSimpleCurrency(control, CURRENCY_TYPE_MONEY, GetCurrentMoney(), GAMEPAD_INVENTORY_BANKED_CURRENCY_OPTIONS)
          return true
    end
    local function GetCapacityString()
        return zo_strformat(SI_GAMEPAD_INVENTORY_CAPACITY_FORMAT, GetNumBagUsedSlots(BAG_BACKPACK), GetBagSize(BAG_BACKPACK))
    end
    self.headerData = {
          data1HeaderText = GetGuildTitle,
          data1Text = GetGuildName,
        data2HeaderText = GetString(SI_GAMEPAD_GUILD_BANK_AVAILABLE_FUNDS),
        data2Text = UpdateGold,
        data3HeaderText = GetString(SI_GAMEPAD_INVENTORY_CAPACITY),
        data3Text = GetCapacityString,
        titleText = GetString(SI_GAMEPAD_TRADING_HOUSE_CREATE_LISTING_TITLE)
    }
end
function ZO_GamepadTradingHouse_CreateListing:InitializeControls()
    self.priceSelectorControl = self.control:GetNamedChild("ListingPriceSelectorContainer")
    self.priceSelector = ZO_CurrencySelector_Gamepad:New(self.priceSelectorControl:GetNamedChild("Selector"))
    self.priceSelector:SetClampValues(true)
    self.priceSelector:RegisterCallback("OnValueChanged", function() self:ValidatePriceSelectorValue(self.priceSelector:GetValue()) end)
    
    local CLAMP_VALUES = true
    self.priceSelector:SetClampValues(CLAMP_VALUES)
    self.priceSelector:SetMaxValue(MAX_PLAYER_MONEY)
    self.listingPriceControl = self.control:GetNamedChild("ListingPrice")
    self.listingPriceAmountLabel = self.listingPriceControl:GetNamedChild("AmountLabel")
    self.listingFeeControl = self.control:GetNamedChild("ListingFee")
    self.listingFeeAmountLabel = self.listingFeeControl:GetNamedChild("AmountLabel")
    self.listingHouseCutControl = self.control:GetNamedChild("HouseCut")
    self.listingHouseCutAmountLabel = self.listingHouseCutControl:GetNamedChild("AmountLabel")
    self.listingProfitControl = self.control:GetNamedChild("Profit")
    self.listingProfitAmountLabel = self.listingProfitControl:GetNamedChild("AmountLabel")
    
end
function ZO_GamepadTradingHouse_CreateListing:InitializeList()
    local entries = 
    {
        {
            control = self.listingPriceControl,
            highlight = self.listingPriceControl:GetNamedChild("Focus"),
            mode = LISTING_PRICE_MODE
        },
        {
            control = self.listingFeeControl,
            highlight = self.listingFeeControl:GetNamedChild("Focus"),
            mode = LISTING_FEE_MODE
        },
        {
            control = self.listingHouseCutControl,
            highlight = self.listingHouseCutControl:GetNamedChild("Focus"),
            mode = LISTING_HOUSE_CUT_MODE
        }
    }
    self.focus = ZO_GamepadFocus:New()
    for _, v in pairs(entries) do
        self.focus:AddEntry(v)
    end
    
    self.focus:SetFocusChangedCallback(function(...) self:OnFocusChanged(...)  end)
end
function ZO_GamepadTradingHouse_CreateListing:OnFocusChanged(selectedData)
    if not selectedData then return nil end
    PlaySound(SOUNDS.HOR_LIST_ITEM_SELECTED)
    self.focusMode = selectedData.mode
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
    self:UpdateTooltip()
end
function ZO_GamepadTradingHouse_CreateListing:OnStateChanged(oldState, newState)
    if newState == SCENE_SHOWING then
        self:Showing()
    elseif newState == SCENE_HIDING then
        self:Hiding()
    end
end
function ZO_GamepadTradingHouse_CreateListing:Showing()
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
    self.focus:Activate()
    self.focus:SetFocusToFirstEntry()
    self:SetListingPrice(self.listingPrice)
end
function ZO_GamepadTradingHouse_CreateListing:Hiding()
    self.focus:Deactivate()
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GamepadTradingHouse_CreateListing:FocusPriceSelector()
    self.priceSelector:SetValue(self.listingPrice)
    self.listingPriceControl:SetHidden(true)
    self.priceSelectorControl:SetHidden(false)
    self.focus:Deactivate()
    self.priceSelector:Activate()
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
    KEYBIND_STRIP:AddKeybindButtonGroup(self.priceSelectorKeybindStripDescriptor)
    self.settingPrice = true
end
function ZO_GamepadTradingHouse_CreateListing:UnfocusPriceSelector()
    if self.settingPrice then
        self.priceSelectorControl:SetHidden(true)
        self.listingPriceControl:SetHidden(false)
        self.priceSelector:Deactivate()
        self.focus:Activate()
        KEYBIND_STRIP:RemoveKeybindButtonGroup(self.priceSelectorKeybindStripDescriptor)
        KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
        self:SetListingPrice(self.listingPrice)
        self.settingPrice = false
    end
end
function ZO_GamepadTradingHouse_CreateListing:ValidatePriceSelectorValue(price)
    self:SetListingPrice(price, IS_PREVIEW)
    self.priceSelector:SetTextColor(self.validPrice and ZO_SELECTED_TEXT or ZO_ERROR_COLOR)
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.priceSelectorKeybindStripDescriptor)
end
function ZO_GamepadTradingHouse_CreateListing:SetControlAmountLabel(control, amount, hasError)
    ZO_CurrencyControl_SetSimpleCurrency(control, CURRENCY_TYPE_MONEY, amount, hasError and LISTING_CURRENCY_ERROR_OPTIONS or GAMEPAD_INVENTORY_CURRENCY_OPTIONS)
end
function ZO_GamepadTradingHouse_CreateListing:SetListingPrice(price, isPreview)
    local listingFee, tradingHouseCut, profit = GetTradingHousePostPriceInfo(price)
    
    self.validPrice = (GetCurrentMoney() >= listingFee) and (price > 0) and (price <= MAX_PLAYER_MONEY)
    local HAS_ERROR = not self.validPrice
    self.listingFee = listingFee
    self:SetControlAmountLabel(self.listingPriceAmountLabel, price, HAS_ERROR)
    self:SetControlAmountLabel(self.listingFeeAmountLabel, listingFee, HAS_ERROR)
    self:SetControlAmountLabel(self.listingHouseCutAmountLabel, tradingHouseCut, HAS_ERROR)
    self:SetControlAmountLabel(self.listingProfitAmountLabel, profit, HAS_ERROR)
    
    if not isPreview then
        self.listingPrice = price
        KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
    end
end
function ZO_GamepadTradingHouse_CreateListing:SetupListing(selectedData, bag, index, listingPrice)
    self.selectedData = selectedData
    self.itemBag = bag
    self.itemIndex = index
    self.listingPrice = listingPrice
end
function ZO_GamepadTradingHouse_CreateListing:InitializeTooltip()
    local LEFT_HIDDEN = true
    local RIGHT_VISIBLE = false
    local anchors = 
    {
        ZO_Anchor:New(TOPLEFT, self.control, TOPRIGHT, 0, 100), 
        ZO_Anchor:New(BOTTOMLEFT, self.control, BOTTOMRIGHT, 0, -200),
    }
    GAMEPAD_TOOLTIPS:SetMovableTooltipAnchors(anchors)
    GAMEPAD_TOOLTIPS:SetMovableTooltipVerticalRules(LEFT_HIDDEN, RIGHT_VISIBLE)
    GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_MOVABLE_TOOLTIP, self.itemBag, self.itemIndex)
end
function ZO_GamepadTradingHouse_CreateListing:LayoutHelpInformation(tooltip, title, description)
    local topSection = tooltip:AcquireSection(tooltip:GetStyle("topSection"))
    topSection:AddLine(title, tooltip:GetStyle("title"))
    tooltip:AddSection(topSection)
    local bodySection = tooltip:AcquireSection(tooltip:GetStyle("bodySection"))
    bodySection:AddLine(description, tooltip:GetStyle("bodyDescription"))
    tooltip:AddSection(bodySection)
end
function ZO_GamepadTradingHouse_CreateListing:UpdateTooltip()
    local tooltip = GAMEPAD_TOOLTIPS:GetTooltip(GAMEPAD_MOVABLE_TOOLTIP)
    tooltip:ClearLines()
    if self.focusMode == LISTING_FEE_MODE then
        self:LayoutHelpInformation(tooltip, GetString(SI_TRADING_HOUSE_POSTING_LISTING_FEE), zo_strformat(SI_TRADING_HOUSE_POSTING_LISTING_FEE_TOOLTIP, GetTradingHouseListingPercentage()))
    elseif self.focusMode == LISTING_HOUSE_CUT_MODE then
        self:LayoutHelpInformation(tooltip, GetString(SI_TRADING_HOUSE_POSTING_TH_CUT), zo_strformat(SI_TRADING_HOUSE_POSTING_CUT_TOOLTIP, GetTradingHouseCutPercentage()))
    else
        GAMEPAD_TOOLTIPS:LayoutBagItem(GAMEPAD_MOVABLE_TOOLTIP, self.itemBag, self.itemIndex)
    end
end
function ZO_GamepadTradingHouse_CreateListing:ShowListItemConfirmation()
    SetPendingItemPost(BAG_BACKPACK, self.selectedData.slotIndex, self.selectedData.stackCount)
    ZO_GamepadTradingHouse_Dialogs_DisplayConfirmationDialog(self.selectedData, "TRADING_HOUSE_CONFIRM_SELL_ITEM", self.listingPrice)
end
--[[ Globals ]]--
    TRADING_HOUSE_CREATE_LISTING_GAMEPAD = ZO_GamepadTradingHouse_CreateListing:New(control)
end
function ZO_TradingHouse_CreateListing_Gamepad_BeginCreateListing(selectedData, bag, index, listingPrice)
    TRADING_HOUSE_CREATE_LISTING_GAMEPAD:SetupListing(selectedData, bag, index, listingPrice)
    SCENE_MANAGER:Push("gamepad_trading_house_create_listing")
end