fix: tell client when it has used a free favor

This commit is contained in:
Sainan 2025-01-23 06:48:26 +01:00
parent 8858b15693
commit cc3a34a161
2 changed files with 16 additions and 5 deletions

View File

@ -98,7 +98,14 @@ export const handlePurchase = async (
const inventory = await getInventory(accountId);
const affiliation = inventory.Affiliations.find(x => x.Tag == syndicateTag)!;
affiliation.FreeFavorsUsed ??= [];
affiliation.FreeFavorsUsed.push(affiliation.FreeFavorsEarned![affiliation.FreeFavorsUsed.length]);
const lastTitle = affiliation.FreeFavorsEarned![affiliation.FreeFavorsUsed.length];
affiliation.FreeFavorsUsed.push(lastTitle);
purchaseResponse.FreeFavorsUsed = [
{
Tag: syndicateTag,
Title: lastTitle
}
];
await inventory.save();
} else {
const syndicate = ExportSyndicates[syndicateTag];

View File

@ -34,12 +34,16 @@ export type IInventoryChanges = {
IBinChanges | number | object[] | IInfestedFoundryClient
>;
export interface IAffiliationMods {
Tag: string;
Standing?: number;
Title?: number;
}
export interface IPurchaseResponse {
InventoryChanges: IInventoryChanges;
Standing?: {
Tag: string;
Standing: number;
}[];
Standing?: IAffiliationMods[];
FreeFavorsUsed?: IAffiliationMods[];
BoosterPackItems?: string;
}