collectible renaming

git [01-25-18 - 15:23]
collectible renaming
Filename
IIfA/IIfA.lua
IIfA/IIfADataCollection.lua
IIfA/IIfAEvents.lua
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index 608e644..e61979d 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -22,17 +22,13 @@ if IIfA == nil then IIfA = {} end
 IIfA.name 				= "Inventory Insight"
 IIfA.version 			= "2.20"
 IIfA.author 			= "AssemblerManiac & manavortex"
-IIfA.defaultAlertType 	= UI_ALERT_CATEGORY_ALERT
 IIfA.defaultAlertSound 	= nil
-IIfA.PlayerLoadedFired 	= false
-IIfA.CharacterNames 	= {}
 IIfA.colorHandler 		= nil
 IIfA.isGuildBankReady 	= false
 IIfA.TooltipLink 		= nil
 IIfA.CurrSceneName 		= "hud"
 IIfA.bFilterOnSetName 	= false
 IIfA.searchFilter 		= ""
-IIfA.searchFilterLower 	= ""

 local LMP = LibStub("LibMediaProvider-1.0")
 local BACKPACK = ZO_PlayerInventoryBackpack
@@ -140,7 +136,7 @@ end

 function IIfA:StatusAlert(message)
 	if (IIfA.data.bDebug) then
-		ZO_Alert(IIfA.defaultAlertType, IIfA.defaultAlertSound, message)
+		ZO_Alert(UI_ALERT_CATEGORY_ALERT, IIfA.defaultAlertSound, message)
 	end
 end

diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index f90535b..1518d88 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -259,15 +259,14 @@ end

 function IIfA:EvalBagItem(bagId, slotNum, fromXfer, qty)
 	if not IIfA.trackedBags[bagId] then return end
+
+	IIfA.data.DBv3 = IIfA.data.DBv3 or {}
 	local DBv3 = IIfA.data.DBv3
+
 	if fromXfer == nil then
 		fromXfer = false
 	end

-	if(not DBv3)then
-		IIfA.data.DBv3 = {}
-		DBv3 = IIfA.data.DBv3
-	end
 	itemName = GetItemName(bagId, slotNum) or EMPTY_STRING

 	IIfA:DebugOut(zo_strformat("EvalBagItem - <<1>>/<<2>> <<3>>", bagId, slotNum, itemName))
@@ -312,9 +311,10 @@ function IIfA:EvalBagItem(bagId, slotNum, fromXfer, qty)
 			location = GetGuildName(GetSelectedGuildBankId())
 		else
 			local collectibleId = GetCollectibleForHouseBankBag(GetBankingBag())
-			location = GetCollectibleNickname(collectibleId)
+			location = GetCollectibleNickname(collectibleId)
 			if location == EMPTY_STRING then location = GetCollectibleName(collectibleId) end
 		end
+
 		if(DBitem) then
 			DBitemlocation = DBitem.locations[location]
 			if DBitemlocation then
@@ -358,7 +358,7 @@ function IIfA:ValidateItemCounts(bagID, slotNum, dbItem, itemKey)
 	else
 		itemLink = itemKey
 	end
-	IIfA:DebugOut("ValidateItemCounts: <<1>>x<<3>> in <<2>>", itemLink, bagID, slotNum)
+	IIfA:DebugOut(zo_strformat("ValidateItemCounts: <<1>>x<<3>> in <<2>>", itemLink, bagID, slotNum))

 	for locName, data in pairs(dbItem.locations) do
 --		if data.bagID ~= nil then	-- it's an item, not attribute
diff --git a/IIfA/IIfAEvents.lua b/IIfA/IIfAEvents.lua
index cbbd6b8..329cc65 100644
--- a/IIfA/IIfAEvents.lua
+++ b/IIfA/IIfAEvents.lua
@@ -32,6 +32,19 @@ 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
+
+	local collectibleData = ZO_COLLECTIBLE_DATA_MANAGER:GetCollectibleDataById(collectibleId)
+    if not collectibleData:IsCategoryType(COLLECTIBLE_CATEGORY_TYPE_HOUSE_BANK) then return end
+	local name 		= GetCollectibleName(collectibleId)
+	local nickName 	= GetCollectibleNickname(collectibleId)
+
+
+
+end
+

 local function IIfA_EventProc(...)
 	--d(...)
@@ -102,6 +115,10 @@ function IIfA:RegisterForEvents()
 --	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)
+
+
 	-- Events for data collection
 	EVENT_MANAGER:RegisterForEvent("IIFA_ALPUSH", EVENT_ACTION_LAYER_PUSHED, IIfA_ActionLayerInventoryUpdate)

@@ -130,22 +147,6 @@ function IIfA:RegisterForEvents()
 	ZO_PreHook('ZO_InventorySlot_ShowContextMenu', function(rowControl) IIfA_OnRightClickUp(rowControl) end)
 end

---[[ maybe revisit this in the future
-function IIfA_EventOnPlayerloaded()
-	--Do these things only on the first load
-	if(not IIfA.PlayerLoadedFired)then
-		--if(IIfA.data.in2AgedGuildBankDataWarning) then IIfA:CheckForAgedGuildBankData() end
-		--Set PlayerLoadedFired = true to prevent future execution during this session
-		IIfA.PlayerLoadedFired = true
-	end
-	--Do these things on any load
-	--Do a little dance...
-	--Make a little love...
-	--Get down tonight...
-end
- --]]
-
-

 --[[ registerfilter & events
 define HOW to listen for events (minimize # of calls to event handler, less overhead of eso internals)