mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-24 15:52:26 +00:00
[Bots] Add IsInRaidOrGroup checks to ^attack and ^pull (#4654)
This commit is contained in:
parent
ed7023f336
commit
41009aa19b
17
zone/bot.cpp
17
zone/bot.cpp
@ -12380,6 +12380,23 @@ bool Bot::BotPassiveCheck() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Bot::ValidStateCheck(Mob* other, bool same_raid_group) {
|
||||||
|
if (
|
||||||
|
GetBotStance() == Stance::Passive ||
|
||||||
|
GetHoldFlag() ||
|
||||||
|
GetAppearance() == eaDead ||
|
||||||
|
IsFeared() ||
|
||||||
|
IsSilenced() ||
|
||||||
|
IsAmnesiad() ||
|
||||||
|
GetHP() < 0 ||
|
||||||
|
!IsInGroupOrRaid(other, same_raid_group)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool Bot::IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id) {
|
bool Bot::IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id) {
|
||||||
if (sub_type == UINT16_MAX) {
|
if (sub_type == UINT16_MAX) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -526,6 +526,7 @@ public:
|
|||||||
void DoAttackRounds(Mob* target, int hand);
|
void DoAttackRounds(Mob* target, int hand);
|
||||||
|
|
||||||
bool BotPassiveCheck();
|
bool BotPassiveCheck();
|
||||||
|
bool ValidStateCheck(Mob* other, bool same_raid_group = false);
|
||||||
Raid* GetStoredRaid() { return _storedRaid; }
|
Raid* GetStoredRaid() { return _storedRaid; }
|
||||||
void SetStoredRaid(Raid* stored_raid) { _storedRaid = stored_raid; }
|
void SetStoredRaid(Raid* stored_raid) { _storedRaid = stored_raid; }
|
||||||
bool GetVerifiedRaid() { return _verifiedRaid; }
|
bool GetVerifiedRaid() { return _verifiedRaid; }
|
||||||
|
|||||||
@ -54,34 +54,33 @@ void bot_command_attack(Client *c, const Seperator *sep)
|
|||||||
Bot *first_attacker = nullptr;
|
Bot *first_attacker = nullptr;
|
||||||
sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
|
sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
|
||||||
for (auto bot_iter : sbl) {
|
for (auto bot_iter : sbl) {
|
||||||
|
if (!bot_iter->ValidStateCheck(c)) {
|
||||||
if (bot_iter->GetAppearance() != eaDead && bot_iter->GetBotStance() != Stance::Passive) {
|
continue;
|
||||||
|
|
||||||
if (!first_attacker) {
|
|
||||||
first_attacker = bot_iter;
|
|
||||||
}
|
|
||||||
++attacker_count;
|
|
||||||
|
|
||||||
bot_iter->SetAttackFlag();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!first_attacker) {
|
||||||
|
first_attacker = bot_iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
++attacker_count;
|
||||||
|
|
||||||
|
bot_iter->SetAttackFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker_count == 1 && first_attacker) {
|
if (first_attacker) {
|
||||||
c->Message(
|
std::string message;
|
||||||
Chat::Green,
|
|
||||||
fmt::format(
|
if (attacker_count == 1) {
|
||||||
"Attacking {}.",
|
message = fmt::format("Attacking {}.", target_mob->GetCleanName());
|
||||||
target_mob->GetCleanName()
|
} else {
|
||||||
).c_str()
|
message = fmt::format("{} of your bots are attacking {}.", sbl.size(), target_mob->GetCleanName());
|
||||||
);
|
}
|
||||||
} else {
|
|
||||||
c->Message(
|
c->Message(Chat::Green, message.c_str());
|
||||||
Chat::Green,
|
|
||||||
fmt::format(
|
|
||||||
"{} of your bots are attacking {}.",
|
|
||||||
sbl.size(),
|
|
||||||
target_mob->GetCleanName()
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
c->Message(Chat::Yellow,fmt::format("None of your bots are capable of attacking {}.", target_mob->GetCleanName()).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -477,11 +477,7 @@ void bot_command_cast(Client* c, const Seperator* sep)
|
|||||||
Bot* first_found = nullptr;
|
Bot* first_found = nullptr;
|
||||||
|
|
||||||
for (auto bot_iter : sbl) {
|
for (auto bot_iter : sbl) {
|
||||||
if (!bot_iter->IsInGroupOrRaid(c)) {
|
if (!bot_iter->ValidStateCheck(c)) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bot_iter->GetBotStance() == Stance::Passive || bot_iter->GetHoldFlag() || bot_iter->GetAppearance() == eaDead || bot_iter->IsFeared() || bot_iter->IsSilenced() || bot_iter->IsAmnesiad() || bot_iter->GetHP() < 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -141,11 +141,7 @@ void bot_command_depart(Client* c, const Seperator* sep)
|
|||||||
std::map<std::string, std::pair<uint8_t, uint8_t>> list_zones;
|
std::map<std::string, std::pair<uint8_t, uint8_t>> list_zones;
|
||||||
|
|
||||||
for (auto bot_iter : sbl) {
|
for (auto bot_iter : sbl) {
|
||||||
if (!bot_iter->IsInGroupOrRaid(tar, !single)) {
|
if (!bot_iter->ValidStateCheck(c)) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bot_iter->GetBotStance() == Stance::Passive || bot_iter->GetHoldFlag() || bot_iter->GetAppearance() == eaDead || bot_iter->IsFeared() || bot_iter->IsSilenced() || bot_iter->IsAmnesiad() || bot_iter->GetHP() < 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -125,11 +125,7 @@ void bot_command_discipline(Client* c, const Seperator* sep)
|
|||||||
Bot* first_found = nullptr;
|
Bot* first_found = nullptr;
|
||||||
|
|
||||||
for (auto bot_iter : sbl) {
|
for (auto bot_iter : sbl) {
|
||||||
if (!bot_iter->IsInGroupOrRaid(c)) {
|
if (!bot_iter->ValidStateCheck(c)) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bot_iter->GetBotStance() == Stance::Passive || bot_iter->GetHoldFlag() || bot_iter->GetAppearance() == eaDead || bot_iter->IsFeared() || bot_iter->IsSilenced() || bot_iter->IsAmnesiad() || bot_iter->GetHP() < 0) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ void bot_command_pull(Client *c, const Seperator *sep)
|
|||||||
Bot* bot_puller = nullptr;
|
Bot* bot_puller = nullptr;
|
||||||
|
|
||||||
for (auto bot_iter : sbl) {
|
for (auto bot_iter : sbl) {
|
||||||
if (bot_iter->GetAppearance() == eaDead || bot_iter->GetBotStance() == Stance::Passive) {
|
if (!bot_iter->ValidStateCheck(c)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user