mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 11:28:25 +00:00
Move GatherSpellTargets to mob
This commit is contained in:
@@ -9258,54 +9258,6 @@ void Bot::DoItemClick(const EQ::ItemData *item, uint16 slot_id)
|
||||
|
||||
uint8 Bot::spell_casting_chances[SPELL_TYPE_COUNT][Class::PLAYER_CLASS_COUNT][Stance::AEBurn][cntHSND] = { 0 };
|
||||
|
||||
std::vector<Mob*> Bot::GatherSpellTargets(bool entireRaid, Mob* target, bool noClients, bool noBots, bool noPets) {
|
||||
std::vector<Mob*> valid_spell_targets;
|
||||
|
||||
if (IsRaidGrouped()) {
|
||||
if (auto raid = GetRaid()) {
|
||||
if (entireRaid) {
|
||||
for (const auto& m : raid->members) {
|
||||
if (m.member && m.group_number != RAID_GROUPLESS && ((m.member->IsClient() && !noClients) || (m.member->IsBot() && !noBots))) {
|
||||
valid_spell_targets.emplace_back(m.member);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::vector<RaidMember> raidGroup;
|
||||
|
||||
if (target) {
|
||||
raidGroup = raid->GetRaidGroupMembers(raid->GetGroup(target->GetName()));
|
||||
}
|
||||
else {
|
||||
raidGroup = raid->GetRaidGroupMembers(raid->GetGroup(GetName()));
|
||||
}
|
||||
|
||||
for (const auto& m : raidGroup) {
|
||||
if (m.member && m.group_number != RAID_GROUPLESS && ((m.member->IsClient() && !noClients) || (m.member->IsBot() && !noBots))) {
|
||||
valid_spell_targets.emplace_back(m.member);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IsGrouped()) {
|
||||
Group* group = GetGroup();
|
||||
|
||||
if (group) {
|
||||
for (const auto& m : group->members) {
|
||||
if (m && ((m->IsClient() && !noClients) || (m->IsBot() && !noBots))) {
|
||||
valid_spell_targets.emplace_back(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
valid_spell_targets.emplace_back(this);
|
||||
}
|
||||
|
||||
return valid_spell_targets;
|
||||
}
|
||||
|
||||
bool Bot::PrecastChecks(Mob* tar, uint16 spellType) {
|
||||
if (!tar) {
|
||||
LogBotPreChecksDetail("{} says, 'Cancelling cast due to PrecastChecks !tar.'", GetCleanName()); //deleteme
|
||||
|
||||
@@ -456,8 +456,6 @@ public:
|
||||
{ return Mob::Attack(other, Hand, FromRiposte, IsStrikethrough, IsFromSpell, opts); }
|
||||
void DoAttackRounds(Mob* target, int hand);
|
||||
|
||||
std::vector<Mob*> GatherSpellTargets(bool entireRaid = false, Mob* target = nullptr, bool noClients = false, bool noBots = false, bool noPets = false);
|
||||
|
||||
bool PrecastChecks(Mob* tar, uint16 spellType);
|
||||
bool CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechecks = false, bool AECheck = false);
|
||||
bool CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar);
|
||||
|
||||
@@ -8695,6 +8695,63 @@ void Mob::CheckScanCloseMobsMovingTimer()
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Mob*> Mob::GatherSpellTargets(bool entireRaid, Mob* target, bool noClients, bool noBots, bool noPets) {
|
||||
std::vector<Mob*> valid_spell_targets;
|
||||
|
||||
if (IsRaidGrouped()) {
|
||||
Raid* raid = nullptr;
|
||||
|
||||
if (IsBot()) {
|
||||
raid = CastToBot()->GetStoredRaid();
|
||||
}
|
||||
else {
|
||||
raid = GetRaid();
|
||||
}
|
||||
|
||||
if (raid) {
|
||||
if (entireRaid) {
|
||||
for (const auto& m : raid->members) {
|
||||
if (m.member && m.group_number != RAID_GROUPLESS && ((m.member->IsClient() && !noClients) || (m.member->IsBot() && !noBots))) {
|
||||
valid_spell_targets.emplace_back(m.member);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::vector<RaidMember> raidGroup;
|
||||
|
||||
if (target) {
|
||||
raidGroup = raid->GetRaidGroupMembers(raid->GetGroup(target->GetName()));
|
||||
}
|
||||
else {
|
||||
raidGroup = raid->GetRaidGroupMembers(raid->GetGroup(GetName()));
|
||||
}
|
||||
|
||||
for (const auto& m : raidGroup) {
|
||||
if (m.member && m.group_number != RAID_GROUPLESS && ((m.member->IsClient() && !noClients) || (m.member->IsBot() && !noBots))) {
|
||||
valid_spell_targets.emplace_back(m.member);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IsGrouped()) {
|
||||
Group* group = GetGroup();
|
||||
|
||||
if (group) {
|
||||
for (const auto& m : group->members) {
|
||||
if (m && ((m->IsClient() && !noClients) || (m->IsBot() && !noBots))) {
|
||||
valid_spell_targets.emplace_back(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
valid_spell_targets.emplace_back(this);
|
||||
}
|
||||
|
||||
return valid_spell_targets;
|
||||
}
|
||||
|
||||
uint16 Mob::GetSpellTypeIDByShortName(std::string spellTypeString) {
|
||||
|
||||
for (int i = BotSpellTypes::START; i <= BotSpellTypes::END; ++i) {
|
||||
|
||||
@@ -432,6 +432,8 @@ public:
|
||||
|
||||
inline bool SpellTypeRecastCheck(uint16 spellType) { return (IsClient() ? true : _spellSettings[spellType].recastTimer.GetRemainingTime() > 0 ? false : true); }
|
||||
|
||||
std::vector<Mob*> GatherSpellTargets(bool entireRaid = false, Mob* target = nullptr, bool noClients = false, bool noBots = false, bool noPets = false);
|
||||
|
||||
uint16 GetSpellTypeIDByShortName(std::string spellTypeString);
|
||||
|
||||
std::string GetBotSpellCategoryName(uint8 setting_type);
|
||||
|
||||
Reference in New Issue
Block a user