Merge pull request #199 from TES3MP/tes3mp-introduce-Client-processors

Add tes3mp-introduce-Client-processors commits up to 18 Apr 2017
pull/176/merge
David Cernat 8 years ago committed by GitHub
commit 818fc459aa

@ -96,7 +96,8 @@ add_openmw_dir (mwbase
inputmanager windowmanager statemanager
)
add_openmw_dir (mwmp Main Networking LocalPlayer DedicatedPlayer LocalActor DedicatedActor ActorList WorldEvent Cell CellController MechanicsHelper GUIChat GUILogin GUIController PlayerMarkerCollection GUIDialogList)
add_openmw_dir (mwmp Main Networking LocalPlayer DedicatedPlayer LocalActor DedicatedActor ActorList WorldEvent Cell CellController MechanicsHelper GUIChat GUILogin
GUIController PlayerMarkerCollection GUIDialogList WorldController PlayerProcessor WorldProcessor ProcessorInitializer)
# Main executable

@ -6,6 +6,7 @@
#define OPENMW_LOCALPLAYER_HPP
#include <components/openmw-mp/Base/BasePlayer.hpp>
#include "../mwworld/ptr.hpp"
#include <RakNetTypes.h>
namespace mwmp

@ -1,3 +1,6 @@
#ifndef OPENMW_MWMP_MAIN
#define OPENMW_MWMP_MAIN
#include "../mwworld/ptr.hpp"
#include <boost/program_options.hpp>
#include <components/files/collections.hpp>
@ -54,3 +57,5 @@ namespace mwmp
unsigned short port;
};
}
#endif //OPENMW_MWMP_MAIN

@ -37,6 +37,12 @@
#include "MechanicsHelper.hpp"
#include "LocalPlayer.hpp"
#include "DedicatedPlayer.hpp"
#include "LocalPlayer.hpp"
#include "GUIController.hpp"
#include "Main.hpp"
#include "PlayerProcessor.hpp"
#include "ProcessorInitializer.hpp"
#include "WorldProcessor.hpp"
using namespace std;
using namespace mwmp;
@ -55,6 +61,7 @@ Networking::Networking(): peer(RakNet::RakPeerInterface::GetInstance()), playerP
worldPacketController.SetStream(0, &bsOut);
connected = 0;
ProcessorInitializer();
}
Networking::~Networking()
@ -151,6 +158,8 @@ void Networking::connect(const std::string &ip, unsigned short port, std::vector
case ID_CONNECTION_REQUEST_ACCEPTED:
{
serverAddr = packet->systemAddress;
PlayerProcessor::SetServerAddr(packet->systemAddress);
WorldProcessor::SetServerAddr(packet->systemAddress);
connected = true;
queue = false;
@ -245,537 +254,8 @@ void Networking::preInit(std::vector<std::string> &content, Files::Collections &
void Networking::processPlayerPacket(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 = PlayerList::getPlayer(guid);
PlayerPacket *myPacket = playerPacketController.GetPacket(packet->data[0]);
switch (packet->data[0])
{
case ID_HANDSHAKE:
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
break;
}
case ID_PLAYER_BASEINFO:
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO from server");
if (guid == myGuid)
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about my id");
if (packet->length == myPacket->headerSize())
{
LOG_APPEND(Log::LOG_INFO, "- Requesting info");
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
LOG_APPEND(Log::LOG_INFO, "- Updating LocalPlayer");
getLocalPlayer()->updateChar();
}
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl == 0 ? "new player" : pl->npc.mName.c_str());
if (pl == 0)
{
LOG_APPEND(Log::LOG_INFO, "- Exchanging data with new player");
pl = PlayerList::newPlayer(guid);
}
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
PlayerList::createPlayer(guid);
}
break;
}
case ID_PLAYER_POS:
{
if (guid == myGuid)
{
if (packet->length != myPacket->headerSize())
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_PLAYER_POS changed by server");
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setPosition();
}
else
getLocalPlayer()->updatePosition(true);
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateMarker();
}
break;
}
case ID_USER_MYID:
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_USER_MYID from server");
myGuid = guid;
getLocalPlayer()->guid = guid;
break;
}
case ID_USER_DISCONNECTED:
{
if (guid == myGuid)
MWBase::Environment::get().getStateManager()->requestQuit();
else if (pl != 0)
PlayerList::disconnectPlayer(guid);
}
case ID_PLAYER_EQUIPMENT:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->updateEquipment(true);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setEquipment();
}
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateEquipment();
}
break;
}
case ID_PLAYER_INVENTORY:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->updateInventory(true);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
int inventoryAction = getLocalPlayer()->inventoryChanges.action;
if (inventoryAction == InventoryChanges::ADD)
{
getLocalPlayer()->addItems();
}
else if (inventoryAction == InventoryChanges::REMOVE)
{
getLocalPlayer()->removeItems();
}
else // InventoryChanges::SET
{
getLocalPlayer()->setInventory();
}
}
}
break;
}
case ID_PLAYER_SPELLBOOK:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->sendSpellbook();
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
int spellbookAction = getLocalPlayer()->spellbookChanges.action;
if (spellbookAction == SpellbookChanges::ADD)
{
getLocalPlayer()->addSpells();
}
else if (spellbookAction == SpellbookChanges::REMOVE)
{
getLocalPlayer()->removeSpells();
}
else // SpellbookChanges::SET
{
getLocalPlayer()->setSpellbook();
}
}
}
break;
}
case ID_PLAYER_JOURNAL:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
// Entire journal cannot currently be requested from players
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->addJournalItems();
}
}
break;
}
case ID_PLAYER_ATTACK:
{
if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
Main::get().getMechanicsHelper()->processAttack(pl->getPtr(), pl->attack);
}
break;
}
case ID_PLAYER_STATS_DYNAMIC:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->updateStatsDynamic(true);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setDynamicStats();
}
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
MWMechanics::DynamicStat<float> value;
for (int i = 0; i < 3; ++i)
{
value.readState(pl->creatureStats.mDynamic[i]);
ptrCreatureStats->setDynamic(i, value);
}
}
break;
}
case ID_PLAYER_DEATH:
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_DEATH from server");
if (guid == myGuid)
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about me");
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::DynamicStat<float> health = player.getClass().getCreatureStats(player).getHealth();
health.setCurrent(0);
player.getClass().getCreatureStats(player).setHealth(health);
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
}
else if (pl != 0)
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->npc.mName.c_str());
MWMechanics::DynamicStat<float> health;
pl->creatureStats.mDead = true;
health.readState(pl->creatureStats.mDynamic[0]);
health.setCurrent(0);
health.writeState(pl->creatureStats.mDynamic[0]);
pl->getPtr().getClass().getCreatureStats(pl->getPtr()).setHealth(health);
}
break;
}
case ID_PLAYER_RESURRECT:
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_RESURRECT from server");
if (guid == myGuid)
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about me");
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
player.getClass().getCreatureStats(player).resurrect();
// If this player had a weapon or spell readied when dying, they will
// still have it readied but be unable to use it unless we clear it here
player.getClass().getNpcStats(player).setDrawState(MWMechanics::DrawState_Nothing);
myPacket->setPlayer(getLocalPlayer());
myPacket->Send(serverAddr);
getLocalPlayer()->updateStatsDynamic(true);
playerPacketController.GetPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(getLocalPlayer());
playerPacketController.GetPacket(ID_PLAYER_STATS_DYNAMIC)->Send(serverAddr);
}
else if (pl != 0)
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", pl->npc.mName.c_str());
pl->creatureStats.mDead = false;
if (pl->creatureStats.mDynamic[0].mMod < 1)
pl->creatureStats.mDynamic[0].mMod = 1;
pl->creatureStats.mDynamic[0].mCurrent = pl->creatureStats.mDynamic[0].mMod;
pl->getPtr().getClass().getCreatureStats(pl->getPtr()).resurrect();
MWMechanics::DynamicStat<float> health;
health.readState(pl->creatureStats.mDynamic[0]);
pl->getPtr().getClass().getCreatureStats(pl->getPtr()).setHealth(health);
}
break;
}
case ID_PLAYER_CELL_CHANGE:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
getLocalPlayer()->updateCell(true);
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setCell();
}
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateCell();
}
break;
}
case ID_PLAYER_CELL_STATE:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
getLocalPlayer()->sendCellStates();
}
break;
}
case ID_PLAYER_ANIM_FLAGS:
{
if (guid == myGuid)
getLocalPlayer()->updateAnimFlags(true);
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
pl->updateAnimFlags();
}
break;
}
case ID_CHAT_MESSAGE:
{
std::string message;
if (guid == myGuid)
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
message = getLocalPlayer()->chatMessage;
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
message = pl->chatMessage;
}
Main::get().getGUIController()->printChatMessage(message);
break;
}
case ID_PLAYER_CHARGEN:
{
if (guid == myGuid)
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
}
break;
}
case ID_PLAYER_ATTRIBUTE:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->updateAttributes(true);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setAttributes();
}
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
MWMechanics::AttributeValue attributeValue;
for (int i = 0; i < 8; ++i)
{
attributeValue.readState(pl->creatureStats.mAttributes[i]);
ptrCreatureStats->setAttribute(i, attributeValue);
}
}
break;
}
case ID_PLAYER_SKILL:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->updateSkills(true);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setSkills();
}
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::NpcStats *ptrNpcStats = &ptrPlayer.getClass().getNpcStats(ptrPlayer);
MWMechanics::SkillValue skillValue;
for (int i = 0; i < 27; ++i)
{
skillValue.readState(pl->npcStats.mSkills[i]);
ptrNpcStats->setSkill(i, skillValue);
}
}
break;
}
case ID_PLAYER_LEVEL:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
{
getLocalPlayer()->updateLevel(true);
}
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setLevel();
}
}
else if (pl != 0)
{
myPacket->setPlayer(pl);
myPacket->Packet(&bsIn, false);
MWWorld::Ptr ptrPlayer = pl->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
ptrCreatureStats->setLevel(pl->creatureStats.mLevel);
}
break;
}
case ID_GUI_MESSAGEBOX:
{
if (guid == myGuid)
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s", getLocalPlayer()->guiMessageBox.type,
getLocalPlayer()->guiMessageBox.label.c_str());
int messageBoxType = getLocalPlayer()->guiMessageBox.type;
if (messageBoxType == BasePlayer::GUIMessageBox::MessageBox)
Main::get().getGUIController()->showMessageBox(getLocalPlayer()->guiMessageBox);
else if (messageBoxType == BasePlayer::GUIMessageBox::CustomMessageBox)
Main::get().getGUIController()->showCustomMessageBox(getLocalPlayer()->guiMessageBox);
else if (messageBoxType == BasePlayer::GUIMessageBox::InputDialog)
Main::get().getGUIController()->showInputBox(getLocalPlayer()->guiMessageBox);
else if (messageBoxType == BasePlayer::GUIMessageBox::ListBox)
Main::get().getGUIController()->showDialogList(getLocalPlayer()->guiMessageBox);
}
break;
}
case ID_PLAYER_CHARCLASS:
{
if (guid == myGuid)
{
if (packet->length == myPacket->headerSize())
getLocalPlayer()->sendClass();
else
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
getLocalPlayer()->setClass();
}
}
break;
}
case ID_GAME_TIME:
{
if (guid == myGuid)
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
MWBase::World *world = MWBase::Environment::get().getWorld();
if (getLocalPlayer()->hour != -1)
world->setHour(getLocalPlayer()->hour);
else if (getLocalPlayer()->day != -1)
world->setDay(getLocalPlayer()->day);
else if (getLocalPlayer()->month != -1)
world->setMonth(getLocalPlayer()->month);
}
break;
}
case ID_GAME_CONSOLE:
{
myPacket->setPlayer(getLocalPlayer());
myPacket->Packet(&bsIn, false);
break;
}
default:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unhandled PlayerPacket with identifier %i has arrived", packet->data[0]);
}
if(!PlayerProcessor::Process(*packet))
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled PlayerPacket with identifier %i has arrived", packet->data[0]);
}
void Networking::processActorPacket(RakNet::Packet *packet)
@ -869,192 +349,8 @@ void Networking::processActorPacket(RakNet::Packet *packet)
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 = PlayerList::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()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received ID_CONTAINER about %s", worldEvent.cell.getDescription().c_str());
LOG_APPEND(Log::LOG_VERBOSE, "- action: %i", worldEvent.action);
// If we've received a request for information, comply with it
if (worldEvent.action == mwmp::BaseEvent::REQUEST)
worldEvent.sendContainers(ptrCellStore);
// Otherwise, edit containers based on the information received
else
worldEvent.editContainers(ptrCellStore);
break;
}
case ID_OBJECT_PLACE:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE about %s", worldEvent.cell.getDescription().c_str());
worldEvent.placeObjects(ptrCellStore);
break;
}
case ID_OBJECT_DELETE:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE about %s", worldEvent.cell.getDescription().c_str());
worldEvent.deleteObjects(ptrCellStore);
break;
}
case ID_OBJECT_LOCK:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK about %s", worldEvent.cell.getDescription().c_str());
worldEvent.lockObjects(ptrCellStore);
break;
}
case ID_OBJECT_UNLOCK:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK about %s", worldEvent.cell.getDescription().c_str());
worldEvent.unlockObjects(ptrCellStore);
break;
}
case ID_OBJECT_SCALE:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE about %s", worldEvent.cell.getDescription().c_str());
worldEvent.scaleObjects(ptrCellStore);
break;
}
case ID_OBJECT_MOVE:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE about %s", worldEvent.cell.getDescription().c_str());
worldEvent.moveObjects(ptrCellStore);
break;
}
case ID_OBJECT_ROTATE:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE about %s", worldEvent.cell.getDescription().c_str());
worldEvent.rotateObjects(ptrCellStore);
break;
}
case ID_OBJECT_ANIM_PLAY:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY about %s", worldEvent.cell.getDescription().c_str());
worldEvent.animateObjects(ptrCellStore);
break;
}
case ID_DOOR_STATE:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE about %s", worldEvent.cell.getDescription().c_str());
worldEvent.activateDoors(ptrCellStore);
break;
}
case ID_SCRIPT_LOCAL_SHORT:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT about %s", worldEvent.cell.getDescription().c_str());
worldEvent.setLocalShorts(ptrCellStore);
break;
}
case ID_SCRIPT_LOCAL_FLOAT:
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(worldEvent.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT about %s", worldEvent.cell.getDescription().c_str());
worldEvent.setLocalFloats(ptrCellStore);
break;
}
case ID_SCRIPT_MEMBER_SHORT:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT");
worldEvent.setMemberShorts();
break;
}
case ID_SCRIPT_GLOBAL_SHORT:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT");
worldEvent.setGlobalShorts();
break;
}
case ID_MUSIC_PLAY:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY");
worldEvent.playMusic();
break;
}
case ID_VIDEO_PLAY:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY");
worldEvent.playVideo();
break;
}
default:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unhandled WorldPacket with identifier %i has arrived", packet->data[0]);
}
if (!WorldProcessor::Process(*packet, worldEvent))
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled WorldPacket with identifier %i has arrived", packet->data[0]);
}
void Networking::receiveMessage(RakNet::Packet *packet)

