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 name of item causing requirements warning to warning message #8335

Merged
merged 1 commit into from
Oct 20, 2024
Merged
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
8 changes: 4 additions & 4 deletions src/Modules/Build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,13 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
{ stat = "SoulCost", label = "Soul Cost", fmt = "d", color = colorCodes.RAGE, pool = "Soul", compPercent = true, lowerIsBetter = true, condFunc = function(v,o) return o.SoulHasCost end },
{ },
{ stat = "Str", label = "Strength", color = colorCodes.STRENGTH, fmt = "d" },
{ stat = "ReqStr", label = "Strength Required", color = colorCodes.STRENGTH, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > o.Str end, warnFunc = function(v) return "You do not meet the Strength requirement" end },
{ stat = "ReqStr", label = "Strength Required", color = colorCodes.STRENGTH, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > o.Str end, warnFunc = function(v,o) return "You do not meet the Strength requirement of " .. (o.ReqStrItem.source == "Item" and o.ReqStrItem.sourceItem.name or o.ReqStrItem.source == "Gem" and o.ReqStrItem.sourceGem.nameSpec) end },
{ stat = "Dex", label = "Dexterity", color = colorCodes.DEXTERITY, fmt = "d" },
{ stat = "ReqDex", label = "Dexterity Required", color = colorCodes.DEXTERITY, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > o.Dex end, warnFunc = function(v) return "You do not meet the Dexterity requirement" end },
{ stat = "ReqDex", label = "Dexterity Required", color = colorCodes.DEXTERITY, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > o.Dex end, warnFunc = function(v,o) return "You do not meet the Dexterity requirement of " .. (o.ReqDexItem.source == "Item" and o.ReqDexItem.sourceItem.name or o.ReqDexItem.source == "Gem" and o.ReqDexItem.sourceGem.nameSpec) end },
{ stat = "Int", label = "Intelligence", color = colorCodes.INTELLIGENCE, fmt = "d" },
{ stat = "ReqInt", label = "Intelligence Required", color = colorCodes.INTELLIGENCE, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > o.Int end, warnFunc = function(v) return "You do not meet the Intelligence requirement" end },
{ stat = "ReqInt", label = "Intelligence Required", color = colorCodes.INTELLIGENCE, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > o.Int end, warnFunc = function(v,o) return "You do not meet the Intelligence requirement of " .. (o.ReqIntItem.source == "Item" and o.ReqIntItem.sourceItem.name or o.ReqIntItem.source == "Gem" and o.ReqIntItem.sourceGem.nameSpec) end },
{ stat = "Omni", label = "Omniscience", color = colorCodes.RARE, fmt = "d" },
{ stat = "ReqOmni", label = "Omniscience Required", color = colorCodes.RARE, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > (o.Omni or 0) end, warnFunc = function(v) return "You do not meet the Omniscience requirement" end },
{ stat = "ReqOmni", label = "Omniscience Required", color = colorCodes.RARE, fmt = "d", lowerIsBetter = true, condFunc = function(v,o) return v > (o.Omni or 0) end, warnFunc = function(v,o) return "You do not meet the Omniscience requirement of " .. (o.ReqOmniItem.source == "Item" and o.ReqOmniItem.sourceItem.name or o.ReqOmniItem.source == "Gem" and o.ReqOmniItem.sourceGem.nameSpec) end },
{ },
{ stat = "Devotion", label = "Devotion", color = colorCodes.RARE, fmt = "d" },
{ },
Expand Down
33 changes: 18 additions & 15 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1649,12 +1649,11 @@ function calcs.perform(env, skipEHP)
-- Process attribute requirements
do
local reqMult = calcLib.mod(modDB, nil, "GlobalAttributeRequirements")
local attrTable = modDB:Flag(nil, "OmniscienceRequirements") and {"Omni","Str","Dex","Int"} or {"Str","Dex","Int"}
local omniRequirements = modDB:Flag(nil, "OmniscienceRequirements") and calcLib.mod(modDB, nil, "OmniAttributeRequirements")
local ignoreAttrReq = modDB:Flag(nil, "IgnoreAttributeRequirements")
local attrTable = omniRequirements and {"Omni","Str","Dex","Int"} or {"Str","Dex","Int"}
for _, attr in ipairs(attrTable) do
local breakdownAttr = attr
if modDB:Flag(nil, "OmniscienceRequirements") then
breakdownAttr = "Omni"
end
local breakdownAttr = omniRequirements and "Omni" or attr
if breakdown then
breakdown["Req"..attr] = {
rowList = { },
Expand All @@ -1665,16 +1664,19 @@ function calcs.perform(env, skipEHP)
}
}
end
local out = 0
local out = {val = 0, source = nil}
for _, reqSource in ipairs(env.requirementsTable) do
if reqSource[attr] and reqSource[attr] > 0 then
local req = m_floor(reqSource[attr] * reqMult)
if modDB:Flag(nil, "OmniscienceRequirements") then
local omniReqMult = 1 / (calcLib.mod(modDB, nil, "OmniAttributeRequirements") - 1)
if omniRequirements then
local omniReqMult = 1 / (omniRequirements - 1)
local attributereq = m_floor(reqSource[attr] * reqMult)
req = m_floor(attributereq * omniReqMult)
end
out = m_max(out, req)
if req > out.val then
out.val = req
out.source = reqSource
end
if breakdown then
local row = {
req = req > output[breakdownAttr] and colorCodes.NEGATIVE..req or req,
Expand All @@ -1694,15 +1696,16 @@ function calcs.perform(env, skipEHP)
end
end
end
if modDB:Flag(nil, "IgnoreAttributeRequirements") then
out = 0
if ignoreAttrReq then
out.val = 0
end
output["Req"..attr.."String"] = 0
if out > (output["Req"..breakdownAttr] or 0) then
output["Req"..breakdownAttr.."String"] = out
output["Req"..breakdownAttr] = out
if out.val > (output["Req"..breakdownAttr] or 0) then
output["Req"..breakdownAttr.."String"] = out.val
output["Req"..breakdownAttr] = out.val
output["Req"..breakdownAttr.."Item"] = out.source
if breakdown then
output["Req"..breakdownAttr.."String"] = out > (output[breakdownAttr] or 0) and colorCodes.NEGATIVE..out or out
output["Req"..breakdownAttr.."String"] = out.val > (output[breakdownAttr] or 0) and colorCodes.NEGATIVE..(out.val) or out.val
end
end
end
Expand Down
Loading