From 8a9dd09e041874afafeb3e767391bb24178312a4 Mon Sep 17 00:00:00 2001 From: Peechey <92683202+Peechey@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:01:17 -0600 Subject: [PATCH] cleaner implementation --- src/Modules/Build.lua | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/Modules/Build.lua b/src/Modules/Build.lua index 2a46856cc2..c2bdf7f335 100644 --- a/src/Modules/Build.lua +++ b/src/Modules/Build.lua @@ -23,16 +23,6 @@ local function InsertIfNew(t, val) table.insert(t, val) end -local function SplitString(input, delim) - local split = {} - if input then - for str in string.gmatch(input, "([^"..delim.."]+)") do - table.insert(split, str) - end - end - return split -end - function buildMode:Init(dbFileName, buildName, buildXML, convertBuild) self.dbFileName = dbFileName self.buildName = buildName @@ -268,8 +258,8 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild) { stat = "PreEffectiveCritChance", label = "Crit Chance", fmt = ".2f%%" }, { stat = "CritChance", label = "Effective Crit Chance", fmt = ".2f%%", condFunc = function(v,o) return v ~= o.PreEffectiveCritChance end }, { stat = "CritMultiplier", label = "Crit Multiplier", fmt = "d%%", pc = true, condFunc = function(v,o) return (o.CritChance or 0) > 0 end }, - { stat = "MainHand.Accuracy", label = "MH Accuracy", fmt = "d", condFunc = function(v,o) return o.PreciseTechnique end }, - { stat = "OffHand.Accuracy", label = "OH Accuracy", fmt = "d", condFunc = function(v,o) return o.PreciseTechnique end }, + { stat = "MainHand", childStat = "Accuracy", label = "MH Accuracy", fmt = "d", condFunc = function(v,o) return o.PreciseTechnique end }, + { stat = "OffHand", childStat = "Accuracy", label = "OH Accuracy", fmt = "d", condFunc = function(v,o) return o.PreciseTechnique end }, { stat = "HitChance", label = "Hit Chance", fmt = ".0f%%", flag = "attack" }, { stat = "HitChance", label = "Hit Chance", fmt = ".0f%%", condFunc = function(v,o) return o.enemyHasSpellBlock end }, { stat = "TotalDPS", label = "Hit DPS", fmt = ".1f", compPercent = true, flag = "notAverage" }, @@ -1365,8 +1355,6 @@ end function buildMode:AddDisplayStatList(statList, actor) local statBoxList = self.controls.statBox.list for index, statData in ipairs(statList) do - -- allows access to output values that are one node deeper (statData.stat is a table e.g. output.MainHand.Accuracy vs output.Life) - local statSplit = SplitString(statData.stat, "%.") if not statData.flag or actor.mainSkill.skillFlags[statData.flag] then local labelColor = "^7" if statData.color then @@ -1374,8 +1362,9 @@ function buildMode:AddDisplayStatList(statList, actor) end if statData.stat then local statVal = actor.output[statData.stat] - if statSplit[2] then - statVal = actor.output[statSplit[1]] and actor.output[statSplit[1]][statSplit[2]] + -- access output values that are one node deeper (statData.stat is a table e.g. output.MainHand.Accuracy vs output.Life) + if statVal and statData.childStat then + statVal = actor.output[statData.stat][statData.childStat] end if statVal and ((statData.condFunc and statData.condFunc(statVal,actor.output)) or (not statData.condFunc and statVal ~= 0)) then local overCapStatVal = actor.output[statData.overCapStat] or nil @@ -1521,7 +1510,7 @@ end function buildMode:CompareStatList(tooltip, statList, actor, baseOutput, compareOutput, header, nodeCount) local count = 0 for _, statData in ipairs(statList) do - if statData.stat and (not statData.flag or actor.mainSkill.skillFlags[statData.flag]) and statData.stat ~= "SkillDPS" then + if statData.stat and (not statData.flag or actor.mainSkill.skillFlags[statData.flag]) and not statData.childStat and statData.stat ~= "SkillDPS" then local statVal1 = compareOutput[statData.stat] or 0 local statVal2 = baseOutput[statData.stat] or 0 local diff = statVal1 - statVal2