返回提交历史
Modified
src/controllers/api/artifactTransmutationController.ts
+17
-6
XFEstudio/SpaceNinjaServer
fix: filter transmutation results by introducedAt (#4225)
Fixes #4147 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4225 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
145ad6ea
代码差异
1 个文件
+17
-6
@@ -1,4 +1,4 @@
1
import { fromOid, toOid2 } from "../../helpers/inventoryHelpers.ts";
1
import { fromOid, toOid2, version_compare } from "../../helpers/inventoryHelpers.ts";
2
2
import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "../../helpers/rivenHelper.ts";
3
3
import {
4
4
addFusionPoints,
@@ -17,6 +17,7 @@ import { ExportBoosterPacks, ExportUpgrades } from "warframe-public-export-plus"
17
17
18
18
export const artifactTransmutationController: RequestHandler = async (req, res) => {
19
19
const account = await getAccountForRequest(req);
20
const buildLabel = getBuildLabel(req, account);
20
21
const inventory = await getInventory2(
21
22
account._id,
22
23
"infiniteCredits",
@@ -59,7 +60,6 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
59
60
}) - 1;
60
61
await inventory.save();
61
62
62
const buildLabel = getBuildLabel(req, account);
63
63
res.json({
64
64
NewMods: [
65
65
{
@@ -117,10 +117,21 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
117
117
LEGENDARY: 0
118
118
};
119
119
120
let options = ExportBoosterPacks["/Lotus/Types/BoosterPacks/ModFuserResult"].components;
121
if (forcedPolarity) {
122
options = options.filter(({ Item }) => ExportUpgrades[Item].polarity == forcedPolarity);
123
}
120
const options = ExportBoosterPacks["/Lotus/Types/BoosterPacks/ModFuserResult"].components.filter(
121
({ Item }) => {
122
const meta = getUpgrade(Item)!;
123
if ((forcedPolarity && meta.polarity != forcedPolarity) || !meta.introducedAt) {
124
return false;
125
}
126
const date = new Date(meta.introducedAt * 1000);
127
return (
128
version_compare(
129
buildLabel,
130
`${date.getUTCFullYear()}.${date.getUTCMonth()}.${date.getUTCDate()}.${date.getUTCHours()}.${date.getUTCMinutes()}`
131
) >= 0
132
);
133
}
134
);
124
135
newModType = getRandomWeightedRewardUc(options, weights)!.Item;
125
136
}
126
137