Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 14 additions & 0 deletions src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down