mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Implemented bot owner options
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "bot_database.h"
|
||||
#include "bot.h"
|
||||
#include "client.h"
|
||||
|
||||
|
||||
BotDatabase botdb;
|
||||
@@ -2185,6 +2186,51 @@ bool BotDatabase::SaveStopMeleeLevel(const uint32 owner_id, const uint32 bot_id,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BotDatabase::LoadOwnerOptions(Client *owner)
|
||||
{
|
||||
if (!owner || !owner->CharacterID())
|
||||
return false;
|
||||
|
||||
query = StringFormat(
|
||||
"SELECT `death_marquee` FROM `bot_owner_options`"
|
||||
" WHERE `owner_id` = '%u'",
|
||||
owner->CharacterID()
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
if (!results.RowCount()) {
|
||||
query = StringFormat("REPLACE INTO `bot_owner_options` (`owner_id`) VALUES ('%u')", owner->CharacterID());
|
||||
results = QueryDatabase(query);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
owner->SetBotOptionDeathMarquee((atoi(row[0]) != 0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BotDatabase::SaveOwnerOptionDeathMarquee(const uint32 owner_id, const bool flag)
|
||||
{
|
||||
if (!owner_id)
|
||||
return false;
|
||||
|
||||
query = StringFormat(
|
||||
"UPDATE `bot_owner_options`"
|
||||
" SET `death_marquee` = '%u'"
|
||||
" WHERE `owner_id` = '%u'",
|
||||
(flag == true ? 1 : 0),
|
||||
owner_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& extant_flag)
|
||||
|
||||
Reference in New Issue
Block a user