fix: handle null in ArchonCrystalUpgrades
This commit is contained in:
parent
71d1b6094c
commit
9a0f112420
@ -60,10 +60,10 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
|||||||
const suit = inventory.Suits.id(request.SuitId.$oid)!;
|
const suit = inventory.Suits.id(request.SuitId.$oid)!;
|
||||||
|
|
||||||
const miscItemChanges: IMiscItem[] = [];
|
const miscItemChanges: IMiscItem[] = [];
|
||||||
if (suit.ArchonCrystalUpgrades![request.Slot].Color) {
|
if (suit.ArchonCrystalUpgrades![request.Slot]?.Color) {
|
||||||
// refund shard
|
// refund shard
|
||||||
const shard = Object.entries(colorToShard).find(
|
const shard = Object.entries(colorToShard).find(
|
||||||
([color]) => color == suit.ArchonCrystalUpgrades![request.Slot].Color
|
([color]) => color == suit.ArchonCrystalUpgrades![request.Slot]!.Color
|
||||||
)![1];
|
)![1];
|
||||||
miscItemChanges.push({
|
miscItemChanges.push({
|
||||||
ItemType: shard,
|
ItemType: shard,
|
||||||
@ -83,9 +83,9 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
|||||||
// >= 38.6.0
|
// >= 38.6.0
|
||||||
type =
|
type =
|
||||||
archonCrystalRemovalResource[
|
archonCrystalRemovalResource[
|
||||||
suit.ArchonCrystalUpgrades![request.Slot].Color!.replace("_MYTHIC", "")
|
suit.ArchonCrystalUpgrades![request.Slot]!.Color!.replace("_MYTHIC", "")
|
||||||
];
|
];
|
||||||
count = suit.ArchonCrystalUpgrades![request.Slot].Color!.indexOf("_MYTHIC") != -1 ? 300 : 150;
|
count = suit.ArchonCrystalUpgrades![request.Slot]!.Color!.indexOf("_MYTHIC") != -1 ? 300 : 150;
|
||||||
}
|
}
|
||||||
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == type)!.Count -= count;
|
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == type)!.Count -= count;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ export const popArchonCrystalUpgradeController: RequestHandler = async (req, res
|
|||||||
const suit = inventory.Suits.id(req.query.oid as string);
|
const suit = inventory.Suits.id(req.query.oid as string);
|
||||||
if (suit && suit.ArchonCrystalUpgrades) {
|
if (suit && suit.ArchonCrystalUpgrades) {
|
||||||
suit.ArchonCrystalUpgrades = suit.ArchonCrystalUpgrades.filter(
|
suit.ArchonCrystalUpgrades = suit.ArchonCrystalUpgrades.filter(
|
||||||
x => x.UpgradeType != (req.query.type as string)
|
x => x && x.UpgradeType != (req.query.type as string)
|
||||||
);
|
);
|
||||||
await inventory.save();
|
await inventory.save();
|
||||||
res.end();
|
res.end();
|
||||||
|
@ -136,7 +136,7 @@ export interface IEquipmentDatabase {
|
|||||||
DefensiveUpgrade?: string;
|
DefensiveUpgrade?: string;
|
||||||
UpgradesExpiry?: Date;
|
UpgradesExpiry?: Date;
|
||||||
UmbraDate?: Date; // related to scrapped "echoes of umbra" feature
|
UmbraDate?: Date; // related to scrapped "echoes of umbra" feature
|
||||||
ArchonCrystalUpgrades?: IArchonCrystalUpgrade[];
|
ArchonCrystalUpgrades?: (IArchonCrystalUpgrade | null)[];
|
||||||
Weapon?: ICrewShipWeapon;
|
Weapon?: ICrewShipWeapon;
|
||||||
Customization?: ICrewShipCustomization;
|
Customization?: ICrewShipCustomization;
|
||||||
RailjackImage?: IFlavourItem;
|
RailjackImage?: IFlavourItem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user