diff --git a/src/database.py b/src/database.py index 03c3fbe..e6a767a 100644 --- a/src/database.py +++ b/src/database.py @@ -739,6 +739,21 @@ class Database: await db.commit() return True + async def get_active_pets(self, player_id: int) -> List[Dict]: + """Get all active pets for a player""" + async with aiosqlite.connect(self.db_path) as db: + db.row_factory = aiosqlite.Row + cursor = await db.execute(""" + SELECT p.*, ps.name as species_name, ps.type1, ps.type2, + ps.base_hp, ps.base_attack, ps.base_defense, ps.base_speed + FROM pets p + JOIN pet_species ps ON p.species_id = ps.id + WHERE p.player_id = ? AND p.is_active = 1 + ORDER BY p.id ASC + """, (player_id,)) + rows = await cursor.fetchall() + return [dict(row) for row in rows] + # Gym Battle System Methods async def get_gyms_in_location(self, location_id: int, player_id: int = None) -> List[Dict]: """Get all gyms in a specific location with optional player progress"""