House tracking is fixed now

git [02-04-18 - 14:40]
House tracking is fixed now
Filename
IIfA/IIfA.lua
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
IIfA/IIfAEvents.lua
IIfA/IIfAMenu.lua
IIfA/IIfASettingsAdapter.lua
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index 421ebba..c2d3236 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -29,7 +29,7 @@ IIfA.TooltipLink 		= nil
 IIfA.CurrSceneName 		= "hud"
 IIfA.bFilterOnSetName 	= false
 IIfA.searchFilter 		= ""
-IIfA.dirtyHouses		= {}
+IIfA.trackedHouses		= {}

 local LMP = LibStub("LibMediaProvider-1.0")
 local BACKPACK = ZO_PlayerInventoryBackpack
@@ -131,9 +131,7 @@ function IIfA_SlashCommands(cmd)
 end

 function IIfA:DebugOut(output)
-	if (IIfA.data.bDebug) then
-		d(output)
-	end
+	if (IIfA.data.bDebug) then d(output) end
 end

 function IIfA:StatusAlert(message)
@@ -142,6 +140,9 @@ function IIfA:StatusAlert(message)
 	end
 end

+function IIfA:BuildHouseLists()
+
+end

 function IIfA_onLoad(eventCode, addOnName)
 	if (addOnName ~= "IIfA") then
@@ -162,9 +163,8 @@ function IIfA_onLoad(eventCode, addOnName)
 		bDebug 					= false,
 		in2TextColors 			= IIFA_COLORDEF_DEFAULT:ToHex(),
 		showItemCountOnRight 	= true,
-		collectHouseData		= {
-			["All"]				= false,
-		},
+		b_collectHouses			= false,
+		collectHouseData		= {},
 		ignoredCharEquipment	= {},
 		ignoredCharInventories	= {},
 		frameSettings =
@@ -188,8 +188,8 @@ function IIfA_onLoad(eventCode, addOnName)
 		in2TooltipsFontSize 			= 16,
 		ShowToolTipWhen 				= "Always",
 		DBv3 							= {},
-		dontFocusSearch					= false
-		}
+		dontFocusSearch					= false,
+	}

 	-- initializing default values
 	local default = {
@@ -215,7 +215,7 @@ function IIfA_onLoad(eventCode, addOnName)
 		in2AgedGuildBankDataWarning = true,
 		in2TooltipsFont = "ZoFontGame",
 		in2TooltipsFontSize = 16,
-		}
+	}

 	IIfA.minWidth = 410
 	-- prevent resizing by user to be larger than this
@@ -245,34 +245,36 @@ function IIfA_onLoad(eventCode, addOnName)
 	-- end)


-	-- http://esodata.uesp.net/100016/src/libraries/utility/zo_savedvars.lua.html#67
-	-- build house list array
-	IIfA:GetHouseList()
+	-- http://esodata.uesp.net/100016/src/libraries/utility/zo_savedvars.lua.html#67


 	IIfA.settings 	= ZO_SavedVars:NewCharacterIdSettings("IIfA_Settings", 1, nil, default)
 	IIfA.data 		= ZO_SavedVars:NewAccountWide("IIfA_Data", 1, "Data", defaultGlobal)

-	IIfA:BuildHouseList()
+	IIfA:RebuildHouseMenuDropdowns()

+	--  nuke non-global positioning settings
 	local ObjSettings = IIfA:GetSettings()
-	if ObjSettings.in2InventoryFrameSceneSettings ~= nil then
-		ObjSettings.in2InventoryFrameSceneSettings = nil
-	end
-	if ObjSettings.in2InventoryFrameScenes ~= nil then
-		ObjSettings.in2InventoryFrameScenes = nil
-	end
-	if ObjSettings.valDocked ~= nil then
-		ObjSettings.valDocked = nil
-		ObjSettings.valLocked = nil
-		ObjSettings.valMinimized = nil
-		ObjSettings.valLastX = nil
-		ObjSettings.valLastY = nil
-		ObjSettings.valHeight = nil
-		ObjSettings.valWidth = nil
-		ObjSettings.valWideX = nil
+	local function nukePositioning()
+		if ObjSettings.in2InventoryFrameSceneSettings ~= nil then
+			ObjSettings.in2InventoryFrameSceneSettings = nil
+		end
+		if ObjSettings.in2InventoryFrameScenes ~= nil then
+			ObjSettings.in2InventoryFrameScenes = nil
+		end
+		if ObjSettings.valDocked ~= nil then
+			ObjSettings.valDocked = nil
+			ObjSettings.valLocked = nil
+			ObjSettings.valMinimized = nil
+			ObjSettings.valLastX = nil
+			ObjSettings.valLastY = nil
+			ObjSettings.valHeight = nil
+			ObjSettings.valWidth = nil
+			ObjSettings.valWideX = nil
+		end
 	end
-
+	nukePositioning()
+
 	if IIfA.settings.in2ToggleGuildBankDataCollection ~= nil then
 		IIfA.settings.in2ToggleGuildBankDataCollection = nil
 	end
@@ -327,12 +329,11 @@ function IIfA_onLoad(eventCode, addOnName)

 	IIfA:SetupCharLookups()

