View Single Post
07/20/15, 04:59 PM   #9
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
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:
  1. local function InitTradingHouseLayout()
  2.     local layoutData = BACKPACK_TRADING_HOUSE_LAYOUT_FRAGMENT.layoutData
  3.     local sellFiltersEnabled = layoutData.sellFiltersEnabled
  4.     -- Check if someone has already enabled it:
  5.     if sellFiltersEnabled then return end
  6.    
  7.     -- Check if its turned on in my addon:
  8.     if not MY_ADDON_SETTING_ON then return end
  9.    
  10.     -- Set flag:
  11.     layoutData.sellFiltersEnabled = true
  12.    
  13.     -- Set the new layoutData:
  14.     layoutData.inventoryTopOffsetY = 43
  15.     layoutData.hiddenFilters = { [ITEMFILTERTYPE_QUEST] = true }  
  16.     local origAdditionalFilter = layoutData.additionalFilter
  17.     layoutData.additionalFilter = function (slot)
  18.                 return origAdditionalFilter(slot) and (not IsItemBound(slot.bagId, slot.slotIndex))
  19.             end
  20.    
  21.     -- Prehook HandleTabSwitch for sell mode:
  22.     local function OnHandleTabSwitch(self, tabData)
  23.         local mode = tabData.descriptor
  24.        
  25.         if mode == ZO_TRADING_HOUSE_MODE_SELL then
  26.             ZO_PlayerInventoryTabs:SetHidden(false)
  27.         end
  28.         return false
  29.     end
  30.     ZO_PreHook(TRADING_HOUSE, "HandleTabSwitch", OnHandleTabSwitch)
  31. end

Last edited by circonian : 07/20/15 at 05:15 PM.
  Reply With Quote