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

Fix numerous fullDPS tooltip issues #8247

Open
wants to merge 4 commits 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
12 changes: 6 additions & 6 deletions src/Classes/CalcsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ end
-- Estimate the offensive and defensive power of all unallocated nodes
function CalcsTabClass:PowerBuilder()
--local timer_start = GetTime()
GlobalCache.useFullDPS = self.powerStat and self.powerStat.stat == "FullDPS" or false
local useFullDPS = self.powerStat and self.powerStat.stat == "FullDPS"
local calcFunc, calcBase = self:GetMiscCalculator()
local cache = { }
local distanceMap = { }
Expand Down Expand Up @@ -514,7 +514,7 @@ function CalcsTabClass:PowerBuilder()
for nodeId, node in pairs(nodes) do
if not node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then
if not cache[node.modKey] then
cache[node.modKey] = calcFunc({ addNodes = { [node] = true } }, { requirementsItems = true, requirementsGems = true, skills = true })
cache[node.modKey] = calcFunc({ addNodes = { [node] = true } }, useFullDPS)
end
local output = cache[node.modKey]
if self.powerStat and self.powerStat.stat and not self.powerStat.ignoreForNodes then
Expand All @@ -527,7 +527,7 @@ function CalcsTabClass:PowerBuilder()
pathNodes[node] = true
end
if node.pathDist > 1 then
node.power.pathPower = self:CalculatePowerStat(self.powerStat, calcFunc({ addNodes = pathNodes }, { requirementsItems = true, requirementsGems = true, skills = true }), calcBase)
node.power.pathPower = self:CalculatePowerStat(self.powerStat, calcFunc({ addNodes = pathNodes }, useFullDPS), calcBase)
end
end
elseif not self.powerStat or not self.powerStat.ignoreForNodes then
Expand All @@ -542,7 +542,7 @@ function CalcsTabClass:PowerBuilder()
end
elseif node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then
if not cache[node.modKey.."_remove"] then
cache[node.modKey.."_remove"] = calcFunc({ removeNodes = { [node] = true } }, { requirementsItems = true, requirementsGems = true, skills = true })
cache[node.modKey.."_remove"] = calcFunc({ removeNodes = { [node] = true } }, useFullDPS)
end
local output = cache[node.modKey.."_remove"]
if self.powerStat and self.powerStat.stat and not self.powerStat.ignoreForNodes then
Expand All @@ -554,7 +554,7 @@ function CalcsTabClass:PowerBuilder()
pathNodes[node] = true
end
if #node.depends > 1 then
node.power.pathPower = self:CalculatePowerStat(self.powerStat, calcFunc({ removeNodes = pathNodes }, { requirementsItems = true, requirementsGems = true, skills = true }), calcBase)
node.power.pathPower = self:CalculatePowerStat(self.powerStat, calcFunc({ removeNodes = pathNodes }, useFullDPS), calcBase)
end
end
end
Expand All @@ -575,7 +575,7 @@ function CalcsTabClass:PowerBuilder()
wipeTable(node.power)
if not node.alloc and node.modKey ~= "" and not self.mainEnv.grantedPassives[nodeId] then
if not cache[node.modKey] then
cache[node.modKey] = calcFunc({ addNodes = { [node] = true } }, { requirementsItems = true, requirementsGems = true, skills = true })
cache[node.modKey] = calcFunc({ addNodes = { [node] = true } }, useFullDPS)
end
local output = cache[node.modKey]
if self.powerStat and self.powerStat.stat and not self.powerStat.ignoreForNodes then
Expand Down
10 changes: 5 additions & 5 deletions src/Classes/GemSelectControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ local GemSelectClass = newClass("GemSelectControl", "EditControl", function(self
}
end)

