multiple tweaks for FCOIS integration

AssemblerManiac [06-28-18 - 02:40]
multiple tweaks for FCOIS integration
Filename
IIfA/IIfA.lua
IIfA/IIfA.txt
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
IIfA/IIfAMenu.lua
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index 1a369e9..f515452 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -7,7 +7,7 @@
 	Collects inventory data for all characters on a single account including the shared bank and makes this information available
 	on tooltips across the entire account providing the playerwith useful insight into their account wide inventory.
 DISCLAIMER
-	This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates. The Elder Scrolls® and related
+	This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates. The Elder Scrolls and related
 	logos are registered trademarks or trademarks of ZeniMax Media Inc. in the United States and/or other countries. All rights reserved."
 ]]
 ------------------------------------------------------------------
@@ -404,8 +404,8 @@ function IIfA_onLoad(eventCode, addOnName)
 	if ObjSettings.FCOISshowMarkerIcons == nil then
 		ObjSettings.FCOISshowMarkerIcons = false
 		IIfA.data.FCOISshowMarkerIcons = false
-	end
-
+	end
+
 	if IIfA.data.guildBanks == nil then
 		IIfA.data.guildBanks = {}
 		local i
@@ -431,11 +431,11 @@ function IIfA_onLoad(eventCode, addOnName)
 	IIfA.LastFilterControl = IIFA_GUI_Header_Filter_Button0

 	-- save off anchors for the ListHolder
-	local _, point, relTo, relPoint, offsX, offsY = IIFA_GUI_ListHolder:GetAnchor(0)
-	IIFA_GUI_ListHolder.savedAnchor1 = {point, relTo, relPoint, offsX, offsY}
+	--local _, point, relTo, relPoint, offsX, offsY, constrains = IIFA_GUI_ListHolder:GetAnchor(0)
+	--IIFA_GUI_ListHolder.savedAnchor1 = {point, relTo, relPoint, offsX, offsY, constrains}

-	_, point, relTo, relPoint, offsX, offsY = IIFA_GUI_ListHolder:GetAnchor(1)
-	IIFA_GUI_ListHolder.savedAnchor2 = {point, relTo, relPoint, offsX, offsY}
+	--_, point, relTo, relPoint, offsX, offsY, constrains = IIFA_GUI_ListHolder:GetAnchor(1)
+	--IIFA_GUI_ListHolder.savedAnchor2 = {point, relTo, relPoint, offsX, offsY, constrains}

 	IIfA:TextColorFixup(IIfA:GetSettings())

@@ -453,7 +453,7 @@ function IIfA_onLoad(eventCode, addOnName)
 	-- manavortex, Feb. 22 2018: drop dbv2 support
 	if nil ~= IIfA.data.DBv2 then IIfA.data.DBv2 = nil end

-	-- keep EU and US items apart
+	-- store EU and US items separately
 	local worldName = GetWorldName():gsub(" Megaserver", IIfA.EMPTY_STRING)
 	IIfA.data[worldName] = IIfA.data[worldName] or {}
 	if IIfA.data[worldName].DBv3 == nil then
diff --git a/IIfA/IIfA.txt b/IIfA/IIfA.txt
index 3d76d64..c86ab24 100644
--- a/IIfA/IIfA.txt
+++ b/IIfA/IIfA.txt
@@ -49,7 +49,7 @@ plugins/FCOIS/IIfA_FCOIS.lua

 ; DISCLOSURE:
 ; This Add-on is not created by, affiliated with or sponsored by ZeniMax
-; Media Inc. or its affiliates. The Elder Scrolls® and related logos are
+; Media Inc. or its affiliates. The Elder Scrolls and related logos are
 ; registered trademarks or trademarks of ZeniMax Media Inc. in the United
 ; States and/or other countries. All rights reserved.
 ; You can read the full terms at https://account.elderscrollsonline.com/add-on-terms
diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index 31f536d..21144b1 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -160,7 +160,8 @@ local function DoesInventoryMatchList(locationName, location)
 		end
 	end
 end
---@Baetram:
+
+--@Baertram:
 --Made the function global to be used in other addons like FCOItemSaver
 function IIfA:DoesInventoryMatchList(locationName, location)
 	return DoesInventoryMatchList(locationName, location)
@@ -637,7 +638,7 @@ function IIfA:GetAccountInventoryList()
 		end
 	end

