chore: get rid of instances of markModified #908
@ -12,7 +12,7 @@ export const artifactsController: RequestHandler = async (req, res) => {
|
|||||||
const { Upgrade, LevelDiff, Cost, FusionPointCost } = artifactsData;
|
const { Upgrade, LevelDiff, Cost, FusionPointCost } = artifactsData;
|
||||||
|
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const { Upgrades, RawUpgrades } = inventory;
|
const { Upgrades } = inventory;
|
||||||
const { ItemType, UpgradeFingerprint, ItemId } = Upgrade;
|
const { ItemType, UpgradeFingerprint, ItemId } = Upgrade;
|
||||||
|
|
||||||
const safeUpgradeFingerprint = UpgradeFingerprint || '{"lvl":0}';
|
const safeUpgradeFingerprint = UpgradeFingerprint || '{"lvl":0}';
|
||||||
@ -32,13 +32,7 @@ export const artifactsController: RequestHandler = async (req, res) => {
|
|||||||
ItemType
|
ItemType
|
||||||
}) - 1;
|
}) - 1;
|
||||||
|
|
||||||
const rawItemIndex = RawUpgrades.findIndex(rawUpgrade => rawUpgrade.ItemType === ItemType);
|
addMods(inventory, [{ ItemType, ItemCount: -1 }]);
|
||||||
RawUpgrades[rawItemIndex].ItemCount--;
|
|
||||||
if (RawUpgrades[rawItemIndex].ItemCount > 0) {
|
|
||||||
inventory.markModified(`RawUpgrades.${rawItemIndex}.UpgradeFingerprint`);
|
|
||||||
} else {
|
|
||||||
RawUpgrades.splice(rawItemIndex, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.infiniteCredits) {
|
if (!config.infiniteCredits) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user