mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-11 11:12:25 +00:00
GetBotOwnerCharacterID converted to QueryDatabase
This commit is contained in:
parent
2429980fd5
commit
081192d29e
31
zone/bot.cpp
31
zone/bot.cpp
@ -4935,29 +4935,22 @@ uint32 Bot::CreatedBotCount(uint32 botOwnerCharacterID, std::string* errorMessag
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::GetBotOwnerCharacterID(uint32 botID, std::string* errorMessage) {
|
uint32 Bot::GetBotOwnerCharacterID(uint32 botID, std::string* errorMessage) {
|
||||||
uint32 Result = 0;
|
|
||||||
|
|
||||||
if(botID > 0) {
|
if(botID == 0)
|
||||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
return 0;
|
||||||
char* Query = 0;
|
|
||||||
MYSQL_RES* DatasetResult;
|
|
||||||
MYSQL_ROW DataRow;
|
|
||||||
|
|
||||||
if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT BotOwnerCharacterID FROM bots WHERE BotID = %u", botID), ErrBuf, &DatasetResult)) {
|
std::string query = StringFormat("SELECT BotOwnerCharacterID FROM bots WHERE BotID = %u", botID);
|
||||||
if(mysql_num_rows(DatasetResult) == 1) {
|
auto results = database.QueryDatabase(query);
|
||||||
if(DataRow = mysql_fetch_row(DatasetResult))
|
if (results.Success()) {
|
||||||
Result = atoi(DataRow[0]);
|
*errorMessage = std::string(results.ErrorMessage());
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
mysql_free_result(DatasetResult);
|
if (results.RowCount() != 1)
|
||||||
}
|
return 0;
|
||||||
else
|
|
||||||
*errorMessage = std::string(ErrBuf);
|
|
||||||
|
|
||||||
safe_delete_array(Query);
|
auto row = results.begin();
|
||||||
}
|
return atoi(row[0]);
|
||||||
|
|
||||||
return Result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::LevelBotWithClient(Client* client, uint8 level, bool sendlvlapp) {
|
void Bot::LevelBotWithClient(Client* client, uint8 level, bool sendlvlapp) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user