fixed the bag_worn thingy

git [02-15-18 - 18:00]
fixed the bag_worn thingy
Filename
IIfA/IIfA.txt
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
IIfA/IIfAEvents.lua
IIfA/IIfASettingsAdapter.lua
diff --git a/IIfA/IIfA.txt b/IIfA/IIfA.txt
index 7d44931..220bd29 100644
--- a/IIfA/IIfA.txt
+++ b/IIfA/IIfA.txt
@@ -1,6 +1,6 @@
 ## Title: Inventory Insight
 ## Author: manavortex, AssemblerManiac
-## Version: 3.00
+## Version: 3.02
 ## APIVersion: 100022
 ## SavedVariables: IIfA_Settings IIfA_Data
 ## OptionalDependsOn: libFilters pChat
diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index d9fb2da..00e85d9 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -149,7 +149,7 @@ local function DoesInventoryMatchList(locationName, location)
 	elseif(filter == "All Houses") then
 		return IIfA.data.collectHouseData[bagId]

-	elseif(nil ~= IIfA:GetTrackingWithHouseNames()[filter]) then
+	elseif (nil ~= IIfA:GetHouseIdFromName(filter)) then
 		return (bagId == IIfA:GetHouseIdFromName(filter))

 	else --Not a preset, must be a specific guildbank or character
diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 9cda93c..6a7f201 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -272,6 +272,8 @@ end
 function IIfA:AddFurnitureItem(itemLink, itemCount, houseCollectibleId, fromInitialize)

 	local location = houseCollectibleId
+	-- bagId, slotId, fromXfer, itemCount, itemLink, itemName, locationID
+
 	IIfA:EvalBagItem(houseCollectibleId, IIfA:GetItemID(itemLink), false, itemCount, itemLink, GetItemLinkName(itemLink), houseCollectibleId)
 end

@@ -289,7 +291,15 @@ function IIfA:RescanHouse(houseCollectibleId)
 	houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
 	if not houseCollectibleId then return end

-	if not IIfA:GetTrackedBags()[houseCollectibleId] then return end
+
+	IIfA.data.collectHouseData[houseCollectibleId] = IIfA.data.collectHouseData[houseCollectibleId] or IIfA:GetHouseTracking()
+
+	if not IIfA.data.collectHouseData[houseCollectibleId] then
+		if IIfA:GetHouseTracking() and IIfA:GetIgnoredHousIds()[houseCollectibleId] then
+		return
+		end
+
+	end

 	--- stuff them all into an array
 	local function getAllPlacedFurniture()
@@ -412,7 +422,7 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName

 	IIfA.database = IIfA.database or {}
 	local DBv3 = IIfA.database
-
+
 	-- item link is either passed as arg or we need to read it from the system
 	itemLink = itemLink or getItemLink(bagId, slotId)

@@ -425,6 +435,8 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName
 	-- 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("saving <<1>> x<<2>> -> <<3>>", itemLink, itemCount, itemKey)
+
 	-- get item key from crafting type
 	local usedInCraftingType, itemType = GetItemCraftingInfo(bagId, slotId)

@@ -443,6 +455,8 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, itemCount, itemLink, itemName

 	if nil == itemKey then return end

+
+
 	itemFilterType = GetItemFilterTypeInfo(bagId, slotId) or 0
 	DBitem = DBv3[itemKey]
 	location = locationID or getLocation(location, bagId) or EMPTY_STRING
@@ -534,28 +548,33 @@ function IIfA:CollectAll()
 		-- call with libAsync to avoid lags
 		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
+			if(bagId == BAG_WORN) then	--location for BAG_BACKPACK and BAG_WORN is the same so only reset once
 				IIfA:ClearLocationData(IIfA.currentCharacterId)
-				grabBagContent(BAG_WORN)
+				if not IIfA:IsCharacterEquipIgnored(IIfA.currentCharacterId)
+					grabBagContent(BAG_WORN)
+				end
 			elseif(bagId == BAG_BANK) then	-- do NOT add BAG_SUBSCRIBER_BANK here, it'll wipe whatever already got put into the bank on first hit
 				IIfA:ClearLocationData(GetString(IIFA_BAG_BANK))
-				grabBagContent(BAG_BANK)
+					grabBagContent(BAG_BANK)
+			elseif(bagId == BAG_BACKPACK) then
+				IIfA:ClearLocationData(GetString(IIFA_BAG_BACKPACK))
+				if not IIfA:IsCharacterInventoryIgnored(IIfA.currentCharacterId)
+					grabBagContent(BAG_BACKPACK)
+				end
 			elseif(bagId == BAG_VIRTUAL)then
 				IIfA:ClearLocationData(GetString(IIFA_BAG_CRAFTBAG))
-				grabBagContent(BAG_WORN)
+				grabBagContent(BAG_VIRTUAL)
 			end
 	--		d("  BagItemCount=" .. bagItems)
 			if bagId ~= BAG_VIRTUAL and tracked then
 				for slotId=0, bagItems, 1 do
 					dbItem, itemKey = IIfA:EvalBagItem(bagId, slotId)
 				end
-			else
-				if HasCraftBagAccess() then
-					slotId = GetNextVirtualBagSlotId(nil)
-					while slotId ~= nil do
-						IIfA:EvalBagItem(bagId, slotId)
-						slotId = GetNextVirtualBagSlotId(slotId)
-					end
+			else -- it's bag virtual
+				slotId = GetNextVirtualBagSlotId(nil)
+				while slotId ~= nil do
+					IIfA:EvalBagItem(bagId, slotId)
+					slotId = GetNextVirtualBagSlotId(slotId)
 				end
 			end

diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index 9f0ccd9..51ebb19 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -57,14 +57,12 @@ end
 local function IIfA_HouseEntered(eventCode)
 	if not IsOwnerOfCurrentHouse() then return end

-	-- 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)
+		IIfA:SetTrackingForHouse(houseCollectibleId,  IIfA:GetCollectingHouseData())
 	end

 	IIfA:RescanHouse(houseCollectibleId)
diff --git a/IIfA/IIfASettingsAdapter.lua b/IIfA/IIfASettingsAdapter.lua
index 4466c61..0fdc1c8 100644
--- a/IIfA/IIfASettingsAdapter.lua
+++ b/IIfA/IIfASettingsAdapter.lua
@@ -166,6 +166,7 @@ function IIfA:GetAllHouseIds()
 	return ret
 end
 function IIfA:SetTrackingForHouse(houseCollectibleId, trackIt)
+	houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
 	if tonumber(houseCollectibleId) ~= houseCollectibleId then
 		realId = IIfA:GetHouseIdFromName(houseCollectibleId)
 		if not realId then d(houseCollectibleId); return end
@@ -181,6 +182,10 @@ function IIfA:SetTrackingForHouse(houseCollectibleId, trackIt)
 	end
 end

+function IIfA:GetHouseTracking()
+	return IIfA.data.b_collectHouses
+end
+
 function IIfA:SetHouseTracking(value)
 	IIfA.data.b_collectHouses = value
 	if value then