mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 03:11:28 +00:00
SetBotGuildMembership converted to QueryDatabase
This commit is contained in:
parent
081192d29e
commit
2095380ba4
31
zone/bot.cpp
31
zone/bot.cpp
@ -8557,28 +8557,19 @@ bool Bot::ProcessGuildRemoval(Client* guildOfficer, std::string botName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bot::SetBotGuildMembership(uint32 botId, uint32 guildid, uint8 rank) {
|
void Bot::SetBotGuildMembership(uint32 botId, uint32 guildid, uint8 rank) {
|
||||||
if(botId > 0) {
|
if(botId == 0)
|
||||||
std::string errorMessage;
|
return;
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char *query = 0;
|
|
||||||
|
|
||||||
if(guildid > 0) {
|
if(guildid > 0) {
|
||||||
if(!database.RunQuery(query, MakeAnyLenString(&query, "REPLACE INTO botguildmembers SET char_id = %u, guild_id = %u, rank = %u;", botId, guildid, rank), errbuf)) {
|
std::string query = StringFormat("REPLACE INTO botguildmembers "
|
||||||
errorMessage = std::string(errbuf);
|
"SET char_id = %u, guild_id = %u, rank = %u;",
|
||||||
}
|
botId, guildid, rank);
|
||||||
}
|
auto results = database.QueryDatabase(query);
|
||||||
else {
|
return;
|
||||||
if(!database.RunQuery(query, MakeAnyLenString(&query, "DELETE FROM botguildmembers WHERE char_id = %u;", botId), errbuf)) {
|
}
|
||||||
errorMessage = std::string(errbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delete_array(query);
|
std::string query = StringFormat("DELETE FROM botguildmembers WHERE char_id = %u;", botId);
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
if(!errorMessage.empty()) {
|
|
||||||
// TODO: Log this error message to the zone error log
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::LoadGuildMembership(uint32* guildId, uint8* guildRank, std::string* guildName) {
|
void Bot::LoadGuildMembership(uint32* guildId, uint8* guildRank, std::string* guildName) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user