mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 19:31:59 +01:00
Core/Conditions: CONDITION_NEAR_CREATURE will exclude personal spawns that aren't the target's owner (#26102)
This commit is contained in:
@@ -44,6 +44,15 @@ Creature* TempSummon::GetSummonerCreatureBase() const
|
||||
return !m_summonerGUID.IsEmpty() ? 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);
|
||||
|
||||
@@ -61,6 +61,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:
|
||||
|
||||
@@ -1448,9 +1448,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())
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Player.h"
|
||||
#include "Spell.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "UnitAI.h"
|
||||
#include "UpdateData.h"
|
||||
|
||||
@@ -1312,7 +1313,7 @@ namespace Trinity
|
||||
|
||||
bool operator()(Creature* u)
|
||||
{
|
||||
if (u->getDeathState() != DEAD && u->GetEntry() == i_entry && u->IsAlive() == i_alive && i_obj.IsWithinDistInMap(u, i_range))
|
||||
if (u->getDeathState() != DEAD && u->GetEntry() == i_entry && u->IsAlive() == i_alive && 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;
|
||||
|
||||
Reference in New Issue
Block a user