-	if IIfA.settings.accountCharacters ~= nil then
-		IIfA.settings.accountCharacters = nil
-	end
-	if IIfA.settings.guildBanks ~= nil then
-		IIfA.settings.guildBanks = nil
-	end
+	-- overwrite non-global tables if present
+
+	IIfA.settings.accountCharacters = nil
+	IIfA.settings.guildBanks = nil
+

 	-- this MUST remain in this location, otherwise it's possible that CollectAll will remove ALL characters data from the list (because they haven't been converted)
 	if IIfA.data.accountCharacters ~= nil then
@@ -465,7 +466,6 @@ function IIfA_onLoad(eventCode, addOnName)
 	IIfA:RegisterForEvents()
 	IIfA:RegisterForSceneChanges() -- register for callbacks on scene statechanges using user preferences or defaults
 	IIfA:ScanCurrentCharacter()
-	IIfA:BuildHouseList() -- write house list into array
 	IIfA:ScanBank()
 end

diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index 60bfe07..6545b76 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -95,71 +95,68 @@ end

 local function getHouseIds()
 	local ret = {}
-	for houseName, houseId in pairs(IIfA:GetHouseList()) do
+	for houseName, houseId in pairs(IIfA:GetTrackedHouses()) do
 		table.insert(ret, houseId)
 	end
 	return ret
 end

+
 local function DoesInventoryMatchList(locationName, location)
-	local bagId = location.bagID
+	local bagId 	= location.bagID
+	local filter 	= IIfA.InventoryListFilter
+
+	local function isHouse()
+		return IIfA:GetTrackingWithHouseNames()[locationName]
+	end

-	local function isHouse(location)
-		return nil ~= getHouseIds()[location.bagID]
+	local function isOneOf(value, comp1, comp2, comp3, comp4, comp5, comp6)
+		return nil ~= value and (value == comp6) or (value == comp5) or (value == comp4) or (value == comp3) or (value == comp2) or value == comp1
 	end

 --	if locationName == "attributes" then return false end
-	if( IIfA.InventoryListFilter == "All" ) then
+	if (filter == "All") then
 		return true

-	elseif(IIfA.InventoryListFilter == "All Banks") then
-		return nil ~= bagId and bagId ~= BAG_BACKPACK and IIfA.trackedBags[bagId]
-		-- (location.bagID == BAG_BANK or location.bagID == BAG_GUILDBANK or location.bagID == BAG_SUBSCRIBER_BANK)
+	elseif (filter == "All Banks") then
+		return isOneOf(bagId, BAG_SUBSCRIBER_BANK, BAG_GUILDBANK) and IIfA.trackedBags[bagId]

-	elseif(IIfA.InventoryListFilter == "All Guild Banks") then
-		return (location.bagID == BAG_GUILDBANK)
+	elseif (filter == "All Guild Banks") then
+		return isOneOf(bagId, BAG_GUILDBANK)

-	elseif(IIfA.InventoryListFilter == "All Characters") then
-		return (location.bagID == BAG_BACKPACK or location.bagID == BAG_WORN)
+	elseif (filter == "All Characters") then
+		return isOneOf(bagId, BAG_BACKPACK, BAG_WORN)

-	elseif(IIfA.InventoryListFilter == "Bank and Characters") then
-		return (location.bagID == BAG_BANK or
-				location.bagID == BAG_SUBSCRIBER_BANK or
-				location.bagID == BAG_BACKPACK or
-				location.bagID == BAG_WORN)
+	elseif (filter == "Bank and Characters") then
+		return isOneOf(bagId, BAG_BANK, BAG_SUBSCRIBER_BANK, BAG_BACKPACK, BAG_WORN)

-	elseif(IIfA.InventoryListFilter == "Bank and Current Character") then
-		return (location.bagID == BAG_BANK or
-				location.bagID == BAG_SUBSCRIBER_BANK or
-				((location.bagID == BAG_BACKPACK or
-				 location.bagID == BAG_WORN) and
-				 locationName == IIfA.currentCharacterId))
+	elseif(filter == "Bank and Current Character") then
+		return isOneOf(bagId, BAG_BANK, BAG_SUBSCRIBER_BANK, BAG_BACKPACK, BAG_WORN)
+			and locationName == IIfA.currentCharacterId

-	elseif(IIfA.InventoryListFilter == "Bank and other characters") then
-		return not isHouse(location) and (location.bagID == BAG_BANK or
-				location.bagID == BAG_SUBSCRIBER_BANK or
-				((location.bagID == BAG_BACKPACK or
-				 location.bagID == BAG_WORN) and
-				 locationName ~= IIfA.currentCharacterId))
-
-	elseif(IIfA.InventoryListFilter == "Bank Only") then
-		return  (location.bagID == BAG_BANK or
-				location.bagID == BAG_SUBSCRIBER_BANK)
-
-	elseif(IIfA.InventoryListFilter == "Craft Bag") then
-		return (location.bagID == BAG_VIRTUAL)
+	elseif(filter == "Bank and other characters") then
+		return isOneOf(bagId, BAG_BANK, BAG_SUBSCRIBER_BANK, BAG_BACKPACK, BAG_WORN)
+			and locationName ~= IIfA.currentCharacterId
+
+	elseif(filter == "Bank Only") then
+		return isOneOf(bagId, BAG_BANK, BAG_SUBSCRIBER_BANK)
+
+	elseif(filter == "Craft Bag") then
+		return (bagId == BAG_VIRTUAL)
+
+	elseif(filter == "All Houses") then
+		return IIfA.data.collectHouseData[bagId]
+
+	elseif(nil ~= IIfA:GetTrackingWithHouseNames()[filter]) then
+		return (bagId == IIfA:GetHouseIdFromName(filter))

