54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
export type CollectionCardState = {
|
|
owned: boolean;
|
|
awakening: number;
|
|
};
|
|
|
|
export type SavedDeck = {
|
|
id: string;
|
|
name: string;
|
|
cardIds: string[];
|
|
settings: Record<string, unknown>;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
};
|
|
|
|
export type CardListPreferences = {
|
|
types: string[];
|
|
stats: string[];
|
|
activeConditions: string[];
|
|
specialConditions: string[];
|
|
activeProbabilities: string[];
|
|
cardVariants: string[];
|
|
generations: string[];
|
|
};
|
|
|
|
export type BoardCardPlacements = Record<string, Record<string, string>>;
|
|
|
|
export type UserDataV1 = {
|
|
schemaVersion: 1;
|
|
updatedAt: string;
|
|
memoryCount: number;
|
|
memberPowerUpPercent: number;
|
|
collection: Record<string, CollectionCardState>;
|
|
memberBoards: Record<string, string[]>;
|
|
boardCards: BoardCardPlacements;
|
|
savedDecks: SavedDeck[];
|
|
preferences: CardListPreferences;
|
|
};
|
|
|
|
export type UserData = UserDataV1;
|
|
|
|
export function createUserData(preferences: CardListPreferences): UserDataV1 {
|
|
return {
|
|
schemaVersion: 1,
|
|
updatedAt: new Date().toISOString(),
|
|
memoryCount: 0,
|
|
memberPowerUpPercent: 0,
|
|
collection: {},
|
|
memberBoards: {},
|
|
boardCards: {},
|
|
savedDecks: [],
|
|
preferences
|
|
};
|
|
}
|