Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to only compare stats for same jewel types. #6314

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
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
43 changes: 33 additions & 10 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3548,17 +3548,20 @@ 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 storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
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 storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({ repSlotName = compareSlot.slotName, repItem = item ~= selItem and item }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
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 @@ -3572,6 +3575,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
7 changes: 7 additions & 0 deletions src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,13 @@ function main:OpenOptionsPopup()
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()
controls.disableDevAutoSave = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Disable Dev AutoSave:", function(state)
Expand Down