-	elseif(IIfA.InventoryListFilter == "All Houses") then
-		return nil ~= getHouseIds()[location.bagID]
-	elseif(nil ~= IIfA:GetHouseList()[IIfA.InventoryListFilter]) then
-		return (location.bagID == IIfA:GetHouseList()[IIfA.InventoryListFilter])
 	else --Not a preset, must be a specific guildbank or character
-		if location.bagID == BAG_BACKPACK or location.bagID == BAG_WORN then
+		if isOneOf(bagId, BAG_BACKPACK, BAG_WORN) then
 			-- it's a character name, convert to Id, check that against location Name in the dbv3 table
-			if locationName == IIfA.CharNameToId[IIfA.InventoryListFilter] then return true end
+			if locationName == IIfA.CharNameToId[filter] then return true end
 		else
 			-- it's a bank to compare, do it direct
-			if locationName == IIfA.InventoryListFilter then return true end
+			return locationName == filter
 		end
 	end
 end
@@ -587,19 +584,17 @@ function IIfA:GetAccountInventoryList()
 			if IIfA.data.guildBanks == nil then
 				IIfA.data.guildBanks = {}
 			end
-
+
 			if IIfA.data.guildBanks[guildName] ~= nil then
 				table.insert(accountInventories, guildName)
 			end
 		end
 	end

-	if IIfA.data.collectHouseData.All then
+	if IIfA.data.b_collectHouses then
 		table.insert(accountInventories, "All Houses")
-		for houseName, houseId in pairs(IIfA:GetHouseList()) do
-			if IIfA:GetTrackedBags()[houseId] then
-				table.insert(accountInventories, houseName)
-			end
+		for idx, houseName in ipairs(IIfA:GetTrackedHouseNames()) do
+			table.insert(accountInventories, houseName)
 		end
 	end

diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 7f943e7..1baacb3 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -24,11 +24,13 @@ function IIfA:DeleteGuildData(name)
 	end
 end

-function IIfA:CollectGuildBank()
-
+function IIfA:CollectGuildBank()

 	-- add roomba support
-	if Roomba and Roomba.WorkInProgress and Roomba.WorkInProgress() then return  end
+	if Roomba and Roomba.WorkInProgress and Roomba.WorkInProgress() then
+		CALLBACK_MANAGER:FireCallbacks("Roomba-EndStacking", function() IIfA:CollectGuildBank() end)
+		return
+	end

 	local curGB = GetSelectedGuildBankId()

@@ -232,15 +234,15 @@ end



-function IIfA:ScanHouse(reset)
+function IIfA:RescanHouse(houseCollectibleId)
+
+	houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
+	if not houseCollectibleId then return end

-	local houseCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId())
 	if not IIfA:GetTrackedBags()[houseCollectibleId] then return end

-	if reset then
-		IIfA:ClearLocationData(houseCollectibleId)
-	end
-
+	-- it's easier to throw everything away and re-scan than to conditionally update
+	IIfA:ClearLocationData(houseCollectibleId)

 	local function getAllPlacedFurniture()
 		local ret = {}
@@ -256,7 +258,6 @@ function IIfA:ScanHouse(reset)
 		end
 	end

-	local houseCollectibleId =  GetCollectibleIdForHouse(GetCurrentZoneHouseId())
 	local items = getAllPlacedFurniture()
 	for itemLink, itemCount in pairs(items) do
 		IIfA:AddFurnitureItem(itemLink, itemCount, houseCollectibleId, true)
@@ -435,31 +436,6 @@ function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey, itemLinkOverri
 	end
 end

-IIfA.HouseList = nil
-function IIfA:GetHouseList()
-	if not IIfA.HouseList then
-		IIfA.HouseList = {}
-		for index=1,GetTotalCollectiblesByCategoryType(COLLECTIBLE_CATEGORY_TYPE_HOUSE) do
-			local collectibleId = GetCollectibleIdFromType(COLLECTIBLE_CATEGORY_TYPE_HOUSE, index)
-			if IsCollectibleUnlocked(collectibleId) then
-				local name = GetCollectibleNickname(collectibleId)
-				if name == EMPTY_STRING then name = GetCollectibleName(collectibleId) end
-				IIfA.HouseList[name] = collectibleId
-			end
-		end
-	end
-	return IIfA.HouseList
-end
-
-function IIfA:BuildHouseList()
-	for houseName, collectibleId in pairs(IIfA:GetHouseList()) do
-		if nil == IIfA.data.collectHouseData[collectibleId] then
-			IIfA.data.collectHouseData[collectibleId] = IIfA.data.collectHouseData.All
-		end
-		IIfA.trackedBags[collectibleId] = IIfA.data.collectHouseData[collectibleId]
-	end
-end
-

 function IIfA:CollectAll()
 	local bagItems = nil
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index 65c00a8..04924a6 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -1,5 +1,5 @@
-local IIfA = IIfA
-
+local IIfA 	= IIfA
+local em 	= EVENT_MANAGER
 -- 2016-7-26 AM - added global funcs for events
 -- the following functions are all globals, not tied to the IIfA class, but call the IIfA class member functions for event processing

