Skip to content

Commit 1af7ce6

Browse files
committed
Revert extra statdesc.lua changes
1 parent f067202 commit 1af7ce6

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

src/Export/statdesc.lua

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,8 @@ end
122122
---@param lang table A stat descriptor
123123
---@param val table[] An array of {min = #, max = #} corresponding to each stat
124124
---@return table? desc A stat description matching the stat values
125-
---@return integer? canonicalStat The index of the stat which the trade site uses for this description
126125
local function matchLimit(lang, val)
127-
-- by default, the trade site uses the first stat listed, but there can be a flag that says otherwise.
128-
local canonicalStat = 1
129126
for _, desc in ipairs(lang) do
130-
for _, flag in ipairs(desc) do
131-
if flag.k == "canonical_stat" then
132-
canonicalStat = flag.v
133-
end
134-
end
135127
local match = true
136128
for i, limit in ipairs(desc.limit) do
137129
if limit[1] == "!" then
@@ -145,7 +137,7 @@ local function matchLimit(lang, val)
145137
end
146138
end
147139
if match then
148-
return desc, canonicalStat
140+
return desc
149141
end
150142
end
151143
end
@@ -187,14 +179,13 @@ function describeStats(stats)
187179
table.insert(descOrdered, descriptor)
188180
end
189181
table.sort(descOrdered, function(a, b) return a.order < b.order end)
190-
local canonicalValues
191182
for _, descriptor in ipairs(descOrdered) do
192183
local val = { }
193184
for i, s in ipairs(descriptor.stats) do
194185
val[i] = stats[s] or { min = 0, max = 0 }
195186
val[i].fmt = "d"
196187
end
197-
local desc, canonicalStat = matchLimit(descriptor[1], val)
188+
local desc = matchLimit(descriptor[1], val)
198189

199190
-- Hack to handle ranges starting or ending at 0 where no descriptor is defined for 0
200191
-- Attempt to adapt existing ranges
@@ -208,25 +199,14 @@ function describeStats(stats)
208199
s.maxZ = true
209200
end
210201
end
211-
desc, canonicalStat = matchLimit(descriptor[1], val)
202+
desc = matchLimit(descriptor[1], val)
212203
for _, s in ipairs(val) do
213204
if s.minZ then s.min = 0 end
214205
if s.maxZ then s.max = 0 end
215206
end
216207
end
217208

218209
if desc then
219-
local stat1Name = descriptor.stats[canonicalStat]
220-
local stat2Name = descriptor.stats[canonicalStat + 1]
221-
local from = val[canonicalStat]
222-
if stat1Name:match("minimum") and stat2Name and stat2Name:match("maximum") then
223-
local to = val[canonicalStat + 1]
224-
local min = (from.min + to.min) / 2
225-
local max = (from.max + to.max) / 2
226-
canonicalValues = { min = min, max = max }
227-
else
228-
canonicalValues = { min = from.min, max = from.max }
229-
end
230210
for _, spec in ipairs(desc) do
231211
if spec.k == "negate" then
232212
val[spec.v].max, val[spec.v].min = -val[spec.v].min, -val[spec.v].max
@@ -439,7 +419,7 @@ function describeStats(stats)
439419
end
440420
end
441421
end
442-
return out, orders, missing, canonicalValues
422+
return out, orders, missing
443423
end
444424

445425
function describeMod(mod)

0 commit comments

Comments
 (0)