Ajust database schema to recent changes

This commit is contained in:
Clément Pons
2025-08-26 17:34:34 +02:00
parent da93fcd82d
commit 042d4479ee
17 changed files with 898 additions and 106 deletions

47
types/character.d.ts vendored
View File

@@ -10,8 +10,11 @@ export type SpellElement = typeof SPELL_ELEMENTS[number];
export type Alignment = typeof ALIGNMENTS[number];
export type FeatureID = string;
export type TextID = string;
export type Resistance = string;
export type Dice = `${number}d${4 | 6 | 8 | 10 | 12 | 20}`;
export type Character = {
id: number;
@@ -20,16 +23,12 @@ export type Character = {
level: number;
aspect?: number;
notes?: string | null;
health: number;
mana: number;
training: Record<MainStat, Partial<Record<TrainingLevel, number>>>;
leveling: Partial<Record<Level, number>>;
abilities: Partial<Record<Ability, number>>; //First is the ability, second is the max increment
spells: string[]; //Spell ID
modifiers: Partial<Record<MainStat, number>>;
choices: Record<string, number[]>;
abilities: Partial<Record<Ability, number>>;
variables: CharacterVariables;
choices: Record<FeatureID, number[]>;
owner: number;
username?: string;
@@ -40,8 +39,9 @@ export type CharacterVariables = {
mana: number;
exhaustion: number;
sickness: Array<{ id: string, progress: number | true }>;
equipment: Array<string>;
sickness: Array<{ id: string, state: number | true }>;
spells: string[]; //Spell ID
equipment: string[]; //Equipment ID
};
export type CharacterConfig = {
peoples: Record<string, RaceConfig>;
@@ -51,8 +51,35 @@ export type CharacterConfig = {
spells: SpellConfig[];
aspects: AspectConfig[];
features: Record<FeatureID, Feature>;
enchantments: Record<string, { name: string, effect: FeatureEffect[] }>; //TODO
items: Record<string, ItemConfig & { enchantments: string[] }>;
lists: Record<string, { id: string, name: string, [key: string]: any }[]>;
texts: Record<string, Localized>;
texts: Record<TextID, Localized>;
};
export type ItemConfig = { id: string, weight?: number, price?: number, power: number } & (ArmorConfig | WeaponConfig | WondrousConfig | MundaneConfig);
type ArmorConfig = {
category: 'armor';
name: string; //TODO -> TextID
description: TextID;
life: number;
absorb: number;
};
type WeaponConfig = {
category: 'armor';
name: string; //TODO -> TextID
description: TextID;
damage: Dice;
};
type WondrousConfig = {
category: 'armor';
name: string; //TODO -> TextID
description: TextID;
effect: FeatureEffect[];
};
type MundaneConfig = {
category: 'armor';
name: string; //TODO -> TextID
description: TextID;
};
export type SpellConfig = {
id: string;