Skip to content

Commit 407b67a

Browse files
authored
Fix min/max stat (#278)
* Fix min/max stat * Argh
1 parent be19455 commit 407b67a

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"source.organizeImports": "never"
1414
}
1515
},
16-
"jest.jestCommandLine": "pnpm test --",
1716
"jest.runMode": "on-demand",
1817
"cSpell.enabledLanguageIds": ["jsonc", "json", "markdown"],
1918
"cSpell.allowCompoundWords": true,

api/stately/loadouts-queries.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ export function statConstraintsFromStately(statConstraints: StatelyStatConstrain
155155
if (c.maxTier !== 10) {
156156
constraint.maxTier = c.maxTier;
157157
}
158+
if (c.minStat !== 0) {
159+
constraint.minStat = c.minStat;
160+
}
161+
// This is the tricky one - an undefined value means max stat 200
162+
if (c.maxStat !== 200 && c.maxStat !== 0) {
163+
constraint.maxStat = c.maxStat;
164+
}
158165
return constraint;
159166
});
160167

@@ -275,6 +282,8 @@ export function statConstraintsToStately(statConstraints: StatConstraint[] | und
275282
statHash: c.statHash,
276283
minTier: Math.max(0, Math.floor(c.minTier ?? 0)),
277284
maxTier: Math.min(Math.ceil(c.maxTier ?? 10), 10),
285+
minStat: Math.max(0, Math.floor(c.minStat ?? 0)),
286+
maxStat: Math.min(Math.ceil(c.maxStat ?? 200), 200),
278287
}))
279288
: [];
280289
}

0 commit comments

Comments
 (0)