# HG changeset patch # User Yellowfive # Date 1610565114 21600 # Node ID 6e8838b231d49a2fd906c44986b38bad9c0b1fab # Parent e34c256739be1ba31860128dfdaf0560667a29c2 Fixed issue with distinguishing different variants of the same item. diff -r e34c256739be -r 6e8838b231d4 AskMrRobot-Serializer/AskMrRobot-Serializer.lua --- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Tue Dec 22 11:10:25 2020 -0600 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Wed Jan 13 13:11:54 2021 -0600 @@ -1,6 +1,6 @@ -- AskMrRobot-Serializer will serialize and communicate character data between users. -local MAJOR, MINOR = "AskMrRobot-Serializer", 96 +local MAJOR, MINOR = "AskMrRobot-Serializer", 97 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else diff -r e34c256739be -r 6e8838b231d4 AskMrRobot.toc --- a/AskMrRobot.toc Tue Dec 22 11:10:25 2020 -0600 +++ b/AskMrRobot.toc Wed Jan 13 13:11:54 2021 -0600 @@ -1,7 +1,7 @@ ## Interface: 90002 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 96 +## Version: 97 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb4 diff -r e34c256739be -r 6e8838b231d4 Core.lua --- a/Core.lua Tue Dec 22 11:10:25 2020 -0600 +++ b/Core.lua Wed Jan 13 13:11:54 2021 -0600 @@ -710,12 +710,5 @@ function Amr:Test() - --local item = Item:CreateFromItemID(171416) - --local blah = C_LegendaryCrafting.GetRuneforgePowers(item:GetItemLocation()) - - --local info = C_LegendaryCrafting.GetRuneforgePowerInfo(30) - - --print(Amr:dump(info)) - --print(Amr:dump(info)) - + end diff -r e34c256739be -r 6e8838b231d4 Gear.lua --- a/Gear.lua Tue Dec 22 11:10:25 2020 -0600 +++ b/Gear.lua Wed Jan 13 13:11:54 2021 -0600 @@ -32,16 +32,20 @@ return 1000000 end - -- different versions of same item (id + bonus ids + suffix + drop level, constitutes a different physical drop) - if Amr.GetItemUniqueId(item1, true, true) ~= Amr.GetItemUniqueId(item2, true, true) then - return 100000 - end - - -- different upgrade levels of the same item - if item1.upgradeId ~= item2.upgradeId then - return 10000 - end - + --if item1.guid and item2.guid and item1.guid == item2.guid then + -- -- these have the same guid, so even if bonus id or something doesn't match for some reason, they are identical items + --else + -- different versions of same item (id + bonus ids + suffix + drop level, constitutes a different physical drop) + if Amr.GetItemUniqueId(item1, true, true) ~= Amr.GetItemUniqueId(item2, true, true) then + return 100000 + end + + -- different upgrade levels of the same item + if item1.upgradeId ~= item2.upgradeId then + return 10000 + end + --end + -- a change that requires reforging is considered more different than a change that does not; -- it is assumed that item1 is how we want the item to be in the end, and item2 is how it currently is local aztReforges = 0 @@ -118,6 +122,7 @@ for k,listItem in pairs(list) do if listItem then local diff = countItemDifferences(item, listItem) + if diff < bestDiff then -- each physical item can only be used once, the usedItems table has items we can't use in this search local key = string.format("%s_%s", tableType, k) @@ -125,10 +130,10 @@ bestItem = listItem bestDiff = diff bestLoc = key - found = true end end - if found then break end + + if bestDiff == 0 then break end end end @@ -1155,6 +1160,7 @@ local diff = countItemDifferences(new, old) if diff > 0 then + list[slotId] = new if list == itemsToEquip.mh or list == itemsToEquip.oh then itemsToEquip.weapons[slotId] = {}