diff AskMrRobot-Serializer/AskMrRobot-Serializer.lua @ 191:4aeedce4c995 v93

Added better identification of duplicate items.
author yellowfive
date Fri, 30 Oct 2020 21:14:57 -0700
parents 21a69c63fee8
children cb7eb9b9cc24
line wrap: on
line diff
--- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Mon Oct 19 11:20:07 2020 -0700
+++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua	Fri Oct 30 21:14:57 2020 -0700
@@ -1,6 +1,6 @@
 -- AskMrRobot-Serializer will serialize and communicate character data between users.
 
-local MAJOR, MINOR = "AskMrRobot-Serializer", 92
+local MAJOR, MINOR = "AskMrRobot-Serializer", 93
 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 
 if not Amr then return end -- already loaded by something else
@@ -429,13 +429,22 @@
 -- get currently equipped items, store with currently active spec
 local function readEquippedItems(ret)
 	local equippedItems = {};
-	local loc = ItemLocation.CreateEmpty()
+	--local loc = ItemLocation.CreateEmpty()
+	local item
 	for slotNum = 1, #Amr.SlotIds do
 		local slotId = Amr.SlotIds[slotNum]
 		local itemLink = GetInventoryItemLink("player", slotId)
 		if itemLink then
 			local itemData = Amr.ParseItemLink(itemLink)
 			if itemData then
+				item = Item:CreateFromEquipmentSlot(slotId)
+
+				-- seems to be of the form Item-1147-0-4000000XXXXXXXXX, so we take just the last 9 digits
+				itemData.guid = item:GetItemGUID()
+				if itemData.guid and strlen(itemData.guid) > 9 then
+					itemData.guid = strsub(itemData.guid, -9)
+				end
+
 				--[[
 				-- see if this is an azerite item and read azerite power ids
 				loc:SetEquipmentSlot(slotId)
@@ -573,6 +582,7 @@
 	local prevLevel = 0
 	--local prevAzeriteId = 0
 	local prevRelicBonusId = 0
+
     for i, itemData in ipairs(itemObjects) do
         local itemParts = {}
         
@@ -643,6 +653,10 @@
                 prevRelicBonusId = bValue
             end
 		end
+
+		if itemData.guid then
+			table.insert(itemParts, "!" .. itemData.guid)
+		end
 		
         table.insert(fields, table.concat(itemParts, ""))
     end