# HG changeset patch # User yellowfive # Date 1544424788 28800 # Node ID df1596b1a74480326ca318b1cc84dea5188a03b9 # Parent 69e759e038387ec20fb0d25e826012619eca7ce2 Tweak for handling duplicate azerite items. diff -r 69e759e03838 -r df1596b1a744 AskMrRobot-Serializer/AskMrRobot-Serializer.lua --- a/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Thu Nov 08 21:21:26 2018 -0800 +++ b/AskMrRobot-Serializer/AskMrRobot-Serializer.lua Sun Dec 09 22:53:08 2018 -0800 @@ -1,6 +1,6 @@ -- AskMrRobot-Serializer will serialize and communicate character data between users. -local MAJOR, MINOR = "AskMrRobot-Serializer", 67 +local MAJOR, MINOR = "AskMrRobot-Serializer", 68 local Amr, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not Amr then return end -- already loaded by something else diff -r 69e759e03838 -r df1596b1a744 AskMrRobot.toc --- a/AskMrRobot.toc Thu Nov 08 21:21:26 2018 -0800 +++ b/AskMrRobot.toc Sun Dec 09 22:53:08 2018 -0800 @@ -1,7 +1,7 @@ ## Interface: 80000 ## Title: Ask Mr. Robot ## Author: Team Robot, Inc. -## Version: 67 +## Version: 68 ## Notes: Gear import/export, combat logging, and more. ## URL: www.askmrrobot.com ## SavedVariables: AskMrRobotDb4 diff -r 69e759e03838 -r df1596b1a744 Core.lua --- a/Core.lua Thu Nov 08 21:21:26 2018 -0800 +++ b/Core.lua Sun Dec 09 22:53:08 2018 -0800 @@ -187,7 +187,7 @@ -- make sure that some initialization is deferred until after PLAYER_ENTERING_WORLD event so that data we need is available; -- also delay this initialization for a few extra seconds to deal with some event spam that is otherwise hard to identify and ignore when a player logs in Amr.Wait(5, function() - Amr:InitializeVersions() + --Amr:InitializeVersions() Amr:InitializeGear() Amr:InitializeExport() Amr:InitializeCombatLog() diff -r 69e759e03838 -r df1596b1a744 Gear.lua --- a/Gear.lua Thu Nov 08 21:21:26 2018 -0800 +++ b/Gear.lua Sun Dec 09 22:53:08 2018 -0800 @@ -51,10 +51,10 @@ aztDiffs = #item2.azerite * 10 else -- count up number in item1 but missing from item2 - for i = 1, #item1.azerite do - local missing = false + for i = 1, #item1.azerite do + local missing = true for j = 1, #item2.azerite do - if item2[j] == item1[i] then + if item2.azerite[j] == item1.azerite[i] then missing = false end end @@ -64,9 +64,9 @@ end -- count up number in item2 but missing from item1 for i = 1, #item2.azerite do - local missing = false + local missing = true for j = 1, #item1.azerite do - if item1[j] == item2[i] then + if item1.azerite[j] == item2.azerite[i] then missing = false end end @@ -288,7 +288,16 @@ -- see if item is currently equipped, is false if don't have any item for that slot (e.g. OH for a 2-hander) local isEquipped = false if equippedItem and optimalItem and Amr.GetItemUniqueId(equippedItem, false, true) == Amr.GetItemUniqueId(optimalItem, false, true) then - isEquipped = true + + if slotId == 1 or slotId == 3 or slotId == 5 then + -- show the item as not equipped if azerite doesn't match... might mean they have to switch to another version of same item + local aztDiff = countItemDifferences(equippedItem, optimalItem) + if aztDiff == 0 then + isEquipped = true + end + else + isEquipped = true + end end local isAzerite = optimalItem and C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItemByID(optimalItem.id) @@ -698,6 +707,8 @@ local setname = setup.Label -- "AMR " .. specName local setid = C_EquipmentSet.GetEquipmentSetID(setname) if setid then + local oldName, oldIcon = C_EquipmentSet.GetEquipmentSetInfo(setid) + setIcon = oldIcon C_EquipmentSet.SaveEquipmentSet(setid, setIcon) else C_EquipmentSet.CreateEquipmentSet(setname, setIcon) @@ -1042,22 +1053,12 @@ remaining = remaining + 1 end else + -- find the best matching item anywhere in the player's gear local bestItem, bestDiff = Amr:FindMatchingItem(new, player, usedItems) new = bestItem - local diff = countItemDifferences(old, new) - - --[[ - if diff > 0 and diff < 1000 then - -- same item, see if inventory has one that is closer (e.g. a duplicate item with correct enchants/gems) - local bestItem, bestDiff = Amr:FindMatchingItem(new, player, usedItems) - if bestDiff and bestDiff < diff then - new = bestItem - diff = bestDiff - end - end - ]] + local diff = countItemDifferences(old, new) if diff > 0 then list[slotId] = new