mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[10201] Broadcast packets only if worldobject is in world
There is no sense to do that for objects that not in world - those objects are unknown for clients and their packets will be ignored (based on SilverIce's repo commit 6305402) Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
ea4afebff8
commit
e47e9a2218
4 changed files with 14 additions and 15 deletions
|
|
@ -1572,25 +1572,24 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const*
|
|||
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
if(_map)
|
||||
_map->MessageBroadcast(this, data);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageBroadcast(this, data);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
_map->MessageDistBroadcast(this, data, dist);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageDistBroadcast(this, data, dist);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
if (IsInWorld())
|
||||
{
|
||||
MaNGOS::MessageDelivererExcept notifier(this, data, skipped_receiver);
|
||||
Cell::VisitWorldObjects(this, notifier, _map->GetVisibilityDistance());
|
||||
Cell::VisitWorldObjects(this, notifier, GetMap()->GetVisibilityDistance());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6068,8 +6068,8 @@ void Player::SaveRecallPosition()
|
|||
|
||||
void Player::SendMessageToSet(WorldPacket *data, bool self)
|
||||
{
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
_map->MessageBroadcast(this, data, false);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageBroadcast(this, data, false);
|
||||
|
||||
//if player is not in world and map in not created/already destroyed
|
||||
//no need to create one, just send packet for itself!
|
||||
|
|
@ -6079,8 +6079,8 @@ void Player::SendMessageToSet(WorldPacket *data, bool self)
|
|||
|
||||
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
|
||||
{
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
_map->MessageDistBroadcast(this, data, dist, false);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageDistBroadcast(this, data, dist, false);
|
||||
|
||||
if (self)
|
||||
GetSession()->SendPacket(data);
|
||||
|
|
@ -6088,8 +6088,8 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
|
|||
|
||||
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only)
|
||||
{
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
_map->MessageDistBroadcast(this, data, dist, false, own_team_only);
|
||||
if (IsInWorld())
|
||||
GetMap()->MessageDistBroadcast(this, data, dist, false, own_team_only);
|
||||
|
||||
if (self)
|
||||
GetSession()->SendPacket(data);
|
||||
|
|
|
|||
|
|
@ -8961,7 +8961,7 @@ void Unit::SetPower(Powers power, uint32 val)
|
|||
data << GetPackGUID();
|
||||
data << uint8(power);
|
||||
data << uint32(val);
|
||||
SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER ? true : false);
|
||||
SendMessageToSet(&data, true);
|
||||
|
||||
// group update
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10200"
|
||||
#define REVISION_NR "10201"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue