Adjustments to spell facing - Adjusted HaveAtClient to accept Object* (still accepts all subordinates) - Use grid searcher to find players in visibility range for unit - Use client cache instead of "See or Detect" to decide who to send updates to - Adjusted SendUpdateToPlayer to send createobject packet only if not known to client

(cherry picked from commit c0693a6ee52d31840ab2ee878c4881884b857638)
This commit is contained in:
r00ty-tc authored and Aokromes committed 2016-05-12 08:17:08 +02:00
1 parent 32e4388a8c
commit f51e4e1ca7
4 files changed
+15 -12

No files matched your search

@@ -2697,17 +2697,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());
+4 -1
View File
@@ -239,7 +239,10 @@ void Object::SendUpdateToPlayer(Player* player)
UpdateData upd(player->GetMapId());
WorldPacket packet;
BuildCreateUpdateBlockForPlayer(&upd, player);
if (player->HaveAtClient(this))
BuildValuesUpdateBlockForPlayer(&upd, player);
else
BuildCreateUpdateBlockForPlayer(&upd, player);
upd.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet);
}
+1 -1
View File
@@ -22478,7 +22478,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();
}
+1 -1
View File
@@ -2280,7 +2280,7 @@ class 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;