[Bots] Save Bot Toggle Archer Setting between Loads. (#2612)

* [Bots] Save Bot Toggle Archer Setting between Loads.

* [Bots] Save Bot Toggle Archer Setting between Loads.

* Typo
This commit is contained in:
Aeadoin
2022-12-04 13:23:25 -05:00
committed by GitHub
parent 7abc084cd1
commit 7e0fe93039
9 changed files with 80 additions and 21 deletions
+20 -4
View File
@@ -72,7 +72,6 @@ Bot::Bot(NPCType *npcTypeData, Client* botOwner) : NPC(npcTypeData, nullptr, glm
SetBotID(0);
SetBotSpellID(0);
SetSpawnStatus(false);
SetBotArcher(false);
SetBotCharmer(false);
SetPetChooser(false);
SetRangerAutoWeaponSelect(false);
@@ -167,7 +166,6 @@ Bot::Bot(uint32 botID, uint32 botOwnerCharacterID, uint32 botSpellsID, double to
SetBotID(botID);
SetBotSpellID(botSpellsID);
SetSpawnStatus(false);
SetBotArcher(false);
SetBotCharmer(false);
SetPetChooser(false);
SetRangerAutoWeaponSelect(false);
@@ -3164,12 +3162,12 @@ void Bot::AI_Process()
if (atArcheryRange && !IsBotArcher()) {
SetBotArcher(true);
SetBotArcherySetting(true);
changeWeapons = true;
}
else if (!atArcheryRange && IsBotArcher()) {
SetBotArcher(false);
SetBotArcherySetting(false);
changeWeapons = true;
}
@@ -10867,6 +10865,24 @@ std::string Bot::GetHPString(int8 min_hp, int8 max_hp)
return hp_string;
}
void Bot::SetBotArcherySetting(bool bot_archer_setting, bool save)
{
m_bot_archery_setting = bot_archer_setting;
if (save) {
if (!database.botdb.SaveBotArcherSetting(GetBotID(), bot_archer_setting)) {
if (GetBotOwner() && GetBotOwner()->IsClient()) {
GetBotOwner()->CastToClient()->Message(
Chat::White,
fmt::format(
"Failed to save archery settings for {}.",
GetCleanName()
).c_str()
);
}
}
}
}
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][PLAYER_CLASS_COUNT][EQ::constants::STANCE_TYPE_COUNT][cntHSND] = { 0 };
#endif