@@ -12,26 +12,10 @@ local function IIfA_EventOnPlayerUnloaded()
 	IIfA.CharBagFrame:UpdateAssets()
 end

-local function IIfA_GuildBankDelayReady()
-	IIfA:GuildBankDelayReady()
-end
-
-local function IIfA_GuildBankAddRemove(...)
-	IIfA:GuildBankAddRemove(...)
-end
-
-local function IIfA_ActionLayerInventoryUpdate()
-	IIfA:ActionLayerInventoryUpdate()
-end
-
 local function IIfA_InventorySlotUpdate(...)
 	IIfA:InventorySlotUpdate(...)
 end

-local function IIfA_OnRightClickUp(rowControl)
-	IIfA:ProcessRightClick(rowControl)
-end
-
 local function IIfA_CollectibleUpdate(eventCode, collectibleId, justUnlocked)
 	if justUnlocked then return end
 	if GetAPIVersion() < 100022 then return end
@@ -41,39 +25,31 @@ local function IIfA_CollectibleUpdate(eventCode, collectibleId, justUnlocked)
 	local name 		= GetCollectibleName(collectibleId)
 	local nickName 	= GetCollectibleNickname(collectibleId)

-
-	-- TODO: Check this!
-	-- function ZO_SharedInventoryManager:HandleSlotCreationOrUpdate(bagCache, bagId, slotIndex, isNewItem)
-		-- local existingSlotData = bagCache[slotIndex]
-		-- local slotData, result = self:CreateOrUpdateSlotData(existingSlotData, bagId, slotIndex, isNewItem)
-		-- bagCache[slotIndex] = slotData
-
-		-- if result == SHARED_INVENTORY_SLOT_RESULT_REMOVED then
-			-- self:FireCallbacks("SlotRemoved", bagId, slotIndex, existingSlotData)
-		-- elseif result == SHARED_INVENTORY_SLOT_RESULT_ADDED then
-			-- self:FireCallbacks("SlotAdded", bagId, slotIndex, slotData)
-		-- elseif result == SHARED_INVENTORY_SLOT_RESULT_UPDATED then
-			-- self:FireCallbacks("SlotUpdated", bagId, slotIndex, slotData)
-		-- elseif result == SHARED_INVENTORY_SLOT_RESULT_REMOVE_AND_ADD then
-			-- self:FireCallbacks("SlotRemoved", bagId, slotIndex, existingSlotData)
-			-- self:FireCallbacks("SlotAdded", bagId, slotIndex, slotData)
-		-- end
-	-- end
-

 end

 local function IIfA_ScanHouse(eventCode, oldMode, newMode)
 	if newMode == "showing" or newMode == "shown" then return end
-	IIfA:ScanHouse(true)
+	-- are we listening?
+	if not IIfA:GetCollectingHouseData() then return end
+
+	IIfA:RescanHouse(GetCollectibleIdForHouse(GetCurrentZoneHouseId()))
 end
+
 local function IIfA_HouseEntered(eventCode)
 	if not IsOwnerOfCurrentHouse() then return end
-	IIfA:ScanHouse()
-end
-
-local function IIfA_ScanBank()
-	IIfA:ScanBank()
+
+	-- are we listening?
+	if not IIfA:GetCollectingHouseData() then return end
+
+	-- is the house registered?
+	local houseCollectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId())
+
+	if nil == IIfA.data.collectHouseData[houseCollectibleId] then
+		IIfA:SetTrackingForHouse(houseCollectibleId, true)
+	end
+
+	IIfA:RescanHouse(houseCollectibleId)
 end
 local function IIfA_EventProc(...)
 	--d(...)
@@ -101,8 +77,6 @@ local function finv1(...)
 	d("inventory open error")
 	IIfA_EventDump(...)
 end
-
-
 local function fgb1(...)
 	d("gb open error")
 	IIfA_EventDump(...)
@@ -126,67 +100,63 @@ end

 function IIfA:RegisterForEvents()
 	-- 2016-6-24 AM - commented this out, doing nothing at the moment, revisit later
-	-- EVENT_MANAGER:RegisterForEvent("IIFA_PLAYER_LOADED_EVENTS", EVENT_PLAYER_ACTIVATED, IIfA_EventOnPlayerloaded)
+	-- em:RegisterForEvent("IIFA_PLAYER_LOADED_EVENTS", EVENT_PLAYER_ACTIVATED, IIfA_EventOnPlayerloaded)

 	-- 2015-3-7 AssemblerManiac - added EVENT_PLAYER_DEACTIVATED event
-	EVENT_MANAGER:RegisterForEvent("IIFA_PLAYER_UNLOADED_EVENTS", EVENT_PLAYER_DEACTIVATED, IIfA_EventOnPlayerUnloaded)
+	em:RegisterForEvent("IIFA_PLAYER_UNLOADED_EVENTS", 	EVENT_PLAYER_DEACTIVATED, IIfA_EventOnPlayerUnloaded)

 	-- when item comes into inventory
