diff --git a/client/src/types.ts b/client/src/types.ts index fe40c66..0b2477e 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -57,9 +57,11 @@ export interface Character { color: string; luck_token: number; torch_lit_at: string | null; + is_dead: boolean; stats: Stat[]; gear: Gear[]; talents: Talent[]; + conditions: Condition[]; } export interface GameItem { diff --git a/server/src/routes/characters.ts b/server/src/routes/characters.ts index 974c256..1897dff 100644 --- a/server/src/routes/characters.ts +++ b/server/src/routes/characters.ts @@ -63,12 +63,17 @@ async function enrichCharacters(characters: RowDataPacket[]) { "SELECT * FROM character_talents WHERE character_id = ?", [char.id] ); + const [conditions] = await db.execute( + "SELECT * FROM character_conditions WHERE character_id = ?", + [char.id] + ); return { ...char, overrides: parseJson(char.overrides), stats, gear: parseGear(gear), talents: parseTalents(talents), + conditions, }; }) ); @@ -216,10 +221,14 @@ router.patch("/:id", requireAuth, async (req, res) => { "SELECT * FROM characters WHERE id = ?", [id] ); - + const [conditions] = await db.execute( + "SELECT * FROM character_conditions WHERE character_id = ?", + [id] + ); const enriched = { ...rows[0], overrides: parseJson(rows[0].overrides), + conditions, }; const io: Server = req.app.get("io");