data will now be stored separately for us and eu megaserver

git [02-10-18 - 15:05]
data will now be stored separately for us and eu megaserver
Filename
IIfA/IIfA.lua
IIfA/IIfABackpack.lua
IIfA/IIfADataCollection.lua
diff --git a/IIfA/IIfA.lua b/IIfA/IIfA.lua
index c2d3236..39d8ae0 100644
--- a/IIfA/IIfA.lua
+++ b/IIfA/IIfA.lua
@@ -455,7 +455,15 @@ function IIfA_onLoad(eventCode, addOnName)
 		end
 		IIfA.data.DBv3 = dbv3
 	end
-
+
+	-- keep EU and US items apart
+	local worldName = GetWorldName():gsub(" Megaserver", "")
+	IIfA.data[worldName] = IIfA.data[worldName] or {}
+	if nil == IIfA.data[worldName].DBv3 then
+		 IIfA.data[GetWorldName()].DBv3 = IIfA.data.DBv3
+	end
+	IIfA.database = IIfA.data[GetWorldName()].DBv3
+
 	IIfA:ActionLayerInventoryUpdate()

 	if not ObjSettings.frameSettings.hud.hidden then
@@ -475,7 +483,7 @@ function IIfA:MakeBSI()
 	local bs = {}
 	local idx
 	local itemLink, DBItem, locname, data
-	for itemLink, DBItem in pairs(IIfA.data.DBv3) do
+	for itemLink, DBItem in pairs(IIfA.database) do
 		for locname, data in pairs(DBItem.locations) do
 			if ((data.bagID == BAG_BACKPACK or data.bagID == BAG_WORN) and locname == IIfA.currentCharacterId) or	-- only index items ON this character if they're in backpack
 				(data.bagID ~= BAG_BACKPACK and data.bagID ~= BAG_WORN) then
@@ -557,7 +565,7 @@ end

 -- used for testing - wipes all craft bag data
 function IIfA:clearvbag()
-	for itemLink, DBItem in pairs(IIfA.data.DBv3) do
+	for itemLink, DBItem in pairs(IIfA.database) do
 		for locationName, locData in pairs(DBItem.locations) do
 --			if locData.bagID ~= nil then
 				if locData.bagID == BAG_VIRTUAL then
diff --git a/IIfA/IIfABackpack.lua b/IIfA/IIfABackpack.lua
index 04e08d5..22775ea 100644
--- a/IIfA/IIfABackpack.lua
+++ b/IIfA/IIfABackpack.lua
@@ -351,7 +351,7 @@ function IIfA:UpdateScrollDataLinesData()

 	local index = 0
 	local dataLines = {}
-	local DBv3 = IIfA.data.DBv3
+	local DBv3 = IIfA.database
 	local iLink, itemLink, iconFile, itemQuality, tempDataLine = nil
 	local itemTypeFilter, itemCount = 0
 	local match = false
@@ -648,7 +648,7 @@ function IIfA:QueryAccountInventory(itemLink)
 		itemLink = IIfA:GetItemID(itemLink)
 	end

-	local item = IIfA.data.DBv3[itemLink]
+	local item = IIfA.database[itemLink]

 	if ((queryItem.link ~= nil) and (item ~= nil)) then
 		for locationName, location in pairs(item.locations) do
diff --git a/IIfA/IIfADataCollection.lua b/IIfA/IIfADataCollection.lua
index f54e018..99303b2 100644
--- a/IIfA/IIfADataCollection.lua
+++ b/IIfA/IIfADataCollection.lua
@@ -322,8 +322,8 @@ end
 function IIfA:EvalBagItem(bagId, slotNum, fromXfer, itemCount, itemLink, itemName, locationID)
 	if not IIfA.trackedBags[bagId] then return end

-	IIfA.data.DBv3 = IIfA.data.DBv3 or {}
-	local DBv3 = IIfA.data.DBv3
+	IIfA.database = IIfA.database or {}
+	local DBv3 = IIfA.database

 	if fromXfer == nil then
 		fromXfer = false
@@ -509,7 +509,7 @@ end

 function IIfA:ClearUnowned()
 -- 2015-3-7 Assembler Maniac - new code added to go through full inventory list, remove any un-owned items
-	local DBv3 = IIfA.data.DBv3
+	local DBv3 = IIfA.database
 	local n, ItemLink, DBItem
 	local ItemOwner, ItemData
 	for ItemLink, DBItem in pairs(DBv3) do
@@ -537,13 +537,13 @@ end


 function IIfA:ClearLocationData(location)
-	local DBv3 = IIfA.data.DBv3
+	local DBv3 = IIfA.database
 	local itemLocation = nil
 	local LocationCount = 0
 	local itemName, itemData

 	if(DBv3)then
-		for itemName, itemData in pairs(IIfA.data.DBv3) do
+		for itemName, itemData in pairs(DBv3) do
 			itemLocation = itemData.locations[location]
 			if (itemLocation) then
 				itemData.locations[location] = nil
@@ -600,7 +600,7 @@ local function GetItemIdentifier(itemLink)
 end

 function IIfA:RenameItems()
-	local DBv3 = IIfA.data.DBv3
+	local DBv3 = IIfA.database
 	local item = nil
 	local itemName