mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
add passive stance checks to commands and loading/saving. shouldn't be `
This commit is contained in:
+18
-1
@@ -9833,7 +9833,6 @@ bool Bot::IsMobEngagedByAnyone(Mob* tar) {
|
||||
if (m->GetTarget() == tar) {
|
||||
if (
|
||||
m->IsBot() &&
|
||||
!m->CastToBot()->GetHoldFlag() &&
|
||||
m->IsEngaged() &&
|
||||
(
|
||||
!m->CastToBot()->IsBotNonSpellFighter() ||
|
||||
@@ -11421,3 +11420,21 @@ void Bot::ResetBotSpellSettings()
|
||||
AI_AddBotSpells(GetBotSpellID());
|
||||
SetBotEnforceSpellSetting(false);
|
||||
}
|
||||
|
||||
bool Bot::BotPassiveCheck() {
|
||||
if (GetBotStance() == Stance::Passive) {
|
||||
GetOwner()->Message(
|
||||
Chat::Yellow,
|
||||
fmt::format(
|
||||
"{} says, 'I am currently set to stance {} [#{}]. My settings cannot be modified.'",
|
||||
GetCleanName(),
|
||||
Stance::GetName(Stance::Passive),
|
||||
Stance::Passive
|
||||
).c_str()
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-1
@@ -497,7 +497,8 @@ public:
|
||||
void SetSpellTypeMaxHPLimit(uint16 spellType, uint8 hpLimit);
|
||||
inline uint16 GetSpellTypeAEOrGroupTargetCount(uint16 spellType) const { return _spellSettings[spellType].AEOrGroupTargetCount; }
|
||||
void SetSpellTypeAEOrGroupTargetCount(uint16 spellType, uint16 targetCount);
|
||||
|
||||
bool BotPassiveCheck();
|
||||
|
||||
bool GetShowHelm() const { return _showHelm; }
|
||||
void SetShowHelm(bool showHelm) { _showHelm = showHelm; }
|
||||
bool GetBehindMob() const { return _behindMobStatus; }
|
||||
|
||||
@@ -130,9 +130,14 @@ void bot_command_behind_mob(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -1440,7 +1440,6 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
|
||||
|
||||
if (helper_is_help_or_usage(sep->arg[1])) {
|
||||
c->Message(Chat::White, "usage: %s [current | reset | sync | value: 0-255] ([actionable: target | byname | ownergroup | ownerraid | targetgroup | namesgroup | mmr | byclass | byrace | spawned] ([actionable_name]))", sep->arg[0]);
|
||||
c->Message(Chat::White, "note: Only caster or hybrid class bots may be modified");
|
||||
c->Message(Chat::White, "note: Use [reset] to set stop melee level to server rule");
|
||||
c->Message(Chat::White, "note: Use [sync] to set stop melee level to current bot level");
|
||||
return;
|
||||
@@ -1508,14 +1507,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
|
||||
int success_count = 0;
|
||||
|
||||
for (auto my_bot : sbl) {
|
||||
if (!IsCasterClass(my_bot->GetClass()) && !IsHybridClass(my_bot->GetClass())) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} says, 'This command only works on caster or hybrid classes.'",
|
||||
my_bot->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ void bot_command_cast(Client* c, const Seperator* sep)
|
||||
NEED TO CHECK: precombat, AE Dispel, AE Lifetap
|
||||
DO I NEED A PBAE CHECK???
|
||||
*/
|
||||
if (bot_iter->GetHoldFlag() || bot_iter->GetAppearance() == eaDead || bot_iter->IsFeared() || bot_iter->IsStunned() || bot_iter->IsMezzed() || bot_iter->DivineAura() || bot_iter->GetHP() < 0) {
|
||||
if (bot_iter->GetBotStance() == Stance::Passive || bot_iter->GetHoldFlag() || bot_iter->GetAppearance() == eaDead || bot_iter->IsFeared() || bot_iter->IsStunned() || bot_iter->IsMezzed() || bot_iter->DivineAura() || bot_iter->GetHP() < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,12 +40,18 @@ void bot_command_click_item(Client* c, const Seperator* sep)
|
||||
}
|
||||
|
||||
std::list<Bot*> sbl;
|
||||
|
||||
if (ActionableBots::PopulateSBL(c, sep->arg[ab_arg], sbl, ab_mask, !class_race_check ? sep->arg[ab_arg + 1] : nullptr, class_race_check ? atoi(sep->arg[ab_arg + 1]) : 0) == ActionableBots::ABT_None) {
|
||||
return;
|
||||
}
|
||||
|
||||
sbl.remove(nullptr);
|
||||
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (RuleI(Bots, BotsClickItemsMinLvl) > my_bot->GetLevel()) {
|
||||
c->Message(Chat::White, "%s must be level %i to use clickable items.", my_bot->GetCleanName(), RuleI(Bots, BotsClickItemsMinLvl));
|
||||
continue;
|
||||
|
||||
@@ -57,6 +57,10 @@ void bot_command_distance_ranged(Client* c, const Seperator* sep)
|
||||
int success_count = 0;
|
||||
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
@@ -130,9 +130,14 @@ void bot_command_illusion_block(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -129,9 +129,14 @@ void bot_command_max_melee_range(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -129,9 +129,14 @@ void bot_command_sit_hp_percent(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -129,9 +129,14 @@ void bot_command_sit_in_combat(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -129,9 +129,14 @@ void bot_command_sit_mana_percent(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -190,9 +190,14 @@ void bot_command_spell_aggro_checks(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -196,9 +196,14 @@ void bot_command_spell_delays(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -194,9 +194,14 @@ void bot_command_spell_engaged_priority(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -194,9 +194,14 @@ void bot_command_spell_idle_priority(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -190,9 +190,14 @@ void bot_command_spell_max_hp_pct(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -190,9 +190,14 @@ void bot_command_spell_max_mana_pct(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -196,9 +196,14 @@ void bot_command_spell_max_thresholds(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -190,9 +190,14 @@ void bot_command_spell_min_hp_pct(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -190,9 +190,14 @@ void bot_command_spell_min_mana_pct(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -198,9 +198,14 @@ void bot_command_spell_min_thresholds(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -194,9 +194,14 @@ void bot_command_spell_pursue_priority(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -190,9 +190,14 @@ void bot_command_spell_target_count(Client* c, const Seperator* sep)
|
||||
Bot* first_found = nullptr;
|
||||
int success_count = 0;
|
||||
for (auto my_bot : sbl) {
|
||||
if (my_bot->BotPassiveCheck()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first_found) {
|
||||
first_found = my_bot;
|
||||
}
|
||||
|
||||
if (current_check) {
|
||||
c->Message(
|
||||
Chat::Green,
|
||||
|
||||
@@ -2221,6 +2221,11 @@ bool BotDatabase::LoadBotSettings(Mob* m)
|
||||
else {
|
||||
query = fmt::format("`bot_id` = {} AND `stance` = {}", mobID, stanceID);
|
||||
}
|
||||
|
||||
if (stanceID == Stance::Passive) {
|
||||
LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive);
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto& l = BotSettingsRepository::GetWhere(database, query);
|
||||
|
||||
@@ -2268,6 +2273,11 @@ bool BotDatabase::SaveBotSettings(Mob* m)
|
||||
uint32 charID = (m->IsClient() ? m->CastToClient()->CharacterID() : 0);
|
||||
uint8 stanceID = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0);
|
||||
|
||||
if (stanceID == Stance::Passive) {
|
||||
LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string query = "";
|
||||
|
||||
if (m->IsClient()) {
|
||||
|
||||
Reference in New Issue
Block a user