mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
[General] Add ActorPacketController & make controller var names clearer
This commit is contained in:
parent
a1d0b4908f
commit
070c6a3bd4
42 changed files with 478 additions and 180 deletions
47
apps/openmw-mp/ActorProcessor.cpp
Normal file
47
apps/openmw-mp/ActorProcessor.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
#include "ActorProcessor.hpp"
|
||||
#include "Networking.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
ActorProcessor::processors_t ActorProcessor::processors;
|
||||
|
||||
void ActorProcessor::Do(ActorPacket &packet, Player &player, BaseEvent &event)
|
||||
{
|
||||
packet.Send(true);
|
||||
}
|
||||
|
||||
void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor) noexcept
|
||||
{
|
||||
for (auto &p : processors)
|
||||
{
|
||||
if (processor->packetID == p.first)
|
||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||
processor->className + " and " + p.second->className);
|
||||
}
|
||||
processors.insert(processors_t::value_type(processor->GetPacketID(), processor));
|
||||
}
|
||||
|
||||
bool ActorProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept
|
||||
{
|
||||
// Clear our BaseEvent before loading new data in it
|
||||
event.cell.blank();
|
||||
event.objectChanges.objects.clear();
|
||||
event.guid = packet.guid;
|
||||
for (auto &processor : processors)
|
||||
{
|
||||
if (processor.first == packet.data[0])
|
||||
{
|
||||
Player *player = Players::getPlayer(packet.guid);
|
||||
ActorPacket *myPacket = Networking::get().getActorPacketController()->GetPacket(packet.data[0]);
|
||||
|
||||
myPacket->setEvent(&event);
|
||||
|
||||
if (!processor.second->avoidReading)
|
||||
myPacket->Read();
|
||||
|
||||
processor.second->Do(*myPacket, *player, event);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
32
apps/openmw-mp/ActorProcessor.hpp
Normal file
32
apps/openmw-mp/ActorProcessor.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef OPENMW_ACTORPROCESSOR_HPP
|
||||
#define OPENMW_ACTORPROCESSOR_HPP
|
||||
|
||||
|
||||
#include <components/openmw-mp/Base/BasePacketProcessor.hpp>
|
||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
||||
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include "Script/Script.hpp"
|
||||
#include "Player.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ActorProcessor : public BasePacketProcessor
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Do(ActorPacket &packet, Player &player, BaseEvent &event);
|
||||
|
||||
static bool Process(RakNet::Packet &packet, BaseEvent &event) noexcept;
|
||||
static void AddProcessor(ActorProcessor *processor) noexcept;
|
||||
|
||||
//typedef boost::unordered_map<unsigned char, boost::shared_ptr<ActorProcessor> > processors_t;
|
||||
typedef std::unordered_map<unsigned char, std::unique_ptr<ActorProcessor> > processors_t;
|
||||
private:
|
||||
static processors_t processors;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_ACTORPROCESSOR_HPP
|
|
@ -79,9 +79,7 @@ set(SERVER
|
|||
Script/Functions/Spells.cpp Script/Functions/Timer.cpp Script/Functions/Positions.cpp
|
||||
Script/Functions/Cells.cpp Script/Functions/World.cpp Script/Functions/Miscellaneous.cpp
|
||||
|
||||
PlayerProcessor.cpp
|
||||
WorldProcessor.cpp
|
||||
ProcessorInitializer.cpp
|
||||
ProcessorInitializer.cpp PlayerProcessor.cpp ActorProcessor.cpp WorldProcessor.cpp
|
||||
|
||||
Script/API/TimerAPI.cpp Script/API/PublicFnAPI.cpp
|
||||
${PawnScript_Sources}
|
||||
|
|
|
@ -51,6 +51,30 @@ Cell::TPlayers Cell::getPlayers() const
|
|||
return players;
|
||||
}
|
||||
|
||||
void Cell::sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseEvent *baseEvent) const
|
||||
{
|
||||
if (players.empty())
|
||||
return;
|
||||
|
||||
std::list <Player*> plList;
|
||||
|
||||
for (auto pl : players)
|
||||
plList.push_back(pl);
|
||||
|
||||
plList.sort();
|
||||
plList.unique();
|
||||
|
||||
for (auto pl : plList)
|
||||
{
|
||||
if (pl->guid == baseEvent->guid) continue;
|
||||
|
||||
actorPacket->setEvent(baseEvent);
|
||||
|
||||
// Send the packet to this eligible guid
|
||||
actorPacket->Send(pl->guid);
|
||||
}
|
||||
}
|
||||
|
||||
void Cell::sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEvent) const
|
||||
{
|
||||
if (players.empty())
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <string>
|
||||
#include <components/esm/records.hpp>
|
||||
#include <components/openmw-mp/Base/BaseEvent.hpp>
|
||||
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
|
||||
class Player;
|
||||
|
@ -62,6 +63,7 @@ public:
|
|||
void removePlayer(Player *player);
|
||||
|
||||
TPlayers getPlayers() const;
|
||||
void sendToLoaded(mwmp::ActorPacket *actorPacket, mwmp::BaseEvent *baseEvent) const;
|
||||
void sendToLoaded(mwmp::WorldPacket *worldPacket, mwmp::BaseEvent *baseEvent) const;
|
||||
|
||||
std::string getDescription() const;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "MasterClient.hpp"
|
||||
#include "Cell.hpp"
|
||||
#include "PlayerProcessor.hpp"
|
||||
#include "ActorProcessor.hpp"
|
||||
#include "WorldProcessor.hpp"
|
||||
#include <components/openmw-mp/Version.hpp>
|
||||
#include <components/openmw-mp/Packets/PacketPreInit.hpp>
|
||||
|
@ -37,12 +38,14 @@ Networking::Networking(RakNet::RakPeerInterface *peer)
|
|||
|
||||
CellController::create();
|
||||
|
||||
playerController = new PlayerPacketController(peer);
|
||||
worldController = new WorldPacketController(peer);
|
||||
playerPacketController = new PlayerPacketController(peer);
|
||||
actorPacketController = new ActorPacketController(peer);
|
||||
worldPacketController = new WorldPacketController(peer);
|
||||
|
||||
// Set send stream
|
||||
playerController->SetStream(0, &bsOut);
|
||||
worldController->SetStream(0, &bsOut);
|
||||
playerPacketController->SetStream(0, &bsOut);
|
||||
actorPacketController->SetStream(0, &bsOut);
|
||||
worldPacketController->SetStream(0, &bsOut);
|
||||
|
||||
running = true;
|
||||
exitCode = 0;
|
||||
|
@ -61,8 +64,8 @@ Networking::~Networking()
|
|||
CellController::destroy();
|
||||
|
||||
sThis = 0;
|
||||
delete playerController;
|
||||
delete worldController;
|
||||
delete playerPacketController;
|
||||
delete worldPacketController;
|
||||
LOG_QUIT();
|
||||
}
|
||||
|
||||
|
@ -80,7 +83,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
{
|
||||
Player *player = Players::getPlayer(packet->guid);
|
||||
|
||||
PlayerPacket *myPacket = playerController->GetPacket(packet->data[0]);
|
||||
PlayerPacket *myPacket = playerPacketController->GetPacket(packet->data[0]);
|
||||
|
||||
if (packet->data[0] == ID_HANDSHAKE)
|
||||
{
|
||||
|
@ -123,8 +126,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
if (!result)
|
||||
{
|
||||
playerController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(Players::getPlayer(packet->guid));
|
||||
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(false);
|
||||
playerPacketController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(Players::getPlayer(packet->guid));
|
||||
playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(false);
|
||||
Players::deletePlayer(packet->guid);
|
||||
return;
|
||||
}
|
||||
|
@ -153,6 +156,18 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
|
||||
}
|
||||
|
||||
void Networking::processActorPacket(RakNet::Packet *packet)
|
||||
{
|
||||
Player *player = Players::getPlayer(packet->guid);
|
||||
|
||||
if (!player->isHandshaked() || player->getLoadState() != Player::POSTLOADED)
|
||||
return;
|
||||
|
||||
if (!ActorProcessor::Process(*packet, baseEvent))
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled WorldPacket with identifier %i has arrived", packet->data[0]);
|
||||
|
||||
}
|
||||
|
||||
void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||
{
|
||||
Player *player = Players::getPlayer(packet->guid);
|
||||
|
@ -193,24 +208,29 @@ void Networking::update(RakNet::Packet *packet)
|
|||
return;
|
||||
}
|
||||
|
||||
playerController->SetStream(&bsIn, 0);
|
||||
playerPacketController->SetStream(&bsIn, 0);
|
||||
|
||||
playerController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
|
||||
playerPacketController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
|
||||
Players::newPlayer(packet->guid);
|
||||
player = Players::getPlayer(packet->guid);
|
||||
|
||||
playerController->GetPacket(ID_USER_MYID)->setPlayer(player);
|
||||
playerController->GetPacket(ID_USER_MYID)->Send(false);
|
||||
playerPacketController->GetPacket(ID_USER_MYID)->setPlayer(player);
|
||||
playerPacketController->GetPacket(ID_USER_MYID)->Send(false);
|
||||
return;
|
||||
}
|
||||
else if (playerController->ContainsPacket(packet->data[0]))
|
||||
else if (playerPacketController->ContainsPacket(packet->data[0]))
|
||||
{
|
||||
playerController->SetStream(&bsIn, 0);
|
||||
playerPacketController->SetStream(&bsIn, 0);
|
||||
processPlayerPacket(packet);
|
||||
}
|
||||
else if (worldController->ContainsPacket(packet->data[0]))
|
||||
else if (actorPacketController->ContainsPacket(packet->data[0]))
|
||||
{
|
||||
worldController->SetStream(&bsIn, 0);
|
||||
actorPacketController->SetStream(&bsIn, 0);
|
||||
processActorPacket(packet);
|
||||
}
|
||||
else if (worldPacketController->ContainsPacket(packet->data[0]))
|
||||
{
|
||||
worldPacketController->SetStream(&bsIn, 0);
|
||||
processWorldPacket(packet);
|
||||
}
|
||||
else
|
||||
|
@ -219,11 +239,11 @@ void Networking::update(RakNet::Packet *packet)
|
|||
|
||||
void Networking::newPlayer(RakNet::RakNetGUID guid)
|
||||
{
|
||||
playerController->GetPacket(ID_PLAYER_BASEINFO)->RequestData(guid);
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(guid);
|
||||
playerController->GetPacket(ID_PLAYER_POS)->RequestData(guid);
|
||||
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(guid);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->RequestData(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->RequestData(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_DYNAMICSTATS)->RequestData(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_POS)->RequestData(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->RequestData(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->RequestData(guid);
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Sending info about other players to %lu", guid.g);
|
||||
|
||||
|
@ -241,21 +261,21 @@ void Networking::newPlayer(RakNet::RakNetGUID guid)
|
|||
// If we are iterating over a player who has inputted their name, proceed
|
||||
else if (pl->second->getLoadState() == Player::POSTLOADED)
|
||||
{
|
||||
playerController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl->second);
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl->second);
|
||||
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl->second);
|
||||
playerController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl->second);
|
||||
playerController->GetPacket(ID_PLAYER_POS)->setPlayer(pl->second);
|
||||
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl->second);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_SKILL)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_POS)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(pl->second);
|
||||
playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(pl->second);
|
||||
|
||||
playerController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid);
|
||||
playerController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(guid);
|
||||
playerController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(guid);
|
||||
playerController->GetPacket(ID_PLAYER_SKILL)->Send(guid);
|
||||
playerController->GetPacket(ID_PLAYER_POS)->Send(guid);
|
||||
playerController->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(guid);
|
||||
playerController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_BASEINFO)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_SKILL)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_POS)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(guid);
|
||||
playerPacketController->GetPacket(ID_PLAYER_EQUIPMENT)->Send(guid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,19 +290,24 @@ void Networking::disconnectPlayer(RakNet::RakNetGUID guid)
|
|||
return;
|
||||
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->getId());
|
||||
|
||||
playerController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(player);
|
||||
playerController->GetPacket(ID_USER_DISCONNECTED)->Send(true);
|
||||
playerPacketController->GetPacket(ID_USER_DISCONNECTED)->setPlayer(player);
|
||||
playerPacketController->GetPacket(ID_USER_DISCONNECTED)->Send(true);
|
||||
Players::deletePlayer(guid);
|
||||
}
|
||||
|
||||
PlayerPacketController *Networking::getPlayerController() const
|
||||
PlayerPacketController *Networking::getPlayerPacketController() const
|
||||
{
|
||||
return playerController;
|
||||
return playerPacketController;
|
||||
}
|
||||
|
||||
WorldPacketController *Networking::getWorldController() const
|
||||
ActorPacketController *Networking::getActorPacketController() const
|
||||
{
|
||||
return worldController;
|
||||
return actorPacketController;
|
||||
}
|
||||
|
||||
WorldPacketController *Networking::getWorldPacketController() const
|
||||
{
|
||||
return worldPacketController;
|
||||
}
|
||||
|
||||
BaseEvent *Networking::getLastEvent()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define OPENMW_NETWORKING_HPP
|
||||
|
||||
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
|
||||
#include <components/openmw-mp/Controllers/ActorPacketController.hpp>
|
||||
#include <components/openmw-mp/Controllers/WorldPacketController.hpp>
|
||||
#include "Player.hpp"
|
||||
|
||||
|
@ -23,6 +24,7 @@ namespace mwmp
|
|||
void kickPlayer(RakNet::RakNetGUID guid);
|
||||
|
||||
void processPlayerPacket(RakNet::Packet *packet);
|
||||
void processActorPacket(RakNet::Packet *packet);
|
||||
void processWorldPacket(RakNet::Packet *packet);
|
||||
void update(RakNet::Packet *packet);
|
||||
|
||||
|
@ -34,8 +36,10 @@ namespace mwmp
|
|||
|
||||
void stopServer(int code);
|
||||
|
||||
PlayerPacketController *getPlayerController() const;
|
||||
WorldPacketController *getWorldController() const;
|
||||
PlayerPacketController *getPlayerPacketController() const;
|
||||
ActorPacketController *getActorPacketController() const;
|
||||
WorldPacketController *getWorldPacketController() const;
|
||||
|
||||
BaseEvent *getLastEvent();
|
||||
|
||||
int getCurrentMpNum();
|
||||
|
@ -59,8 +63,9 @@ namespace mwmp
|
|||
TPlayers *players;
|
||||
MasterClient *mclient;
|
||||
|
||||
PlayerPacketController *playerController;
|
||||
WorldPacketController *worldController;
|
||||
PlayerPacketController *playerPacketController;
|
||||
ActorPacketController *actorPacketController;
|
||||
WorldPacketController *worldPacketController;
|
||||
|
||||
bool running;
|
||||
int exitCode;
|
||||
|
|
|
@ -29,7 +29,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet) noexcept
|
|||
if (processor.first == packet.data[0])
|
||||
{
|
||||
Player *player = Players::getPlayer(packet.guid);
|
||||
PlayerPacket *myPacket = Networking::get().getPlayerController()->GetPacket(packet.data[0]);
|
||||
PlayerPacket *myPacket = Networking::get().getPlayerPacketController()->GetPacket(packet.data[0]);
|
||||
myPacket->setPlayer(player);
|
||||
|
||||
if (!processor.second->avoidReading)
|
||||
|
|
|
@ -24,10 +24,11 @@
|
|||
#include "processors/player/ProcessorPlayerCharGen.hpp"
|
||||
#include "processors/player/ProcessorGUIMessageBox.hpp"
|
||||
#include "processors/player/ProcessorPlayerCharClass.hpp"
|
||||
#include "ActorProcessor.hpp"
|
||||
#include "processors/actor/ProcessorActorList.hpp"
|
||||
#include "processors/actor/ProcessorActorAuthority.hpp"
|
||||
#include "processors/actor/ProcessorActorFrame.hpp"
|
||||
#include "WorldProcessor.hpp"
|
||||
#include "processors/world/ProcessorActorList.hpp"
|
||||
#include "processors/world/ProcessorActorAuthority.hpp"
|
||||
#include "processors/world/ProcessorActorFrame.hpp"
|
||||
#include "processors/world/ProcessorContainer.hpp"
|
||||
#include "processors/world/ProcessorDoorState.hpp"
|
||||
#include "processors/world/ProcessorMusicPlay.hpp"
|
||||
|
@ -70,9 +71,10 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass());
|
||||
|
||||
WorldProcessor::AddProcessor(new ProcessorActorList());
|
||||
WorldProcessor::AddProcessor(new ProcessorActorAuthority());
|
||||
WorldProcessor::AddProcessor(new ProcessorActorFrame());
|
||||
ActorProcessor::AddProcessor(new ProcessorActorList());
|
||||
ActorProcessor::AddProcessor(new ProcessorActorAuthority());
|
||||
ActorProcessor::AddProcessor(new ProcessorActorFrame());
|
||||
|
||||
WorldProcessor::AddProcessor(new ProcessorContainer());
|
||||
WorldProcessor::AddProcessor(new ProcessorDoorState());
|
||||
WorldProcessor::AddProcessor(new ProcessorMusicPlay());
|
||||
|
|
|
@ -110,6 +110,6 @@ void CellFunctions::SendCell(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CELL_CHANGE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CELL_CHANGE)->Send(false);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ void CharClassFunctions::SendClass(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARCLASS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARCLASS)->Send(false);
|
||||
}
|
||||
|
||||
void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept
|
||||
|
|
|
@ -15,11 +15,11 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
|
|||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "System: %s", message);
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player);
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(false);
|
||||
if (broadcast)
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(true);
|
||||
}
|
||||
|
||||
void ScriptFunctions::CleanChat(unsigned short pid)
|
||||
|
|
|
@ -18,8 +18,8 @@ void GUIFunctions::_MessageBox(unsigned short pid, int id, const char *label) no
|
|||
player->guiMessageBox.label = label;
|
||||
player->guiMessageBox.type = Player::GUIMessageBox::MessageBox;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
}
|
||||
|
||||
void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept
|
||||
|
@ -32,8 +32,8 @@ void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *labe
|
|||
player->guiMessageBox.buttons = buttons;
|
||||
player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
}
|
||||
|
||||
void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept
|
||||
|
@ -45,8 +45,8 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no
|
|||
player->guiMessageBox.label = label;
|
||||
player->guiMessageBox.type = Player::GUIMessageBox::InputDialog;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
}
|
||||
|
||||
void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const char *items)
|
||||
|
@ -59,8 +59,8 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const
|
|||
player->guiMessageBox.data = items;
|
||||
player->guiMessageBox.type = Player::GUIMessageBox::ListBox;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
|
||||
}
|
||||
|
||||
void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept
|
||||
|
@ -80,6 +80,6 @@ void GUIFunctions::SetConsoleAllow(unsigned short pid, bool state)
|
|||
|
||||
player->consoleAllowed = state;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_CONSOLE)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_CONSOLE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_CONSOLE)->Send(false);
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(false);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_EQUIPMENT)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_EQUIPMENT)->Send(true);
|
||||
}
|
||||
|
||||
void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept
|
||||
|
@ -156,8 +156,8 @@ void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept
|
|||
GET_PLAYER(pid, player, );
|
||||
|
||||
std::swap(player->inventoryChanges, player->inventoryChangesBuffer);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_INVENTORY)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_INVENTORY)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_INVENTORY)->Send(false);
|
||||
player->inventoryChanges = std::move(player->inventoryChangesBuffer);
|
||||
player->inventoryChangesBuffer.items.clear();
|
||||
}
|
||||
|
|
|
@ -109,6 +109,6 @@ void PositionFunctions::SendPos(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_POS)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_POS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_POS)->Send(false);
|
||||
}
|
||||
|
|
|
@ -73,8 +73,8 @@ void QuestFunctions::SendJournalChanges(unsigned short pid) noexcept
|
|||
GET_PLAYER(pid, player, );
|
||||
|
||||
std::swap(player->journalChanges, player->journalChangesBuffer);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_JOURNAL)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JOURNAL)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JOURNAL)->Send(false);
|
||||
player->journalChanges = std::move(player->journalChangesBuffer);
|
||||
player->journalChangesBuffer.journalItems.clear();
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid) noexcept
|
|||
GET_PLAYER(pid, player, );
|
||||
|
||||
std::swap(player->spellbookChanges, player->spellbookChangesBuffer);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPELLBOOK)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPELLBOOK)->Send(false);
|
||||
player->spellbookChanges = std::move(player->spellbookChangesBuffer);
|
||||
player->spellbookChangesBuffer.spells.clear();
|
||||
}
|
||||
|
|
|
@ -451,15 +451,15 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe
|
|||
player->charGenStage.current = start;
|
||||
player->charGenStage.end = end;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_CHARGEN)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARGEN)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_CHARGEN)->Send(false);
|
||||
}
|
||||
|
||||
void StatsFunctions::Resurrect(unsigned short pid)
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_RESURRECT)->RequestData(player->guid);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_RESURRECT)->RequestData(player->guid);
|
||||
}
|
||||
|
||||
void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
|
||||
|
@ -467,9 +467,9 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(false);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_BASEINFO)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BASEINFO)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BASEINFO)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_BASEINFO)->Send(true);
|
||||
}
|
||||
|
||||
void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept
|
||||
|
@ -477,9 +477,9 @@ void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(false);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(true);
|
||||
}
|
||||
|
||||
void StatsFunctions::SendAttributes(unsigned short pid) noexcept
|
||||
|
@ -487,9 +487,9 @@ void StatsFunctions::SendAttributes(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(false);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ATTRIBUTE)->Send(true);
|
||||
}
|
||||
|
||||
void StatsFunctions::SendSkills(unsigned short pid) noexcept
|
||||
|
@ -497,9 +497,9 @@ void StatsFunctions::SendSkills(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player,);
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(false);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_SKILL)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SKILL)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SKILL)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SKILL)->Send(true);
|
||||
}
|
||||
|
||||
void StatsFunctions::SendLevel(unsigned short pid) noexcept
|
||||
|
@ -507,7 +507,7 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept
|
|||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(false);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_PLAYER_LEVEL)->Send(true);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_LEVEL)->Send(true);
|
||||
}
|
||||
|
|
|
@ -273,56 +273,56 @@ void WorldFunctions::AddContainerItem() noexcept
|
|||
|
||||
void WorldFunctions::SendActorList() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_LIST)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_LIST)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendActorAuthority() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_AUTHORITY)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_ACTOR_AUTHORITY)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_AUTHORITY)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectDelete() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_DELETE)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectPlace() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_PLACE)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectScale() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_SCALE)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectLock() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_LOCK)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectUnlock() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_UNLOCK)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_OBJECT_UNLOCK)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendDoorState() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_DOOR_STATE)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SendContainer() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(scriptEvent.guid);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER)->setEvent(&scriptEvent);
|
||||
mwmp::Networking::get().getWorldPacketController()->GetPacket(ID_CONTAINER)->Send(scriptEvent.guid);
|
||||
}
|
||||
|
||||
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
|
||||
|
@ -334,8 +334,8 @@ void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
|
|||
player->month = -1;
|
||||
player->day = -1;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||
}
|
||||
|
||||
void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
|
||||
|
@ -347,8 +347,8 @@ void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
|
|||
player->month = month;
|
||||
player->day = -1;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -361,6 +361,6 @@ void WorldFunctions::SetDay(unsigned short pid, int day) noexcept
|
|||
player->month = -1;
|
||||
player->day = day;
|
||||
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->setPlayer(player);
|
||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GAME_TIME)->Send(false);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept
|
|||
if (processor.first == packet.data[0])
|
||||
{
|
||||
Player *player = Players::getPlayer(packet.guid);
|
||||
WorldPacket *myPacket = Networking::get().getWorldController()->GetPacket(packet.data[0]);
|
||||
WorldPacket *myPacket = Networking::get().getWorldPacketController()->GetPacket(packet.data[0]);
|
||||
|
||||
myPacket->setEvent(&event);
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PROCESSORACTORAUTHORITY_HPP
|
||||
#define OPENMW_PROCESSORACTORAUTHORITY_HPP
|
||||
|
||||
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||
#include "apps/openmw-mp/ActorProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorActorAuthority : public WorldProcessor
|
||||
class ProcessorActorAuthority : public ActorProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorActorAuthority()
|
||||
|
@ -13,7 +13,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_ACTOR_AUTHORITY)
|
||||
}
|
||||
|
||||
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||
void Do(ActorPacket &packet, Player &player, BaseEvent &event) override
|
||||
{
|
||||
packet.Send(true);
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PROCESSORACTORFRAME_HPP
|
||||
#define OPENMW_PROCESSORACTORFRAME_HPP
|
||||
|
||||
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||
#include "apps/openmw-mp/ActorProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorActorFrame : public WorldProcessor
|
||||
class ProcessorActorFrame : public ActorProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorActorFrame()
|
||||
|
@ -13,7 +13,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_ACTOR_FRAME)
|
||||
}
|
||||
|
||||
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||
void Do(ActorPacket &packet, Player &player, BaseEvent &event) override
|
||||
{
|
||||
// Send only to players who have the cell loaded
|
||||
Cell *serverCell = CellController::get()->getCell(&event.cell);
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PROCESSORACTORLIST_HPP
|
||||
#define OPENMW_PROCESSORACTORLIST_HPP
|
||||
|
||||
#include "apps/openmw-mp/WorldProcessor.hpp"
|
||||
#include "apps/openmw-mp/ActorProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorActorList : public WorldProcessor
|
||||
class ProcessorActorList : public ActorProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorActorList()
|
||||
|
@ -13,7 +13,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_ACTOR_LIST)
|
||||
}
|
||||
|
||||
void Do(WorldPacket &packet, Player &player, BaseEvent &event) override
|
||||
void Do(ActorPacket &packet, Player &player, BaseEvent &event) override
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str());
|
||||
|
|
@ -17,7 +17,7 @@ namespace mwmp
|
|||
ProcessorPlayerAttack()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_ATTACK)
|
||||
playerController = Networking::get().getPlayerController();
|
||||
playerController = Networking::get().getPlayerPacketController();
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace mwmp
|
|||
ProcessorPlayerCellChange()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_CELL_CHANGE)
|
||||
playerController = Networking::get().getPlayerController();
|
||||
playerController = Networking::get().getPlayerPacketController();
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace mwmp
|
|||
ProcessorPlayerCellState()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_CELL_STATE)
|
||||
playerController = Networking::get().getPlayerController();
|
||||
playerController = Networking::get().getPlayerPacketController();
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
|
|
|
@ -86,8 +86,8 @@ void Cell::updateLocal()
|
|||
}
|
||||
}
|
||||
|
||||
Main::get().getNetworking()->getWorldPacket(ID_ACTOR_FRAME)->setEvent(worldEvent);
|
||||
Main::get().getNetworking()->getWorldPacket(ID_ACTOR_FRAME)->Send();
|
||||
Main::get().getNetworking()->getActorPacket(ID_ACTOR_FRAME)->setEvent(worldEvent);
|
||||
Main::get().getNetworking()->getActorPacket(ID_ACTOR_FRAME)->Send();
|
||||
}
|
||||
|
||||
void Cell::updateDedicated(float dt)
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
using namespace std;
|
||||
using namespace mwmp;
|
||||
|
||||
Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerController(peer), worldController(peer)
|
||||
Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerPacketController(peer),
|
||||
actorPacketController(peer), worldPacketController(peer)
|
||||
{
|
||||
|
||||
RakNet::SocketDescriptor sd;
|
||||
|
@ -43,8 +44,9 @@ Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerC
|
|||
RakNet::StartupResult b = peer->Startup(1,&sd, 1);
|
||||
RakAssert(b==RAKNET_STARTED);
|
||||
|
||||
playerController.SetStream(0, &bsOut);
|
||||
worldController.SetStream(0, &bsOut);
|
||||
playerPacketController.SetStream(0, &bsOut);
|
||||
actorPacketController.SetStream(0, &bsOut);
|
||||
worldPacketController.SetStream(0, &bsOut);
|
||||
|
||||
connected = 0;
|
||||
}
|
||||
|
@ -246,7 +248,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
if (guid != myGuid)
|
||||
pl = Players::getPlayer(guid);
|
||||
|
||||
PlayerPacket *myPacket = playerController.GetPacket(packet->data[0]);
|
||||
PlayerPacket *myPacket = playerPacketController.GetPacket(packet->data[0]);
|
||||
|
||||
switch (packet->data[0])
|
||||
{
|
||||
|
@ -575,8 +577,8 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
myPacket->Send(serverAddr);
|
||||
|
||||
getLocalPlayer()->updateDynamicStats(true);
|
||||
playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(getLocalPlayer());
|
||||
playerController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr);
|
||||
playerPacketController.GetPacket(ID_PLAYER_DYNAMICSTATS)->setPlayer(getLocalPlayer());
|
||||
playerPacketController.GetPacket(ID_PLAYER_DYNAMICSTATS)->Send(serverAddr);
|
||||
}
|
||||
else if (pl != 0)
|
||||
{
|
||||
|
@ -822,7 +824,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
|||
}
|
||||
}
|
||||
|
||||
void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||
void Networking::processActorPacket(RakNet::Packet *packet)
|
||||
{
|
||||
RakNet::RakNetGUID guid;
|
||||
RakNet::BitStream bsIn(&packet->data[1], packet->length, false);
|
||||
|
@ -833,7 +835,7 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
if (guid != myGuid)
|
||||
pl = Players::getPlayer(guid);
|
||||
|
||||
WorldPacket *myPacket = worldController.GetPacket(packet->data[0]);
|
||||
ActorPacket *myPacket = actorPacketController.GetPacket(packet->data[0]);
|
||||
|
||||
myPacket->setEvent(&worldEvent);
|
||||
myPacket->Packet(&bsIn, false);
|
||||
|
@ -869,6 +871,29 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
|
|||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unhandled ActorPacket with identifier %i has arrived", packet->data[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void Networking::processWorldPacket(RakNet::Packet *packet)
|
||||
{
|
||||
RakNet::RakNetGUID guid;
|
||||
RakNet::BitStream bsIn(&packet->data[1], packet->length, false);
|
||||
bsIn.Read(guid);
|
||||
|
||||
DedicatedPlayer *pl = 0;
|
||||
static RakNet::RakNetGUID myGuid = getLocalPlayer()->guid;
|
||||
if (guid != myGuid)
|
||||
pl = Players::getPlayer(guid);
|
||||
|
||||
WorldPacket *myPacket = worldPacketController.GetPacket(packet->data[0]);
|
||||
|
||||
myPacket->setEvent(&worldEvent);
|
||||
myPacket->Packet(&bsIn, false);
|
||||
|
||||
switch (packet->data[0])
|
||||
{
|
||||
case ID_CONTAINER:
|
||||
{
|
||||
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCell(worldEvent.cell);
|
||||
|
@ -1046,11 +1071,15 @@ void Networking::receiveMessage(RakNet::Packet *packet)
|
|||
if (packet->length < 2)
|
||||
return;
|
||||
|
||||
if (playerController.ContainsPacket(packet->data[0]))
|
||||
if (playerPacketController.ContainsPacket(packet->data[0]))
|
||||
{
|
||||
processPlayerPacket(packet);
|
||||
}
|
||||
else if (worldController.ContainsPacket(packet->data[0]))
|
||||
else if (actorPacketController.ContainsPacket(packet->data[0]))
|
||||
{
|
||||
processActorPacket(packet);
|
||||
}
|
||||
else if (worldPacketController.ContainsPacket(packet->data[0]))
|
||||
{
|
||||
processWorldPacket(packet);
|
||||
}
|
||||
|
@ -1058,12 +1087,17 @@ void Networking::receiveMessage(RakNet::Packet *packet)
|
|||
|
||||
PlayerPacket *Networking::getPlayerPacket(RakNet::MessageID id)
|
||||
{
|
||||
return playerController.GetPacket(id);
|
||||
return playerPacketController.GetPacket(id);
|
||||
}
|
||||
|
||||
ActorPacket *Networking::getActorPacket(RakNet::MessageID id)
|
||||
{
|
||||
return actorPacketController.GetPacket(id);
|
||||
}
|
||||
|
||||
WorldPacket *Networking::getWorldPacket(RakNet::MessageID id)
|
||||
{
|
||||
return worldController.GetPacket(id);
|
||||
return worldPacketController.GetPacket(id);
|
||||
}
|
||||
|
||||
LocalPlayer *Networking::getLocalPlayer()
|
||||
|
|
|
@ -11,8 +11,11 @@
|
|||
|
||||
#include "WorldEvent.hpp"
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
#include <components/openmw-mp/Controllers/PlayerPacketController.hpp>
|
||||
#include <components/openmw-mp/Controllers/ActorPacketController.hpp>
|
||||
#include <components/openmw-mp/Controllers/WorldPacketController.hpp>
|
||||
|
||||
#include <components/files/collections.hpp>
|
||||
|
||||
namespace mwmp
|
||||
|
@ -28,6 +31,7 @@ namespace mwmp
|
|||
void update();
|
||||
|
||||
PlayerPacket *getPlayerPacket(RakNet::MessageID id);
|
||||
ActorPacket *getActorPacket(RakNet::MessageID id);
|
||||
WorldPacket *getWorldPacket(RakNet::MessageID id);
|
||||
|
||||
bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
|
||||
|
@ -49,12 +53,16 @@ namespace mwmp
|
|||
RakNet::SystemAddress serverAddr;
|
||||
RakNet::BitStream bsOut;
|
||||
|
||||
PlayerPacketController playerController;
|
||||
WorldPacketController worldController;
|
||||
PlayerPacketController playerPacketController;
|
||||
ActorPacketController actorPacketController;
|
||||
WorldPacketController worldPacketController;
|
||||
|
||||
WorldEvent worldEvent;
|
||||
|
||||
void processPlayerPacket(RakNet::Packet *packet);
|
||||
void processActorPacket(RakNet::Packet *packet);
|
||||
void processWorldPacket(RakNet::Packet *packet);
|
||||
|
||||
void receiveMessage(RakNet::Packet *packet);
|
||||
|
||||
void preInit(std::vector<std::string> &content, Files::Collections &collections);
|
||||
|
|
|
@ -512,8 +512,8 @@ void WorldEvent::sendActors(MWWorld::CellStore* cellStore)
|
|||
addObject(worldObject);
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_ACTOR_LIST)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_ACTOR_LIST)->Send();
|
||||
mwmp::Main::get().getNetworking()->getActorPacket(ID_ACTOR_LIST)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getActorPacket(ID_ACTOR_LIST)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
|
||||
|
|
|
@ -149,8 +149,10 @@ add_component_dir (version
|
|||
|
||||
add_component_dir (openmw-mp
|
||||
Log Utils
|
||||
Controllers/PlayerPacketController Controllers/WorldPacketController
|
||||
Packets/BasePacket Packets/Player/PlayerPacket Packets/World/WorldPacket
|
||||
|
||||
Controllers/PlayerPacketController Controllers/ActorPacketController Controllers/WorldPacketController
|
||||
|
||||
Packets/BasePacket Packets/Player/PlayerPacket Packets/Actor/ActorPacket Packets/World/WorldPacket
|
||||
|
||||
Packets/Player/PacketHandshake Packets/Player/PacketChatMessage
|
||||
|
||||
|
@ -165,7 +167,7 @@ add_component_dir (openmw-mp
|
|||
|
||||
Packets/Player/PacketGUIBoxes Packets/Player/PacketTime
|
||||
|
||||
Packets/World/PacketActorList Packets/World/PacketActorAuthority Packets/World/PacketActorFrame
|
||||
Packets/Actor/PacketActorList Packets/Actor/PacketActorAuthority Packets/Actor/PacketActorFrame
|
||||
|
||||
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectScale
|
||||
Packets/World/PacketObjectLock Packets/World/PacketObjectUnlock Packets/World/PacketObjectMove
|
||||
|
|
45
components/openmw-mp/Controllers/ActorPacketController.cpp
Normal file
45
components/openmw-mp/Controllers/ActorPacketController.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../Packets/Actor/PacketActorList.hpp"
|
||||
#include "../Packets/Actor/PacketActorAuthority.hpp"
|
||||
#include "../Packets/Actor/PacketActorFrame.hpp"
|
||||
|
||||
#include "ActorPacketController.hpp"
|
||||
|
||||
template <typename T>
|
||||
inline void AddPacket(mwmp::ActorPacketController::packets_t *packets, RakNet::RakPeerInterface *peer)
|
||||
{
|
||||
T *packet = new T(peer);
|
||||
typedef mwmp::ActorPacketController::packets_t::value_type value_t;
|
||||
packets->insert(value_t(packet->GetPacketID(), value_t::second_type(packet)));
|
||||
}
|
||||
|
||||
mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *peer)
|
||||
{
|
||||
AddPacket<PacketActorList>(&packets, peer);
|
||||
AddPacket<PacketActorAuthority>(&packets, peer);
|
||||
AddPacket<PacketActorFrame>(&packets, peer);
|
||||
}
|
||||
|
||||
|
||||
mwmp::ActorPacket *mwmp::ActorPacketController::GetPacket(RakNet::MessageID id)
|
||||
{
|
||||
return packets[(unsigned char)id].get();
|
||||
}
|
||||
|
||||
void mwmp::ActorPacketController::SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
||||
{
|
||||
BOOST_FOREACH( packets_t::value_type &packet, packets )
|
||||
packet.second->SetStreams(inStream, outStream);
|
||||
}
|
||||
|
||||
bool mwmp::ActorPacketController::ContainsPacket(RakNet::MessageID id)
|
||||
{
|
||||
BOOST_FOREACH(packets_t::value_type &packet, packets) {
|
||||
if (packet.first == id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
27
components/openmw-mp/Controllers/ActorPacketController.hpp
Normal file
27
components/openmw-mp/Controllers/ActorPacketController.hpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef OPENMW_ACTORPACKETCONTROLLER_HPP
|
||||
#define OPENMW_ACTORPACKETCONTROLLER_HPP
|
||||
|
||||
|
||||
#include <RakPeerInterface.h>
|
||||
#include "../Packets/Actor/ActorPacket.hpp"
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ActorPacketController
|
||||
{
|
||||
public:
|
||||
ActorPacketController(RakNet::RakPeerInterface *peer);
|
||||
ActorPacket *GetPacket(RakNet::MessageID id);
|
||||
void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream);
|
||||
|
||||
bool ContainsPacket(RakNet::MessageID id);
|
||||
|
||||
typedef std::map<unsigned char, boost::shared_ptr<ActorPacket> > packets_t;
|
||||
private:
|
||||
packets_t packets;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_WORLDPACKETCONTROLLER_HPP
|
|
@ -2,10 +2,6 @@
|
|||
#include <boost/foreach.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../Packets/World/PacketActorList.hpp"
|
||||
#include "../Packets/World/PacketActorAuthority.hpp"
|
||||
#include "../Packets/World/PacketActorFrame.hpp"
|
||||
|
||||
#include "../Packets/World/PacketObjectDelete.hpp"
|
||||
#include "../Packets/World/PacketObjectPlace.hpp"
|
||||
#include "../Packets/World/PacketObjectScale.hpp"
|
||||
|
@ -37,10 +33,6 @@ inline void AddPacket(mwmp::WorldPacketController::packets_t *packets, RakNet::R
|
|||
|
||||
mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer)
|
||||
{
|
||||
AddPacket<PacketActorList>(&packets, peer);
|
||||
AddPacket<PacketActorAuthority>(&packets, peer);
|
||||
AddPacket<PacketActorFrame>(&packets, peer);
|
||||
|
||||
AddPacket<PacketObjectDelete>(&packets, peer);
|
||||
AddPacket<PacketObjectPlace>(&packets, peer);
|
||||
AddPacket<PacketObjectScale>(&packets, peer);
|
||||
|
|
25
components/openmw-mp/Packets/Actor/ActorPacket.cpp
Normal file
25
components/openmw-mp/Packets/Actor/ActorPacket.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include <PacketPriority.h>
|
||||
#include <RakPeer.h>
|
||||
#include "ActorPacket.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
ActorPacket::ActorPacket(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
||||
{
|
||||
packetID = 0;
|
||||
priority = HIGH_PRIORITY;
|
||||
reliability = RELIABLE_ORDERED;
|
||||
this->peer = peer;
|
||||
}
|
||||
|
||||
ActorPacket::~ActorPacket()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ActorPacket::setEvent(BaseEvent *event)
|
||||
{
|
||||
this->event = event;
|
||||
guid = event->guid;
|
||||
}
|
30
components/openmw-mp/Packets/Actor/ActorPacket.hpp
Normal file
30
components/openmw-mp/Packets/Actor/ActorPacket.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef OPENMW_ACTORPACKET_HPP
|
||||
#define OPENMW_ACTORPACKET_HPP
|
||||
|
||||
#include <string>
|
||||
#include <RakNetTypes.h>
|
||||
#include <BitStream.h>
|
||||
#include <PacketPriority.h>
|
||||
#include <components/openmw-mp/Base/BaseEvent.hpp>
|
||||
|
||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
||||
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ActorPacket : public BasePacket
|
||||
{
|
||||
public:
|
||||
ActorPacket(RakNet::RakPeerInterface *peer);
|
||||
|
||||
~ActorPacket();
|
||||
|
||||
void setEvent(BaseEvent *event);
|
||||
|
||||
protected:
|
||||
BaseEvent *event;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_ACTORPACKET_HPP
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketActorAuthority::PacketActorAuthority(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||
PacketActorAuthority::PacketActorAuthority(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
|
||||
{
|
||||
packetID = ID_ACTOR_AUTHORITY;
|
||||
}
|
||||
|
||||
void PacketActorAuthority::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, send);
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (!send)
|
||||
event->objectChanges.objects.clear();
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PACKETACTORAUTHORITY_HPP
|
||||
#define OPENMW_PACKETACTORAUTHORITY_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketActorAuthority : public WorldPacket
|
||||
class PacketActorAuthority : public ActorPacket
|
||||
{
|
||||
public:
|
||||
PacketActorAuthority(RakNet::RakPeerInterface *peer);
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketActorFrame::PacketActorFrame(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||
PacketActorFrame::PacketActorFrame(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
|
||||
{
|
||||
packetID = ID_ACTOR_FRAME;
|
||||
}
|
||||
|
||||
void PacketActorFrame::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, send);
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
if (!send)
|
||||
event->objectChanges.objects.clear();
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PACKETACTORFRAME_HPP
|
||||
#define OPENMW_PACKETACTORFRAME_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketActorFrame : public WorldPacket
|
||||
class PacketActorFrame : public ActorPacket
|
||||
{
|
||||
public:
|
||||
PacketActorFrame(RakNet::RakPeerInterface *peer);
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketActorList::PacketActorList(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
|
||||
PacketActorList::PacketActorList(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
|
||||
{
|
||||
packetID = ID_ACTOR_LIST;
|
||||
}
|
||||
|
||||
void PacketActorList::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, send);
|
||||
ActorPacket::Packet(bs, send);
|
||||
|
||||
RW(event->action, send);
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PACKETACTORLIST_HPP
|
||||
#define OPENMW_PACKETACTORLIST_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
|
||||
#include <components/openmw-mp/Packets/Actor/ActorPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketActorList : public WorldPacket
|
||||
class PacketActorList : public ActorPacket
|
||||
{
|
||||
public:
|
||||
PacketActorList(RakNet::RakPeerInterface *peer);
|
Loading…
Reference in a new issue