mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +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*/)
|
void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
|
||||||
{
|
{
|
||||||
//if object is in world, map for it already created!
|
//if object is in world, map for it already created!
|
||||||
Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
|
if (IsInWorld())
|
||||||
if(_map)
|
GetMap()->MessageBroadcast(this, data);
|
||||||
_map->MessageBroadcast(this, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
|
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
|
||||||
{
|
{
|
||||||
//if object is in world, map for it already created!
|
//if object is in world, map for it already created!
|
||||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
if (IsInWorld())
|
||||||
_map->MessageDistBroadcast(this, data, dist);
|
GetMap()->MessageDistBroadcast(this, data, dist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver)
|
void WorldObject::SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver)
|
||||||
{
|
{
|
||||||
//if object is in world, map for it already created!
|
//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);
|
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)
|
void Player::SendMessageToSet(WorldPacket *data, bool self)
|
||||||
{
|
{
|
||||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
if (IsInWorld())
|
||||||
_map->MessageBroadcast(this, data, false);
|
GetMap()->MessageBroadcast(this, data, false);
|
||||||
|
|
||||||
//if player is not in world and map in not created/already destroyed
|
//if player is not in world and map in not created/already destroyed
|
||||||
//no need to create one, just send packet for itself!
|
//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)
|
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self)
|
||||||
{
|
{
|
||||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
if (IsInWorld())
|
||||||
_map->MessageDistBroadcast(this, data, dist, false);
|
GetMap()->MessageDistBroadcast(this, data, dist, false);
|
||||||
|
|
||||||
if (self)
|
if (self)
|
||||||
GetSession()->SendPacket(data);
|
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)
|
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only)
|
||||||
{
|
{
|
||||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
if (IsInWorld())
|
||||||
_map->MessageDistBroadcast(this, data, dist, false, own_team_only);
|
GetMap()->MessageDistBroadcast(this, data, dist, false, own_team_only);
|
||||||
|
|
||||||
if (self)
|
if (self)
|
||||||
GetSession()->SendPacket(data);
|
GetSession()->SendPacket(data);
|
||||||
|
|
|
||||||
|
|
@ -8961,7 +8961,7 @@ void Unit::SetPower(Powers power, uint32 val)
|
||||||
data << GetPackGUID();
|
data << GetPackGUID();
|
||||||
data << uint8(power);
|
data << uint8(power);
|
||||||
data << uint32(val);
|
data << uint32(val);
|
||||||
SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER ? true : false);
|
SendMessageToSet(&data, true);
|
||||||
|
|
||||||
// group update
|
// group update
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10200"
|
#define REVISION_NR "10201"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue