feat: handle helminth offerings update request (#714)

This commit is contained in:
Sainan 2025-01-05 05:17:40 +01:00 committed by GitHub
parent e42e2eb258
commit 05d16f09b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,10 +107,21 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
break;
}
case "o": // offerings update
// {"OfferingsIndex":540,"SuitTypes":["/Lotus/Powersuits/PaxDuviricus/PaxDuviricusBaseSuit","/Lotus/Powersuits/Nezha/NezhaBaseSuit","/Lotus/Powersuits/Devourer/DevourerBaseSuit"],"Extra":false}
res.status(404).end();
case "o": {
// offerings update
const request = getJSONfromString(String(req.body)) as IHelminthOfferingsUpdate;
const inventory = await getInventory(accountId);
inventory.InfestedFoundry ??= {};
inventory.InfestedFoundry.InvigorationIndex = request.OfferingsIndex;
inventory.InfestedFoundry.InvigorationSuitOfferings = request.SuitTypes;
await inventory.save();
res.json({
InventoryChanges: {
InfestedFoundry: inventory.toJSON().InfestedFoundry
}
});
break;
}
case "a": {
// subsume warframe
@ -251,3 +262,9 @@ export const handleSubsumeCompletion = (inventory: TInventoryDatabaseDocument):
addRecipes(inventory, recipeChanges);
return recipeChanges;
};
interface IHelminthOfferingsUpdate {
OfferingsIndex: number;
SuitTypes: string[];
Extra: boolean;
}