diff --git a/esoui/ingame/fence/keyboard/fence_keyboard.lua b/esoui/ingame/fence/keyboard/fence_keyboard.lua
index 51e915d..a845377 100755
--- a/esoui/ingame/fence/keyboard/fence_keyboard.lua
+++ b/esoui/ingame/fence/keyboard/fence_keyboard.lua
@@ -9,6 +9,11 @@ function ZO_Fence_Keyboard:New(...)
end
function ZO_Fence_Keyboard:Initialize(control)
+ local resetTimeControl = control:GetNamedChild("ResetTime")
+ self.resetTimeControl = resetTimeControl
+ self.resetTimeStatControl = resetTimeControl:GetNamedChild("Stat")
+ self.resetTimeValueControl = resetTimeControl:GetNamedChild("Value")
+
-- Call base initialize
ZO_Fence_Base.Initialize(self, control)
SYSTEMS:RegisterKeyboardObject("fence", self)
@@ -29,10 +34,23 @@ function ZO_Fence_Keyboard:Initialize(control)
-- Initialize Mode Bar
self:InitializeModeBar()
+
+ local lastUpdateSeconds = 0
+ local function OnUpdate(control, currentFrameTimeSeconds)
+ if currentFrameTimeSeconds - lastUpdateSeconds > 1 then
+ self:RefreshFooter()
+ lastUpdateSeconds = currentFrameTimeSeconds
+ end
+ end
+ control:SetHandler("OnUpdate", OnUpdate)
end
-function ZO_Fence_Keyboard:InitializeModeBar()
+function ZO_Fence_Keyboard:InitializeModeBar(enableSell, enableLaunder)
+ if not self.modeBar then
self.modeBar = ZO_SceneFragmentBar:New(ZO_Fence_Keyboard_WindowMenuBar)
+ else
+ self.modeBar:RemoveAll()
+ end
local function CreateButtonData(normal, pressed, highlight, clickSound, tutorialTrigger, additionalCallback)
return {
@@ -60,6 +78,7 @@ function ZO_Fence_Keyboard:InitializeModeBar()
}
--Sell Button
+ if enableSell then
local sellButtonData = CreateButtonData("EsoUI/Art/Vendor/vendor_tabIcon_sell_up.dds",
"EsoUI/Art/Vendor/vendor_tabIcon_sell_down.dds",
"EsoUI/Art/Vendor/vendor_tabIcon_sell_over.dds",
@@ -68,24 +87,29 @@ function ZO_Fence_Keyboard:InitializeModeBar()
function() FENCE_MANAGER:OnEnterSell() end)
self.modeBar:Add(SI_STORE_MODE_SELL, { INVENTORY_FRAGMENT, BACKPACK_FENCE_LAYOUT_FRAGMENT }, sellButtonData, stackAllButton)
+ end
--Launder Button
+ if enableLaunder then
local launderButtonData = CreateButtonData("EsoUI/Art/Vendor/vendor_tabIcon_fence_up.dds",
"EsoUI/Art/Vendor/vendor_tabIcon_fence_down.dds",
"EsoUI/Art/Vendor/vendor_tabIcon_fence_over.dds",
SOUNDS.MENU_BAR_CLICK,
TUTORIAL_TRIGGER_LAUNDER_OPENED,
function() FENCE_MANAGER:OnEnterLaunder() end)
+
self.modeBar:Add(SI_FENCE_LAUNDER_TAB, { INVENTORY_FRAGMENT, BACKPACK_LAUNDER_LAYOUT_FRAGMENT }, launderButtonData, stackAllButton)
end
+end
--[[
---- Callbacks
--]]
-function ZO_Fence_Keyboard:OnOpened(sellsUsed, laundersUsed)
+function ZO_Fence_Keyboard:OnOpened(enableSell, enableLaunder)
if not IsInGamepadPreferredMode() then
- self.mode = ZO_MODE_STORE_SELL_STOLEN
+ self:InitializeModeBar(enableSell, enableLaunder)
+ self.mode = enableSell and ZO_MODE_STORE_SELL_STOLEN or ZO_MODE_STORE_LAUNDER
SCENE_MANAGER:Show("fence_keyboard")
end
end
@@ -112,6 +136,7 @@ function ZO_Fence_Keyboard:OnEnterSell(totalSells, sellsUsed)
self:UpdateTransactionLabel(totalSells, sellsUsed, SI_FENCE_SELL_LIMIT, SI_FENCE_SELL_LIMIT_REACHED)
PLAYER_INVENTORY:RefreshBackpackWithFenceData()
ZO_PlayerInventorySortByPriceName:SetText(GetString(SI_INVENTORY_SORT_TYPE_PRICE))
+ self:RefreshFooter()
end
function ZO_Fence_Keyboard:OnEnterLaunder(totalLaunders, laundersUsed)
@@ -127,6 +152,7 @@ function ZO_Fence_Keyboard:OnEnterLaunder(totalLaunders, laundersUsed)
PLAYER_INVENTORY:RefreshBackpackWithFenceData(ColorCost)
ZO_PlayerInventorySortByPriceName:SetText(GetString(SI_LAUNDER_SORT_TYPE_COST))
+ self:RefreshFooter()
end
--[[
@@ -142,6 +168,33 @@ function ZO_Fence_Keyboard:IsLaundering()
return self.mode == ZO_MODE_STORE_LAUNDER
end
+function ZO_Fence_Keyboard:RefreshFooter()
+ if self.mode == ZO_MODE_STORE_SELL_STOLEN then
+ local totalSells, sellsUsed, resetTimeSeconds = GetFenceSellTransactionInfo()
+ if totalSells - sellsUsed <= 0 then
+ self.resetTimeStatControl:SetText(GetString(SI_FENCE_SELL_LIMIT_RESET))
+
+ local timeText = ZO_FormatTimeMilliseconds(resetTimeSeconds * 1000, TIME_FORMAT_STYLE_COLONS, TIME_FORMAT_PRECISION_TWELVE_HOUR)
+ self.resetTimeValueControl:SetText(timeText)
+ self.resetTimeControl:SetHidden(false)
+ else
+ self.resetTimeControl:SetHidden(true)
+ end
+ elseif self.mode == ZO_MODE_STORE_LAUNDER then
+ local totalLaunders, laundersUsed, resetTimeSeconds = GetFenceLaunderTransactionInfo()
+ if totalLaunders - laundersUsed <= 0 then
+ self.resetTimeStatControl:SetText(GetString(SI_FENCE_LAUNDER_LIMIT_RESET))
+
+ local timeText = ZO_FormatTimeMilliseconds(resetTimeSeconds * 1000, TIME_FORMAT_STYLE_COLONS, TIME_FORMAT_PRECISION_TWELVE_HOUR)
+ self.resetTimeValueControl:SetText(timeText)
+ self.resetTimeControl:SetHidden(false)
+ else
+ self.resetTimeControl:SetHidden(true)
+ end
+ end
+end
+
+
--[[
---- Global Functions
--]]