chore: improve IInventoryChanges #654

Merged
Sainan merged 2 commits from improve-IInventoryChanges into main 2024-12-29 12:40:54 -08:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit e909216001 - Show all commits

View File

@ -85,7 +85,7 @@ export const combineInventoryChanges = (InventoryChanges: IInventoryChanges, del
} else { } else {
console.assert(key.substring(-3) == "Bin"); console.assert(key.substring(-3) == "Bin");
const left = InventoryChanges[key] as IBinChanges; const left = InventoryChanges[key] as IBinChanges;
const right: IBinChanges = delta[key]; const right: IBinChanges = delta[key] as IBinChanges;
left.count += right.count; left.count += right.count;
left.platinum += right.platinum; left.platinum += right.platinum;
left.Slots += right.Slots; left.Slots += right.Slots;

View File

@ -17,7 +17,9 @@ export interface IPurchaseParams {
UseFreeFavor?: boolean; // for Source 2 UseFreeFavor?: boolean; // for Source 2
} }
export type IInventoryChanges = Record<string, IBinChanges | object[]>; export type IInventoryChanges = {
[_ in SlotNames]?: IBinChanges;
} & Record<string, IBinChanges | number | object[]>;
export interface IPurchaseResponse { export interface IPurchaseResponse {
InventoryChanges: IInventoryChanges; InventoryChanges: IInventoryChanges;