function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, qualityId)
function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, qualityId, useFullDPS)
local gemList = self.skillsTab.displayGroup.gemList
local oldGem
if gemList[self.index] then
Expand Down Expand Up @@ -89,7 +89,7 @@ function GemSelectClass:CalcOutputWithThisGem(calcFunc, gemData, qualityId)
-- Add hovered gem to tooltip
self:AddGemTooltip(gemInstance)
-- Calculate the impact of using this gem
local output = calcFunc({ }, { allocNodes = true, requirementsItems = true })
local output = calcFunc(nil, useFullDPS)
-- Put the original gem back into the list
if oldGem then
gemInstance.gemData = oldGem.gemData
Expand Down Expand Up @@ -325,7 +325,7 @@ function GemSelectClass:UpdateSortCache()
end

local dpsField = self.skillsTab.sortGemsByDPSField
GlobalCache.useFullDPS = dpsField == "FullDPS"
local useFullDPS = dpsField == "FullDPS"
local calcFunc, calcBase = self.skillsTab.build.calcsTab:GetMiscCalculator(self.build)
-- Check for nil because some fields may not be populated, default to 0
local baseDPS = (dpsField == "FullDPS" and calcBase[dpsField] ~= nil and calcBase[dpsField]) or (calcBase.Minion and calcBase.Minion.CombinedDPS) or (calcBase[dpsField] ~= nil and calcBase[dpsField]) or 0
Expand All @@ -334,7 +334,7 @@ function GemSelectClass:UpdateSortCache()
sortCache.dps[gemId] = baseDPS
-- Ignore gems that don't support the active skill
if sortCache.canSupport[gemId] or gemData.grantedEffect.hasGlobalEffect then
local output = self:CalcOutputWithThisGem(calcFunc, gemData, self:GetQualityType(gemId))
local output = self:CalcOutputWithThisGem(calcFunc, gemData, self:GetQualityType(gemId), useFullDPS)
-- Check for nil because some fields may not be populated, default to 0
sortCache.dps[gemId] = (dpsField == "FullDPS" and output[dpsField] ~= nil and output[dpsField]) or (output.Minion and output.Minion.CombinedDPS) or (output[dpsField] ~= nil and output[dpsField]) or 0
end
Expand Down Expand Up @@ -477,7 +477,7 @@ function GemSelectClass:Draw(viewPort, noTooltip)
local calcFunc, calcBase = self.skillsTab.build.calcsTab:GetMiscCalculator(self.build)
if calcFunc then
self.tooltip:Clear()
local output, gemInstance = self:CalcOutputWithThisGem(calcFunc, self.gems[self.list[self.hoverSel]], self:GetQualityType(self.list[self.hoverSel]))
local output, gemInstance = self:CalcOutputWithThisGem(calcFunc, self.gems[self.list[self.hoverSel]], self:GetQualityType(self.list[self.hoverSel]), self.skillsTab.sortGemsByDPSField == "FullDPS")
self.tooltip:AddSeparator(10)
self.skillsTab.build:AddStatComparesToTooltip(self.tooltip, calcBase, output, "^7Selecting this gem will give you:")
self.tooltip:Draw(x, y + height + 2 + (self.hoverSel - 1) * (height - 4) - scrollBar.offset, width, height - 4, viewPort)
Expand Down
7 changes: 2 additions & 5 deletions src/Classes/ItemDBControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ local ItemDBClass = newClass("ItemDBControl", "ListControl", function(self, anch
if dbType == "UNIQUE" then
self.controls.sort = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, baseY + 20, 179, 18}, self.sortDropList, function(index, value)
self:SetSortMode(value.sortMode)
GlobalCache.useFullDPS = value.sortMode == "FullDPS"
end)
self.controls.league = new("DropDownControl", {"LEFT",self.controls.sort,"RIGHT"}, {2, 0, 179, 18}, self.leagueList, function(index, value)
self.listBuildFlag = true
Expand Down Expand Up @@ -224,15 +223,14 @@ function ItemDBClass:ListBuilder()
end

if self.sortDetail and self.sortDetail.stat then -- stat-based
local useFullDPS = self.sortDetail.stat == "FullDPS"
local start = GetTime()
local calcFunc, calcBase = self.itemsTab.build.calcsTab:GetMiscCalculator(self.build)
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
for itemIndex, item in ipairs(list) do
item.measuredPower = 0
for slotName, slot in pairs(self.itemsTab.slots) do
if self.itemsTab:IsItemValidForSlot(item, slotName) and not slot.inactive and (not slot.weaponSet or slot.weaponSet == (self.itemsTab.activeItemSet.useSecondWeaponSet and 2 or 1)) then
local output = calcFunc(item.base.flask and { toggleFlask = item } or item.base.tincture and { toggleTincture = item } or { repSlotName = slotName, repItem = item }, { nodeAlloc = true, requirementsGems = true })
local output = calcFunc(item.base.flask and { toggleFlask = item } or item.base.tincture and { toggleTincture = item } or { repSlotName = slotName, repItem = item }, useFullDPS)
local measuredPower = output.Minion and output.Minion[self.sortMode] or output[self.sortMode] or 0
if self.sortDetail.transform then
measuredPower = self.sortDetail.transform(measuredPower)
Expand All @@ -247,7 +245,6 @@ function ItemDBClass:ListBuilder()
start = now
end
end
GlobalCache.useFullDPS = storedGlobalCacheDPSView
end

table.sort(list, function(a, b)
Expand Down
34 changes: 8 additions & 26 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1859,11 +1859,8 @@ function ItemsTabClass:AddModComparisonTooltip(tooltip, mod)
newItem:BuildAndParseRaw()

local calcFunc = self.build.calcsTab:GetMiscCalculator()
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local outputBase = calcFunc({ repSlotName = slotName, repItem = self.displayItem }, {})
local outputNew = calcFunc({ repSlotName = slotName, repItem = newItem }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local outputBase = calcFunc({ repSlotName = slotName, repItem = self.displayItem })
local outputNew = calcFunc({ repSlotName = slotName, repItem = newItem })
self.build:AddStatComparesToTooltip(tooltip, outputBase, outputNew, "\nAdding this mod will give: ")
end

Expand Down Expand Up @@ -2288,11 +2285,8 @@ function ItemsTabClass:AppendAnointTooltip(tooltip, node, actionText)
header = "^7"..actionText.." nothing will give you: "
end
local calcFunc = self.build.calcsTab:GetMiscCalculator()
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local outputBase = calcFunc({ repSlotName = "Amulet", repItem = self.displayItem }, {})
local outputNew = calcFunc({ repSlotName = "Amulet", repItem = self:anointItem(node) }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local outputBase = calcFunc({ repSlotName = "Amulet", repItem = self.displayItem })
local outputNew = calcFunc({ repSlotName = "Amulet", repItem = self:anointItem(node) })
local numChanges = self.build:AddStatComparesToTooltip(tooltip, outputBase, outputNew, header)
if node and numChanges == 0 then
tooltip:AddLine(14, "^7"..actionText.." "..node.dn.." changes nothing.")
Expand All @@ -2303,11 +2297,8 @@ end
---@param tooltip table @The tooltip to append into
---@param node table @The passive tree node that will be added
function ItemsTabClass:AppendAddedNotableTooltip(tooltip, node)
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local calcFunc, calcBase = self.build.calcsTab:GetMiscCalculator()
local outputNew = calcFunc({ addNodes = { [node] = true } }, { requirementsItems = true, requirementsGems = true, skills = true })
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local outputNew = calcFunc({ addNodes = { [node] = true } })
local numChanges = self.build:AddStatComparesToTooltip(tooltip, calcBase, outputNew, "^7Allocating "..node.dn.." will give you: ")
if numChanges == 0 then
tooltip:AddLine(14, "^7Allocating "..node.dn.." changes nothing.")
Expand Down Expand Up @@ -3650,10 +3641,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
tooltip:AddLine(14, stat)
end
end
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({ toggleFlask = item }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local output = calcFunc({ toggleFlask = item })
local header
if self.build.calcsTab.mainEnv.flasks[item] then
header = "^7Deactivating this flask will give you:"
Expand Down Expand Up @@ -3689,10 +3677,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
tooltip:AddLine(14, stat)
end
end
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({ toggleTincture = item }, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local output = calcFunc({ toggleTincture = item })
local header
if self.build.calcsTab.mainEnv.tinctures[item] then
header = "^7Deactivating this tincture will give you:"
Expand Down Expand Up @@ -3739,10 +3724,7 @@ 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 or nil}, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
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:"
Expand Down
7 changes: 2 additions & 5 deletions src/Classes/NotableDBControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,12 @@ function NotableDBClass:ListBuilder()
local start = GetTime()
local calcFunc = self.itemsTab.build.calcsTab:GetMiscCalculator()
local itemType = self.itemsTab.displayItem.base.type
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local calcBase = calcFunc({ repSlotName = itemType, repItem = self.itemsTab:anointItem(nil) }, {})
local calcBase = calcFunc({ repSlotName = itemType, repItem = self.itemsTab:anointItem(nil) })
self.sortMaxPower = 0
for nodeIndex, node in ipairs(list) do
node.measuredPower = 0
if node.modKey ~= "" then
local output = calcFunc({ repSlotName = itemType, repItem = self.itemsTab:anointItem(node) }, {})
local output = calcFunc({ repSlotName = itemType, repItem = self.itemsTab:anointItem(node) })
node.measuredPower = self:CalculatePowerStat(self.sortDetail, output, calcBase)
if node.measuredPower == m_huge then
t_insert(infinites, node)
Expand All @@ -160,7 +158,6 @@ function NotableDBClass:ListBuilder()
start = now
end
end
GlobalCache.useFullDPS = storedGlobalCacheDPSView

if #infinites > 0 then
self.sortMaxPower = self.sortMaxPower * 2
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/PassiveTreeView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build)
-- Calculated the differences caused by allocating this node and all nodes along the path to it
if node.type == "Mastery" and node.allMasteryOptions then
pathNodes[node] = nil
nodeOutput = calcFunc({})
nodeOutput = calcFunc()
else
nodeOutput = calcFunc({ addNodes = { [node] = true } })
end
Expand Down
15 changes: 3 additions & 12 deletions src/Classes/SkillsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,7 @@ function SkillsTabClass:CreateGemSlot(index)
local tempQual = self.displayGroup.gemList[index].qualityId
self.displayGroup.gemList[index].qualityId = hoveredQuality.type
self:ProcessSocketGroup(self.displayGroup)
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({}, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local output = calcFunc()
self.displayGroup.gemList[index].qualityId = tempQual
tooltip:AddSeparator(10)
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, "^7Switching to this quality variant will give you:")
Expand Down Expand Up @@ -827,10 +824,7 @@ function SkillsTabClass:CreateGemSlot(index)
if calcFunc then
local storedQuality = self.displayGroup.gemList[index].quality
self.displayGroup.gemList[index].quality = 20
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({}, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local output = calcFunc()
self.displayGroup.gemList[index].quality = storedQuality
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, "^7Setting to 20 quality will give you:")
end
Expand Down Expand Up @@ -872,10 +866,7 @@ function SkillsTabClass:CreateGemSlot(index)
local calcFunc, calcBase = self.build.calcsTab:GetMiscCalculator(self.build)
if calcFunc then
self.displayGroup.gemList[index].enabled = not self.displayGroup.gemList[index].enabled
local storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
local output = calcFunc({}, {})
GlobalCache.useFullDPS = storedGlobalCacheDPSView
local output = calcFunc()
self.displayGroup.gemList[index].enabled = not self.displayGroup.gemList[index].enabled
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, self.displayGroup.gemList[index].enabled and "^7Disabling this gem will give you:" or "^7Enabling this gem will give you:")
end
Expand Down
20 changes: 5 additions & 15 deletions src/Classes/TradeQuery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ local TradeQueryClass = newClass("TradeQuery", function(self, itemsTab)
end

-- set
self.storedGlobalCacheDPSView = GlobalCache.useFullDPS
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
self.hostName = "https://www.pathofexile.com/"
end)

Expand Down Expand Up @@ -503,9 +501,7 @@ Highest Weight - Displays the order retrieved from trade]]
end
end
self.controls.fullPrice = new("LabelControl", {"BOTTOM", nil, "BOTTOM"}, {0, -row_height - pane_margins_vertical - row_vertical_padding, pane_width - 2 * pane_margins_horizontal, row_height}, "")
GlobalCache.useFullDPS = GlobalCache.numActiveSkillInFullDPS > 0
self.controls.close = new("ButtonControl", {"BOTTOM", nil, "BOTTOM"}, {0, -pane_margins_vertical, 90, row_height}, "Done", function()
GlobalCache.useFullDPS = self.storedGlobalCacheDPSView
main:ClosePopup()
-- there's a case where if you have a socket(s) allocated, open TradeQuery, close it, dealloc, then open TradeQuery again
-- the deallocated socket controls were still showing, so this will remove all dynamically created controls from items
Expand Down Expand Up @@ -692,13 +688,7 @@ end
function TradeQueryClass:ReduceOutput(output)
local smallOutput = {}
for _, statTable in ipairs(self.statSortSelectionList) do
if statTable.stat == "FullDPS" and GlobalCache.numActiveSkillInFullDPS == 0 then
smallOutput.TotalDPS = output.TotalDPS
smallOutput.TotalDotDPS = output.TotalDotDPS
smallOutput.CombinedDPS = output.CombinedDPS
else
smallOutput[statTable.stat] = output[statTable.stat]
end
smallOutput[statTable.stat] = output[statTable.stat]
end
return smallOutput
end
Expand Down Expand Up @@ -728,10 +718,10 @@ function TradeQueryClass:GetResultEvaluation(row_idx, result_index, calcFunc, ba
for nodeName in (result.item_string.."\r\n"):gmatch("1 Added Passive Skill is (.-)\r?\n") do
t_insert(addedNodes, self.itemsTab.build.spec.tree.clusterNodeMap[nodeName])
end
local output12 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[1]] = true, [addedNodes[2]] = true } }, { requirementsItems = true, requirementsGems = true, skills = true }))
local output13 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[1]] = true, [addedNodes[3]] = true } }, { requirementsItems = true, requirementsGems = true, skills = true }))
local output23 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[2]] = true, [addedNodes[3]] = true } }, { requirementsItems = true, requirementsGems = true, skills = true }))
local output123 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[1]] = true, [addedNodes[2]] = true, [addedNodes[3]] = true } }), { requirementsItems = true, requirementsGems = true, skills = true })
local output12 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[1]] = true, [addedNodes[2]] = true } }))
local output13 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[1]] = true, [addedNodes[3]] = true } }))
local output23 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[2]] = true, [addedNodes[3]] = true } }))
local output123 = self:ReduceOutput(calcFunc({ addNodes = { [addedNodes[1]] = true, [addedNodes[2]] = true, [addedNodes[3]] = true } }))
-- Sometimes the third node is as powerful as a wet noodle, so use weight per point spent, including the jewel socket
local weight12 = self.tradeQueryGenerator.WeightedRatioOutputs(baseOutput, output12, self.statSortSelectionList) / 4
local weight13 = self.tradeQueryGenerator.WeightedRatioOutputs(baseOutput, output13, self.statSortSelectionList) / 4
Expand Down
Loading
Loading