mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
AllowedBotSpawns converted to QueryDatabase
This commit is contained in:
parent
45320fd8ec
commit
0ac238d762
34
zone/bot.cpp
34
zone/bot.cpp
@ -4882,30 +4882,24 @@ uint32 Bot::GetBotGroupLeaderIdByBotGroupName(std::string botGroupName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::AllowedBotSpawns(uint32 botOwnerCharacterID, std::string* errorMessage) {
|
uint32 Bot::AllowedBotSpawns(uint32 botOwnerCharacterID, std::string* errorMessage) {
|
||||||
uint32 Result = 0;
|
|
||||||
|
|
||||||
if(botOwnerCharacterID > 0) {
|
if(botOwnerCharacterID == 0)
|
||||||
char ErrBuf[MYSQL_ERRMSG_SIZE];
|
return 0;
|
||||||
char* Query = 0;
|
|
||||||
MYSQL_RES* DatasetResult;
|
|
||||||
MYSQL_ROW DataRow;
|
|
||||||
|
|
||||||
if(database.RunQuery(Query, MakeAnyLenString(&Query, "SELECT value FROM quest_globals WHERE name='bot_spawn_limit' and charid=%i", botOwnerCharacterID), ErrBuf, &DatasetResult)) {
|
std::string query = StringFormat("SELECT value FROM quest_globals "
|
||||||
if(mysql_num_rows(DatasetResult) == 1) {
|
"WHERE name = 'bot_spawn_limit' AND charid = %i",
|
||||||
DataRow = mysql_fetch_row(DatasetResult);
|
botOwnerCharacterID);
|
||||||
if(DataRow)
|
auto results = database.QueryDatabase(query);
|
||||||
Result = atoi(DataRow[0]);
|
if (!results.Success()) {
|
||||||
}
|
*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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::SpawnedBotCount(uint32 botOwnerCharacterID, std::string* errorMessage) {
|
uint32 Bot::SpawnedBotCount(uint32 botOwnerCharacterID, std::string* errorMessage) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user