@ -0,0 +1,73 @@
//
// Created by koncord on 04.04.17.
//
#include <boost/foreach.hpp>
#include "Networking.hpp"
#include "PlayerProcessor.hpp"
#include "DedicatedPlayer.hpp"
#include "LocalPlayer.hpp"
#include "Main.hpp"
using namespace mwmp;
PlayerProcessor::processors_t PlayerProcessor::processors;
RakNet::RakNetGUID PlayerProcessor::myGuid;
RakNet::RakNetGUID PlayerProcessor::guid;
RakNet::SystemAddress PlayerProcessor::serverAddr;
bool PlayerProcessor::request;
void PlayerProcessor::AddProcessor(PlayerProcessor *processor)
{
BOOST_FOREACH(processors_t::value_type &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(), boost::shared_ptr<PlayerProcessor>(processor)));
}
bool PlayerProcessor::Process(RakNet::Packet &packet)
{
RakNet::BitStream bsIn(&packet.data[1], packet.length, false);
bsIn.Read(guid);
PlayerPacket *myPacket = Main::get().getNetworking()->getPlayerPacket(packet.data[0]);
myPacket->SetReadStream(&bsIn);
/*if(myPacket == 0)
{
// error: packet not found
}*/
BOOST_FOREACH(processors_t::value_type &processor, processors)
{
if(processor.first == packet.data[0])
{
myGuid = Main::get().getLocalPlayer()->guid;
request = packet.length == myPacket->headerSize();
BasePlayer *player = 0;
if (guid != myGuid)
player = PlayerList::getPlayer(guid);
else
player = Main::get().getLocalPlayer();
if(!request && !processor.second->avoidReading && player != 0)
{
myPacket->setPlayer(player);
myPacket->Read();
}
processor.second->Do(*myPacket, player);
return true;
}
}
return false;
}
LocalPlayer *PlayerProcessor::getLocalPlayer()
{
return Main::get().getLocalPlayer();
}

@ -0,0 +1,58 @@
//
// Created by koncord on 03.04.17.
//
#ifndef OPENMW_PLAYERPROCESSOR_HPP
#define OPENMW_PLAYERPROCESSOR_HPP
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Base/BasePacketProcessor.hpp>
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
#include "LocalPlayer.hpp"
#include "DedicatedPlayer.hpp"
namespace mwmp
{
class PlayerProcessor : public BasePacketProcessor
{
public:
virtual void Do(PlayerPacket &packet, BasePlayer *player) = 0;
static bool Process(RakNet::Packet &packet);
static void AddProcessor(PlayerProcessor *processor);
static void SetServerAddr(RakNet::SystemAddress addr)
{
serverAddr = addr;
}
typedef boost::unordered_map<unsigned char, boost::shared_ptr<PlayerProcessor> > processors_t;
//typedef std::unordered_map<unsigned char, std::unique_ptr<PlayerProcessor> > processors_t;
private:
static processors_t processors;
static bool request;
protected:
inline bool isRequest()
{
return request;
}
inline bool isLocal()
{
return guid == myGuid;
}
LocalPlayer *getLocalPlayer();
protected:
static RakNet::RakNetGUID myGuid;
static RakNet::RakNetGUID guid;
static RakNet::SystemAddress serverAddr;
};
}
#endif //OPENMW_PLAYERPROCESSOR_HPP

