Skip to content

Commit 6bacd62

Browse files
committed
Use stat transform in trader, fixes lower is better stats not counting
1 parent c03529d commit 6bacd62

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Classes/TradeQueryGenerator.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ function TradeQueryGeneratorClass.WeightedRatioOutputs(baseOutput, newOutput, st
177177
if statTable.stat == "FullDPS" and not (baseOutput["FullDPS"] and newOutput["FullDPS"]) then
178178
meanStatDiff = meanStatDiff + ratioModSums("TotalDPS", "TotalDotDPS", "CombinedDPS") * statTable.weightMult
179179
end
180-
meanStatDiff = meanStatDiff + ratioModSums(statTable.stat) * statTable.weightMult
180+
local modSumRatio = ratioModSums(statTable.stat)
181+
-- some weights, such as damage taken from hit need to be negated as lower is better for them
182+
if statTable.transform then
183+
modSumRatio = statTable.transform(modSumRatio)
184+
end
185+
meanStatDiff = meanStatDiff + modSumRatio * statTable.weightMult
181186
end
182187
return meanStatDiff
183188
end
@@ -547,6 +552,9 @@ end
547552
function TradeQueryGeneratorClass:GenerateModWeights(modsToTest)
548553
local start = GetTime()
549554
for _, entry in pairs(modsToTest) do
555+
if _ == "1671376347" then
556+
print("help")
557+
end
550558
if entry[self.calcContext.itemCategory] ~= nil then
551559
if self.alreadyWeightedMods[entry.tradeMod.id] ~= nil then -- Don't calculate the same thing twice (can happen with corrupted vs implicit)
552560
goto continue

0 commit comments

Comments
 (0)