-	EVENT_MANAGER:RegisterForEvent("IIFA_InventorySlotUpdate", EVENT_INVENTORY_SINGLE_SLOT_UPDATE, IIfA_InventorySlotUpdate)
-	EVENT_MANAGER:AddFilterForEvent("IIFA_InventorySlotUpdate", EVENT_INVENTORY_SINGLE_SLOT_UPDATE, REGISTER_FILTER_INVENTORY_UPDATE_REASON, INVENTORY_UPDATE_REASON_DEFAULT)
+	em:RegisterForEvent( "IIFA_InventorySlotUpdate", 	EVENT_INVENTORY_SINGLE_SLOT_UPDATE, IIfA_InventorySlotUpdate)
+	em:AddFilterForEvent("IIFA_InventorySlotUpdate", 	EVENT_INVENTORY_SINGLE_SLOT_UPDATE, REGISTER_FILTER_INVENTORY_UPDATE_REASON, INVENTORY_UPDATE_REASON_DEFAULT)

---	EVENT_MANAGER:RegisterForEvent("IIFA_unknown", EVENT_ITEM_SLOT_CHANGED, IIfA_EventDump)
---	EVENT_MANAGER:RegisterForEvent("IIFA_unknown", EVENT_INVENTORY_ITEM_USED, IIfA_EventDump)	-- arg 1 = event id, arg 2 = 27 (no clue)
---	EVENT_MANAGER:RegisterForEvent("IIFA_unknown", EVENT_INVENTORY_ITEM_DESTROYED, IIfA_EventDump)
---	EVENT_MANAGER:RegisterForEvent("IIFA_unknown", EVENT_JUSTICE_FENCE_UPDATE, IIfA_EventDump) -- # sold, # laundered is sent to event handler
+--	em:RegisterForEvent("IIFA_unknown", EVENT_ITEM_SLOT_CHANGED, IIfA_EventDump)
+--	em:RegisterForEvent("IIFA_unknown", EVENT_INVENTORY_ITEM_USED, IIfA_EventDump)	-- arg 1 = event id, arg 2 = 27 (no clue)
+--	em:RegisterForEvent("IIFA_unknown", EVENT_INVENTORY_ITEM_DESTROYED, IIfA_EventDump)
+--	em:RegisterForEvent("IIFA_unknown", EVENT_JUSTICE_FENCE_UPDATE, IIfA_EventDump) -- # sold, # laundered is sent to event handler

 -- not helpful, no link at all on this callback
 --	SHARED_INVENTORY:RegisterCallback("SlotRemoved", IIfA_EventDump)
 --	SHARED_INVENTORY:RegisterCallback("SingleSlotInventoryUpdate", IIfA_EventDump)

 	-- react to players possibly renaming their storage chests
-	EVENT_MANAGER:RegisterForEvent("IIFA_Collectible_Updated", EVENT_COLLECTIBLE_UPDATED, IIfA_CollectibleUpdate)
+	em:RegisterForEvent("IIFA_Collectible_Updated", 	EVENT_COLLECTIBLE_UPDATED, IIfA_CollectibleUpdate)


 	-- Events for data collection
-	EVENT_MANAGER:RegisterForEvent("IIFA_ALPUSH", EVENT_ACTION_LAYER_PUSHED, IIfA_ActionLayerInventoryUpdate)
-	EVENT_MANAGER:RegisterForEvent("IIFA_ON_BANK_OPEN", EVENT_OPEN_BANK , IIfA_ScanBank)
+	em:RegisterForEvent("IIFA_ALPUSH", 		EVENT_ACTION_LAYER_PUSHED, 	function() IIfA:ActionLayerInventoryUpdate() end)
+	em:RegisterForEvent("IIFA_BANK_OPEN",	EVENT_OPEN_BANK, 			function() IIfA:ScanBank() end)

 	-- on opening guild bank:
-	EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_LOADED", EVENT_GUILD_BANK_ITEMS_READY, IIfA_GuildBankDelayReady)
+	em:RegisterForEvent("IIFA_GUILDBANK_LOADED", EVENT_GUILD_BANK_ITEMS_READY, function() IIfA:GuildBankDelayReady() end)

---	EVENT_MANAGER:RegisterForEvent("IIFA_gb1", EVENT_GUILD_BANK_OPEN_ERROR, fgb1)
-	EVENT_MANAGER:RegisterForEvent("IIFA_gb2", EVENT_GUILD_BANK_UPDATED_QUANTITY, fgb2)
---	EVENT_MANAGER:RegisterForEvent("IIFA_gb3", EVENT_GUILD_BANK_SELECTED, fgb3)
---	EVENT_MANAGER:RegisterForEvent("IIFA_gb4", EVENT_GUILD_BANK_DESELECTED, fgb4)
---	EVENT_MANAGER:RegisterForEvent("IIFA_gb5", EVENT_GUILD_BANK_ITEMS_READY, fgb5)
+--	em:RegisterForEvent("IIFA_gb1", EVENT_GUILD_BANK_OPEN_ERROR, fgb1)
+	em:RegisterForEvent("IIFA_gb2", EVENT_GUILD_BANK_UPDATED_QUANTITY, fgb2)
+--	em:RegisterForEvent("IIFA_gb3", EVENT_GUILD_BANK_SELECTED, fgb3)
+--	em:RegisterForEvent("IIFA_gb4", EVENT_GUILD_BANK_DESELECTED, fgb4)
+--	em:RegisterForEvent("IIFA_gb5", EVENT_GUILD_BANK_ITEMS_READY, fgb5)


 	-- on adding or removing an item from the guild bank:
