Merge pull request #20 from AssemblerManiac/master

manavortex [02-25-18 - 17:14]
Merge pull request #20 from AssemblerManiac/master

tracking completely solved, I think
Filename
IIfA/CharBagSpaceTooltip.lua
IIfA/IIfA.lua
IIfA/IIfA.txt
IIfA/IIfA.xml
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
IIfA/IIfAEvents.lua
IIfA/IIfASettingsAdapter.lua
diff --git a/IIfA/CharBagSpaceTooltip.lua b/IIfA/CharBagSpaceTooltip.lua
index dbc30a5..2e2f0ff 100644
--- a/IIfA/CharBagSpaceTooltip.lua
+++ b/IIfA/CharBagSpaceTooltip.lua
@@ -163,7 +163,7 @@ end
 -- add iteration for house chests
 -- if GetBagSize == 0, you've run out of chests to iterate (break out of loop)
 -- /script for i=BAG_HOUSE_BANK_ONE,BAG_MAX_VALUE do d(i .. GetCollectibleName(GetCollectibleForHouseBankBag(i))) end
--- /script for i=BAG_HOUSE_BANK_ONE,BAG_MAX_VALUE do d(IsCollectibleUnlocked(GetCollectibleForHouseBankBag(i))) end
+-- /script for i=BAG_HOUSE_BANK_ONE,BAG_MAX_VALUE do d(i .. " " .. IsCollectibleUnlocked(GetCollectibleForHouseBankBag(i))) end

 function CharBagFrame:RepaintSpaceUsed()
 	-- loop through characters
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index 065fbd2..1f335f0 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -21,7 +21,7 @@ if IIfA == nil then IIfA = {} end
 --local IIfA = IIfA

 IIfA.name 				= "Inventory Insight"
-IIfA.version 			= "3.07"
+IIfA.version 			= "3.09"
 IIfA.author 			= "AssemblerManiac & manavortex"
 IIfA.defaultAlertSound 	= nil
 IIfA.colorHandler 		= nil
