mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 07:18:37 +00:00
Move GatherSpellTargets to mob
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user