[Bots] Fix pet buffs from saving duplicates every save (#4520)

* [Bots] Fix pet buffs from saving duplicates every save

Previously we were not checking the pet index properly when clearing buffs in the database before saving which resulted in no prior data being deleted.

This corrects the logic for the save and also will clean up any buffs for pets that don't exist in the table.

* Changes

* Update world_boot.cpp

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
nytmyrandAkkadius authored and GitHub committed 2024-10-21 23:57:42 -05:00
1 parent d524cb6a5a
commit d6d5d992cb
2 files changed
+8 -1

No files matched your search

+1 -1
View File
@@ -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;
}