XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

fix: tell client when it has used a free favor (#850)

efcaaa56
Sainan <sainan@calamity.inc>
提交于

代码差异

2 个文件 +16 -5
Modified src/services/purchaseService.ts +8 -1
@@ -98,7 +98,14 @@ export const handlePurchase = async (
98 98 const inventory = await getInventory(accountId);
99 99 const affiliation = inventory.Affiliations.find(x => x.Tag == syndicateTag)!;
100 100 affiliation.FreeFavorsUsed ??= [];
101 affiliation.FreeFavorsUsed.push(affiliation.FreeFavorsEarned![affiliation.FreeFavorsUsed.length]);
101 const lastTitle = affiliation.FreeFavorsEarned![affiliation.FreeFavorsUsed.length];
102 affiliation.FreeFavorsUsed.push(lastTitle);
103 purchaseResponse.FreeFavorsUsed = [
104 {
105 Tag: syndicateTag,
106 Title: lastTitle
107 }
108 ];
102 109 await inventory.save();
103 110 } else {
104 111 const syndicate = ExportSyndicates[syndicateTag];
Modified src/types/purchaseTypes.ts +8 -4
@@ -34,12 +34,16 @@ export type IInventoryChanges = {
34 34 IBinChanges | number | object[] | IInfestedFoundryClient
35 35 >;
36 36
37 export interface IAffiliationMods {
38 Tag: string;
39 Standing?: number;
40 Title?: number;
41 }
42
37 43 export interface IPurchaseResponse {
38 44 InventoryChanges: IInventoryChanges;
39 Standing?: {
40 Tag: string;
41 Standing: number;
42 }[];
45 Standing?: IAffiliationMods[];
46 FreeFavorsUsed?: IAffiliationMods[];
43 47 BoosterPackItems?: string;
44 48 }
45 49