[Bug Fix] Add required distance to CoTH before aggro wipe (#2253)

* Add required distance to CoTH before aggro wipe

This should fix eqemu/master#2205

* Remove implied this->

* Adjustments to rules per PR discussion.
This commit is contained in:
Michael
2022-07-02 22:51:57 -04:00
committed by GitHub
parent d107226ced
commit 68d28bcd3e
4 changed files with 27 additions and 7 deletions
+8
View File
@@ -2091,6 +2091,14 @@ Group *EntityList::GetGroupByID(uint32 group_id)
return nullptr;
}
bool EntityList::IsInSameGroupOrRaidGroup(Client *client1, Client *client2) {
Group* group = entity_list.GetGroupByClient(client1);
Raid* raid = entity_list.GetRaidByClient(client1);
return (group && group->IsGroupMember(client2))
|| (raid && raid->IsRaidMember(client2->GetName()) && raid->GetGroup(client1) == raid->GetGroup(client2));
}
Group *EntityList::GetGroupByClient(Client *client)
{
std::list <Group *>::iterator iterator;
+1
View File
@@ -193,6 +193,7 @@ public:
NPC* GetRandomNPC(const glm::vec3& location, float distance, NPC* exclude_npc = nullptr);
Mob* GetRandomMob(const glm::vec3& location, float distance, Mob* exclude_mob = nullptr);
Group *GetGroupByMob(Mob* mob);
bool IsInSameGroupOrRaidGroup(Client *client1, Client *client2);
Group *GetGroupByClient(Client* client);
Group *GetGroupByID(uint32 id);
Group *GetGroupByLeaderName(const char* leader);
+17 -7
View File
@@ -2130,20 +2130,30 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
case SE_SummonPC:
{
if (!caster)
if (!caster) {
break;
}
if (IsClient()) {
if (caster->IsClient()) {
if (!entity_list.IsInSameGroupOrRaidGroup(caster->CastToClient(), CastToClient())) {
caster->Message(Chat::Red, "Your target must be a group member for this spell.");
break;
}
// clear aggro when summoned in zone and further than aggro clear distance rule.
if (RuleR(Spells, CallOfTheHeroAggroClearDist) == 0 || caster->CalculateDistance(GetX(), GetY(), GetZ()) >= RuleR(Spells, CallOfTheHeroAggroClearDist)) {
entity_list.ClearAggro(this);
}
}
CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), caster->GetX(),
caster->GetY(), caster->GetZ(), caster->GetHeading(), 2,
SummonPC);
Message(Chat::Yellow, "You have been summoned!");
// only for beneficial spells like Call of the Hero
// This clear probably isn't actually needed, but need to investigate more
if (IsBeneficialSpell(spell_id))
entity_list.ClearAggro(this);
} else
} else {
caster->Message(Chat::Red, "This spell can only be cast on players.");
}
break;
}