Core/Conditions: CONDITION_NEAR_CREATURE will exclude personal spawns that aren't the target's owner (#26102)

# Conflicts:
#	src/server/game/Grids/Notifiers/GridNotifiers.h
This commit is contained in:
Matan Shukry authored and Ovahlord committed 2021-02-19 13:04:08 +01:00
1 parent abae5e4596
commit 73efb99005
4 files changed
+14 -4

No files matched your search

@@ -44,6 +44,15 @@ Creature* TempSummon::GetSummonerCreatureBase() const
return m_summonerGUID ? ObjectAccessor::GetCreature(*this, m_summonerGUID) : nullptr;
}
bool TempSummon::IsPersonalSummonOfAnotherPlayer(Creature const* summon, ObjectGuid playerToCheck)
{
if (TempSummon const* tempSummon = summon->ToTempSummon())
if (tempSummon->IsVisibleBySummonerOnly() && playerToCheck != tempSummon->GetSummonerGUID())
return true;
return false;
}
void TempSummon::Update(uint32 diff)
{
Creature::Update(diff);
@@ -89,6 +89,7 @@ class TC_GAME_API TempSummon : public Creature
void SetVisibleBySummonerOnly(bool visibleBySummonerOnly) { m_visibleBySummonerOnly = visibleBySummonerOnly; }
bool IsVisibleBySummonerOnly() const { return m_visibleBySummonerOnly; }
static bool IsPersonalSummonOfAnotherPlayer(Creature const* summon, ObjectGuid playerToCheck);
SummonPropertiesEntry const* const m_Properties;
private:
+2 -3
View File
@@ -1770,9 +1770,8 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
viewpoint = player->GetViewpoint();
if (Creature const* creature = obj->ToCreature())
if (TempSummon const* tempSummon = creature->ToTempSummon())
if (tempSummon->IsVisibleBySummonerOnly() && GetGUID() != tempSummon->GetSummonerGUID())
return false;
if (TempSummon::IsPersonalSummonOfAnotherPlayer(creature, GetGUID()))
return false;
}
if (GameObject const* go = obj->ToGameObject())
@@ -27,6 +27,7 @@
#include "Player.h"
#include "Spell.h"
#include "SpellInfo.h"
#include "TemporarySummon.h"
#include "UnitAI.h"
#include "UpdateData.h"
@@ -1255,7 +1256,7 @@ namespace Trinity
bool operator()(Creature* u)
{
if (u->getDeathState() != DEAD && u->GetEntry() == i_entry && u->IsAlive() == i_alive && u->GetGUID() != i_obj.GetGUID() && i_obj.IsWithinDistInMap(u, i_range))
if (u->getDeathState() != DEAD && u->GetEntry() == i_entry && u->IsAlive() == i_alive && u->GetGUID() != i_obj.GetGUID() && i_obj.IsWithinDistInMap(u, i_range) && !TempSummon::IsPersonalSummonOfAnotherPlayer(u, i_obj.GetGUID()))
{
i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check
return true;