-	EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_ITEM_ADDED", 	EVENT_GUILD_BANK_ITEM_ADDED, IIfA_GuildBankAddRemove)
-	EVENT_MANAGER:RegisterForEvent("IIFA_GUILDBANK_ITEM_REMOVED", EVENT_GUILD_BANK_ITEM_REMOVED, IIfA_GuildBankAddRemove)
+	em:RegisterForEvent("IIFA_GUILDBANK_ITEM_ADDED", 	EVENT_GUILD_BANK_ITEM_ADDED, 	function(...) IIfA:GuildBankAddRemove(...) end)
+	em:RegisterForEvent("IIFA_GUILDBANK_ITEM_REMOVED", 	EVENT_GUILD_BANK_ITEM_REMOVED, 	function(...) IIfA:GuildBankAddRemove(...) end)

-
-	EVENT_MANAGER:RegisterForEvent("IIFA_HOUSING_PLAYER_INFO_CHANGED", 	EVENT_PLAYER_ACTIVATED, 			IIfA_HouseEntered)
-
-	EVENT_MANAGER:RegisterForEvent("IIfA_HOUSE_MANAGER_MODE_CHANGED", 	EVENT_HOUSING_EDITOR_MODE_CHANGED, 	IIfA_ScanHouse)
+	-- Housing
+	em:RegisterForEvent("IIFA_HOUSING_PLAYER_INFO_CHANGED", EVENT_PLAYER_ACTIVATED, 			IIfA_HouseEntered)
+	em:RegisterForEvent("IIfA_HOUSE_MANAGER_MODE_CHANGED", 	EVENT_HOUSING_EDITOR_MODE_CHANGED, 	IIfA_ScanHouse)

-	local function RebuildOptionsMenu()
-		self:CreateOptionsMenu()
-	end
-	EVENT_MANAGER:RegisterForEvent("IIFA_GuildJoin", EVENT_GUILD_SELF_JOINED_GUILD, RebuildOptionsMenu)
-	EVENT_MANAGER:RegisterForEvent("IIFA_GuildLeave", EVENT_GUILD_SELF_LEFT_GUILD, RebuildOptionsMenu)
-	SHARED_INVENTORY:RegisterCallback("SingleSlotInventoryUpdate", IIFA_OnSingleSlotInventoryUpdate)
---    ZO_QuickSlot:RegisterForEvent(EVENT_ABILITY_COOLDOWN_UPDATED, IIfA_EventDump)
-	ZO_PreHook('ZO_InventorySlot_ShowContextMenu', function(rowControl) IIfA_OnRightClickUp(rowControl) end)
+	em:RegisterForEvent("IIFA_GuildJoin", EVENT_GUILD_SELF_JOINED_GUILD, 	function() IIfA:CreateOptionsMenu() end)
+	em:RegisterForEvent("IIFA_GuildLeave", EVENT_GUILD_SELF_LEFT_GUILD, 	function() IIfA:CreateOptionsMenu() end)
+
+	--    ZO_QuickSlot:RegisterForEvent(EVENT_ABILITY_COOLDOWN_UPDATED, IIfA_EventDump)
+	ZO_PreHook('ZO_InventorySlot_ShowContextMenu', function(rowControl) IIfA:ProcessRightClick(rowControl) end)
 end


 --[[ registerfilter & events
 define HOW to listen for events (minimize # of calls to event handler, less overhead of eso internals)
-EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_INVENTORY_SINGLE_SLOT_UPDATE, OnInventorySlotUpdate)
-EVENT_MANAGER:AddFilterForEvent(ADDON_NAME, EVENT_INVENTORY_SINGLE_SLOT_UPDATE,  REGISTER_FILTER_BAG_ID, BAG_BACKPACK)
-EVENT_MANAGER:AddFilterForEvent(ADDON_NAME, EVENT_INVENTORY_SINGLE_SLOT_UPDATE,  REGISTER_FILTER_INVENTORY_UPDATE_REASON, INVENTORY_UPDATE_REASON_DEFAULT)
+em:RegisterForEvent(ADDON_NAME, EVENT_INVENTORY_SINGLE_SLOT_UPDATE, OnInventorySlotUpdate)
+em:AddFilterForEvent(ADDON_NAME, EVENT_INVENTORY_SINGLE_SLOT_UPDATE,  REGISTER_FILTER_BAG_ID, BAG_BACKPACK)
+em:AddFilterForEvent(ADDON_NAME, EVENT_INVENTORY_SINGLE_SLOT_UPDATE,  REGISTER_FILTER_INVENTORY_UPDATE_REASON, INVENTORY_UPDATE_REASON_DEFAULT)
 --]]


diff --git a/IIfA/IIfAMenu.lua b/IIfA/IIfAMenu.lua
index b95c603..146b485 100644
--- a/IIfA/IIfAMenu.lua
+++ b/IIfA/IIfAMenu.lua
@@ -50,26 +50,6 @@ local function getGuildBankName(guildNum)
 	return GetGuildName(id)
 end

-local function getHouseNames()
-	local ret = {}
-	for houseName, houseId in pairs(IIfA:GetHouseList()) do
-		if IIfA:GetTrackedBags()[houseId] then
-			table.insert(ret, houseName)
-		end
-	end
-	return ret
-end
-
-local function getIgnoredHouseNames()
-	local ret = {}
-	for houseName, houseId in pairs(IIfA:GetHouseList()) do
-		if not IIfA:GetTrackedBags()[houseId] then
-			table.insert(ret, houseName)
-		end
-	end
-	return ret
-end
-
 local function getGuildBankKeepDataSetting(guildNum)
 	guildName = getGuildBankName(guildNum)

