返回提交历史
Modified
src/controllers/api/arcaneCommonController.ts
+2
-2
Modified
src/services/inventoryService.ts
+1
-2
XFEstudio/XFESpaceNinjaServer
chore: fix unsafe member access warnings for upgrade fingerprints (#653)
00bcf5c3
代码差异
2 个文件
+3
-4
@@ -19,7 +19,7 @@ export const arcaneCommonController: RequestHandler = async (req, res) => {
19
19
inventory.Upgrades.pull({ _id: json.arcane.ItemId.$oid });
20
20
21
21
// Add RawUpgrades
22
const numRawUpgradesToGive = arcaneLevelCounts[JSON.parse(upgrade.UpgradeFingerprint).lvl];
22
const numRawUpgradesToGive = arcaneLevelCounts[(JSON.parse(upgrade.UpgradeFingerprint) as { lvl: number }).lvl];
23
23
addMods(inventory, [
24
24
{
25
25
ItemType: json.arcane.ItemType,
@@ -35,7 +35,7 @@ export const arcaneCommonController: RequestHandler = async (req, res) => {
35
35
if (upgrade) {
36
36
// Have an existing Upgrade item?
37
37
if (upgrade.UpgradeFingerprint) {
38
const existingLevel = JSON.parse(upgrade.UpgradeFingerprint).lvl;
38
const existingLevel = (JSON.parse(upgrade.UpgradeFingerprint) as { lvl: number }).lvl;
39
39
numConsumed -= arcaneLevelCounts[existingLevel];
40
40
}
41
41
upgrade.UpgradeFingerprint = JSON.stringify({ lvl: json.newRank });
@@ -905,8 +905,7 @@ export const upgradeMod = async (artifactsData: IArtifactsRequest, accountId: st
905
905
const { ItemType, UpgradeFingerprint, ItemId } = Upgrade;
906
906
907
907
const safeUpgradeFingerprint = UpgradeFingerprint || '{"lvl":0}';
908
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
909
const parsedUpgradeFingerprint = JSON.parse(safeUpgradeFingerprint);
908
const parsedUpgradeFingerprint = JSON.parse(safeUpgradeFingerprint) as { lvl: number };
910
909
parsedUpgradeFingerprint.lvl += LevelDiff;
911
910
const stringifiedUpgradeFingerprint = JSON.stringify(parsedUpgradeFingerprint);
912
911