mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9796] Controlled unit should be a source of movement packets, not player-controller.
Now movements of controlled unit are visible for nearby players, even when controller too far from controlled unit This new type of packet broadcasting used in HandleMovementOpcodes handler only, maybe it can be used somewhere else. (based on SilverIce's repo commit d2387ca) Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
3032e80bb6
commit
6ab55fa09e
6 changed files with 41 additions and 4 deletions
|
|
@ -132,6 +132,20 @@ MessageDeliverer::Visit(PlayerMapType &m)
|
|||
}
|
||||
}
|
||||
|
||||
void MessageDelivererExcept::Visit(PlayerMapType &m)
|
||||
{
|
||||
for(PlayerMapType::iterator it = m.begin(); it!= m.end(); ++it)
|
||||
{
|
||||
Player* player = it->getSource();
|
||||
if(!player->InSamePhase(i_phaseMask) || player == i_skipped_receiver)
|
||||
continue;
|
||||
|
||||
if (WorldSession* session = player->GetSession())
|
||||
session->SendPacket(i_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ObjectMessageDeliverer::Visit(PlayerMapType &m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,6 +87,19 @@ namespace MaNGOS
|
|||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
};
|
||||
|
||||
struct MessageDelivererExcept
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
WorldPacket* i_message;
|
||||
Player const* i_skipped_receiver;
|
||||
|
||||
MessageDelivererExcept(WorldObject const* obj, WorldPacket *msg, Player const* skipped)
|
||||
: i_phaseMask(obj->GetPhaseMask()), i_message(msg), i_skipped_receiver(skipped) {}
|
||||
|
||||
void Visit(PlayerMapType &m);
|
||||
template<class SKIP> void Visit(GridRefManager<SKIP> &) {}
|
||||
};
|
||||
|
||||
struct MANGOS_DLL_DECL ObjectMessageDeliverer
|
||||
{
|
||||
uint32 i_phaseMask;
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||
WorldPacket data(opcode, recv_data.size());
|
||||
data.appendPackGUID(mover->GetGUID()); // write guid
|
||||
movementInfo.Write(data); // write data
|
||||
GetPlayer()->SendMessageToSet(&data, false);
|
||||
mover->SendMessageToSetExcept(&data, _player);
|
||||
|
||||
if(plMover) // nothing is charmed, or player charmed
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1579,11 +1579,20 @@ void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/)
|
|||
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/)
|
||||
{
|
||||
//if object is in world, map for it already created!
|
||||
Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
if(_map)
|
||||
if (Map * _map = IsInWorld() ? GetMap() : sMapMgr.FindMap(GetMapId(), GetInstanceId()))
|
||||
_map->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()))
|
||||
{
|
||||
MaNGOS::MessageDelivererExcept notifier(this, data, skipped_receiver);
|
||||
Cell::VisitWorldObjects(this, notifier, _map->GetVisibilityDistance());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::SendObjectDeSpawnAnim(uint64 guid)
|
||||
{
|
||||
WorldPacket data(SMSG_GAMEOBJECT_DESPAWN_ANIM, 8);
|
||||
|
|
|
|||
|
|
@ -429,6 +429,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
|||
|
||||
virtual void SendMessageToSet(WorldPacket *data, bool self);
|
||||
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self);
|
||||
void SendMessageToSetExcept(WorldPacket *data, Player const* skipped_receiver);
|
||||
|
||||
void MonsterSay(const char* text, uint32 language, uint64 TargetGuid);
|
||||
void MonsterYell(const char* text, uint32 language, uint64 TargetGuid);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9795"
|
||||
#define REVISION_NR "9796"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue