mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 07:22:02 -04:00
Merge pull request #16839 from chaodhib/spell_facing_fix
Adjustments to spell facing
This commit is contained in:
@@ -2786,17 +2786,17 @@ bool Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
|
||||
)
|
||||
)
|
||||
{
|
||||
const MapRefManager& mapPlayers = GetMap()->GetPlayers();
|
||||
for (MapRefManager::const_iterator it = mapPlayers.begin(); it != mapPlayers.end(); ++it)
|
||||
if (Player* player = (*it).GetSource())
|
||||
std::list<Player*> playersNearby;
|
||||
GetPlayerListInGrid(playersNearby, GetVisibilityRange());
|
||||
for (Player* player : playersNearby)
|
||||
{
|
||||
// only update players that are known to the client (have already been created)
|
||||
if (player->HaveAtClient(this))
|
||||
{
|
||||
// only update players that can both see us, and are actually in combat with us (this is a performance tradeoff)
|
||||
if (player->CanSeeOrDetect(this, false, true) && IsInCombatWith(player))
|
||||
{
|
||||
SendUpdateToPlayer(player);
|
||||
shouldDelay = true;
|
||||
}
|
||||
SendUpdateToPlayer(player);
|
||||
shouldDelay = true;
|
||||
}
|
||||
}
|
||||
if (shouldDelay)
|
||||
shouldDelay = !(focusSpell->IsTriggered() || focusSpell->GetCastTime() || focusSpell->GetSpellInfo()->IsChanneled());
|
||||
|
||||
|
||||
@@ -221,7 +221,10 @@ void Object::SendUpdateToPlayer(Player* player)
|
||||
UpdateData upd;
|
||||
WorldPacket packet;
|
||||
|
||||
BuildCreateUpdateBlockForPlayer(&upd, player);
|
||||
if (player->HaveAtClient(this))
|
||||
BuildValuesUpdateBlockForPlayer(&upd, player);
|
||||
else
|
||||
BuildCreateUpdateBlockForPlayer(&upd, player);
|
||||
upd.BuildPacket(&packet);
|
||||
player->GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
@@ -21942,7 +21942,7 @@ WorldLocation Player::GetStartPosition() const
|
||||
return WorldLocation(mapId, info->positionX, info->positionY, info->positionZ, 0);
|
||||
}
|
||||
|
||||
bool Player::HaveAtClient(WorldObject const* u) const
|
||||
bool Player::HaveAtClient(Object const* u) const
|
||||
{
|
||||
return u == this || m_clientGUIDs.find(u->GetGUID()) != m_clientGUIDs.end();
|
||||
}
|
||||
|
||||
@@ -2097,7 +2097,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
// currently visible objects at player client
|
||||
GuidUnorderedSet m_clientGUIDs;
|
||||
|
||||
bool HaveAtClient(WorldObject const* u) const;
|
||||
bool HaveAtClient(Object const* u) const;
|
||||
|
||||
bool IsNeverVisible() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user