splitting/moving not yet working correctly

git [02-11-18 - 15:42]
splitting/moving not yet working correctly
Filename
IIfA/IIfA.lua
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
IIfA/IIfAEvents.lua
IIfA/IIfASceneFuncs.lua
IIfA/IIfASettingsAdapter.lua
IIfA/IIfATooltip.lua
IIfA/IIfA_xml_adapter.lua
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index 590bd7b..9e4ecb4 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -130,8 +130,33 @@ function IIfA_SlashCommands(cmd)
 	end
 end

-function IIfA:DebugOut(output)
-	if (IIfA.data.bDebug) then d(output) end
+function IIfA:DebugOut(output, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+	if not IIfA.data.bDebug then return end
+	if a10 then
+		d(zo_strformat(output, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10))
+	elseif a9 then
+		d(zo_strformat(output, a1, a2, a3, a4, a5, a6, a7, a8, a9))
+	elseif a8 then
+		d(zo_strformat(output, a1, a2, a3, a4, a5, a6, a7, a8))
+	elseif a7 then
+		d(zo_strformat(output, a1, a2, a3, a4, a5, a6, a7))
+	elseif a6 then
+		d(zo_strformat(output, a1, a2, a3, a4, a5, a6))
+	elseif a5 then
+		d(zo_strformat(output, a1, a2, a3, a4, a5))
+	elseif a4 then
+		d(zo_strformat(output, a1, a2, a3, a4))
+	elseif a3 then
+		d(zo_strformat(output, a1, a2, a3))
+	elseif a2 then
+		d(zo_strformat(output, a1, a2))
+	elseif a1 then
+		d(zo_strformat(output, a1))
+	elseif output then
+		d(zo_strformat(output))
+	else
+		d("\n")
+	end
 end

 function IIfA:StatusAlert(message)
@@ -234,7 +259,7 @@ function IIfA_onLoad(eventCode, addOnName)
 	IIfA.filterTypes = nil

 	-- grabs data from bagpack, and worn bag when we first open the inventory
-	ZO_PreHook(PLAYER_INVENTORY, "ApplyBackpackLayout", IIfA.OnFirstInventoryOpen)
+	-- ZO_PreHook(PLAYER_INVENTORY, "ApplyBackpackLayout", IIfA.OnFirstInventoryOpen)
 	ZO_PreHook(BACKPACK_GUILD_BANK_LAYOUT_FRAGMENT, "ApplyBackpackLayout", IIfA.CollectGuildBank)

 	-- ZO_PreHook(SHARED_INVENTORY, "GetOrCreateBagCache", function(self, bagId)
diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index d7fdebd..3c2b840 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -10,7 +10,7 @@ IIfA.InventoryFilter = "All"
 IIfA.InventoryListFilter = "Any"
 IIfA.InventoryListFilterQuality = 99

-
+local function p(...) IIfA:DebugOut(...) end
 -- this is for the buttons
 local function enableFilterButton(num)
 	local buttonName = "Button"..num
@@ -50,8 +50,7 @@ function IIfA:SetActiveFilter(value)

 	enableFilterButton(value)

-	IIfA:UpdateScrollDataLinesData()
-	IIfA:UpdateInventoryScroll()
+	IIfA:RefreshInventoryScroll()
 end

 function IIfA:GetActiveSubFilter()
@@ -66,8 +65,7 @@ function IIfA:SetActiveSubFilter(value)
 	else
 		IIfA.activeSubFilter = value
 	end
-	IIfA:UpdateScrollDataLinesData()
-	IIfA:UpdateInventoryScroll()
+	IIfA:RefreshInventoryScroll()
 end


@@ -344,7 +342,6 @@ end

 -- fill the shown item list with items that match current filter(s)
 function IIfA:UpdateScrollDataLinesData()
-	IIfA:DebugOut("UpdateScrollDataLinesData")

 	if (not IIfA.searchFilter) or IIfA.searchFilter == "Click to search..." then
 		IIfA.searchFilter = IIFA_GUI_SearchBox:GetText()
@@ -433,8 +430,8 @@ local function fillLine(curLine, curItem)
 	end
 end

-function IIfA:InitializeInventoryLines()
-	IIfA:DebugOut("InitializeInventoryLines")
+function IIfA:SetDataLinesData()
+	p("SetDataLinesData")

 	local curLine, curData
 	for i = 1, IIFA_GUI_ListHolder.maxLines do
@@ -454,19 +451,28 @@ end
 function IIfA:UpdateInventoryScroll()
 	local index = 0

-	IIfA:DebugOut("UpdateInventoryScroll")
-
 	------------------------------------------------------
 	if IIFA_GUI_ListHolder.dataOffset < 0 then IIFA_GUI_ListHolder.dataOffset = 0 end
 	if IIFA_GUI_ListHolder.maxLines == nil then
 		IIFA_GUI_ListHolder.maxLines = 35
 	end
-	IIfA:InitializeInventoryLines()
+	IIfA:SetDataLinesData()

 	local total = #IIFA_GUI_ListHolder.dataLines - IIFA_GUI_ListHolder.maxLines
 	IIFA_GUI_ListHolder_Slider:SetMinMax(0, total)
 end

+function IIfA:RefreshInventoryScroll()
+
+	-- p("RefreshInventoryScroll")
+
+	IIfA:UpdateScrollDataLinesData()
+	IIfA:UpdateInventoryScroll()
+end
+
+
+
+

 function IIfA:SetItemCountPosition()
 	for i=1, IIFA_GUI_ListHolder.maxLines do
@@ -520,7 +526,7 @@ end


 function IIfA:CreateInventoryScroll()
-	IIfA:DebugOut("CreateInventoryScroll")
+	p("CreateInventoryScroll")

 	IIFA_GUI_ListHolder.dataOffset = 0

@@ -953,8 +959,7 @@ function IIfA:FilterByItemName(control)
 	IIFA_GUI_SearchBox:SetText(itemName)
 	IIFA_GUI_SearchBoxText:SetHidden(true)
 	IIfA.bFilterOnSetName = false
-    IIfA:UpdateScrollDataLinesData()
-    IIfA:UpdateInventoryScroll()
+    IIfA:RefreshInventoryScroll()

 end

@@ -980,8 +985,7 @@ function IIfA:FilterByItemSet(control)
 	IIFA_GUI_SearchBox:SetText(setName)
 	IIFA_GUI_SearchBoxText:SetHidden(true)
 	IIfA.bFilterOnSetName = true
-    IIfA:UpdateScrollDataLinesData()
-    IIfA:UpdateInventoryScroll()
+    IIfA:RefreshInventoryScroll()

 end

diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 277c3f1..4f5c9f1 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -3,10 +3,13 @@ local EMPTY_STRING 	= ""

 local task 			= LibStub("LibAsync"):Create("IIfA_DataCollection")
 IIfA.task			= task
-local function grabBagContent(bagId)
+
+local function p(...) IIfA:DebugOut(...) end
+
+local function grabBagContent(bagId, override)
 	local bagItems = GetBagSize(bagId)
 	for slotNum=0, bagItems, 1 do
-		dbItem, itemKey = IIfA:EvalBagItem(bagId, slotNum)
+		dbItem, itemKey = IIfA:EvalBagItem(bagId, slotNum, false, nil, nil, nil, nil, override)
 	end
 end

@@ -114,16 +117,18 @@ local function tryScanHouseBank()
 	local bagId = GetBankingBag()
 	if not bagId then return end
 	local collectibleId = GetCollectibleForHouseBankBag(bagId)
-

 	if IsCollectibleUnlocked(collectibleId) then
+
+		IIfA:DebugOut(zo_strformat("tryScanHouseBank(<<1>>)", collectibleId))
+
 		local collectibleName = GetCollectibleNickname(collectibleId)
 		if collectibleName == EMPTY_STRING then collectibleName = GetCollectibleName(collectibleId) end
 		-- call with libAsync to avoid lags
 		task:Call(function()
-			IIfA:ClearLocationData(bagId)
+			IIfA:ClearLocationData(collectibleId)
 		end):Then(function()
-			grabBagContent(bagId)
+			grabBagContent(bagId, true)
 		end)
 	end

@@ -131,6 +136,7 @@ local function tryScanHouseBank()
 end

 function IIfA:ScanBank()
+
 	if tryScanHouseBank() then return end
 	-- call with libAsync to avoid lags
 	task:Call(function()
@@ -167,12 +173,17 @@ end

 -- only grabs the content of bagpack and worn on the first login - hence we set the function to insta-return below.
 function IIfA:OnFirstInventoryOpen()
+
+	if IIfA.BagsScanned then return end
+	IIfA.BagsScanned = true
+
 	scanBags()
 	-- call with libAsync to avoid lags
 	task:Call(function()
+
+	end):Then(function()
 		IIfA:ScanBank()
 	end)
-	IIfA.OnFirstInventoryOpen = function() return end
 end

 function IIfA:CheckForAgedGuildBankData( days )
@@ -277,6 +288,7 @@ function IIfA:AddFurnitureItem(itemLink, itemCount, houseCollectibleId, fromInit
 	local location = houseCollectibleId
 	IIfA:EvalBagItem(houseCollectibleId, IIfA:GetItemID(itemLink), false, itemCount, itemLink, GetItemLinkName(itemLink), houseCollectibleId)
 end
+
 --[[
 Data collection notes:
 	Currently crafting items are coming back from getitemlink with level info in them.
@@ -286,26 +298,6 @@ Data collection notes:
 	When showing items in tooltips, check for both stolen & owned, show both
 --]]

-
--- used by an event function - see iifaevents.lua for call
-function IIfA:InventorySlotUpdate(eventCode, bagId, slotNum, isNewItem, itemSoundCategory, inventoryUpdateReason, qty)
-	if isNewItem then
-		isNewItem = "True"
-	else
-		isNewItem = "False"
-	end
-
-	IIfA:DebugOut(zo_strformat("Inv Slot Upd - <<1>>, <<2>>, <<3>>, <<4>>, <<5>>, <<6>>, <<7>>",
-		GetItemLink(bagId, slotNum, LINK_STYLE_NORMAL), eventCode, bagId, slotNum, inventoryUpdateReason, qty, isNewItem))
-	local dbItem, itemKey
-	dbItem, itemKey = self:EvalBagItem(bagId, slotNum, true, qty)
---	if dbItem ~= nil and (bagId == BAG_BANK or bagId == BAG_SUBSCRIBER_BANK or bagId == BAG_BACKPACK) then
---		IIfA:ValidateItemCounts(bagId, slotNum, dbItem, itemKey)
---	end
-end
-
-
-
 function IIfA:RescanHouse(houseCollectibleId)

 	houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
@@ -329,6 +321,8 @@ function IIfA:RescanHouse(houseCollectibleId)
 		end
 	end

+	-- IIfA:DebugOut(zo_strformat("IIfA: Scanning house <<1>>", collectibleId))
+
 	-- call with libAsync to avoid lags
 	task:Call(function()
 		-- it's easier to throw everything away and re-scan than to conditionally update
@@ -382,23 +376,22 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemNam
 	IIfA.database = IIfA.database or {}
 	local DBv3 = IIfA.database

-	if fromXfer == nil then
-		fromXfer = false
-	end
-
 	itemName = itemName or GetItemName(bagId, slotNum) or EMPTY_STRING
-	if itemName == "" then
-		if nil ~= IIfA.BagSlotInfo[bagId] and nil ~= IIfA.BagSlotInfo[bagId][slotNum] then
+	if itemName == EMPTY_STRING then
+		if itemLink then
+			itemName = GetItemLinkName(itemLink)
+		elseif nil ~= IIfA.BagSlotInfo[bagId] and nil ~= IIfA.BagSlotInfo[bagId][slotNum] then
 			itemLink = IIfA.BagSlotInfo[bagId][slotNum]
-			itemName = GetItemLinkName(bagId, slotNum)
+			itemName = GetItemLinkName(itemLink)
 		end
 	end
+
+	IIfA:DebugOut(zo_strformat("EvalBagItem bagId/slotId: <<1>>/<<2>> name/count: <<3>> x <<4>>", bagId, slotNum, itemName, itemCount))
+
 	if not itemCount then
 		_, itemCount =  GetItemInfo(bagId, slotNum)
 	end

-	--  IIfA:DebugOut(zo_strformat("EvalBagItem bagId/slotId: <<1>>/<<2>> name/count: <<3>> x <<4>>", bagId, slotNum, itemName, itemCount))
-
 	if itemName > EMPTY_STRING then
 		itemLink = itemLink or GetItemLink(bagId, slotNum, LINK_STYLE_BRACKETS)
 		itemKey = itemLink
@@ -445,16 +438,11 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemNam
 			location = GetGuildName(GetSelectedGuildBankId())
 		elseif GetAPIVersion() >= 100022 and 0 < GetCollectibleForHouseBankBag(bagId) then
 			location = GetCollectibleForHouseBankBag(bagId)
-
-		-- elseif GetAPIVersion() >= 100022 then
-			-- local collectibleId = GetCollectibleForHouseBankBag(GetBankingBag())
-			-- location = GetCollectibleNickname(collectibleId)
-			-- if location == EMPTY_STRING then location = GetCollectibleName(collectibleId) end
 		end

 		if(DBitem) then
 			DBitemlocation = DBitem.locations[location]
-			if DBitemlocation then
+			if DBitemlocation then
 				DBitemlocation.itemCount = DBitemlocation.itemCount + itemCount
 				DBitemlocation.bagSlot = DBitemlocation.bagSlot or slotNum
 			else
@@ -488,6 +476,8 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemNam
 end

 function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey, itemLinkOverride, override)
+
+	local itemCount
 	local itemLink, itemLinkCheck
 	if zo_strlen(itemKey) < 10 then
 		itemLink = GetItemLink(bagID, slotNum) or dbItem.itemLink or (override and itemLinkOverride)
@@ -497,6 +487,49 @@ function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey, itemLinkOverri
 	IIfA:DebugOut(zo_strformat("ValidateItemCounts: <<1>> in bag <<2>>/<<3>>", itemLink, bagID, slotNum))

 	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
+			data.bagID == BAG_VIRTUAL or
+			data.bagID == BAG_BANK or
+			data.bagID == BAG_SUBSCRIBER_BANK or
+			nil ~= GetCollectibleForHouseBankBag and nil ~= GetCollectibleForHouseBankBag(data.bagID) or -- is housing bank, manaeeee
+		   ((data.bagID == BAG_BACKPACK or data.bagID == BAG_WORN) and locName == GetCurrentCharacterId()) then
+
+			itemLinkCheck = GetItemLink(data.bagID, data.bagSlot, LINK_STYLE_BRACKETS)
+			if itemLinkCheck == nil then
+				itemLinkCheck = (override and itemLinkOverride) or EMPTY_STRING
+			end
+			if itemLinkCheck ~= itemLink then
+				if bagID ~= data.bagID and slotNum ~= data.bagSlot then
+				-- it's no longer the same item, or it's not there at all
+					IIfA.database[itemKey].locations[locName] = nil
+				end
+			-- item link is valid, just make sure we have our count right
+			elseif bagId == data.bagID then
+					_, data.itemCount = GetItemInfo(bagID, slotNum)
+
+			end
+
+		end
+	end
+
+	IIfA:UpdateBSI(bagID, slotNum)
+end
+
+function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey, itemLinkOverride, override)
+	local itemLink, itemLinkCheck
+	if nil == itemKey or zo_strlen(itemKey) < 10 then
+		itemLink = GetItemLink(bagID, slotNum, LINK_STYLE_BRACKETS) or dbItem.itemLink or (override and itemLinkOverride)
+	else
+		itemLink = itemKey
+	end
+	if itemLink == "" then
+		itemLink = (nil ~= IIfA.BagSlotInfo[bagID] and IIfA.BagSlotInfo[bagID][slotNum])
+	end
+	dbItem = dbItem or IIfA:QueryAccountInventory(itemLink)
+	-- IIfA:DebugOut(zo_strformat("ValidateItemCounts: <<1>> in bag <<2>>/<<3>>", itemLink, bagID, slotNum))
+
+	for locName, data in pairs(dbItem.locations) do
 --		if data.bagID ~= nil then	-- it's an item, not attribute
 			if (data.bagID == BAG_GUILDBANK and locName == GetGuildName(GetSelectedGuildBankId())) or
 			-- we're looking at the right guild bank
@@ -506,18 +539,20 @@ function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey, itemLinkOverri
 				nil ~= GetCollectibleForHouseBankBag and nil ~= GetCollectibleForHouseBankBag(data.bagID) or -- is housing bank, manaeeee
 			   ((data.bagID == BAG_BACKPACK or data.bagID == BAG_WORN) and locName == GetCurrentCharacterId()) then
 --		d(locName)
---		d(data)
+		-- d(data)
 --		d(GetItemLink(data.bagID, data.bagSlot, LINK_STYLE_BRACKETS))
 				itemLinkCheck = GetItemLink(data.bagID, data.bagSlot, LINK_STYLE_BRACKETS)
 				if itemLinkCheck == nil then
 					itemLinkCheck = (override and itemLinkOverride) or EMPTY_STRING
 				end
---				d("ItemlinkCheck = " .. itemLinkCheck)
+--				("ItemlinkCheck = " .. itemLinkCheck)
 				if itemLinkCheck ~= itemLink then
 					if bagID ~= data.bagID and slotNum ~= data.bagSlot then
 --						d("should remove " .. itemLink .. " from " .. locName)
-					-- it's no longer the same item, or it's not there at all
-						IIfA.database[itemKey].locations[locName] = nil
+					-- it's no longer the same item, or it's not there at all
+						if nil ~= IIfA.database[itemKey] and nil ~= IIfA.database[itemKey].locations and nil ~= locName then
+							IIfA.database[itemKey].locations[locName] = nil
+						end
 					end
 				end
 			end
@@ -537,8 +572,7 @@ function IIfA:CollectAll()

 	for bagId, tracked in ipairs(BagList) do
 		-- call with libAsync to avoid lags
-		task:Call(function()
-
+		task:Call(function()
 			bagItems = GetBagSize(bagId)
 			if(bagId == BAG_WORN)then	--location for BAG_BACKPACK and BAG_WORN is the same so only reset once
 				IIfA:ClearLocationData(IIfA.currentCharacterId)
@@ -615,6 +649,9 @@ function IIfA:ClearLocationData(location)
 	local itemName, itemData

 	if(DBv3)then
+
+		IIfA:DebugOut(zo_strformat("IIfA:ClearLocationData(<<1>>)", location))
+
 		for itemName, itemData in pairs(DBv3) do
 			itemLocation = itemData.locations[location]
 			if (itemLocation) then
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index f53c4aa..9d8529e 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -12,6 +12,28 @@ local function IIfA_EventOnPlayerUnloaded()
 	IIfA.CharBagFrame:UpdateAssets()
 end

+
+-- used by an event function
+function IIfA:InventorySlotUpdate(eventCode, bagId, slotId, isNewItem, itemSoundCategory, inventoryUpdateReason, qty)
+
+	if isNewItem then
+		isNewItem = "True"
+	else
+		isNewItem = "False"
+	end
+
+	local itemLink = GetItemLink(bagId, slotId, LINK_STYLE_BRACKETS) or ""
+	if #itemLink == 0 then itemLink = (nil ~= IIfA.BagSlotInfo[bagId] and IIfA.BagSlotInfo[bagId][slotId]) end
+
+	IIfA:DebugOut("Inv Slot Upd <<1>> - bag/slot <<2>>/<<3>> x<<4>>, new: <<6>>, updateReason: <<5>>",
+		itemLink, bagId, slotId, qty, inventoryUpdateReason, tostring(isNewItem))
+
+	-- (bagId, slotNum, fromXfer, itemCount, itemLink, itemName, locationID)
+	local dbItem, itemKey = self:EvalBagItem(bagId, slotId, true, qty, itemLink)
+
+end
+
+
 local function IIfA_InventorySlotUpdate(...)
 	IIfA:InventorySlotUpdate(...)
 end
@@ -20,8 +42,9 @@ local function IIfA_ScanHouse(eventCode, oldMode, newMode)
 	if newMode == "showing" or newMode == "shown" then return end
 	-- are we listening?
 	if not IIfA:GetCollectingHouseData() then return end
-
-	IIfA:RescanHouse(GetCollectibleIdForHouse(GetCurrentZoneHouseId()))
+	local collectibleId = GetCollectibleIdForHouse(GetCurrentZoneHouseId())
+	IIfA:DebugOut(zo_strformat("Housing editor mode is now <<2>> - calling IIfA:RescanHouse(<<1>>)", collectibleId, newMode))
+	IIfA:RescanHouse(collectibleId)
 end

 local function IIfA_HouseEntered(eventCode)
diff --git a/IIfA/IIfASceneFuncs.lua b/IIfA/IIfASceneFuncs.lua
index 717562c..5f8e0bf 100644
--- a/IIfA/IIfASceneFuncs.lua
+++ b/IIfA/IIfASceneFuncs.lua
@@ -110,12 +110,11 @@ end
 function IIfA:ToggleInventoryFrame()
 	IIFA_GUI:SetHidden(not IIFA_GUI:IsControlHidden())
 	if not IIFA_GUI:IsControlHidden() then
-		IIfA:OnFirstInventoryOpen()
+		-- IIfA:OnFirstInventoryOpen()
 		-- get current camera mode so when we toggle off, we put it back to where it was (maybe, can think of some weird circumstances where it might screw it up)
 		SetGameCameraUIMode(true)
 		IIfA:GuiResizeScroll()
-    	IIfA:UpdateScrollDataLinesData()
-    	IIfA:UpdateInventoryScroll()
+    	IIfA:RefreshInventoryScroll()
 		IIFA_GUI_SearchBox:TakeFocus()
 	end
 	if not IIfA.data.dontFocusSearch then
diff --git a/IIfA/IIfASettingsAdapter.lua b/IIfA/IIfASettingsAdapter.lua
index b5a80c0..e07faef 100644
--- a/IIfA/IIfASettingsAdapter.lua
+++ b/IIfA/IIfASettingsAdapter.lua
@@ -49,8 +49,7 @@ end
 function IIfA:SetSetNameFilterOnly(value)
 	IIfA.bFilterOnSetName = not IIfA.bFilterOnSetName
 	IIFA_GUI_SetNameOnly:SetState((IIfA.bFilterOnSetName and BSTATE_PRESSED) or BSTATE_NORMAL)
-    IIfA:UpdateScrollDataLinesData()
-    IIfA:UpdateInventoryScroll()
+    IIfA:RefreshInventoryScroll()
 end

 function IIfA:GetFocusSearchOnToggle()
@@ -80,8 +79,7 @@ function IIfA:SetInventoryListFilter(value)

 	IIfA.searchFilter = IIFA_GUI_SearchBox:GetText()

-	IIfA:UpdateScrollDataLinesData()
-	IIfA:UpdateInventoryScroll()
+	IIfA:RefreshInventoryScroll()
 end

 -- this is for the dropdown menu
@@ -95,8 +93,7 @@ function IIfA:SetInventoryListFilterQuality(value)

 	IIfA.searchFilter = IIFA_GUI_SearchBox:GetText()

-	IIfA:UpdateScrollDataLinesData()
-    IIfA:UpdateInventoryScroll()
+	IIfA:RefreshInventoryScroll()
 end
 function IIfA:GetCollectingHouseData()
 	return IIfA.data.b_collectHouses
diff --git a/IIfA/IIfATooltip.lua b/IIfA/IIfATooltip.lua
index d97397c..b25fb9f 100644
--- a/IIfA/IIfATooltip.lua
+++ b/IIfA/IIfATooltip.lua
@@ -1,6 +1,8 @@
 local IIfA = IIfA
 IIfA.LastActiveRowControl = nil

+local function p(...) IIfA:DebugOut(...) end
+
 function IIfA:addStatsPopupTooltip(...)
 	d("IIFA - Popup tooltip OnUpdate hit")
 	d(...)
@@ -243,7 +245,7 @@ function IIfA_TooltipOnTwitch(control, eventNum)
 		end
 		-- this is called whenever there's any data added to the ingame tooltip
 		if eventNum == TOOLTIP_GAME_DATA_MAX_VALUE then		-- hopefully always called on last data add
---			IIfA:DebugOut("Tooltip On Twitch - " .. control:GetName() .. ", " .. eventNum)
+--			p("Tooltip On Twitch - " .. control:GetName() .. ", " .. eventNum)
 			IIfA:UpdateTooltip(control)
 		end
 	end
@@ -374,10 +376,10 @@ function IIfA:getMouseoverLink()

 	else
 --		d(mouseOverControl:GetName(), mouseOverControl)
-		IIfA:DebugOut("Tooltip not processed - '" .. name .. "'")
+		p("Tooltip not processed - '" .. name .. "'")

 		if IIfA.TooltipLink then
-			IIfA:DebugOut("Current Link - " .. IIfA.TooltipLink)
+			p("Current Link - " .. IIfA.TooltipLink)
 		end

 		return nil
@@ -460,11 +462,12 @@ function IIfA:UpdateTooltip(tooltip)
 							textOut = string.format("%s x %s", location.name, location.itemsFound)
 						end
 					end
-					IIfA:DebugOut(textOut)
+
 					if location.worn then
 						textOut = string.format("%s *", textOut)
 					end
 					textOut = IIfA.colorHandler:Colorize(textOut)
+					-- p("IIfA:UpdateTooltip -> <<1>>", textOut)
 					tooltip:AddLine(textOut)
 				end
 			end
diff --git a/IIfA/IIfA_xml_adapter.lua b/IIfA/IIfA_xml_adapter.lua
index 41282ca..8f69c4b 100644
--- a/IIfA/IIfA_xml_adapter.lua
+++ b/IIfA/IIfA_xml_adapter.lua
@@ -222,7 +222,7 @@ function IIfA:GuiOnFilterButton(control, mouseButton, filterGroup, filterTypes,

 	function SetSubSubFilters(_, subFiltName, choice)
 		IIfA.filterTypes = choice.subFiltTypes
-		IIfA:UpdateScrollDataLinesData()
+		IIfA:RefreshInventoryScroll()
 	end

 	if filterTypeNames ~= nil then
@@ -274,7 +274,7 @@ function IIfA:GuiOnFilterButton(control, mouseButton, filterGroup, filterTypes,

 	IIfA:GuiResizeScroll()

-	IIfA:UpdateScrollDataLinesData()
+	IIfA:RefreshInventoryScroll()
 end

 -- IIFA_GUI_SearchBox is the input field
@@ -283,16 +283,14 @@ function IIfA:GuiOnSearchboxText(control)
 	local text = control:GetText()
 	IIFA_GUI_SearchBoxText:SetHidden(text ~= nil and text > "")
 	IIfA.searchFilter = zo_strlower(text)
-    IIfA:UpdateScrollDataLinesData()
-    IIfA:UpdateInventoryScroll()
+    IIfA:RefreshInventoryScroll()
 end

 function IIfA:GuiOnSearchBoxClear(control)
 	IIFA_GUI_SearchBox:SetText("")
 	IIFA_GUI_SearchBoxText:SetHidden(false)
 	IIfA.searchFilter = ""
-    IIfA:UpdateScrollDataLinesData()
-    IIfA:UpdateInventoryScroll()
+    IIfA:RefreshInventoryScroll()
 end


@@ -311,8 +309,7 @@ function IIfA:GuiOnSort(initialised)
 		icon:SetTexture("/esoui/art/miscellaneous/list_sortheader_icon_sortdown.dds")
 		icon:SetAlpha(1)
 	end
-	IIfA:UpdateScrollDataLinesData()
-	IIfA:UpdateInventoryScroll()
+	IIfA:RefreshInventoryScroll()
 end

 function IIfA:GuiOnScroll(control, delta)
@@ -574,8 +571,8 @@ function IIfA:RePositionFrame(settings)

 	if not settings.hidden then
 		IIfA:GuiResizeScroll()
-    	IIfA:UpdateScrollDataLinesData()
-    	IIfA:UpdateInventoryScroll()
+		IIfA:RefreshInventoryScroll()
+
 	end
 	IIFA_GUI:SetHidden(settings.hidden)
 end