fix: tell client when it has used a free favor (#850)
This commit is contained in:
parent
7716c945d0
commit
efcaaa56c4
@ -98,7 +98,14 @@ export const handlePurchase = async (
|
|||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const affiliation = inventory.Affiliations.find(x => x.Tag == syndicateTag)!;
|
const affiliation = inventory.Affiliations.find(x => x.Tag == syndicateTag)!;
|
||||||
affiliation.FreeFavorsUsed ??= [];
|
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();
|
await inventory.save();
|
||||||
} else {
|
} else {
|
||||||
const syndicate = ExportSyndicates[syndicateTag];
|
const syndicate = ExportSyndicates[syndicateTag];
|
||||||
|
@ -34,12 +34,16 @@ export type IInventoryChanges = {
|
|||||||
IBinChanges | number | object[] | IInfestedFoundryClient
|
IBinChanges | number | object[] | IInfestedFoundryClient
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
export interface IAffiliationMods {
|
||||||
|
Tag: string;
|
||||||
|
Standing?: number;
|
||||||
|
Title?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface IPurchaseResponse {
|
export interface IPurchaseResponse {
|
||||||
InventoryChanges: IInventoryChanges;
|
InventoryChanges: IInventoryChanges;
|
||||||
Standing?: {
|
Standing?: IAffiliationMods[];
|
||||||
Tag: string;
|
FreeFavorsUsed?: IAffiliationMods[];
|
||||||
Standing: number;
|
|
||||||
}[];
|
|
||||||
BoosterPackItems?: string;
|
BoosterPackItems?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user