[Bots] Expanded Bot Spell Settings List. (#2606)

* [Bots] Expanded Bot Spell List Settings

* [Bots] Expanded Bot Spell List Settings

* Fixes/formatting

* typo

* Formatting & update SpellInfo Command

* Spelling

* Typo
This commit is contained in:
Aeadoin
2022-12-03 12:15:57 -05:00
committed by GitHub
parent 35d22913b9
commit 61b91d92c3
12 changed files with 504 additions and 386 deletions
+25 -1
View File
@@ -409,7 +409,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
" `show_helm`," // 25
" `follow_distance`," // 26
" `stop_melee_level`," // 27
" `expansion_bitmask`" // 28
" `expansion_bitmask`," // 28
" `enforce_spell_settings`" // 29
" FROM `bot_data`"
" WHERE `bot_id` = {}"
" LIMIT 1",
@@ -508,6 +509,8 @@ bool BotDatabase::LoadBot(const uint32 bot_id, Bot*& loaded_bot)
auto eb = std::stoi(row[28]);
loaded_bot->SetExpansionBitmask(eb, false);
loaded_bot->SetBotEnforceSpellSetting((std::stoi(row[29]) > 0 ? true : false));
}
return true;
@@ -3278,6 +3281,27 @@ bool BotDatabase::SaveExpansionBitmask(const uint32 bot_id, const int expansion_
return true;
}
bool BotDatabase::SaveEnforceSpellSetting(const uint32 bot_id, const bool enforce_spell_setting)
{
if (!bot_id) {
return false;
}
query = fmt::format(
"UPDATE `bot_data`"
"SET `enforce_spell_settings` = {} "
"WHERE `bot_id` = {}",
(enforce_spell_setting ? 1 : 0),
bot_id
);
auto results = database.QueryDatabase(query);
if (!results.Success()) {
return false;
}
return true;
}
/* fail::Bot functions */
const char* BotDatabase::fail::LoadBotsList() { return "Failed to bots list"; }
const char* BotDatabase::fail::LoadOwnerID() { return "Failed to load owner ID"; }