diff --git a/world/world_boot.cpp b/world/world_boot.cpp index 859eff534..831babdb7 100644 --- a/world/world_boot.cpp +++ b/world/world_boot.cpp @@ -294,6 +294,13 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv) database.ClearBuyerDetails(); LogInfo("Clearing buyer table details"); + if (RuleB(Bots, Enabled)) { + LogInfo("Clearing [bot_pet_buffs] table of stale entries"); + database.QueryDatabase( + "DELETE FROM bot_pet_buffs WHERE NOT EXISTS (SELECT * FROM bot_pets WHERE bot_pets.pets_index = bot_pet_buffs.pets_index)" + ); + } + if (!content_db.LoadItems(hotfix_name)) { LogError("Error: Could not load item data. But ignoring"); } diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index dcc5ff89b..a24cd0c30 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -1451,7 +1451,7 @@ bool BotDatabase::DeletePetBuffs(const uint32 bot_id) return true; } - BotPetBuffsRepository::DeleteOne(database, saved_pet_index); + BotPetBuffsRepository::DeleteWhere(database, fmt::format("pets_index = {}", saved_pet_index)); return true; }