mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
GetBotGroupLeaderIdByBotGroupName converted to QueryDatabase
This commit is contained in:
parent
6d33a13e23
commit
45320fd8ec
33
zone/bot.cpp
33
zone/bot.cpp
@ -4868,34 +4868,17 @@ uint32 Bot::GetBotGroupIdByBotGroupName(std::string botGroupName, std::string* e
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::GetBotGroupLeaderIdByBotGroupName(std::string botGroupName) {
|
uint32 Bot::GetBotGroupLeaderIdByBotGroupName(std::string botGroupName) {
|
||||||
uint32 result = 0;
|
|
||||||
|
|
||||||
if(!botGroupName.empty()) {
|
if(botGroupName.empty())
|
||||||
char* Query = 0;
|
return 0;
|
||||||
MYSQL_RES* DatasetResult;
|
|
||||||
MYSQL_ROW DataRow;
|
|
||||||
|
|
||||||
if(database.RunQuery(Query, MakeAnyLenString(&Query, "select BotGroupLeaderBotId from vwBotGroups where BotGroupName = '%s'", botGroupName.c_str()), 0, &DatasetResult)) {
|
std::string query = StringFormat("SELECT BotGroupLeaderBotId FROM vwBotGroups WHERE BotGroupName = '%s'", botGroupName.c_str());
|
||||||
uint32 RowCount = mysql_num_rows(DatasetResult);
|
auto results = database.QueryDatabase(query);
|
||||||
|
if (!results.Success() || results.RowCount() == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if(RowCount > 0) {
|
auto row = results.begin();
|
||||||
for(int iCounter = 0; iCounter < RowCount; iCounter++) {
|
return atoi(row[0]);
|
||||||
DataRow = mysql_fetch_row(DatasetResult);
|
|
||||||
|
|
||||||
if(DataRow) {
|
|
||||||
result = atoi(DataRow[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql_free_result(DatasetResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delete_array(Query);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Bot::AllowedBotSpawns(uint32 botOwnerCharacterID, std::string* errorMessage) {
|
uint32 Bot::AllowedBotSpawns(uint32 botOwnerCharacterID, std::string* errorMessage) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user