add GetBotSpellCategoryIDByShortName and CopyBotBlockedPetBuffs, update ^defaultsettings command

This commit is contained in:
nytmyr
2024-12-17 23:20:39 -06:00
parent ffd92017e0
commit 21f8bc0f95
5 changed files with 54 additions and 4 deletions
+36
View File
@@ -11734,6 +11734,10 @@ void Bot::CopySettings(Bot* to, uint8 settingType, uint16 spellType) {
void Bot::CopyBotSpellSettings(Bot* to)
{
if (!to) {
return;
}
to->ResetBotSpellSettings();
to->bot_spell_settings.clear();
@@ -11784,6 +11788,38 @@ void Bot::ResetBotSpellSettings()
SetBotEnforceSpellSetting(false);
}
void Bot::CopyBotBlockedBuffs(Bot* to) {
if (!to) {
return;
}
to->ClearBotBlockedBuffs();
std::vector<BotBlockedBuffs_Struct> blockedBuffs = GetBotBlockedBuffs();
if (!blockedBuffs.empty()) {
for (auto& blocked_buff : blockedBuffs) {
to->SetBotBlockedBuff(blocked_buff.spell_id, blocked_buff.blocked);
}
}
}
void Bot::CopyBotBlockedPetBuffs(Bot* to) {
if (!to) {
return;
}
to->ClearBotBlockedBuffs();
std::vector<BotBlockedBuffs_Struct> blockedBuffs = GetBotBlockedBuffs();
if (!blockedBuffs.empty()) {
for (auto& blocked_buff : blockedBuffs) {
to->SetBotBlockedPetBuff(blocked_buff.spell_id, blocked_buff.blocked_pet);
}
}
}
bool Bot::BotPassiveCheck() {
if (GetBotStance() == Stance::Passive) {
GetOwner()->Message(
+1
View File
@@ -472,6 +472,7 @@ public:
void CopyBotSpellSettings(Bot* to);
void ResetBotSpellSettings();
void CopyBotBlockedBuffs(Bot* to);
void CopyBotBlockedPetBuffs(Bot* to);
int GetBotBaseSetting(uint16 botSetting);
int GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance = Stance::Balanced);
void SetBotBaseSetting(uint16 botSetting, int settingValue);
+5 -2
View File
@@ -358,7 +358,7 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
}
else if (!strcasecmp(sep->arg[1], "targetcounts")) {
if (spellType != UINT16_MAX) {
myBot->SetSpellDelay(spellType, myBot->GetDefaultSpellDelay(spellType, botStance));
myBot->SetSpellTypeAEOrGroupTargetCount(spellType, myBot->GetDefaultSpellTypeAEOrGroupTargetCount(spellType, botStance));
}
else {
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) {
@@ -366,7 +366,7 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
}
}
output = "ae/group count settings";
output = "target count settings";
}
else if (!strcasecmp(sep->arg[1], "spellsettings")) {
myBot->ResetBotSpellSettings();
@@ -430,6 +430,9 @@ void bot_command_default_settings(Client* c, const Seperator* sep)
};
myBot->ResetBotSpellSettings();
myBot->ClearBotBlockedBuffs();
myBot->Save();
output = "settings";
+11 -2
View File
@@ -8751,6 +8751,16 @@ std::string Mob::GetBotSpellCategoryName(uint8 setting_type) {
return "Null";
}
uint16 Mob::GetBotSpellCategoryIDByShortName(std::string settingString) {
for (int i = BotSettingCategories::START; i <= BotSettingCategories::END; ++i) {
if (!Strings::ToLower(settingString).compare(Strings::ToLower(GetBotSpellCategoryName(i)))) {
return i;
}
}
return UINT16_MAX;
}
std::string Mob::GetBotSettingCategoryName(uint8 setting_type) {
switch (setting_type) {
case BotBaseSettings::ExpansionBitmask:
@@ -8789,9 +8799,8 @@ std::string Mob::GetBotSettingCategoryName(uint8 setting_type) {
}
uint16 Mob::GetBaseSettingIDByShortName(std::string settingString) {
for (int i = BotSettingCategories::START; i <= BotSettingCategories::END; ++i) {
if (!Strings::ToLower(settingString).compare(GetBotSettingCategoryName(i))) {
if (!Strings::ToLower(settingString).compare(Strings::ToLower(GetBotSettingCategoryName(i)))) {
return i;
}
}
+1
View File
@@ -435,6 +435,7 @@ public:
uint16 GetSpellTypeIDByShortName(std::string spellTypeString);
std::string GetBotSpellCategoryName(uint8 setting_type);
uint16 GetBotSpellCategoryIDByShortName(std::string settingString);
std::string GetBotSettingCategoryName(uint8 setting_type);
uint16 GetBaseSettingIDByShortName(std::string settingString);
std::string GetSpellTypeNameByID(uint16 spellType);