From 821c6f570cce688d331ddaf5fa0322256c521ce8 Mon Sep 17 00:00:00 2001 From: megaproxy Date: Mon, 14 Jul 2025 11:55:47 +0100 Subject: [PATCH] Fix database loading to update existing records MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 Problem Fixed: - Achievement changes weren't being applied because INSERT OR IGNORE doesn't update - New pets and location spawns weren't being loaded for the same reason - Database was stuck with old configuration data 🔧 Changes: - Changed INSERT OR IGNORE to INSERT OR REPLACE for achievements - Changed INSERT OR IGNORE to INSERT OR REPLACE for pet species - Changed INSERT OR IGNORE to INSERT OR REPLACE for locations and spawns - This ensures config file changes are properly loaded into database ⚠️ Restart Required: - Bot needs to be restarted to reload the updated configurations - After restart, Whispering Woods should be unlocked by Pet Collector achievement - New Grass pets (Vinewrap, Bloomtail) will be available in Whispering Woods 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/game_engine.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game_engine.py b/src/game_engine.py index acbdb0f..7763701 100644 --- a/src/game_engine.py +++ b/src/game_engine.py @@ -36,7 +36,7 @@ class GameEngine: async with aiosqlite.connect(self.database.db_path) as db: for species in species_data: await db.execute(""" - INSERT OR IGNORE INTO pet_species + INSERT OR REPLACE INTO pet_species (name, type1, type2, base_hp, base_attack, base_defense, base_speed, evolution_level, rarity) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) @@ -103,7 +103,7 @@ class GameEngine: async with aiosqlite.connect(self.database.db_path) as db: for species in default_species: await db.execute(""" - INSERT OR IGNORE INTO pet_species + INSERT OR REPLACE INTO pet_species (name, type1, type2, base_hp, base_attack, base_defense, base_speed, rarity) VALUES (?, ?, ?, ?, ?, ?, ?, ?) """, ( @@ -123,7 +123,7 @@ class GameEngine: async with aiosqlite.connect(self.database.db_path) as db: for location in locations_data: await db.execute(""" - INSERT OR IGNORE INTO locations (name, description, level_min, level_max) + INSERT OR REPLACE INTO locations (name, description, level_min, level_max) VALUES (?, ?, ?, ?) """, (location["name"], location["description"], location["level_min"], location["level_max"])) @@ -142,7 +142,7 @@ class GameEngine: if species_id: await db.execute(""" - INSERT OR IGNORE INTO location_spawns + INSERT OR REPLACE INTO location_spawns (location_id, species_id, spawn_rate, min_level, max_level) VALUES (?, ?, ?, ?, ?) """, (location_id, species_id[0], spawn["spawn_rate"], @@ -452,7 +452,7 @@ class GameEngine: # Insert or update achievement await db.execute(""" - INSERT OR IGNORE INTO achievements + INSERT OR REPLACE INTO achievements (name, description, requirement_type, requirement_data, unlock_location_id) VALUES (?, ?, ?, ?, ?) """, (