-	--house banks
+	-- house item inventories
 	if IIfA.data.b_collectHouses then
 		-- table.insert(accountInventories, "All Houses") --  4-11-18 AM - removed duplicate entry, it's in the dropdownLocNames already
 		for idx, houseName in pairs(IIfA:GetTrackedHouseNames()) do
@@ -734,6 +735,7 @@ end
 -- general note for popup menus
 -- example here http://www.esoui.com/downloads/info1146-LibCustomMenu.html
 -- AddCustomSubMenuItem(mytext, entries, myfont, normalColor, highlightColor, itemYPad)
+
 function IIfA:SetupBackpack()

 	local function createInventoryDropdown()
diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index 8a420e6..b2f6050 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -304,15 +304,11 @@ function IIfA:GuildBankAddRemove(eventID, slotId)
 	end)
 end

-function IIfA:IgnoreHouse(houseCollectibleId)
-    houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
-end
 function IIfA:RescanHouse(houseCollectibleId)

 	houseCollectibleId = houseCollectibleId or GetCollectibleIdForHouse(GetCurrentZoneHouseId())
 	if not houseCollectibleId or not IIfA.trackedBags[houseCollectibleId] then return end
-
-    -- if GetHouseCategoryType(GetCurrentZoneHouseId()) == HOUSE_CATEGORY_TYPE_NOTABLE then return end
+
 	IIfA.data.collectHouseData[houseCollectibleId] = IIfA.data.collectHouseData[houseCollectibleId] or IIfA:GetHouseTracking()

 	if not IIfA.data.collectHouseData[houseCollectibleId] then
@@ -330,7 +326,7 @@ function IIfA:RescanHouse(houseCollectibleId)
         local counter = 1
         local furnitureId = nil
 		 while(true) do
-			furnitureId = GetNextPlacedHousingFurnitureId(furnitureId)
+			local furnitureId = GetNextPlacedHousingFurnitureId(furnitureId)
 			if (not furnitureId or counter > 10000 ) then return ret end
 			local itemLink = GetPlacedFurnitureLink(furnitureId, LINK_STYLE_BRACKETS)
 			-- if not ret[itemLink] then
@@ -342,15 +338,13 @@ function IIfA:RescanHouse(houseCollectibleId)
 		end
         return ret
 	end
-
     IIfA.getAllPlacedFurniture = getAllPlacedFurniture

 	-- call with libAsync to avoid lag
 	task:Call(function()
 		-- clear and re-create, faster than conditionally updating
 		IIfA:ClearLocationData(houseCollectibleId)
-
-
+
 	end):Then(function()  -- TODO - can this go again? Having it in here at least prevented the crash
         local placedFurniture = getAllPlacedFurniture()
 		for itemLink, itemCount in pairs(placedFurniture) do
@@ -359,6 +353,7 @@ function IIfA:RescanHouse(houseCollectibleId)
 			IIfA:EvalBagItem(houseCollectibleId, tonumber(IIfA_GetItemID(itemLink)), false, itemCount, itemLink, GetItemLinkName(itemLink), houseCollectibleId)
 		end
 	end)
+
 end

 -- try to read item name from bag/slot - if that's empty, we read it from item link
@@ -435,7 +430,7 @@ function IIfA:TableCount(tbl)
 	return cnt
 end

---@Baetram:
+--@Baertram:
 -- Added for other addons like FCOItemSaver to get the item instance or the unique ID
 -->Returns itemInstance or uniqueId as 1st return value
 -->Returns a boolean value as 2nd retun value: true if the bagId should build an itemInstance or unique ID / false if not
@@ -476,7 +471,7 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, qty, itemLink, itemName, loca

 	local itemCount = qty or getItemCount(bagId, slotId, itemLink)

-    --@Baetram:
+    --@Baertram:
 	--Item instance/unique id  (needed for other addons like FCOItemSaver to (un)mark items via that id)
 	local itemInstanceOrUniqueId, isBagToBuildItemInstanceOrUniqueId = getItemInstanceOrUniqueId(bagId, slotId, itemLink)
 	if isBagToBuildItemInstanceOrUniqueId then
@@ -543,12 +538,7 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, qty, itemLink, itemName, loca
 				DBitem.locations[location].bagSlot = {}
 				DBitem.locations[location].bagSlot[slotId] = itemCount
 			end
