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 miscItemChanges: IMiscItem[] = [];
|
||||
if (suit.ArchonCrystalUpgrades![request.Slot].Color) {
|
||||
if (suit.ArchonCrystalUpgrades![request.Slot]?.Color) {
|
||||
// refund shard
|
||||
const shard = Object.entries(colorToShard).find(
|
||||
([color]) => color == suit.ArchonCrystalUpgrades![request.Slot].Color
|
||||
([color]) => color == suit.ArchonCrystalUpgrades![request.Slot]!.Color
|
||||
)![1];
|
||||
miscItemChanges.push({
|
||||
ItemType: shard,
|
||||
@ -83,9 +83,9 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
|
||||
// >= 38.6.0
|
||||
type =
|
||||
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;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export const popArchonCrystalUpgradeController: RequestHandler = async (req, res
|
||||
const suit = inventory.Suits.id(req.query.oid as string);
|
||||
if (suit && suit.ArchonCrystalUpgrades) {
|
||||
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();
|
||||
res.end();
|
||||
|
@ -136,7 +136,7 @@ export interface IEquipmentDatabase {
|
||||
DefensiveUpgrade?: string;
|
||||
UpgradesExpiry?: Date;
|
||||
UmbraDate?: Date; // related to scrapped "echoes of umbra" feature
|
||||
ArchonCrystalUpgrades?: IArchonCrystalUpgrade[];
|
||||
ArchonCrystalUpgrades?: (IArchonCrystalUpgrade | null)[];
|
||||
Weapon?: ICrewShipWeapon;
|
||||
Customization?: ICrewShipCustomization;
|
||||
RailjackImage?: IFlavourItem;
|
||||
|
Loading…
x
Reference in New Issue
Block a user