@@ -218,18 +198,18 @@ function IIfA:CreateOptionsMenu()
 					type = "checkbox",
 					name = "Collect furniture in houses",
 					tooltip = "Enables/Disables collection of furniture inside houses",
-					getFunc = function() return 	IIfA:GetCollectingHouseData() end,
-					setFunc = function(value)		IIfA:SetCollectingHouseData(value) end,
+					getFunc = function() return 	IIfA.data.b_collectHouses end,
+					setFunc = function(value)		IIfA:SetHouseTracking(value) end,
 				}, -- checkbox end

 				{	type 	= "description",
 					title 	= "Ignore or delete houses",
 					text 	= "removes or un-tracks a house. \nWarning: This change will be applied immediately.",
 				},
-				{
+				{  	--dropdown houses to delete or un-track
 					type 	= "dropdown",
 					name 	= "houses to delete or un-track",
-					choices = getHouseNames(),
+					choices = IIfA:GetTrackedHouseNames(),
 					getFunc = function() return end,
 					setFunc = function(choice) deleteHouse = nil; deleteHouse = choice end
 				}, --dropdown end
@@ -238,12 +218,12 @@ function IIfA:CreateOptionsMenu()
 					width = "half",
 					name = "Ignore house",
 					tooltip = "All furniture items in the currently selected house will be untracked",
-					func = function() IIfA:SetCollectHouseStatus(deleteHouse, false) end,
+					func = function() IIfA:SetTrackingForHouse(deleteHouse, false) end,
 				}, -- button end
 				{
 					type 	= "dropdown",
 					name 	= "houses to re-track",
-					choices = getIgnoredHouseNames(),
+					choices = IIfA:GetIgnoredHouseNames(),
 					getFunc = function() return end,
 					setFunc = function(choice) restoreHouse = nil; restoreHouse = choice end
 				}, --dropdown end
@@ -252,7 +232,7 @@ function IIfA:CreateOptionsMenu()
 					width = "half",
 					name = "Unignore house",
 					tooltip = "All furniture items in the currently selected house will be tracked again",
-					func = function() IIfA:SetCollectHouseStatus(restoreHouse, true) end,
+					func = function() IIfA:SetTrackingForHouse(restoreHouse, true) end,
 				}, -- button end
 			},
 		},
@@ -336,7 +316,7 @@ function IIfA:CreateOptionsMenu()
 			},
 		},

