This commit is contained in:
1 parent
9d809309ac
commit
e2abe972ad
1 file changed
+66
-2
+66
-2
@@ -223,6 +223,54 @@ function Amibis:GetEquippedItems()
|
||||
return items
|
||||
end
|
||||
|
||||
-- Trinket slots are interchangeable: match equipped trinkets to BIS trinkets
|
||||
-- as a set instead of by slot index, so swapping Trinket0/Trinket1 still
|
||||
-- counts as BIS. Returns a map of trinket slot name -> equipped item (or nil).
|
||||
function Amibis:AssignTrinketEquipped(bisList, equipped)
|
||||
local assigned = {}
|
||||
|
||||
local trinketBisSlots = {}
|
||||
for _, s in ipairs({ "Trinket0", "Trinket1" }) do
|
||||
if bisList and bisList[s] then
|
||||
table.insert(trinketBisSlots, s)
|
||||
end
|
||||
end
|
||||
|
||||
local equippedTrinkets = {}
|
||||
for _, s in ipairs({ "Trinket0", "Trinket1" }) do
|
||||
if equipped and equipped[s] then
|
||||
table.insert(equippedTrinkets, equipped[s])
|
||||
end
|
||||
end
|
||||
|
||||
local used = {}
|
||||
-- Prefer exact itemID matches first.
|
||||
for _, bisSlot in ipairs(trinketBisSlots) do
|
||||
local bisItem = bisList[bisSlot]
|
||||
for ei, eq in ipairs(equippedTrinkets) do
|
||||
if not used[ei] and eq.itemID == bisItem.itemID then
|
||||
assigned[bisSlot] = eq
|
||||
used[ei] = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Then fill remaining BIS slots with leftover equipped trinkets.
|
||||
for _, bisSlot in ipairs(trinketBisSlots) do
|
||||
if assigned[bisSlot] == nil then
|
||||
for ei, eq in ipairs(equippedTrinkets) do
|
||||
if not used[ei] then
|
||||
assigned[bisSlot] = eq
|
||||
used[ei] = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return assigned
|
||||
end
|
||||
|
||||
local STAT_MAP = {
|
||||
["ITEM_MOD_HEALING_DONE_SHORT"] = "healing",
|
||||
["ITEM_MOD_SPELL_HEALING_DONE_SHORT"] = "healing",
|
||||
@@ -412,9 +460,19 @@ function Amibis:CompareGear()
|
||||
local statProfile = GetStatProfile(class, spec)
|
||||
local statWeights = self:GetStatWeightsForSpec(class, spec)
|
||||
|
||||
-- Trinket slots are interchangeable: a BIS trinket counts regardless of
|
||||
-- whether it is equipped in Trinket0 or Trinket1.
|
||||
local trinketAssigned = self:AssignTrinketEquipped(bisList, equipped)
|
||||
|
||||
for slotName, bisItem in pairs(bisList) do
|
||||
totalSlots = totalSlots + 1
|
||||
local equippedItem = equipped[slotName]
|
||||
local isTrinket = (slotName == "Trinket0" or slotName == "Trinket1")
|
||||
local equippedItem
|
||||
if isTrinket then
|
||||
equippedItem = trinketAssigned[slotName]
|
||||
else
|
||||
equippedItem = equipped[slotName]
|
||||
end
|
||||
local isBIS = false
|
||||
|
||||
if equippedItem and equippedItem.itemID == bisItem.itemID then
|
||||
@@ -536,10 +594,16 @@ function Amibis:CompareGear()
|
||||
latestCompletionRatio = self:StatRatio(equippedStats, latestStats, class, spec)
|
||||
latestStatsComplete = true
|
||||
else
|
||||
local trinketAssigned = self:AssignTrinketEquipped(latestList, equipped)
|
||||
local matched, total = 0, 0
|
||||
for slotName, bisItem in pairs(latestList) do
|
||||
total = total + 1
|
||||
local equippedItem = equipped[slotName]
|
||||
local equippedItem
|
||||
if slotName == "Trinket0" or slotName == "Trinket1" then
|
||||
equippedItem = trinketAssigned[slotName]
|
||||
else
|
||||
equippedItem = equipped[slotName]
|
||||
end
|
||||
if equippedItem and equippedItem.itemID == bisItem.itemID then
|
||||
matched = matched + 1
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user