diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 9a8162b911..c9c8bd34b8 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -3984,14 +3984,17 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode) for _, compareSlot in pairs(compareSlots) do if not main.slotOnlyTooltips or (slot and (slot.nodeId == compareSlot.nodeId or slot.slotName == compareSlot.slotName)) or not slot or slot == compareSlot then local selItem = self.items[compareSlot.selItemId] - local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil}) - local header - if item == selItem then - header = "^7Removing this item from "..compareSlot.label.." will give you:" - else - header = string.format("^7Equipping this item in %s will give you:%s", compareSlot.label, selItem and "\n(replacing "..colorCodes[selItem.rarity]..selItem.name.."^7)" or "") + + if not (main.compareJewelsOfSameType and item.type == "Jewel" and not self:IsSameBase(item, selItem)) then + local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item or nil}) + local header + if item == selItem then + header = "^7Removing this item from "..compareSlot.label.." will give you:" + else + header = string.format("^7Equipping this item in %s will give you:%s", compareSlot.label, selItem and "\n(replacing "..colorCodes[selItem.rarity]..selItem.name.."^7)" or "") + end + self.build:AddStatComparesToTooltip(tooltip, calcBase, output, header) end - self.build:AddStatComparesToTooltip(tooltip, calcBase, output, header) end end end @@ -4006,6 +4009,26 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode) end end +function ItemsTabClass:IsSameBase(firstItem, secondItem) + if not secondItem then + return false + end + + if not firstItem.base or not secondItem.base then + return firstItem.type == secondItem.type + end + + if not firstItem.base.subType and not secondItem.base.subType then + return firstItem.base.type == secondItem.base.type + end + + if firstItem.base.subType == secondItem.base.subType then + return true + end + + return false +end + function ItemsTabClass:CreateUndoState() local state = { } state.activeItemSetId = self.activeItemSetId diff --git a/src/Modules/Main.lua b/src/Modules/Main.lua index c329acc5ec..50c56399b2 100644 --- a/src/Modules/Main.lua +++ b/src/Modules/Main.lua @@ -114,6 +114,7 @@ function main:Init() self.showFlavourText = true self.showAnimations = true self.showAllItemAffixes = true + self.compareJewelsOfSameType = false self.errorReadingSettings = false if not SetDPIScaleOverridePercent then SetDPIScaleOverridePercent = function(scale) end end @@ -660,6 +661,9 @@ function main:LoadSettings(ignoreBuild) self.dpiScaleOverridePercent = tonumber(node.attrib.dpiScaleOverridePercent) or 0 SetDPIScaleOverridePercent(self.dpiScaleOverridePercent) end + if node.attrib.compareJewelsOfSameType then + self.compareJewelsOfSameType = node.attrib.compareJewelsOfSameType == "true" + end end end end @@ -791,6 +795,7 @@ function main:SaveSettings() showAnimations = tostring(self.showAnimations), showAllItemAffixes = tostring(self.showAllItemAffixes), dpiScaleOverridePercent = tostring(self.dpiScaleOverridePercent), + compareJewelsOfSameType = tostring(self.compareJewelsOfSameType), } }) local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml") if not res then @@ -1078,6 +1083,13 @@ function main:OpenOptionsPopup() end) controls.invertSliderScrollDirection.tooltipText = "Default scroll direction is:\nScroll Up = Move right\nScroll Down = Move left" controls.invertSliderScrollDirection.state = self.invertSliderScrollDirection + + nextRow() + controls.compareJewelsOfSameType = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Compare jewels of the same type:", function(state) + self.compareJewelsOfSameType = state + end) + controls.compareJewelsOfSameType.tooltipText = "Enabling this option will force comparing jewels only jewels of the same type." + controls.compareJewelsOfSameType.state = self.compareJewelsOfSameType if launch.devMode then nextRow() @@ -1118,6 +1130,7 @@ function main:OpenOptionsPopup() local initialShowAnimations = self.showAnimations local initialShowAllItemAffixes = self.showAllItemAffixes local initialDpiScaleOverridePercent = self.dpiScaleOverridePercent + local initialCompareJewelsOfSameType = self.compareJewelsOfSameType -- last line with buttons has more spacing nextRow(1.5) @@ -1175,6 +1188,7 @@ function main:OpenOptionsPopup() self.showAllItemAffixes = initialShowAllItemAffixes self.dpiScaleOverridePercent = initialDpiScaleOverridePercent SetDPIScaleOverridePercent(self.dpiScaleOverridePercent) + self.compareJewelsOfSameType = initialCompareJewelsOfSameType main:ClosePopup() end) nextRow(1.5)