How about
sellFiltersEnabled
I would also recommend then no one hooks SetTradingHouseModeEnabled like I suggested. No reason for every addon to be hooking into that if their not even going to use it.
Switched to prehook the HandleTabSwitch(...) that way only the addon who is handling the sell filters will need to set a hook.
Lua Code:
local function InitTradingHouseLayout()
local layoutData = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData
local sellFiltersEnabled = layoutData.sellFiltersEnabled
-- Check if someone has already enabled it:
if sellFiltersEnabled then return end
-- Check if its turned on in my addon:
if not MY_ADDON_SETTING_ON then return end
-- Set flag:
layoutData.sellFiltersEnabled = true
-- Set the new layoutData:
layoutData.inventoryTopOffsetY = 43
layoutData.hiddenFilters = { [ITEMFILTERTYPE_QUEST] = true }
local origAdditionalFilter = layoutData.additionalFilter
layoutData.additionalFilter = function (slot)
return origAdditionalFilter(slot) and (not IsItemBound(slot.bagId, slot.slotIndex))
end
-- Prehook HandleTabSwitch for sell mode:
local function OnHandleTabSwitch(self, tabData)
local mode = tabData.descriptor
if mode == ZO_TRADING_HOUSE_MODE_SELL then
ZO_PlayerInventoryTabs:SetHidden(false)
end
return false
end
ZO_PreHook(TRADING_HOUSE, "HandleTabSwitch", OnHandleTabSwitch)
end