mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-27 20:21:30 +00:00
SavePetStats converted to QueryDatabase
This commit is contained in:
parent
364a51b119
commit
ab76783f8b
17
zone/bot.cpp
17
zone/bot.cpp
@ -2707,20 +2707,13 @@ void Bot::SavePet() {
|
||||
}
|
||||
|
||||
uint32 Bot::SavePetStats(std::string petName, uint16 petMana, uint16 petHitPoints, uint32 botPetId) {
|
||||
uint32 Result = 0;
|
||||
|
||||
std::string errorMessage;
|
||||
char* Query = 0;
|
||||
char TempErrorMessageBuffer[MYSQL_ERRMSG_SIZE];
|
||||
std::string query = StringFormat("REPLACE INTO botpets SET PetId = %u, BotId = %u, Name = '%s', "
|
||||
"Mana = %u, HitPoints = %u;", botPetId, GetBotID(), petName.c_str(),
|
||||
petMana, petHitPoints);
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
if(!database.RunQuery(Query, MakeAnyLenString(&Query, "REPLACE INTO botpets SET PetId = %u, BotId = %u, Name = '%s', Mana = %u, HitPoints = %u;", botPetId, GetBotID(), petName.c_str(), petMana, petHitPoints), TempErrorMessageBuffer, 0, 0, &Result)) {
|
||||
errorMessage = std::string(TempErrorMessageBuffer);
|
||||
}
|
||||
|
||||
safe_delete(Query);
|
||||
Query = 0;
|
||||
|
||||
return Result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Bot::SavePetBuffs(SpellBuff_Struct* petBuffs, uint32 botPetSaveId) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user