Skip to content

Commit fff484c

Browse files
obokingWires77
andauthored
Add build comparison tab (#9543)
Co-authored-by: Wires77 <Wires77@users.noreply.github.com>
1 parent b51a4e9 commit fff484c

16 files changed

Lines changed: 6973 additions & 330 deletions

src/Classes/CalcSectionControl.lua

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -157,64 +157,6 @@ function CalcSectionClass:UpdatePos()
157157
end
158158
end
159159

160-
function CalcSectionClass:FormatVal(val, p)
161-
return formatNumSep(tostring(round(val, p)))
162-
end
163-
164-
function CalcSectionClass:FormatStr(str, actor, colData)
165-
str = str:gsub("{output:([%a%.:]+)}", function(c)
166-
local ns, var = c:match("^(%a+)%.(%a+)$")
167-
if ns then
168-
return actor.output[ns] and actor.output[ns][var] or ""
169-
else
170-
return actor.output[c] or ""
171-
end
172-
end)
173-
str = str:gsub("{(%d+):output:([%a%.:]+)}", function(p, c)
174-
local ns, var = c:match("^(%a+)%.(%a+)$")
175-
if ns then
176-
return self:FormatVal(actor.output[ns] and actor.output[ns][var] or 0, tonumber(p))
177-
else
178-
return self:FormatVal(actor.output[c] or 0, tonumber(p))
179-
end
180-
end)
181-
str = str:gsub("{(%d+):mod:([%d,]+)}", function(p, n)
182-
local numList = { }
183-
for num in n:gmatch("%d+") do
184-
t_insert(numList, tonumber(num))
185-
end
186-
local modType = colData[numList[1]].modType
187-
local modTotal = modType == "MORE" and 1 or 0
188-
for _, num in ipairs(numList) do
189-
local sectionData = colData[num]
190-
local modCfg = (sectionData.cfg and actor.mainSkill[sectionData.cfg.."Cfg"]) or { }
191-
if sectionData.modSource then
192-
modCfg.source = sectionData.modSource
193-
end
194-
if sectionData.actor then
195-
modCfg.actor = sectionData.actor
196-
end
197-
local modVal
198-
local modStore = (sectionData.enemy and actor.enemy.modDB) or (sectionData.cfg and actor.mainSkill.skillModList) or actor.modDB
199-
if type(sectionData.modName) == "table" then
200-
modVal = modStore:Combine(sectionData.modType, modCfg, unpack(sectionData.modName))
201-
else
202-
modVal = modStore:Combine(sectionData.modType, modCfg, sectionData.modName)
203-
end
204-
if modType == "MORE" then
205-
modTotal = modTotal * modVal
206-
else
207-
modTotal = modTotal + modVal
208-
end
209-
end
210-
if modType == "MORE" then
211-
modTotal = (modTotal - 1) * 100
212-
end
213-
return self:FormatVal(modTotal, tonumber(p))
214-
end)
215-
return str
216-
end
217-
218160
function CalcSectionClass:Draw(viewPort, noTooltip)
219161
local x, y = self:GetPos()
220162
local width, height = self:GetSize()
@@ -245,7 +187,7 @@ function CalcSectionClass:Draw(viewPort, noTooltip)
245187
DrawString(x + 3, lineY + 3, "LEFT", 16, "VAR BOLD", textColor..subSec.label..":")
246188
if subSec.data.extra then
247189
local x = x + 3 + DrawStringWidth(16, "VAR BOLD", subSec.label) + 10
248-
DrawString(x, lineY + 3, "LEFT", 16, "VAR", "^7"..self:FormatStr(subSec.data.extra, actor))
190+
DrawString(x, lineY + 3, "LEFT", 16, "VAR", "^7"..formatCalcStr(subSec.data.extra, actor))
249191
end
250192
end
251193
-- Draw line below label
@@ -300,7 +242,7 @@ function CalcSectionClass:Draw(viewPort, noTooltip)
300242
end
301243
local textSize = rowData.textSize or 14
302244
SetViewport(colData.x + 3, colData.y, colData.width - 4, colData.height)
303-
DrawString(1, 9 - textSize/2, "LEFT", textSize, "VAR", "^7"..self:FormatStr(colData.format, actor, colData))
245+
DrawString(1, 9 - textSize/2, "LEFT", textSize, "VAR", "^7"..formatCalcStr(colData.format, actor, colData))
304246
SetViewport()
305247
end
306248
end

src/Classes/CalcsTab.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ function CalcsTabClass:SetDisplayStat(displayData, pin)
372372
self.controls.breakdown:SetBreakdownData(displayData, pin)
373373
end
374374

375-
function CalcsTabClass:CheckFlag(obj)
376-
local actor = self.input.showMinion and self.calcsEnv.minion or self.calcsEnv.player
375+
function CalcsTabClass:CheckFlag(obj, actor)
376+
actor = actor or (self.input.showMinion and self.calcsEnv.minion or self.calcsEnv.player)
377377
local skillFlags = actor.mainSkill.skillFlags
378378
if obj.flag and not skillFlags[obj.flag] then
379379
return

0 commit comments

Comments
 (0)