@ -0,0 +1,95 @@
//
// Created by koncord on 31.03.17.
//
#include "ProcessorInitializer.hpp"
#include "PlayerProcessor.hpp"
#include "processors/player/ProcessorPlayerPos.hpp"
#include "processors/player/ProcessorPlayerCellChange.hpp"
#include "processors/player/ProcessorPlayerCellState.hpp"
#include "processors/player/ProcessorPlayerAttribute.hpp"
#include "processors/player/ProcessorPlayerSkill.hpp"
#include "processors/player/ProcessorPlayerLevel.hpp"
#include "processors/player/ProcessorPlayerEquipment.hpp"
#include "processors/player/ProcessorPlayerInventory.hpp"
#include "processors/player/ProcessorPlayerSpellbook.hpp"
#include "processors/player/ProcessorPlayerJournal.hpp"
#include "processors/player/ProcessorPlayerAttack.hpp"
#include "processors/player/ProcessorPlayerDynamicStats.hpp"
#include "processors/player/ProcessorPlayerDeath.hpp"
#include "processors/player/ProcessorPlayerResurrect.hpp"
#include "processors/player/ProcessorPlayerDrawState.hpp"
#include "processors/player/ProcessorChatMessage.hpp"
#include "processors/player/ProcessorPlayerCharGen.hpp"
#include "processors/player/ProcessorGUIMessageBox.hpp"
#include "processors/player/ProcessorPlayerCharClass.hpp"
#include "processors/player/ProcessorHandshake.hpp"
#include "processors/player/ProcessorPlayerBaseInfo.hpp"
#include "processors/player/ProcessorUserDisconnected.hpp"
#include "processors/player/ProcessorUserMyID.hpp"
#include "WorldProcessor.hpp"
#include "processors/world/ProcessorContainer.hpp"
#include "processors/world/ProcessorDoorState.hpp"
#include "processors/world/ProcessorMusicPlay.hpp"
#include "processors/world/ProcessorObjectAnimPlay.hpp"
#include "processors/world/ProcessorObjectDelete.hpp"
#include "processors/world/ProcessorObjectLock.hpp"
#include "processors/world/ProcessorObjectMove.hpp"
#include "processors/world/ProcessorObjectPlace.hpp"
#include "processors/world/ProcessorObjectRotate.hpp"
#include "processors/world/ProcessorObjectScale.hpp"
#include "processors/world/ProcessorObjectUnlock.hpp"
#include "processors/world/ProcessorScriptGlobalShort.hpp"
#include "processors/world/ProcessorScriptLocalFloat.hpp"
#include "processors/world/ProcessorScriptLocalShort.hpp"
#include "processors/world/ProcessorScriptMemberShort.hpp"
#include "processors/world/ProcessorVideoPlay.hpp"
using namespace mwmp;
void ProcessorInitializer()
{
PlayerProcessor::AddProcessor(new ProcessorPlayerPos());
PlayerProcessor::AddProcessor(new ProcessorPlayerCellChange());
PlayerProcessor::AddProcessor(new ProcessorPlayerCellState());
PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute());
PlayerProcessor::AddProcessor(new ProcessorPlayerSkill());
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment());
PlayerProcessor::AddProcessor(new ProcessorPlayerInventory());
PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook());
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
PlayerProcessor::AddProcessor(new ProcessorPlayerAttack());
PlayerProcessor::AddProcessor(new ProcessorPlayerDynamicStats());
PlayerProcessor::AddProcessor(new ProcessorPlayerDeath());
PlayerProcessor::AddProcessor(new ProcessorPlayerResurrect());
PlayerProcessor::AddProcessor(new ProcessorPlayerDrawState());
PlayerProcessor::AddProcessor(new ProcessorChatMessage());
PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen());
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass());
PlayerProcessor::AddProcessor(new ProcessorHandshake());
PlayerProcessor::AddProcessor(new ProcessorPlayerBaseInfo());
PlayerProcessor::AddProcessor(new ProcessorUserDisconnected());
PlayerProcessor::AddProcessor(new ProcessorUserMyID());
WorldProcessor::AddProcessor(new ProcessorContainer());
WorldProcessor::AddProcessor(new ProcessorDoorState());
WorldProcessor::AddProcessor(new ProcessorMusicPlay());
WorldProcessor::AddProcessor(new ProcessorObjectAnimPlay());
WorldProcessor::AddProcessor(new ProcessorObjectDelete());
WorldProcessor::AddProcessor(new ProcessorObjectLock());
WorldProcessor::AddProcessor(new ProcessorObjectMove());
WorldProcessor::AddProcessor(new ProcessorObjectPlace());
WorldProcessor::AddProcessor(new ProcessorObjectRotate());
WorldProcessor::AddProcessor(new ProcessorObjectScale());
WorldProcessor::AddProcessor(new ProcessorObjectUnlock());
WorldProcessor::AddProcessor(new ProcessorScriptGlobalShort());
WorldProcessor::AddProcessor(new ProcessorScriptLocalFloat());
WorldProcessor::AddProcessor(new ProcessorScriptLocalShort());
WorldProcessor::AddProcessor(new ProcessorScriptMemberShort());
WorldProcessor::AddProcessor(new ProcessorVideoPlay());
}

@ -0,0 +1,11 @@
//
// Created by koncord on 31.03.17.
//
#ifndef OPENMW_INIT_PROCESSORS_HPP
#define OPENMW_INIT_PROCESSORS_HPP
void ProcessorInitializer();
#endif //OPENMW_INIT_PROCESSORS_HPP

@ -0,0 +1,60 @@
//
// Created by koncord on 16.04.17.
//
#include <boost/foreach.hpp>
#include "WorldProcessor.hpp"
#include "Main.hpp"
#include "Networking.hpp"
using namespace mwmp;
WorldProcessor::processors_t WorldProcessor::processors;
RakNet::RakNetGUID WorldProcessor::guid;
RakNet::SystemAddress WorldProcessor::serverAddr;
bool WorldProcessor::request;
bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
{
RakNet::BitStream bsIn(&packet.data[1], packet.length, false);
bsIn.Read(guid);
WorldPacket *myPacket = Main::get().getNetworking()->getWorldPacket(packet.data[0]);
myPacket->setEvent(&event);
myPacket->SetReadStream(&bsIn);
BOOST_FOREACH(processors_t::value_type &processor, processors)
{
if(processor.first == packet.data[0])
{
request = packet.length == myPacket->headerSize();
if(!request && !processor.second->avoidReading)
{
myPacket->Read();
}
processor.second->Do(*myPacket, event);
return true;
}
}
return false;
}
void WorldProcessor::AddProcessor(mwmp::WorldProcessor *processor)
{
BOOST_FOREACH(processors_t::value_type &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(), boost::shared_ptr<WorldProcessor>(processor)));
}
LocalPlayer *WorldProcessor::getLocalPlayer()
{
return Main::get().getLocalPlayer();
}

@ -0,0 +1,51 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_WORLDPROCESSSOR_HPP
#define OPENMW_WORLDPROCESSSOR_HPP
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Base/BasePacketProcessor.hpp>
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
#include "WorldEvent.hpp"
#include "LocalPlayer.hpp"
#include "DedicatedPlayer.hpp"
namespace mwmp
{
class WorldProcessor : public BasePacketProcessor
{
public:
virtual void Do(WorldPacket &packet, WorldEvent &event) = 0;
static bool Process(RakNet::Packet &packet, WorldEvent &event);
static void AddProcessor(WorldProcessor *processor);
static void SetServerAddr(RakNet::SystemAddress addr)
{
serverAddr = addr;
}
typedef boost::unordered_map<unsigned char, boost::shared_ptr<WorldProcessor> > processors_t;
protected:
inline bool isRequest()
{
return request;
}
LocalPlayer *getLocalPlayer();
protected:
static RakNet::RakNetGUID guid;
static RakNet::SystemAddress serverAddr;
private:
static processors_t processors;
static bool request;
};
}
#endif //OPENMW_WORLDPROCESSSOR_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORCHATMESSAGE_HPP
#define OPENMW_PROCESSORCHATMESSAGE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/GUIController.hpp"
namespace mwmp
{
class ProcessorChatMessage : public PlayerProcessor
{
public:
ProcessorChatMessage()
{
BPP_INIT(ID_CHAT_MESSAGE)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
Main::get().getGUIController()->printChatMessage(player->chatMessage);
}
};
}
#endif //OPENMW_PROCESSORCHATMESSAGE_HPP

@ -0,0 +1,44 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORGUIMESSAGEBOX_HPP
#define OPENMW_PROCESSORGUIMESSAGEBOX_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorGUIMessageBox : public PlayerProcessor
{
public:
ProcessorGUIMessageBox()
{
BPP_INIT(ID_GUI_MESSAGEBOX)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s", player->guiMessageBox.type,
player->guiMessageBox.label.c_str());
int messageBoxType = player->guiMessageBox.type;
if (messageBoxType == BasePlayer::GUIMessageBox::MessageBox)
Main::get().getGUIController()->showMessageBox(player->guiMessageBox);
else if (messageBoxType == BasePlayer::GUIMessageBox::CustomMessageBox)
Main::get().getGUIController()->showCustomMessageBox(player->guiMessageBox);
else if (messageBoxType == BasePlayer::GUIMessageBox::InputDialog)
Main::get().getGUIController()->showInputBox(player->guiMessageBox);
else if (messageBoxType == BasePlayer::GUIMessageBox::ListBox)
Main::get().getGUIController()->showDialogList(player->guiMessageBox);
}
}
};
}
#endif //OPENMW_PROCESSORGUIMESSAGEBOX_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORGAMECONSOLE_HPP
#define OPENMW_PROCESSORGAMECONSOLE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorGameConsole : public PlayerProcessor
{
public:
ProcessorGameConsole()
{
BPP_INIT(ID_GAME_CONSOLE)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
}
};
}
#endif //OPENMW_PROCESSORGAMECONSOLE_HPP

@ -0,0 +1,39 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORGAMETIME_HPP
#define OPENMW_PROCESSORGAMETIME_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorGameTime : public PlayerProcessor
{
public:
ProcessorGameTime()
{
BPP_INIT(ID_PLAYER_CHARCLASS)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
MWBase::World *world = MWBase::Environment::get().getWorld();
if (player->hour != -1)
world->setHour(player->hour);
else if (player->day != -1)
world->setDay(player->day);
else if (player->month != -1)
world->setMonth(player->month);
}
}
};
}
#endif //OPENMW_PROCESSORGAMETIME_HPP

@ -0,0 +1,28 @@
//
// Created by koncord on 04.04.17.
//
#ifndef OPENMW_PROCESSORHANDSHAKE_HPP
#define OPENMW_PROCESSORHANDSHAKE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorHandshake : public PlayerProcessor
{
public:
ProcessorHandshake()
{
BPP_INIT(ID_HANDSHAKE)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
packet.setPlayer(getLocalPlayer()); // player is 0 because myGuid will be setted after ProcessUserMyID
packet.Send(serverAddr);
}
};
}
#endif //OPENMW_PROCESSORHANDSHAKE_HPP

@ -0,0 +1,36 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERATTACK_HPP
#define OPENMW_PROCESSORPLAYERATTACK_HPP
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
#include "apps/openmw/mwmp/MechanicsHelper.hpp"
#include "apps/openmw/mwbase/world.hpp"
#include "apps/openmw/mwworld/containerstore.hpp"
#include "apps/openmw/mwworld/inventorystore.hpp"
#include "apps/openmw/mwmechanics/combat.hpp"
#include "apps/openmw/mwbase/environment.hpp"
namespace mwmp
{
class ProcessorPlayerAttack : public PlayerProcessor
{
public:
ProcessorPlayerAttack()
{
BPP_INIT(ID_PLAYER_ATTACK)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
Main::get().getMechanicsHelper()->processAttack(static_cast<DedicatedPlayer*>(player)->getPtr(), player->attack);
}
};
}
#endif //OPENMW_PROCESSORPLAYERATTACK_HPP

@ -0,0 +1,49 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERATTRIBUTE_HPP
#define OPENMW_PROCESSORPLAYERATTRIBUTE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
#include "apps/openmw/mwmechanics/npcstats.hpp"
#include "apps/openmw/mwclass/npc.hpp"
namespace mwmp
{
class ProcessorPlayerAttribute : public PlayerProcessor
{
public:
ProcessorPlayerAttribute()
{
BPP_INIT(ID_PLAYER_ATTRIBUTE)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if(isRequest())
static_cast<LocalPlayer *>(player)->updateAttributes(true);
else
static_cast<LocalPlayer *>(player)->setAttributes();
}
else
{
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
MWMechanics::AttributeValue attributeValue;
for (int i = 0; i < 8; ++i)
{
attributeValue.readState(player->creatureStats.mAttributes[i]);
ptrCreatureStats->setAttribute(i, attributeValue);
}
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERATTRIBUTE_HPP

@ -0,0 +1,58 @@
//
// Created by koncord on 04.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERBASEINFO_HPP
#define OPENMW_PROCESSORPLAYERBASEINFO_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerBaseInfo : public PlayerProcessor
{
public:
ProcessorPlayerBaseInfo()
{
BPP_INIT(ID_PLAYER_BASEINFO)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO from server");
if(isLocal())
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about my id");
if(isRequest())
{
LOG_APPEND(Log::LOG_INFO, "- Requesting info");
packet.Send(serverAddr);
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Updating LocalPlayer");
static_cast<LocalPlayer*>(player)->updateChar();
}
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", player == 0 ? "new player" : player->npc.mName.c_str());
if (player == 0)
{
LOG_APPEND(Log::LOG_INFO, "- Exchanging data with new player");
player = PlayerList::newPlayer(guid);
packet.setPlayer(player);
packet.Read();
}
PlayerList::createPlayer(guid);
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERBASEINFO_HPP

@ -0,0 +1,37 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERCELLCHANGE_HPP
#define OPENMW_PROCESSORPLAYERCELLCHANGE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerCellChange : public PlayerProcessor
{
public:
ProcessorPlayerCellChange()
{
BPP_INIT(ID_PLAYER_CELL_CHANGE)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if (isRequest())
static_cast<LocalPlayer *>(player)->updateCell(true);
else
static_cast<LocalPlayer *>(player)->setCell();
}
else
static_cast<DedicatedPlayer*>(player)->updateCell();
}
};
}
#endif //OPENMW_PROCESSORPLAYERCELLCHANGE_HPP

@ -0,0 +1,31 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERCELLSTATE_HPP
#define OPENMW_PROCESSORPLAYERCELLSTATE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerCellState : public PlayerProcessor
{
public:
ProcessorPlayerCellState()
{
BPP_INIT(ID_PLAYER_CELL_STATE)
avoidReading = true;
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal() && isRequest())
static_cast<LocalPlayer *>(player)->sendCellStates();
}
};
}
#endif //OPENMW_PROCESSORPLAYERCELLSTATE_HPP

@ -0,0 +1,35 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERCHARCLASS_HPP
#define OPENMW_PROCESSORPLAYERCHARCLASS_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerCharClass : public PlayerProcessor
{
public:
ProcessorPlayerCharClass()
{
BPP_INIT(ID_PLAYER_CHARCLASS)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if(isRequest())
static_cast<LocalPlayer *>(player)->sendClass();
else
static_cast<LocalPlayer *>(player)->setClass();
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERCHARCLASS_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERCHARGEN_HPP
#define OPENMW_PROCESSORPLAYERCHARGEN_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerCharGen : public PlayerProcessor
{
public:
ProcessorPlayerCharGen()
{
BPP_INIT(ID_PLAYER_CHARGEN)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
}
};
}
#endif //OPENMW_PROCESSORPLAYERCHARGEN_HPP

@ -0,0 +1,53 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERDEATH_HPP
#define OPENMW_PROCESSORPLAYERDEATH_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerDeath : public PlayerProcessor
{
public:
ProcessorPlayerDeath()
{
BPP_INIT(ID_PLAYER_DEATH)
avoidReading = true;
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_DEATH from server");
if (isLocal())
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about me");
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::DynamicStat<float> health = playerPtr.getClass().getCreatureStats(playerPtr).getHealth();
health.setCurrent(0);
playerPtr.getClass().getCreatureStats(playerPtr).setHealth(health);
packet.setPlayer(player);
packet.Send(serverAddr);
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str());
MWMechanics::DynamicStat<float> health;
player->creatureStats.mDead = true;
health.readState(player->creatureStats.mDynamic[0]);
health.setCurrent(0);
health.writeState(player->creatureStats.mDynamic[0]);
MWWorld::Ptr ptr = static_cast<DedicatedPlayer*>(player)->getPtr();
ptr.getClass().getCreatureStats(ptr).setHealth(health);
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERDEATH_HPP

@ -0,0 +1,35 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERDRAWSTATE_HPP
#define OPENMW_PROCESSORPLAYERDRAWSTATE_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerDrawState : public PlayerProcessor
{
public:
ProcessorPlayerDrawState()
{
BPP_INIT(ID_PLAYER_ANIM_FLAGS)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if(isRequest())
static_cast<LocalPlayer *>(player)->updateAnimFlags(true);
}
else
static_cast<DedicatedPlayer *>(player)->updateAnimFlags();
}
};
}
#endif //OPENMW_PROCESSORPLAYERDRAWSTATE_HPP

@ -0,0 +1,47 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERDYNAMICSTATS_HPP
#define OPENMW_PROCESSORPLAYERDYNAMICSTATS_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerDynamicStats : public PlayerProcessor
{
public:
ProcessorPlayerDynamicStats()
{
BPP_INIT(ID_PLAYER_STATS_DYNAMIC)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if (isRequest())
static_cast<LocalPlayer *>(player)->updateStatsDynamic(true);
else
static_cast<LocalPlayer *>(player)->setDynamicStats();
}
else
{
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer*>(player)->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
MWMechanics::DynamicStat<float> value;
for (int i = 0; i < 3; ++i)
{
value.readState(player->creatureStats.mDynamic[i]);
ptrCreatureStats->setDynamic(i, value);
}
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERDYNAMICSTATS_HPP

@ -0,0 +1,36 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYEREQUIPMENT_HPP
#define OPENMW_PROCESSORPLAYEREQUIPMENT_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerEquipment : public PlayerProcessor
{
public:
ProcessorPlayerEquipment()
{
BPP_INIT(ID_PLAYER_EQUIPMENT)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if (isRequest())
static_cast<LocalPlayer*>(player)->updateEquipment(true);
else
static_cast<LocalPlayer*>(player)->setEquipment();
}
else
static_cast<DedicatedPlayer*>(player)->updateEquipment();
}
};
}
#endif //OPENMW_PROCESSORPLAYEREQUIPMENT_HPP

@ -0,0 +1,43 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERUPDATEINVENTORY_HPP
#define OPENMW_PROCESSORPLAYERUPDATEINVENTORY_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerInventory : public PlayerProcessor
{
public:
ProcessorPlayerInventory()
{
BPP_INIT(ID_PLAYER_INVENTORY)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (!isLocal()) return;
if (isRequest())
static_cast<LocalPlayer*>(player)->updateInventory(true);
else
{
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
int inventoryAction = localPlayer.inventoryChanges.action;
if (inventoryAction == InventoryChanges::ADD)
localPlayer.addItems();
else if (inventoryAction == InventoryChanges::REMOVE)
localPlayer.removeItems();
else // InventoryChanges::SET
localPlayer.setInventory();
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERUPDATEINVENTORY_HPP

@ -0,0 +1,36 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERJOURNAL_HPP
#define OPENMW_PROCESSORPLAYERJOURNAL_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerJournal : public PlayerProcessor
{
public:
ProcessorPlayerJournal()
{
BPP_INIT(ID_PLAYER_JOURNAL)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (!isLocal()) return;
if (isRequest())
{
// Entire journal cannot currently be requested from players
}
else
static_cast<LocalPlayer*>(player)->addJournalItems();
}
};
}
#endif //OPENMW_PROCESSORPLAYERJOURNAL_HPP

@ -0,0 +1,42 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERLEVEL_HPP
#define OPENMW_PROCESSORPLAYERLEVEL_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerLevel : public PlayerProcessor
{
public:
ProcessorPlayerLevel()
{
BPP_INIT(ID_PLAYER_LEVEL)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if(isRequest())
static_cast<LocalPlayer *>(player)->updateLevel(true);
else
static_cast<LocalPlayer *>(player)->setLevel();
}
else
{
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &ptrPlayer.getClass().getCreatureStats(ptrPlayer);
ptrCreatureStats->setLevel(player->creatureStats.mLevel);
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERLEVEL_HPP

@ -0,0 +1,41 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERPOS_HPP
#define OPENMW_PROCESSORPLAYERPOS_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerPos : public PlayerProcessor
{
public:
ProcessorPlayerPos()
{
BPP_INIT(ID_PLAYER_POS)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if (!isRequest())
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_PLAYER_POS changed by server");
static_cast<LocalPlayer*>(player)->setPosition();
}
else
static_cast<LocalPlayer*>(player)->updatePosition(true);
}
else // dedicated player
static_cast<DedicatedPlayer*>(player)->updateMarker();
}
};
}
#endif //OPENMW_PROCESSORPLAYERPOS_HPP

@ -0,0 +1,67 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERRESURRECT_HPP
#define OPENMW_PROCESSORPLAYERRESURRECT_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/Networking.hpp"
namespace mwmp
{
class ProcessorPlayerResurrect : public PlayerProcessor
{
public:
ProcessorPlayerResurrect()
{
BPP_INIT(ID_PLAYER_RESURRECT)
avoidReading = true;
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_RESURRECT from server");
if (isLocal())
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about me");
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
playerPtr.getClass().getCreatureStats(playerPtr).resurrect();
// If this player had a weapon or spell readied when dying, they will
// still have it readied but be unable to use it unless we clear it here
playerPtr.getClass().getNpcStats(playerPtr).setDrawState(MWMechanics::DrawState_Nothing);
packet.setPlayer(player);
packet.Send(serverAddr);
static_cast<LocalPlayer*>(player)->updateStatsDynamic(true);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_STATS_DYNAMIC)->setPlayer(player);
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_STATS_DYNAMIC)->Send(serverAddr);
}
else
{
LOG_APPEND(Log::LOG_INFO, "- Packet was about %s", player->npc.mName.c_str());
player->creatureStats.mDead = false;
if (player->creatureStats.mDynamic[0].mMod < 1)
player->creatureStats.mDynamic[0].mMod = 1;
player->creatureStats.mDynamic[0].mCurrent = player->creatureStats.mDynamic[0].mMod;
MWWorld::Ptr ptr = static_cast<DedicatedPlayer*>(player)->getPtr();
ptr.getClass().getCreatureStats(ptr).resurrect();
MWMechanics::DynamicStat<float> health;
health.readState(player->creatureStats.mDynamic[0]);
ptr.getClass().getCreatureStats(ptr).setHealth(health);
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERRESURRECT_HPP

@ -0,0 +1,47 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERSKILL_HPP
#define OPENMW_PROCESSORPLAYERSKILL_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerSkill : public PlayerProcessor
{
public:
ProcessorPlayerSkill()
{
BPP_INIT(ID_PLAYER_SKILL)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
{
if(isRequest())
static_cast<LocalPlayer *>(player)->updateSkills(true);
else
static_cast<LocalPlayer *>(player)->setSkills();
}
else
{
MWWorld::Ptr ptrPlayer = static_cast<DedicatedPlayer *>(player)->getPtr();
MWMechanics::NpcStats *ptrNpcStats = &ptrPlayer.getClass().getNpcStats(ptrPlayer);
MWMechanics::SkillValue skillValue;
for (int i = 0; i < 27; ++i)
{
skillValue.readState(player->npcStats.mSkills[i]);
ptrNpcStats->setSkill(i, skillValue);
}
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERSKILL_HPP

@ -0,0 +1,44 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
#define OPENMW_PROCESSORPLAYERSPELLBOOK_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorPlayerSpellbook : public PlayerProcessor
{
public:
ProcessorPlayerSpellbook()
{
BPP_INIT(ID_PLAYER_SPELLBOOK)
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (!isLocal()) return;
if (isRequest())
static_cast<LocalPlayer*>(player)->sendSpellbook();
else
{
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
int spellbookAction = localPlayer.spellbookChanges.action;
if (spellbookAction == SpellbookChanges::ADD)
localPlayer.addSpells();
else if (spellbookAction == SpellbookChanges::REMOVE)
localPlayer.removeSpells();
else // SpellbookChanges::SET
localPlayer.setSpellbook();
}
}
};
}
#endif //OPENMW_PROCESSORPLAYERSPELLBOOK_HPP

@ -0,0 +1,33 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORUSERDISCONNECTED_HPP
#define OPENMW_PROCESSORUSERDISCONNECTED_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
#include "apps/openmw/mwstate/statemanagerimp.hpp"
namespace mwmp
{
class ProcessorUserDisconnected : public PlayerProcessor
{
public:
ProcessorUserDisconnected()
{
BPP_INIT(ID_USER_DISCONNECTED)
avoidReading = true;
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
if (isLocal())
MWBase::Environment::get().getStateManager()->requestQuit();
else
PlayerList::disconnectPlayer(guid);
}
};
}
#endif //OPENMW_PROCESSORUSERDISCONNECTED_HPP

@ -0,0 +1,31 @@
//
// Created by koncord on 16.04.17.
//
#ifndef OPENMW_PROCESSORUSERMYID_HPP
#define OPENMW_PROCESSORUSERMYID_HPP
#include "apps/openmw/mwmp/PlayerProcessor.hpp"
namespace mwmp
{
class ProcessorUserMyID : public PlayerProcessor
{
public:
ProcessorUserMyID()
{
BPP_INIT(ID_USER_MYID)
avoidReading = true;
}
virtual void Do(PlayerPacket &packet, BasePlayer *player)
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_USER_MYID from server");
myGuid = guid;
getLocalPlayer()->guid = guid;
}
};
}
#endif //OPENMW_PROCESSORUSERMYID_HPP

@ -0,0 +1,32 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_BASEOBJECTPROCESSOR_HPP
#define OPENMW_BASEOBJECTPROCESSOR_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/CellController.hpp"
#include "apps/openmw/mwworld/cellstore.hpp"
namespace mwmp
{
class BaseObjectProcessor : public WorldProcessor
{
public:
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
MWWorld::CellStore *ptrCellStore = Main::get().getCellController()->getCellStore(event.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), event.cell.getDescription().c_str());
}
protected:
MWWorld::CellStore *ptrCellStore;
};
}
#endif //OPENMW_BASEOBJECTPROCESSOR_HPP

@ -0,0 +1,37 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORCONTAINER_HPP
#define OPENMW_PROCESSORCONTAINER_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorContainer : public BaseObjectProcessor
{
public:
ProcessorContainer()
{
BPP_INIT(ID_CONTAINER)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
LOG_APPEND(Log::LOG_VERBOSE, "- action: %i", event.action);
// If we've received a request for information, comply with it
if (event.action == mwmp::BaseEvent::REQUEST)
event.sendContainers(ptrCellStore);
// Otherwise, edit containers based on the information received
else
event.editContainers(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSORCONTAINER_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSDOORSTATE_HPP
#define OPENMW_PROCESSDOORSTATE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorDoorState : public BaseObjectProcessor
{
public:
ProcessorDoorState()
{
BPP_INIT(ID_DOOR_STATE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.activateDoors(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSDOORSTATE_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORMUSICPLAY_HPP
#define OPENMW_PROCESSORMUSICPLAY_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorMusicPlay : public WorldProcessor
{
public:
ProcessorMusicPlay()
{
BPP_INIT(ID_MUSIC_PLAY)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.playMusic();
}
};
}
#endif //OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTANIMPLAY_HPP
#define OPENMW_PROCESSOROBJECTANIMPLAY_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectAnimPlay : public BaseObjectProcessor
{
public:
ProcessorObjectAnimPlay()
{
BPP_INIT(ID_OBJECT_ANIM_PLAY)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.animateObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTANIMPLAY_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTDELETE_HPP
#define OPENMW_PROCESSOROBJECTDELETE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectDelete : public BaseObjectProcessor
{
public:
ProcessorObjectDelete()
{
BPP_INIT(ID_OBJECT_DELETE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.deleteObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTDELETE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTLOCK_HPP
#define OPENMW_PROCESSOROBJECTLOCK_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectLock : public BaseObjectProcessor
{
public:
ProcessorObjectLock()
{
BPP_INIT(ID_OBJECT_LOCK)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.lockObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTLOCK_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTMOVE_HPP
#define OPENMW_PROCESSOROBJECTMOVE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectMove : public BaseObjectProcessor
{
public:
ProcessorObjectMove()
{
BPP_INIT(ID_OBJECT_MOVE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.moveObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTMOVE_HPP

@ -0,0 +1,31 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTPLACE_HPP
#define OPENMW_PROCESSOROBJECTPLACE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectPlace : public BaseObjectProcessor
{
public:
ProcessorObjectPlace()
{
BPP_INIT(ID_OBJECT_PLACE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.placeObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTPLACE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTROTATE_HPP
#define OPENMW_PROCESSOROBJECTROTATE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectRotate : public BaseObjectProcessor
{
public:
ProcessorObjectRotate()
{
BPP_INIT(ID_OBJECT_ROTATE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.rotateObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTROTATE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTSCALE_HPP
#define OPENMW_PROCESSOROBJECTSCALE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectScale : public BaseObjectProcessor
{
public:
ProcessorObjectScale()
{
BPP_INIT(ID_OBJECT_SCALE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.scaleObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTSCALE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTUNLOCK_HPP
#define OPENMW_PROCESSOROBJECTUNLOCK_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectUnlock : public BaseObjectProcessor
{
public:
ProcessorObjectUnlock()
{
BPP_INIT(ID_OBJECT_UNLOCK)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.unlockObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTUNLOCK_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP
#define OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorScriptGlobalShort : public WorldProcessor
{
public:
ProcessorScriptGlobalShort()
{
BPP_INIT(ID_SCRIPT_GLOBAL_SHORT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.setGlobalShorts();
}
};
}
#endif //OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTLOCALFLOAT_HPP
#define OPENMW_PROCESSORSCRIPTLOCALFLOAT_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorScriptLocalFloat : public BaseObjectProcessor
{
public:
ProcessorScriptLocalFloat()
{
BPP_INIT(ID_SCRIPT_LOCAL_FLOAT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.setLocalFloats(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSORSCRIPTLOCALFLOAT_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTLOCALSHORT_HPP
#define OPENMW_PROCESSORSCRIPTLOCALSHORT_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorScriptLocalShort : public BaseObjectProcessor
{
public:
ProcessorScriptLocalShort()
{
BPP_INIT(ID_SCRIPT_LOCAL_SHORT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.setLocalShorts(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSORSCRIPTLOCALSHORT_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTMEMBERSHORT_HPP
#define OPENMW_PROCESSORSCRIPTMEMBERSHORT_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorScriptMemberShort : public WorldProcessor
{
public:
ProcessorScriptMemberShort()
{
BPP_INIT(ID_SCRIPT_MEMBER_SHORT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.setMemberShorts();
}
};
}
#endif //OPENMW_PROCESSORSCRIPTMEMBERSHORT_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORVIDEOPLAY_HPP
#define OPENMW_PROCESSORVIDEOPLAY_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorVideoPlay : public WorldProcessor
{
public:
ProcessorVideoPlay()
{
BPP_INIT(ID_VIDEO_PLAY)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.playVideo();
}
};
}
#endif //OPENMW_PROCESSORVIDEOPLAY_HPP
Loading…
Cancel
Save