Merge pull request #199 from TES3MP/tes3mp-introduce-Client-processors
Add tes3mp-introduce-Client-processors commits up to 18 Apr 2017pull/176/merge
commit
818fc459aa
@ -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…
Reference in New Issue