mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-27 20:47:15 +00:00
Consolidate IsInGroupOrRaid
This commit is contained in:
+12
-39
@@ -9419,7 +9419,7 @@ void Mob::ClearDataBucketCache()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mob::IsInGroupOrRaid(Mob *other, bool same_raid_group) {
|
bool Mob::IsInGroupOrRaid(Mob* other, bool same_raid_group) {
|
||||||
if (!other || !IsOfClientBotMerc() || !other->IsOfClientBotMerc()) {
|
if (!other || !IsOfClientBotMerc() || !other->IsOfClientBotMerc()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -9428,64 +9428,37 @@ bool Mob::IsInGroupOrRaid(Mob *other, bool same_raid_group) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Raid* raid = nullptr;
|
Raid* raid = IsBot() ? CastToBot()->GetStoredRaid() : (IsRaidGrouped() ? GetRaid() : nullptr);
|
||||||
|
|
||||||
if (IsBot()) {
|
|
||||||
raid = CastToBot()->GetStoredRaid();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (IsRaidGrouped()) {
|
|
||||||
raid = GetRaid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsRaidGrouped()) {
|
|
||||||
if (!raid) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (raid) {
|
if (raid) {
|
||||||
if (!other->IsRaidGrouped()) {
|
if (!other->IsRaidGrouped()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Raid* other_raid = nullptr;
|
Raid* other_raid = other->IsBot() ? other->CastToBot()->GetStoredRaid() : other->GetRaid();
|
||||||
|
|
||||||
if (other->IsBot()) {
|
|
||||||
other_raid = other->CastToBot()->GetStoredRaid();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
other_raid = other->GetRaid();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!other_raid) {
|
if (!other_raid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto raid_group = raid->GetGroup(GetCleanName());
|
auto raid_group = raid->GetGroup(GetCleanName());
|
||||||
auto raid_other_group = other_raid->GetGroup(other->GetCleanName());
|
auto other_raid_group = other_raid->GetGroup(other->GetCleanName());
|
||||||
|
|
||||||
if (raid_group == RAID_GROUPLESS || raid_other_group == RAID_GROUPLESS || (same_raid_group && raid_group != raid_other_group)) {
|
if (
|
||||||
|
raid_group == RAID_GROUPLESS ||
|
||||||
|
other_raid_group == RAID_GROUPLESS ||
|
||||||
|
(same_raid_group && raid_group != other_raid_group)
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
auto* group = GetGroup();
|
|
||||||
auto* group_other = other->GetGroup();
|
|
||||||
|
|
||||||
if (group) {
|
Group* group = GetGroup();
|
||||||
if (!group_other || group != group_other) {
|
Group* other_group = other->GetGroup();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return group && group == other_group;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mob::DoLosChecks(Mob* who, Mob* other) {
|
bool Mob::DoLosChecks(Mob* who, Mob* other) {
|
||||||
|
|||||||
Reference in New Issue
Block a user