返回提交历史
Modified
src/controllers/api/artifactTransmutationController.ts
+6
-9
XFEstudio/XFESpaceNinjaServer
chore: fix deprecation warning in transmutation controller (#3454)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3454 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
5fdf2a22
代码差异
1 个文件
+6
-9
@@ -2,7 +2,7 @@ import { fromOid, toOid2 } from "../../helpers/inventoryHelpers.ts";
2
2
import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "../../helpers/rivenHelper.ts";
3
3
import { addMiscItems, addMods, getInventory } from "../../services/inventoryService.ts";
4
4
import { getAccountForRequest } from "../../services/loginService.ts";
5
import { getRandomElement, getRandomWeightedReward, getRandomWeightedRewardUc } from "../../services/rngService.ts";
5
import { getRandomElement, getRandomWeightedRewardUc } from "../../services/rngService.ts";
6
6
import type { IUpgradeFromClient } from "../../types/inventoryTypes/inventoryTypes.ts";
7
7
import type { RequestHandler } from "express";
8
8
import type { TRarity } from "warframe-public-export-plus";
@@ -98,14 +98,11 @@ export const artifactTransmutationController: RequestHandler = async (req, res)
98
98
LEGENDARY: 0
99
99
};
100
100
101
const options: { uniqueName: string; rarity: TRarity }[] = [];
102
Object.entries(ExportUpgrades).forEach(([uniqueName, upgrade]) => {
103
if (upgrade.canBeTransmutation && (!forcedPolarity || upgrade.polarity == forcedPolarity)) {
104
options.push({ uniqueName, rarity: upgrade.rarity });
105
}
106
});
107
108
newModType = getRandomWeightedReward(options, weights)!.uniqueName;
101
let options = ExportBoosterPacks["/Lotus/Types/BoosterPacks/ModFuserResult"].components;
102
if (forcedPolarity) {
103
options = options.filter(({ Item }) => ExportUpgrades[Item].polarity == forcedPolarity);
104
}
105
newModType = getRandomWeightedRewardUc(options, weights)!.Item;
109
106
}
110
107
111
108
addMods(inventory, [