forked from mirror/openmw-tes3mp
[Server] Add broadcast argument to functions for sending WorldPackets
This commit is contained in:
parent
1e2517698d
commit
47a3dc9ff2
3 changed files with 101 additions and 50 deletions
|
@ -18,6 +18,7 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
|
|||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player);
|
||||
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(true);
|
||||
}
|
||||
|
|
|
@ -301,64 +301,104 @@ void WorldFunctions::AddContainerItem() noexcept
|
|||
tempContainerItem = emptyContainerItem;
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectPlace() noexcept
|
||||
void WorldFunctions::SendObjectPlace(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectSpawn() noexcept
|
||||
void WorldFunctions::SendObjectSpawn(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SPAWN)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SPAWN)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SPAWN);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectDelete() noexcept
|
||||
void WorldFunctions::SendObjectDelete(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectLock() noexcept
|
||||
void WorldFunctions::SendObjectLock(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectTrap() noexcept
|
||||
void WorldFunctions::SendObjectTrap(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_TRAP)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_TRAP)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_TRAP);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectScale() noexcept
|
||||
void WorldFunctions::SendObjectScale(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectState() noexcept
|
||||
void WorldFunctions::SendObjectState(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_STATE)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_STATE)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_STATE);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendDoorState() noexcept
|
||||
void WorldFunctions::SendDoorState(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendContainer() noexcept
|
||||
void WorldFunctions::SendContainer(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendConsoleCommand() noexcept
|
||||
void WorldFunctions::SendConsoleCommand(bool broadcast) noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONSOLE_COMMAND)->setEvent(&writeEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONSOLE_COMMAND)->Send(writeEvent.guid);
|
||||
mwmp::WorldPacket *packet = mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONSOLE_COMMAND);
|
||||
packet->setEvent(&writeEvent);
|
||||
packet->Send(false);
|
||||
|
||||
if (broadcast)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
|
||||
|
|
|
@ -568,92 +568,102 @@ public:
|
|||
/**
|
||||
* \brief Send an ObjectPlace packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectPlace() noexcept;
|
||||
static void SendObjectPlace(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ObjectSpawn packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectSpawn() noexcept;
|
||||
static void SendObjectSpawn(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ObjectDelete packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectDelete() noexcept;
|
||||
static void SendObjectDelete(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ObjectLock packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectLock() noexcept;
|
||||
static void SendObjectLock(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ObjectTrap packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectTrap() noexcept;
|
||||
static void SendObjectTrap(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ObjectScale packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectScale() noexcept;
|
||||
static void SendObjectScale(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send an ObjectState packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendObjectState() noexcept;
|
||||
static void SendObjectState(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a DoorState packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendDoorState() noexcept;
|
||||
static void SendDoorState(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a Container packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendContainer() noexcept;
|
||||
static void SendContainer(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a ConsoleCommand packet.
|
||||
*
|
||||
* It is sent only to the player for whom the current event was initialized.
|
||||
* \param broadcast Whether this packet should be sent only to the player for whom the current
|
||||
* event was initialized or to everyone on the server.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void SendConsoleCommand() noexcept;
|
||||
static void SendConsoleCommand(bool broadcast = false) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the game hour for a player and send a GameTime packet to that player.
|
||||
|
|
Loading…
Reference in a new issue