-        end
-        --@Baetram:
-        --Added for other addons like FCOItemSaver. Only needed for non-account wide bags!
-        if isBagToBuildItemInstanceOrUniqueId then
-            DBitem.itemInstanceOrUniqueId = itemInstanceOrUniqueId
-        end
+		end
 	else
 		DBv3[itemKey] = {}
 		DBv3[itemKey].filterType = itemFilterType
@@ -559,14 +549,15 @@ function IIfA:EvalBagItem(bagId, slotId, fromXfer, qty, itemLink, itemName, loca
 		DBv3[itemKey].locations[location].bagID = bagId
 		DBv3[itemKey].locations[location].bagSlot = {}
 		DBv3[itemKey].locations[location].bagSlot[slotId] = itemCount
-        --@Baetram:
-        --Added for other addons like FCOItemSaver. Only needed for non-account wide bags!
-        if isBagToBuildItemInstanceOrUniqueId then
-            DBv3[itemKey].itemInstanceOrUniqueId = itemInstanceOrUniqueId
-        end
 		DBitem = DBv3[itemKey]
 	end

+    --@Baertram:
+    --Added for other addons like FCOItemSaver. Only needed for non-account wide bags!
+    if isBagToBuildItemInstanceOrUniqueId then
+        DBitem.itemInstanceOrUniqueId = itemInstanceOrUniqueId
+    end
+
 	if nil ~= location and DBitem.locations and DBitem.locations[location] and IIfA:TableCount(DBitem.locations[location].bagSlot) == 0 then
 		p("Zapping location=<<1>>, bag=<<2>>, slot=<<3>>", location, bagId, slotId)
 		DBitem.locations[location] = nil
@@ -736,9 +727,10 @@ function IIfA:ClearLocationData(location, bagID)		-- if loc is characterid, bagI
 	local itemLocation = nil
 	local LocationCount = 0
 	local itemName, itemData
-
-    local bChar = (bagID == nil and nil) or location == IIfA.currentCharacterId
-
+	local bChar = nil
+	if bagID ~= nil then
+		bChar = location == IIfA.currentCharacterId
+	end

 	if(DBv3)then
 		p(zo_strformat("IIfA:ClearLocationData(<<1>>, <<2>>)", location, bagID))
diff --git a/IIfA/IIfAMenu.lua b/IIfA/IIfAMenu.lua
index 6f8a99c..297ec21 100644
--- a/IIfA/IIfAMenu.lua
+++ b/IIfA/IIfAMenu.lua
@@ -587,32 +587,36 @@ function IIfA:CreateOptionsMenu()
 			getFunc = function() return IIfA:GetSceneVisible("trade") end,
 			setFunc = function(value) IIfA:SetSceneVisible("trade", value) end,
 		},
-
-		--Other addons
-		{
-		    type = "header",
-		    name = "Other addons",
-		},
-
-		--FCOItemSaver
-		{
-			type = "submenu",
-			name = "FCOItemSaver",
-			tooltip = "Manage settings for the addon FCOItemSaver within IIfA",
-			controls = {
-				{
-				    type = "checkbox",
-				    name = "Show marker icons",
-				    tooltip = "Shows FCOIS marker icons within the inventory frame rows",
-				    getFunc = function() return IIfA:GetSettings().FCOISshowMarkerIcons end,
-				    setFunc = function(value) IIfA:GetSettings().FCOISshowMarkerIcons = value end,
-				},
-			},
-		},

 	-- options data end
 	}

+	if FCOIS then
+		optionsData[#optionsData + 1] =
+			--Other addons
+			{
+			    type = "header",
+			    name = "Other addons",
+			}
+		optionsData[#optionsData + 2] =
+			--FCOItemSaver
+			{
+				type = "submenu",
+				name = "FCOItemSaver",
+				tooltip = "Manage settings for the addon FCOItemSaver within IIfA",
+				controls = {
+					{
+					    type = "checkbox",
+					    name = "Show marker icons",
+					    tooltip = "Shows FCOIS marker icons within the inventory frame rows",
+					    getFunc = function() return IIfA:GetSettings().FCOISshowMarkerIcons end,
+					    setFunc = function(value) IIfA:GetSettings().FCOISshowMarkerIcons = value end,
+					},
+				},
+			}
+	end
+
+
 	-- run through list of options, find one with empty controls, add in the submenu for guild banks options
 	local i, data
 	for i, data in ipairs(optionsData) do