-		{
+		{	-- header: Global/Per Char settings
 			type = "header",
 			name = "Global/Per Char settings",
 		},
@@ -344,11 +324,11 @@ function IIfA:CreateOptionsMenu()



-		{
+		{	-- submenu: tooltips
 			type = "submenu",
 			name = "Tooltips",
 			tooltip = "Manage tooltip options for both default and custom IIfA tooltips",
-			controls = {
+			controls = { -- tooltips
 				{
 					type = "dropdown",
 					name = "Show IIfA Tooltips",
@@ -414,7 +394,7 @@ function IIfA:CreateOptionsMenu()

 		}, -- tooltipOptionsSubWindow end

-		{
+		{	-- checkbox: item count on the right
 			type = "checkbox",
 			tooltip = "Show Item Count on Right side of list",
 			name = "Item Count on Right",
@@ -444,28 +424,25 @@ function IIfA:CreateOptionsMenu()
 			-- warning = "Will need to reload the UI",	--(optional)
 		},

-		{
+		{ -- checkbox: Focus search box on UI toggle
 			type = "checkbox",
-			name = "Don't focus search box on UI toggle?",
-			tooltip = "If you open the UI, the edit control will take focus. Check this box to disable it.",
-			getFunc = function() return IIfA.defaults.dontFocusSearch end,
-			setFunc = function(value)
-				IIfA.defaults.dontFocusSearch = value
-			end,
+			name = "Focus search box",
+			tooltip = "Focus search bar after UI toggle?",
+			getFunc = function() return not IIfA:GetSettings().dontFocusSearch end,
+			setFunc = function(value) IIfA:GetSettings().dontFocusSearch = not value end,
 		}, -- checkbox end
+
 		{
 			type = "checkbox",
-			name = "Search Set Names when using Text Filter",
+			name = "Text Filter considers set name as well",
 			tooltip = "Enables/Disables set name inclusion in searches",
 			getFunc = function() return IIfA:GetSettings().bFilterOnSetNameToo end,
-			setFunc = function(value)
-				IIfA:GetSettings().bFilterOnSetNameToo = value
-			end,
+			setFunc = function(value) IIfA:GetSettings().bFilterOnSetNameToo = value end,
 		}, -- checkbox end

 		{
 			type = "checkbox",
-			name = "Default to search only Set Names when using Text Filter",
+			name = "Text Filter only searches set name",
 			tooltip = "Enables/Disables set name inclusion in searches",
 			getFunc = function() return IIfA:GetSettings().bFilterOnSetName end,
 			setFunc = function(value)
diff --git a/IIfA/IIfASettingsAdapter.lua b/IIfA/IIfASettingsAdapter.lua
index d235db5..b5a80c0 100644
--- a/IIfA/IIfASettingsAdapter.lua
+++ b/IIfA/IIfASettingsAdapter.lua
@@ -1,5 +1,11 @@
- local IIfA = IIfA
+local IIfA = IIfA
+IIfA.houseNameToIdTbl = {}

+local function GetRealCollectibleName(collectibleId)
+	local collectibleName = GetCollectibleNickname(collectibleId)
+	if collectibleName and #collectibleName == 0 then collectibleName = GetCollectibleName(collectibleId) end
+	return collectibleName
+end

 function IIfA:IsCharacterInventoryIgnored(ignoreChar)
 	return IIfA.data.ignoredCharEquipment[ignoreChar]
@@ -47,6 +53,13 @@ function IIfA:SetSetNameFilterOnly(value)
     IIfA:UpdateInventoryScroll()
 end

+function IIfA:GetFocusSearchOnToggle()
+	return not IIfA.defaults.dontFocusSearch
+end
+function IIfA:SetFocusSearchOnToggle(value)
+	IIfA.defaults.dontFocusSearch = not value
+end
+

 -- Get pointer to current settings based on user pref (global or per char)
 function IIfA:GetSettings()
@@ -76,7 +89,6 @@ function IIfA:GetInventoryListFilterQuality()
 	return IIfA.InventoryListFilterQuality or 99
 end

-
 -- this is for the dropdown menu
 function IIfA:SetInventoryListFilterQuality(value)
 	IIfA.InventoryListFilterQuality = value
@@ -87,23 +99,92 @@ function IIfA:SetInventoryListFilterQuality(value)
     IIfA:UpdateInventoryScroll()
 end
 function IIfA:GetCollectingHouseData()
-	return IIfA.data.collectHouseData.All
+	return IIfA.data.b_collectHouses
 end
-function IIfA:SetCollectingHouseData(value)
-	IIfA.data.collectHouseData.All = value
-	for houseName, houseId in pairs(IIfA:GetHouseList()) do
-		IIfA:SetCollectHouseStatus(houseName, value)
+
+function IIfA:GetTrackedBags()
+	return IIfA.trackedBags
+end
+
+function IIfA:GetTrackedHousIds()
+	local ret = {}
+	for id, trackIt in pairs(IIfA.data.collectHouseData) do
+		if trackIt then
+			table.insert(ret, id)
+		end
 	end
+	return ret
 end
-function IIfA:SetCollectHouseStatus(houseName, value)
-	local houseId = IIfA:GetHouseList()[houseName]
-	IIfA.data.collectHouseData[houseId] = value
-	IIfA:GetTrackedBags()[houseId] 		= value
-	if not value then
-		IIfA:ClearLocationData(houseId)
+function IIfA:GetIgnoredHousIds()
+	local ret = {}
+	for id, trackIt in pairs(IIfA.data.collectHouseData) do
+		if not trackIt then table.insert(ret, id) end
 	end
+	return ret
 end

-function IIfA:GetTrackedBags()
-	return IIfA.trackedBags
+function IIfA:GetHouseIdFromName(houseName)
+	return IIfA.houseNameToIdTbl[houseName]
+end
+function IIfA:GetTrackingWithHouseNames()
+	local ret = {}
+	for collectibleId, trackIt in pairs(IIfA.data.collectHouseData) do
+		ret[GetRealCollectibleName(collectibleId)] = true
+	end
+	return ret
+end
+function IIfA:RebuildHouseMenuDropdowns()
+	local tracked = {}
+	local ignored = {}
+	for collectibleId, trackIt in pairs(IIfA.data.collectHouseData) do
+		local collectibleName = GetRealCollectibleName(collectibleId)
+		-- cache house name for lookup
+		IIfA.houseNameToIdTbl[collectibleName] = collectibleId
+		local targetTable = (trackIt and tracked) or ignored
+		table.insert(targetTable, collectibleName)
+	end
+	IIfA.houseNamesIgnored = ignored
+	IIfA.houseNamesTracked = tracked
+end
+function IIfA:GetIgnoredHouseNames()
+	if nil == IIfA.houseNamesIgnored then
+		IIfA:RebuildHouseMenuDropdowns()
+	end
+	return IIfA.houseNamesIgnored
+end
+function IIfA:GetTrackedHouseNames()
+	if nil == IIfA.houseNamesIgnored then
+		IIfA:RebuildHouseMenuDropdowns()
+	end
+	return IIfA.houseNamesTracked
+end
+
+function IIfA:GetAllHouseIds()
+	local ret = {}
+	for id, trackIt in pairs(IIfA.data.collectHouseData) do
+		table.insert(ret, id)
+	end
+	return ret
+end
+function IIfA:SetTrackingForHouse(houseCollectibleId, trackIt)
+	if tonumber(houseCollectibleId) ~= houseCollectibleId then
+		realId = IIfA:GetHouseIdFromName(houseCollectibleId)
+		if not realId then d(houseCollectibleId); return end
+		houseCollectibleId = realId
+	end
+	IIfA.data.collectHouseData[houseCollectibleId] 	= trackIt
+	IIfA:GetTrackedBags()[houseCollectibleId] 		= trackIt
+	IIfA:RebuildHouseMenuDropdowns()
+	if not trackIt then
+		IIfA:ClearLocationData(houseCollectibleId)
+	else -- try rescanning, in case we are in the house right now
+		IIfA:RescanHouse()
+	end
+end
+
+function IIfA:SetHouseTracking(value)
+	IIfA.data.b_collectHouses = value
+	if value then
+		IIfA:RebuildHouseMenuDropdowns()
+	end
 end
\ No newline at end of file