diff --git a/zone/bot.cpp b/zone/bot.cpp index 0c5a77b25..ccbcae8a4 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -1787,7 +1787,7 @@ void Bot::SpellProcess() { } void Bot::BotMeditate(bool isSitting) { - if (GetManaRatio() < GetManaWhenToMed() || (GetHPRatio() < GetHPWhenToMed() && GetLevel() < GetStopMeleeLevel())) { + if (GetManaRatio() < GetSitManaPct() || (GetHPRatio() < GetSitHPPct() && GetLevel() < GetStopMeleeLevel())) { if ((!IsEngaged() || (IsEngaged() && GetMedInCombat() && !HasTargetReflection())) && !isSitting) { Sit(); } @@ -10170,11 +10170,11 @@ void Bot::SetBotBaseSetting(uint16 botSetting, int settingValue) { case BotBaseSettings::MedInCombat: SetMedInCombat(settingValue); break; - case BotBaseSettings::HPWhenToMed: - SetHPWhenToMed(settingValue); + case BotBaseSettings::SitHPPct: + SetSitHPPct(settingValue); break; - case BotBaseSettings::ManaWhenToMed: - SetManaWhenToMed(settingValue); + case BotBaseSettings::SitManaPct: + SetSitManaPct(settingValue); break; default: break; @@ -10219,12 +10219,12 @@ int Bot::GetBotBaseSetting(uint16 botSetting) { case BotBaseSettings::MedInCombat: //LogBotSettingsDetail("Returning current GetMedInCombate of [{}] for [{}]", GetMaxMeleeRange(), GetCleanName()); //deleteme return GetMedInCombat(); - case BotBaseSettings::HPWhenToMed: - //LogBotSettingsDetail("Returning current GetHPWhenToMed of [{}] for [{}]", GetMaxMeleeRange(), GetCleanName()); //deleteme - return GetHPWhenToMed(); - case BotBaseSettings::ManaWhenToMed: - //LogBotSettingsDetail("Returning current GetManaWhenToMed of [{}] for [{}]", GetMaxMeleeRange(), GetCleanName()); //deleteme - return GetManaWhenToMed(); + case BotBaseSettings::SitHPPct: + //LogBotSettingsDetail("Returning current GetSitHPPct of [{}] for [{}]", GetMaxMeleeRange(), GetCleanName()); //deleteme + return GetSitHPPct(); + case BotBaseSettings::SitManaPct: + //LogBotSettingsDetail("Returning current GetSitManaPct of [{}] for [{}]", GetMaxMeleeRange(), GetCleanName()); //deleteme + return GetSitManaPct(); default: return true; } @@ -10274,8 +10274,8 @@ int Bot::GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance) { } return false; - case BotBaseSettings::HPWhenToMed: - case BotBaseSettings::ManaWhenToMed: + case BotBaseSettings::SitHPPct: + case BotBaseSettings::SitManaPct: return 80; case BotBaseSettings::EnforceSpellSettings: case BotBaseSettings::RangedSetting: @@ -10883,82 +10883,6 @@ void Bot::SetSpellTypeAEOrGroupTargetCount(uint16 spellType, uint16 targetCount) _spellSettings[spellType].AEOrGroupTargetCount = targetCount; } -std::string Bot::GetBotSettingCategoryName(uint8 setting_type) { - switch (setting_type) { - case BotBaseSettings::ExpansionBitmask: - return "ExpansionBitmask"; - case BotBaseSettings::ShowHelm: - return "ShowHelm"; - case BotBaseSettings::FollowDistance: - return "FollowDistance"; - case BotBaseSettings::StopMeleeLevel: - return "StopMeleeLevel"; - case BotBaseSettings::EnforceSpellSettings: - return "EnforceSpellSettings"; - case BotBaseSettings::RangedSetting: - return "RangedSetting"; - case BotBaseSettings::PetSetTypeSetting: - return "PetSetTypeSetting"; - case BotBaseSettings::BehindMob: - return "BehindMob"; - case BotBaseSettings::DistanceRanged: - return "DistanceRanged"; - case BotBaseSettings::IllusionBlock: - return "IllusionBlock"; - case BotBaseSettings::MaxMeleeRange: - return "MaxMeleeRange"; - case BotBaseSettings::MedInCombat: - return "MedInCombat"; - case BotBaseSettings::HPWhenToMed: - return "HPWhenToMed"; - case BotBaseSettings::ManaWhenToMed: - return "ManaWhenToMed"; - default: - return "Null"; - } - - return "Null"; -} - -std::string Bot::GetBotSpellCategoryName(uint8 setting_type) { - switch (setting_type) { - case BotSettingCategories::BaseSetting: - return "BaseSetting"; - case BotSettingCategories::SpellHold: - return "SpellHold"; - case BotSettingCategories::SpellDelay: - return "SpellDelay"; - case BotSettingCategories::SpellMinThreshold: - return "SpellMinThreshold"; - case BotSettingCategories::SpellMaxThreshold: - return "SpellMaxThreshold"; - case BotSettingCategories::SpellTypeAggroCheck: - return "SpellTypeAggroCheck"; - case BotSettingCategories::SpellTypeMinManaPct: - return "SpellTypeMinManaPct"; - case BotSettingCategories::SpellTypeMaxManaPct: - return "SpellTypeMaxManaPct"; - case BotSettingCategories::SpellTypeMinHPPct: - return "SpellTypeMinHPPct"; - case BotSettingCategories::SpellTypeMaxHPPct: - return "SpellTypeMaxHPPct"; - case BotSettingCategories::SpellTypeIdlePriority: - return "SpellTypeIdlePriority"; - case BotSettingCategories::SpellTypeEngagedPriority: - return "SpellTypeEngagedPriority"; - case BotSettingCategories::SpellTypePursuePriority: - return "SpellTypePursuePriority"; - case BotSettingCategories::SpellTypeAEOrGroupTargetCount: - return "SpellTypeAEOrGroupTargetCount"; - case BotSettingCategories::SpellTypeRecastDelay: - return "SpellTypeRecastDelay"; - default: - return "Null"; - } - - return "Null"; -} - std::list Bot::GetSpellTypesPrioritized(uint8 priorityType) { std::list castOrder; std::list tempCastOrder; diff --git a/zone/bot.h b/zone/bot.h index 20a2c479e..c96632d8e 100644 --- a/zone/bot.h +++ b/zone/bot.h @@ -139,12 +139,12 @@ namespace BotBaseSettings { constexpr uint16 IllusionBlock = 9; constexpr uint16 MaxMeleeRange = 10; constexpr uint16 MedInCombat = 11; - constexpr uint16 HPWhenToMed = 12; - constexpr uint16 ManaWhenToMed = 13; + constexpr uint16 SitHPPct = 12; + constexpr uint16 SitManaPct = 13; constexpr uint16 START_ALL = ExpansionBitmask; constexpr uint16 START = BotBaseSettings::ShowHelm; // Everything above this cannot be copied, changed or viewed by players - constexpr uint16 END = BotBaseSettings::ManaWhenToMed; // Increment as needed + constexpr uint16 END = BotBaseSettings::SitManaPct; // Increment as needed }; namespace CommandedSubTypes { @@ -471,6 +471,7 @@ public: void CopySettings(Bot* to, uint8 settingType, uint16 spellType = UINT16_MAX); void CopyBotSpellSettings(Bot* to); void ResetBotSpellSettings(); + void CopyBotBlockedBuffs(Bot* to); int GetBotBaseSetting(uint16 botSetting); int GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance = Stance::Balanced); void SetBotBaseSetting(uint16 botSetting, int settingValue); @@ -485,9 +486,6 @@ public: void SetBotBlockedBuff(uint16 spell_id, bool block); void SetBotBlockedPetBuff(uint16 spell_id, bool block); - std::string GetBotSpellCategoryName(uint8 setting_type); - std::string GetBotSettingCategoryName(uint8 setting_type); - int GetDefaultSetting(uint16 settingCategory, uint16 settingType, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypePriority(uint16 spellType, uint8 priorityType, uint8 botClass, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypeIdlePriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); @@ -532,10 +530,10 @@ public: void SetBotDistanceRanged(uint32 distanceRanged) { _distanceRanged = distanceRanged; } bool GetMedInCombat() const { return _medInCombat; } void SetMedInCombat(bool value) { _medInCombat = value; } - uint8 GetHPWhenToMed() const { return _HPWhenToMed; } - void SetHPWhenToMed(uint8 value) { _HPWhenToMed = value; } - uint8 GetManaWhenToMed() const { return _ManaWhenToMed; } - void SetManaWhenToMed(uint8 value) { _ManaWhenToMed = value; } + uint8 GetSitHPPct() const { return _SitHPPct; } + void SetSitHPPct(uint8 value) { _SitHPPct = value; } + uint8 GetSitManaPct() const { return _SitManaPct; } + void SetSitManaPct(uint8 value) { _SitManaPct = value; } void SetHasLoS(bool hasLoS) { _hasLoS = hasLoS; } bool HasLoS() const { return _hasLoS; } @@ -1089,8 +1087,8 @@ private: bool _behindMobStatus; bool _maxMeleeRangeStatus; bool _medInCombat; - uint8 _HPWhenToMed; - uint8 _ManaWhenToMed; + uint8 _SitHPPct; + uint8 _SitManaPct; uint16 _castedSpellType; bool _hasLoS; bool _commandedSpell; diff --git a/zone/bot_commands/sit_hp_percent.cpp b/zone/bot_commands/sit_hp_percent.cpp index 38b42ffd9..a8f6d76ff 100644 --- a/zone/bot_commands/sit_hp_percent.cpp +++ b/zone/bot_commands/sit_hp_percent.cpp @@ -141,12 +141,12 @@ void bot_command_sit_hp_percent(Client* c, const Seperator* sep) fmt::format( "{} says, 'I sit in combat whem at or below [{}%%] HP.'", my_bot->GetCleanName(), - my_bot->GetHPWhenToMed() + my_bot->GetSitHPPct() ).c_str() ); } else { - my_bot->SetHPWhenToMed(typeValue); + my_bot->SetSitHPPct(typeValue); ++success_count; } } @@ -157,7 +157,7 @@ void bot_command_sit_hp_percent(Client* c, const Seperator* sep) fmt::format( "{} says, 'I will now sit in combat whem at or below [{}%%] HP.'", first_found->GetCleanName(), - first_found->GetHPWhenToMed() + first_found->GetSitHPPct() ).c_str() ); } diff --git a/zone/bot_commands/sit_mana_percent.cpp b/zone/bot_commands/sit_mana_percent.cpp index 820be6a75..0c538023c 100644 --- a/zone/bot_commands/sit_mana_percent.cpp +++ b/zone/bot_commands/sit_mana_percent.cpp @@ -141,12 +141,12 @@ void bot_command_sit_mana_percent(Client* c, const Seperator* sep) fmt::format( "{} says, 'I sit in combat whem at or below [{}%%] mana.'", my_bot->GetCleanName(), - my_bot->GetManaWhenToMed() + my_bot->GetSitManaPct() ).c_str() ); } else { - my_bot->SetManaWhenToMed(typeValue); + my_bot->SetSitManaPct(typeValue); ++success_count; } } @@ -157,7 +157,7 @@ void bot_command_sit_mana_percent(Client* c, const Seperator* sep) fmt::format( "{} says, 'I will now sit in combat whem at or below [{}%%] mana.'", first_found->GetCleanName(), - first_found->GetManaWhenToMed() + first_found->GetSitManaPct() ).c_str() ); } diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index c401604c3..dc7bcf38d 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -2238,7 +2238,7 @@ bool BotDatabase::LoadBotSettings(Mob* m) if (e.setting_type == BotSettingCategories::BaseSetting) { LogBotSettings("[{}] says, 'Loading {} [{}] - setting to [{}]." , m->GetCleanName() - , m->CastToBot()->GetBotSettingCategoryName(e.setting_type) + , m->GetBotSettingCategoryName(e.setting_type) , e.setting_type , e.value ); //deleteme @@ -2246,7 +2246,7 @@ bool BotDatabase::LoadBotSettings(Mob* m) else { LogBotSettings("[{}] says, 'Loading {} [{}], {} [{}] - setting to [{}]." , m->GetCleanName() - , m->CastToBot()->GetBotSpellCategoryName(e.setting_type) + , m->GetBotSpellCategoryName(e.setting_type) , e.setting_type , m->GetSpellTypeNameByID(e.setting_id) , e.setting_id @@ -2304,13 +2304,13 @@ bool BotDatabase::SaveBotSettings(Mob* m) .setting_id = static_cast(i), .setting_type = static_cast(BotSettingCategories::BaseSetting), .value = static_cast(m->CastToBot()->GetBotBaseSetting(i)), - .category_name = m->CastToBot()->GetBotSpellCategoryName(BotSettingCategories::BaseSetting), - .setting_name = m->CastToBot()->GetBotSettingCategoryName(i) + .category_name = m->GetBotSpellCategoryName(BotSettingCategories::BaseSetting), + .setting_name = m->GetBotSettingCategoryName(i) }; v.emplace_back(e); - LogBotSettings("{} says, 'Saving {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->CastToBot()->GetBotSettingCategoryName(i), i, e.value, m->CastToBot()->GetDefaultBotBaseSetting(i)); //deleteme + LogBotSettings("{} says, 'Saving {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSettingCategoryName(i), i, e.value, m->CastToBot()->GetDefaultBotBaseSetting(i)); //deleteme } } @@ -2324,13 +2324,13 @@ bool BotDatabase::SaveBotSettings(Mob* m) .setting_id = static_cast(x), .setting_type = static_cast(i), .value = m->CastToBot()->GetSetting(i, x), - .category_name = m->CastToBot()->GetBotSpellCategoryName(i), + .category_name = m->GetBotSpellCategoryName(i), .setting_name = m->CastToBot()->GetSpellTypeNameByID(x) }; v.emplace_back(e); - LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->CastToBot()->GetBotSpellCategoryName(i), m->GetSpellTypeNameByID(x), x, e.value, m->CastToBot()->GetDefaultSetting(i, x, botStance)); //deleteme + LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->GetSpellTypeNameByID(x), x, e.value, m->CastToBot()->GetDefaultSetting(i, x, botStance)); //deleteme } } } @@ -2345,18 +2345,18 @@ bool BotDatabase::SaveBotSettings(Mob* m) .setting_id = static_cast(BotBaseSettings::IllusionBlock), .setting_type = static_cast(BotSettingCategories::BaseSetting), .value = m->GetIllusionBlock(), - .category_name = m->CastToBot()->GetBotSpellCategoryName(BotSettingCategories::BaseSetting), - .setting_name = m->CastToBot()->GetBotSettingCategoryName(BotBaseSettings::IllusionBlock) + .category_name = m->GetBotSpellCategoryName(BotSettingCategories::BaseSetting), + .setting_name = m->GetBotSettingCategoryName(BotBaseSettings::IllusionBlock) }; v.emplace_back(e); - LogBotSettings("{} says, 'Saving {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->CastToBot()->GetBotSettingCategoryName(BotBaseSettings::IllusionBlock), BotBaseSettings::IllusionBlock, e.value, m->GetIllusionBlock()); //deleteme + LogBotSettings("{} says, 'Saving {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSettingCategoryName(BotBaseSettings::IllusionBlock), BotBaseSettings::IllusionBlock, e.value, m->GetIllusionBlock()); //deleteme } for (uint16 i = BotSettingCategories::START_CLIENT; i <= BotSettingCategories::END_CLIENT; ++i) { for (uint16 x = BotSpellTypes::START; x <= BotSpellTypes::END; ++x) { - LogBotSettings("{} says, 'Checking {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->CastToBot()->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, m->CastToClient()->GetBotSetting(i, x), m->CastToClient()->GetDefaultBotSettings(i, x)); //deleteme + LogBotSettings("{} says, 'Checking {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, m->CastToClient()->GetBotSetting(i, x), m->CastToClient()->GetDefaultBotSettings(i, x)); //deleteme if (m->CastToClient()->GetBotSetting(i, x) != m->CastToClient()->GetDefaultBotSettings(i, x)) { auto e = BotSettingsRepository::BotSettings{ .char_id = charID, @@ -2365,13 +2365,13 @@ bool BotDatabase::SaveBotSettings(Mob* m) .setting_id = static_cast(x), .setting_type = static_cast(i), .value = m->CastToClient()->GetBotSetting(i, x), - .category_name = m->CastToBot()->GetBotSpellCategoryName(i), + .category_name = m->GetBotSpellCategoryName(i), .setting_name = m->CastToBot()->GetSpellTypeNameByID(x) }; v.emplace_back(e); - LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->CastToBot()->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, e.value, m->CastToClient()->GetDefaultBotSettings(i, x)); //deleteme + LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, e.value, m->CastToClient()->GetDefaultBotSettings(i, x)); //deleteme } } } diff --git a/zone/mob.cpp b/zone/mob.cpp index b47908a17..44151a06f 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -8712,6 +8712,93 @@ uint16 Mob::GetSpellTypeIDByShortName(std::string spellTypeString) { return UINT16_MAX; } +std::string Mob::GetBotSpellCategoryName(uint8 setting_type) { + switch (setting_type) { + case BotSettingCategories::BaseSetting: + return "BaseSetting"; + case BotSettingCategories::SpellHold: + return "SpellHolds"; + case BotSettingCategories::SpellDelay: + return "SpellDelays"; + case BotSettingCategories::SpellMinThreshold: + return "SpellMinThresholds"; + case BotSettingCategories::SpellMaxThreshold: + return "SpellMaxThresholds"; + case BotSettingCategories::SpellTypeAggroCheck: + return "SpellAggroChecks"; + case BotSettingCategories::SpellTypeMinManaPct: + return "SpellMinManaPct"; + case BotSettingCategories::SpellTypeMaxManaPct: + return "SpellMaxManaPct"; + case BotSettingCategories::SpellTypeMinHPPct: + return "SpellMinHPPct"; + case BotSettingCategories::SpellTypeMaxHPPct: + return "SpellMaxHPPct"; + case BotSettingCategories::SpellTypeIdlePriority: + return "SpellIdlePriority"; + case BotSettingCategories::SpellTypeEngagedPriority: + return "SpellEngagedPriority"; + case BotSettingCategories::SpellTypePursuePriority: + return "SpellPursuePriority"; + case BotSettingCategories::SpellTypeAEOrGroupTargetCount: + return "SpellTargetCounts"; + case BotSettingCategories::SpellTypeRecastDelay: + return "SpellRecastDelay"; + default: + return "Null"; + } + + return "Null"; +} + +std::string Mob::GetBotSettingCategoryName(uint8 setting_type) { + switch (setting_type) { + case BotBaseSettings::ExpansionBitmask: + return "ExpansionBitmask"; + case BotBaseSettings::ShowHelm: + return "ShowHelm"; + case BotBaseSettings::FollowDistance: + return "FollowDistance"; + case BotBaseSettings::StopMeleeLevel: + return "StopMeleeLevel"; + case BotBaseSettings::EnforceSpellSettings: + return "EnforceSpellSettings"; + case BotBaseSettings::RangedSetting: + return "RangedSetting"; + case BotBaseSettings::PetSetTypeSetting: + return "PetSetTypeSetting"; + case BotBaseSettings::BehindMob: + return "BehindMob"; + case BotBaseSettings::DistanceRanged: + return "DistanceRanged"; + case BotBaseSettings::IllusionBlock: + return "IllusionBlock"; + case BotBaseSettings::MaxMeleeRange: + return "MaxMeleeRange"; + case BotBaseSettings::MedInCombat: + return "MedInCombat"; + case BotBaseSettings::SitHPPct: + return "SitHPPct"; + case BotBaseSettings::SitManaPct: + return "SitManaPct"; + default: + return "Null"; + } + + return "Null"; +} + +uint16 Mob::GetBaseSettingIDByShortName(std::string settingString) { + + for (int i = BotSettingCategories::START; i <= BotSettingCategories::END; ++i) { + if (!Strings::ToLower(settingString).compare(GetBotSettingCategoryName(i))) { + return i; + } + } + + return UINT16_MAX; +} + std::string Mob::GetSpellTypeNameByID(uint16 spellType) { std::string spellTypeName = "null"; diff --git a/zone/mob.h b/zone/mob.h index 8c43f04b9..29baea67e 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -434,6 +434,9 @@ public: uint16 GetSpellTypeIDByShortName(std::string spellTypeString); + std::string GetBotSpellCategoryName(uint8 setting_type); + std::string GetBotSettingCategoryName(uint8 setting_type); + uint16 GetBaseSettingIDByShortName(std::string settingString); std::string GetSpellTypeNameByID(uint16 spellType); std::string GetSpellTypeShortNameByID(uint16 spellType); std::string GetSubTypeNameByID(uint16 subType);