@@ -156,7 +156,7 @@ function IIfA:DebugOut(output, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
 	elseif a1 then
 		d(zo_strformat(output, a1))
 	elseif output then
-		d(zo_strformat(output))
+		d(output)
 	else
 		d("\n")
 	end
@@ -168,10 +168,6 @@ function IIfA:StatusAlert(message)
 	end
 end

-function IIfA:BuildHouseLists()
-
-end
-
 function IIfA_onLoad(eventCode, addOnName)
 	if (addOnName ~= "IIfA") then
 		return
diff --git a/IIfA/IIfA.txt b/IIfA/IIfA.txt
index 6ad01c7..94589d0 100644
--- a/IIfA/IIfA.txt
+++ b/IIfA/IIfA.txt
@@ -1,6 +1,6 @@
 ## Title: Inventory Insight
 ## Author: manavortex, AssemblerManiac
-## Version: 3.07
+## Version: 3.09
 ## APIVersion: 100022
 ## SavedVariables: IIfA_Settings IIfA_Data
 ## OptionalDependsOn: libFilters pChat
diff --git a/IIfA/IIfA.xml b/IIfA/IIfA.xml
index 65d98fb..5358790 100644
--- a/IIfA/IIfA.xml
+++ b/IIfA/IIfA.xml
@@ -135,7 +135,7 @@
 							<Anchor point="TOPLEFT" relativeTo="$(parent)_BagButton" relativePoint="TOPRIGHT" offsetX="10" />
 							<Anchor point="BOTTOMRIGHT" relativeTo="$(parent)_BagButton" relativePoint="BOTTOMRIGHT" offsetX="260" offsetY="5" />

-							<OnShow>	IIfA:GuiSetupDropdown(self)</OnShow>
+							<OnShow>IIfA:GuiSetupDropdown(self)</OnShow>
 							<OnMouseEnter>IIfA:GuiShowTooltip(self, "Select inventory to view")</OnMouseEnter>
 							<OnMouseExit>IIfA:GuiHideTooltip(self)</OnMouseExit>
 						</Control>
diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index aa374d6..ad7ffc0 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -83,16 +83,6 @@ function IIfA:GUIDoubleClick(control, button)
 	end
 end

-local function getItemLinkFromDB(itemLink, item)
-	local iLink = ""
-	if zo_strlen(itemLink) < 10 then
-		iLink = item.itemLink
-	else
-		iLink = itemLink
-	end
-	return iLink
-end
-
 local function getHouseIds()
 	local ret = {}
 	for houseName, houseId in pairs(IIfA:GetTrackedHouses()) do
@@ -356,45 +346,55 @@ function IIfA:UpdateScrollDataLinesData()
 	local index = 0
 	local dataLines = {}
 	local DBv3 = IIfA.database
-	local iLink, itemLink, iconFile, itemQuality, tempDataLine = nil
+	local itemLink, itemKey, iconFile, itemQuality, tempDataLine = nil
 	local itemTypeFilter, itemCount = 0
 	local match = false
 	local bWorn = false
+	local dbItem

 	if(DBv3)then
-		for itemLink, item in pairs(DBv3) do
-			iLink = getItemLinkFromDB(itemLink, item)
+		for itemKey, dbItem in pairs(DBv3) do
+			if zo_strlen(itemKey) < 10 then
+				itemLink = dbItem.itemLink
+			else
+				itemLink = itemKey
+			end

-			if (itemLink ~= "") then
+			if (itemKey ~= "") then

 				itemTypeFilter = 0
-				if (item.filterType) then
-					itemTypeFilter = item.filterType
+				if (dbItem.filterType) then
+					itemTypeFilter = dbItem.filterType
 				end

 				itemCount = 0
 				bWorn = false
-				local itemIcon = GetItemLinkIcon(iLink)
+				local itemIcon = GetItemLinkIcon(itemLink)

 				local locationName, locData
-				for locationName, locData in pairs(item.locations) do
+				for locationName, locData in pairs(dbItem.locations) do
 					itemCount = itemCount + (locData.itemCount or 0)
 					if DoesInventoryMatchList(locationName, locData) then
 						match = true
 					end
 					bWorn = bWorn or (locData.bagID == BAG_WORN)
 				end
+				if not dbItem.itemName or #dbItem.itemName == 0 then
+					p("Filling in missing itemName/Quality")
+					dbItem.itemName = GetItemLinkName(itemLink)
+                    dbItem.itemQuality = GetItemLinkQuality(itemLink)
+                end
 				tempDataLine = {
-					link = iLink, 		-- getItemLinkFromDB(itemLink, item),
+					link = itemLink,
 					qty = itemCount,
 					icon = itemIcon,
-					name = item.itemName,
-					quality = item.itemQuality,
+					name = dbItem.itemName,
+					quality = dbItem.itemQuality,
 					filter = itemTypeFilter,
 					worn = bWorn
 				}

-				if(itemCount > 0) and matchFilter(item.itemName, iLink) and matchQuality(item.itemQuality) and match then
+				if(itemCount > 0) and matchFilter(dbItem.itemName, itemLink) and matchQuality(dbItem.itemQuality) and match then
 					table.insert(dataLines, tempDataLine)
 				end
 				match = false
@@ -477,10 +477,6 @@ function IIfA:RefreshInventoryScroll()
 	IIfA:UpdateInventoryScroll()
 end

-
-
-
-
 function IIfA:SetItemCountPosition()
 	for i=1, IIFA_GUI_ListHolder.maxLines do
 		local line = IIFA_GUI_ListHolder.lines[i]
@@ -508,10 +504,6 @@ function IIfA:CreateLine(i, predecessor, parent)
 	line.worn = line:GetNamedChild("IconWorn")
 	line.stolen = line:GetNamedChild("IconStolen")

---	line.text:SetText(text)
---	line.itemLink = text
---	text=""
-
 	line:SetHidden(false)
 	line:SetMouseEnabled(true)
 	line:SetHeight(IIFA_GUI_ListHolder.rowHeight)
@@ -711,6 +703,7 @@ function IIfA:SetupBackpack()
 		local function OnItemSelect(_, choiceText, choice)
 	--		d("OnItemSelect", choiceText, choice)
 			IIfA:SetInventoryListFilter(choiceText)
+			IIfA:RefreshInventoryScroll()
 			PlaySound(SOUNDS.POSITIVE_CLICK)
 		end

diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 6fe8306..eedda07 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -73,6 +73,7 @@ function IIfA:CollectGuildBank()
 		IIfA.data.guildBanks[curGuild].bCollectData = true		-- default to true just so it's here and ok
 	end

+	IIfA.BagSlotInfo[curGuild] = nil
 	-- call with libAsync to avoid lag
 	task:Call(function()
 		IIfA:DebugOut("Collect guild bank - <<1>>", curGuild)
@@ -83,7 +84,10 @@ function IIfA:CollectGuildBank()
 		IIfA:DebugOut(" - " .. #ZO_GuildBankBackpack.data .. " items")
 		for i=1, #ZO_GuildBankBackpack.data do
 			local slotIndex = ZO_GuildBankBackpack.data[i].data.slotIndex
-			IIfA:EvalBagItem(BAG_GUILDBANK, slotIndex)
+			local dbItem, itemKey = IIfA:EvalBagItem(BAG_GUILDBANK, slotIndex)
+			IIfA.BagSlotInfo[curGuild] = IIfA.BagSlotInfo[curGuild] or {}
+			IIfA.BagSlotInfo[curGuild][slotIndex] = itemKey
+			IIfA:DebugOut("Collect guild bank from <<1>> - slot/key <<2>> / <<3>>", curGuild, slotIndex, itemKey)
 		end
 	end)
 --	d("IIfA - Guild Bank Collected - " .. curGuild)
@@ -255,15 +259,25 @@ function IIfA:GuildBankAddRemove(eventID, slotId)
 	end):Then(function()
 	--IIfA:CollectGuildBank()
 		local dbItem, itemKey
+		local guildName = GetGuildName(GetSelectedGuildBankId())
 		if eventID == EVENT_GUILD_BANK_ITEM_ADDED then
 			IIfA:DebugOut("GB Add - Slot <<1>>", slotId)
-			dbItem, itemKey = IIfA:EvalBagItem(BAG_GUILDBANK, slotId, true, 0)
+			dbItem, itemKey = IIfA:EvalBagItem(BAG_GUILDBANK, slotId, true)
 			IIfA:ValidateItemCounts(BAG_GUILDBANK, slotId, dbItem, itemKey)
+			IIfA.BagSlotInfo[guildName][slotId] = itemKey
 		else
-	--		d("GB Remove")
-	--		d(GetItemLink(BAG_GUILDBANK, slotId))
-	--		dbItem, itemKey = IIfA:EvalBagItem(BAG_BACKPACK, slotId)
-	--		IIfA:ValidateItemCounts(BAG_GUILDBANK, slotId, dbItem, itemKey)
+			if IIfA.BagSlotInfo[guildName] ~= nil and IIfA.BagSlotInfo[guildName][slotId] then
+				itemLink = IIfA.BagSlotInfo[guildName][slotId]
+				if #itemLink < 10 then
+					itemLink = IIfA.database[itemLink].itemLink
+				end
+				IIfA:DebugOut("GB Remove - Slot <<1>>, Link <<2>>, ", slotId)
+				dbItem, itemKey = IIfA:EvalBagItem(BAG_GUILDBANK, slotId, false, 0, itemLink)
+				IIfA:ValidateItemCounts(BAG_GUILDBANK, slotId, dbItem, itemKey)
+				IIfA.BagSlotInfo[guildName][slotId] = nil
+			else
+				IIfA:DebugOut("GB Remove - Slot <<1>> - no BSI found", slotId)
+			end
 		end
 	end)
 end
@@ -287,7 +301,6 @@ function IIfA:RescanHouse(houseCollectibleId)
 	houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
 	if not houseCollectibleId then return end

-
 	IIfA.data.collectHouseData[houseCollectibleId] = IIfA.data.collectHouseData[houseCollectibleId] or IIfA:GetHouseTracking()

 	if not IIfA.data.collectHouseData[houseCollectibleId] then
@@ -328,22 +341,6 @@ function IIfA:RescanHouse(houseCollectibleId)

 end

---[[ causing massive problems because we're creating the BSI entry while trying to use it from EvalBagItem
--- try to read item link from bag/slot - if that's an empty string, we try to read it from BSI
-local function getItemLink(bagId, slotId)
-	if nil == bagId or nil == slotId then return end
-	local itemLink = GetItemLink(bagId, slotId, LINK_STYLE_BRACKETS)
-	if itemLink ~= "" then
-		-- got an item link, save it to the BSI for reverse lookups
-		IIfA:SaveBagSlotIndex(bagId, slotId, itemLink)
-		return itemLink
-	end
-	if not IIfA.BagSlotInfo then return end
-	if nil == IIfA.BagSlotInfo[bagId] then return end
-	return IIfA.BagSlotInfo[bagId][slotId]
-end
---]]
-
 -- try to read item name from bag/slot - if that's empty, we read it from item link
 local function getItemName(bagId, slotId, itemLink)
 	local itemName = GetItemName(bagId, slotId)
@@ -357,7 +354,7 @@ function IIfA:GetItemKey(itemLink, usedInCraftingType, itemType)

 	if CanItemLinkBeVirtual(itemLink) then	-- anything that goes in the craft bag
 		return IIfA:GetItemID(itemLink)
-	elseif usedInCraftingType ~= CRAFTING_TYPE_INVALID and		-- crafting materials get saved by ID
+	elseif usedInCraftingType ~= CRAFTING_TYPE_INVALID and		-- crafting materials get saved by ID - think about removing this
    		itemType ~= ITEMTYPE_GLYPH_ARMOR and
    		itemType ~= ITEMTYPE_GLYPH_JEWELRY and
    		itemType ~= ITEMTYPE_GLYPH_WEAPON then
@@ -375,8 +372,9 @@ function IIfA:GetItemKey(itemLink, usedInCraftingType, itemType)
 end

 local function getItemCount(bagId, slotId, itemLink)
-
 	local stackCountBackpack, stackCountBank, stackCountCraftBag, itemCount
+	if bagId > BAG_MAX_VALUE then return 0 end
+
 	-- first try to read item count from bag/slot
 	_, itemCount =  GetItemInfo(bagId, slotId)
 	if 0 < itemCount then return itemCount end
@@ -428,30 +426,34 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName

 	-- item link is either passed as arg or we need to read it from the system
 	itemLink = itemLink or GetItemLink(bagId, slotId)
-	itemLink = string.gsub(itemLink, '|H0', '|H1')		-- always store/eval with brackets on the link
-
-	--IIfA:DebugOut("trying to save <<1>> x<<2>>", itemLink, itemCount)
-
 	-- return if we don't have any item to track
-	if itemLink == nil or itemLink == "" then return end
+	if itemLink == nil or #itemLink == 0 then return end
+
+	itemLink = string.gsub(itemLink, '|H0', '|H1')		-- always store/eval with brackets on the link
+	if #itemLink < 10 then
+		IIfA:DebugOut("Item link error - <<1>> should be > 10, but it's an itemKey instead", itemLink)
+		-- deliberate crash
+		IIfA.database.junk["nothing"] = "something"
+	end

 	-- item names is either passed or we get it from bag/slot or item link
-	itemName = itemName or getItemName(bagId, slotId, itemLink) or EMPTY_STRING
+	if itemName and #itemName == 0 then itemName = nil end
+	itemName = itemName or getItemName(bagId, slotId, itemLink)

 	-- item count is either passed or we have to get it from bag/slot ID or item link
 	itemCount = itemCount or getItemCount(bagId, slotId, itemLink)

+	--IIfA:DebugOut("trying to save <<1>> x<<2>>", itemLink, itemCount)

 	-- get item key from crafting type
 	local usedInCraftingType, itemType
-	local qty, itemQuality
+	local itemQuality

 	if bagId <= BAG_MAX_VALUE then
 		usedInCraftingType, _ = GetItemCraftingInfo(bagId, slotId)
-		_, qty, _, _, _, _, _, itemQuality = GetItemInfo(bagId, slotId)
+		_, itemCount, _, _, _, _, _, itemQuality = GetItemInfo(bagId, slotId)
 	else	-- these are furniture items in a house
 		usedInCraftingType = GetItemLinkCraftingSkillType(itemLink)
-		qty = itemCount or 0
 		itemQuality = GetItemLinkQuality(itemLink)
 	end

@@ -459,14 +461,9 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName

 	-- IIfA:DebugOut("CraftingType, ItemType <<1>>, <<2>>", usedInCraftingType, itemType)

-
-	if 0 == qty and itemLink then
-		itemQuality			= GetItemLinkQuality(itemLink)
-		usedInCraftingType 	= GetItemLinkCraftingSkillType(itemLink)
-		itemType 			= GetItemLinkItemType(itemLink)
-	end
-
-	itemLink = string.gsub(itemLink, '|H0', '|H1')
+	itemQuality			= GetItemLinkQuality(itemLink)
+	usedInCraftingType 	= GetItemLinkCraftingSkillType(itemLink)
+	itemType 			= GetItemLinkItemType(itemLink)

 	local itemKey
 	if bagId == BAG_VIRTUAL then
@@ -475,7 +472,6 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName
 		itemKey = IIfA:GetItemKey(itemLink, usedInCraftingType, itemType) or itemLink
 	end

-
 	if nil == itemKey then return end

 	local itemFilterType = GetItemFilterTypeInfo(bagId, slotId) or 0
@@ -483,22 +479,18 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName
 	local location = locationID or getLocation(location, bagId) or EMPTY_STRING

 	if(DBitem) then
-		local DBitemlocation = DBitem.locations[location]
-		if DBitemlocation then
-			DBitemlocation.itemCount = DBitemlocation.itemCount + itemCount
-			DBitemlocation.bagSlot = DBitemlocation.bagSlot or slotId
+		if itemCount == 0 then
+			DBitem.locations[location] = nil
 		else
-			DBitem.locations[location] = {}
-			DBitem.locations[location].bagID = bagId
-			DBitem.locations[location].bagSlot = slotId
-			DBitem.locations[location].itemCount = itemCount
-		end
-		if qty < 1 then
-			qty = getItemCount(bagId, slotId, itemLink)
-			if qty == 0 then
-				DBitem.locations[location] = nil
+			local DBitemlocation = DBitem.locations[location]
+			if DBitemlocation then
+				DBitemlocation.itemCount = itemCount 		-- DBitemlocation.itemCount + itemCount
+				DBitemlocation.bagSlot = DBitemlocation.bagSlot or slotId
 			else
-				DBitem.locations[location].itemCount = qty
+				DBitem.locations[location] = {}
+				DBitem.locations[location].bagID = bagId
+				DBitem.locations[location].bagSlot = slotId
+				DBitem.locations[location].itemCount = itemCount
 			end
 		end
 	else
@@ -530,16 +522,21 @@ function IIfA:ValidateItemCounts(bagID, slotId, dbItem, itemKey, itemLinkOverrid

 	local itemCount
 	local itemLink, itemLinkCheck
+	local guildName = GetGuildName(GetSelectedGuildBankId())
 	if zo_strlen(itemKey) < 10 then
-		itemLink = dbItem.itemLink or GetItemLink(bagID, slotId) or (override and itemLinkOverride)
+		if override and itemLinkOverride then
+			itemLink = itemLinkOverride
+		else
+			itemLink = dbItem.itemLink or GetItemLink(bagID, slotId)
+		end
 	else
 		itemLink = itemKey
 	end
 	IIfA:DebugOut(zo_strformat("ValidateItemCounts: <<1>> in bag <<2>>/<<3>>", itemLink, bagID, slotId))

 	for locName, data in pairs(dbItem.locations) do
-		if (data.bagID == BAG_GUILDBANK and locName == GetGuildName(GetSelectedGuildBankId())) or
-		-- we're looking at the right guild bank
+		if (data.bagID == BAG_GUILDBANK and locName == guildName) or
+			-- we're looking at the right guild bank
 			data.bagID == BAG_VIRTUAL or
 			data.bagID == BAG_BANK or
 			data.bagID == BAG_SUBSCRIBER_BANK or
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index a800520..bfe7151 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -24,17 +24,21 @@ function IIfA:InventorySlotUpdate(eventCode, bagId, slotId, isNewItem, itemSound
 	end

 	local itemLink = GetItemLink(bagId, slotId, LINK_STYLE_BRACKETS) or ""
+	local itemKey = IIfA:GetItemKey(itemLink, nil, nil)		-- yes, the nil's can be left off, but this way we know it's supposed to take 3 args)
 	if #itemLink == 0 and IIfA.BagSlotInfo[bagId] ~= nil and IIfA.BagSlotInfo[bagId][slotId] then
-		itemLink = IIfA.BagSlotInfo[bagId][slotId]
+		itemKey = IIfA.BagSlotInfo[bagId][slotId]
+		if #itemLink < 10 then
+			itemLink = IIfA.database[itemKey].itemLink
+		end
 	elseif #itemLink > 0 and IIfA.BagSlotInfo[bagId] == nil then
 		IIfA.BagSlotInfo[bagId] = {}
-		IIfA.BagSlotInfo[bagId][slotId] = itemLink
+		IIfA.BagSlotInfo[bagId][slotId] = itemKey
 	elseif #itemLink > 0 and IIfA.BagSlotInfo[bagId][slotId] == nil then
-		IIfA.BagSlotInfo[bagId][slotId] = itemLink
+		IIfA.BagSlotInfo[bagId][slotId] = itemKey
 	end

 	IIfA:DebugOut("Inv Slot Upd <<1>> - bag/slot <<2>>/<<3>> x<<4>>, new: <<6>>",
-		itemLink, bagId, slotId, qty, inventoryUpdateReason, tostring(isNewItem))
+		itemLink, bagId, slotId, qty, inventoryUpdateReason, isNewItem)

 	-- (bagId, slotNum, fromXfer, itemCount, itemLink, itemName, locationID)
 	local dbItem, itemKey = self:EvalBagItem(bagId, slotId, not isNewItem, qty, itemLink)
@@ -54,9 +58,11 @@ function IIfA:InventorySlotUpdate(eventCode, bagId, slotId, isNewItem, itemSound
     --cancel previously scheduled update if any
     EVENT_MANAGER:UnregisterForUpdate(callbackName)
     --register a new one
-    EVENT_MANAGER:RegisterForUpdate(callbackName, 250, Update)
+	if not IIFA_GUI:IsControlHidden() then		-- only update the frame if it's shown
+    	EVENT_MANAGER:RegisterForUpdate(callbackName, 250, Update)
+	end
 end
-
+-- |H1:item:16424:4:1:0:0:0:0:0:0:0:0:0:0:0:0:7:0:0:0:0:0|h|h

 local function IIfA_InventorySlotUpdate(...)
 	IIfA:InventorySlotUpdate(...)
@@ -82,10 +88,12 @@ local function IIfA_HouseEntered(eventCode)
 		IIfA:SetTrackingForHouse(houseCollectibleId,  IIfA:GetCollectingHouseData())
 	end
 	IIfA:GetTrackedBags()[houseCollectibleId] = IIfA:GetTrackedBags()[houseCollectibleId] or IIfA.data.collectHouseData[houseCollectibleId]
-	IIfA:RescanHouse(houseCollectibleId)
+	if IIfA:GetTrackedBags()[houseCollectibleId] then
+		IIfA:RescanHouse(houseCollectibleId)
+	end
 end

-local function IIfA_EventProc(...)
+local function IIfA_EventDump(...)
 	--d(...)
 	local l = {...}
 	local s = ""
@@ -108,7 +116,15 @@ local function IIfA_EventProc(...)
 end

 local function finv1(...)
-	d("inventory open error")
+	d("inventory slot changed")
+	IIfA_EventDump(...)
+end
+local function finv2(...)
+	d("inventory item destroyed")
+	IIfA_EventDump(...)
+end
+local function finv3(...)
+	d("inventory slot update")
 	IIfA_EventDump(...)
 end
 local function fgb1(...)
@@ -143,9 +159,9 @@ function IIfA:RegisterForEvents()
 	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)

---	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_ITEM_SLOT_CHANGED, finv1)
+--	em:RegisterForEvent("IIFA_unknown", EVENT_INVENTORY_ITEM_USED, IIfA_EventDump)	-- arg 1 = event id, arg 2 = 27 (slot #?)
+--	em:RegisterForEvent("IIFA_unknown", EVENT_INVENTORY_ITEM_DESTROYED, finv2)
 --	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
diff --git a/IIfA/IIfASettingsAdapter.lua b/IIfA/IIfASettingsAdapter.lua
index 807f951..20d525c 100644
--- a/IIfA/IIfASettingsAdapter.lua
+++ b/IIfA/IIfASettingsAdapter.lua
@@ -137,6 +137,7 @@ end
 function IIfA:GetHouseIdFromName(houseName)
 	return IIfA.houseNameToIdTbl[houseName]
 end
+
 function IIfA:GetTrackingWithHouseNames()
 	local ret = {}
 	for collectibleId, trackIt in pairs(IIfA.data.collectHouseData) do