diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index eda0bc86b..d752012a5 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -144,10 +144,10 @@ set(PROCESSORS_WORLD processors/world/ProcessorObjectDelete.hpp processors/world/ProcessorObjectLock.hpp processors/world/ProcessorObjectMove.hpp processors/world/ProcessorObjectPlace.hpp processors/world/ProcessorObjectRotate.hpp processors/world/ProcessorObjectScale.hpp - processors/world/ProcessorObjectSpawn.hpp processors/world/ProcessorObjectTrap.hpp - processors/world/ProcessorScriptLocalShort.hpp processors/world/ProcessorScriptLocalFloat.hpp - processors/world/ProcessorScriptMemberShort.hpp processors/world/ProcessorScriptGlobalShort.hpp - processors/world/ProcessorVideoPlay.hpp + processors/world/ProcessorObjectSpawn.hpp processors/world/ProcessorObjectState.hpp + processors/world/ProcessorObjectTrap.hpp processors/world/ProcessorScriptLocalShort.hpp + processors/world/ProcessorScriptLocalFloat.hpp processors/world/ProcessorScriptMemberShort.hpp + processors/world/ProcessorScriptGlobalShort.hpp processors/world/ProcessorVideoPlay.hpp ) source_group(tes3mp-server\\processors\\world FILES ${PROCESSORS_WORLD}) diff --git a/apps/openmw-mp/processors/ProcessorInitializer.cpp b/apps/openmw-mp/processors/ProcessorInitializer.cpp index 4c0405995..8167e635d 100644 --- a/apps/openmw-mp/processors/ProcessorInitializer.cpp +++ b/apps/openmw-mp/processors/ProcessorInitializer.cpp @@ -63,6 +63,7 @@ #include "world/ProcessorObjectRotate.hpp" #include "world/ProcessorObjectScale.hpp" #include "world/ProcessorObjectSpawn.hpp" +#include "world/ProcessorObjectState.hpp" #include "world/ProcessorObjectTrap.hpp" #include "world/ProcessorScriptLocalShort.hpp" #include "world/ProcessorScriptLocalFloat.hpp" @@ -130,6 +131,7 @@ void ProcessorInitializer() WorldProcessor::AddProcessor(new ProcessorObjectRotate()); WorldProcessor::AddProcessor(new ProcessorObjectScale()); WorldProcessor::AddProcessor(new ProcessorObjectSpawn()); + WorldProcessor::AddProcessor(new ProcessorObjectState()); WorldProcessor::AddProcessor(new ProcessorObjectTrap()); WorldProcessor::AddProcessor(new ProcessorScriptLocalShort()); WorldProcessor::AddProcessor(new ProcessorScriptLocalFloat()); diff --git a/apps/openmw-mp/processors/world/ProcessorObjectState.hpp b/apps/openmw-mp/processors/world/ProcessorObjectState.hpp new file mode 100644 index 000000000..52b0e2687 --- /dev/null +++ b/apps/openmw-mp/processors/world/ProcessorObjectState.hpp @@ -0,0 +1,27 @@ +#ifndef OPENMW_PROCESSOROBJECTSTATE_HPP +#define OPENMW_PROCESSOROBJECTSTATE_HPP + +#include "../WorldProcessor.hpp" + +namespace mwmp +{ + class ProcessorObjectState : public WorldProcessor + { + public: + ProcessorObjectState() + { + BPP_INIT(ID_OBJECT_STATE) + } + + void Do(WorldPacket &packet, Player &player, BaseEvent &event) override + { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player.npc.mName.c_str()); + + packet.Send(true); + + Script::Call(player.getId(), event.cell.getDescription().c_str()); + } + }; +} + +#endif //OPENMW_PROCESSOROBJECTSTATE_HPP diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 580b932f1..2699ca0c0 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -111,20 +111,21 @@ add_openmw_dir (mwmp/processors/actor ProcessorActorAI ProcessorActorAnimFlags P ProcessorActorPosition ProcessorActorSpeech ProcessorActorStatsDynamic ProcessorActorTest ) -add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageBox ProcessorHandshake ProcessorUserDisconnected - ProcessorUserMyID ProcessorGameSettings ProcessorGameTime ProcessorGameWeather ProcessorPlayerBaseInfo - ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBook - ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen - ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInventory - ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel ProcessorPlayerMap ProcessorPlayerPosition - ProcessorPlayerResurrect ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic - ProcessorPlayerTopic - ) - -add_openmw_dir (mwmp/processors/world BaseObjectProcessor ProcessorContainer ProcessorDoorState ProcessorMusicPlay - ProcessorVideoPlay ProcessorObjectAnimPlay ProcessorObjectDelete ProcessorObjectLock ProcessorObjectMove - ProcessorObjectPlace ProcessorObjectRotate ProcessorObjectScale ProcessorObjectSpawn ProcessorObjectTrap - ProcessorScriptLocalShort ProcessorScriptLocalFloat ProcessorScriptMemberShort ProcessorScriptGlobalShort +add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageBox ProcessorHandshake + ProcessorUserDisconnected ProcessorUserMyID ProcessorGameSettings ProcessorGameTime ProcessorGameWeather + ProcessorPlayerBaseInfo ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute + ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass + ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction + ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerLevel + ProcessorPlayerMap ProcessorPlayerPosition ProcessorPlayerResurrect ProcessorPlayerSkill ProcessorPlayerSpeech + ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic + ) + +add_openmw_dir (mwmp/processors/world BaseObjectProcessor ProcessorConsoleCommand ProcessorContainer ProcessorDoorState + ProcessorMusicPlay ProcessorVideoPlay ProcessorObjectAnimPlay ProcessorObjectDelete ProcessorObjectLock + ProcessorObjectMove ProcessorObjectPlace ProcessorObjectRotate ProcessorObjectScale ProcessorObjectSpawn + ProcessorObjectState ProcessorObjectTrap ProcessorScriptLocalShort ProcessorScriptLocalFloat ProcessorScriptMemberShort + ProcessorScriptGlobalShort ) # Main executable diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index 63d64df7d..2925f3646 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -29,6 +29,7 @@ #include "player/ProcessorPlayerEquipment.hpp" #include "player/ProcessorPlayerFaction.hpp" #include "player/ProcessorPlayerInventory.hpp" +#include "player/ProcessorPlayerJail.hpp" #include "player/ProcessorPlayerJournal.hpp" #include "player/ProcessorPlayerKillCount.hpp" #include "player/ProcessorPlayerLevel.hpp" @@ -44,6 +45,7 @@ #include "player/ProcessorPlayerTopic.hpp" #include "WorldProcessor.hpp" +#include "world/ProcessorConsoleCommand.hpp" #include "world/ProcessorContainer.hpp" #include "world/ProcessorDoorState.hpp" #include "world/ProcessorMusicPlay.hpp" @@ -55,6 +57,7 @@ #include "world/ProcessorObjectRotate.hpp" #include "world/ProcessorObjectScale.hpp" #include "world/ProcessorObjectSpawn.hpp" +#include "world/ProcessorObjectState.hpp" #include "world/ProcessorObjectTrap.hpp" #include "world/ProcessorScriptLocalShort.hpp" #include "world/ProcessorScriptLocalFloat.hpp" diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerJail.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerJail.hpp new file mode 100644 index 000000000..25c372056 --- /dev/null +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerJail.hpp @@ -0,0 +1,30 @@ +#ifndef OPENMW_PROCESSORPLAYERJAIL_HPP +#define OPENMW_PROCESSORPLAYERJAIL_HPP + +#include "../PlayerProcessor.hpp" +#include "apps/openmw/mwmp/Main.hpp" +#include "apps/openmw/mwmp/Networking.hpp" + +namespace mwmp +{ + class ProcessorPlayerJail : public PlayerProcessor + { + public: + ProcessorPlayerJail() + { + BPP_INIT(ID_PLAYER_JAIL) + } + + virtual void Do(PlayerPacket &packet, BasePlayer *player) + { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_JAIL from server"); + + if (isLocal()) + { + // To be filled in + } + } + }; +} + +#endif //OPENMW_PROCESSORPLAYERJAIL_HPP diff --git a/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp b/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp new file mode 100644 index 000000000..9d6229a89 --- /dev/null +++ b/apps/openmw/mwmp/processors/world/ProcessorConsoleCommand.hpp @@ -0,0 +1,24 @@ +#ifndef OPENMW_PROCESSORCONSOLECOMMAND_HPP +#define OPENMW_PROCESSORCONSOLECOMMAND_HPP + +#include "../WorldProcessor.hpp" + +namespace mwmp +{ + class ProcessorConsoleCommand : public WorldProcessor + { + public: + ProcessorConsoleCommand() + { + BPP_INIT(ID_CONSOLE_COMMAND) + } + + virtual void Do(WorldPacket &packet, WorldEvent &event) + { + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str()); + //event.runConsoleCommand(); + } + }; +} + +#endif //OPENMW_PROCESSORCONSOLECOMMAND_HPP diff --git a/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp b/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp new file mode 100644 index 000000000..34e02e425 --- /dev/null +++ b/apps/openmw/mwmp/processors/world/ProcessorObjectState.hpp @@ -0,0 +1,25 @@ +#ifndef OPENMW_PROCESSOROBJECTSTATE_HPP +#define OPENMW_PROCESSOROBJECTSTATE_HPP + +#include "BaseObjectProcessor.hpp" + +namespace mwmp +{ + class ProcessorObjectState : public BaseObjectProcessor + { + public: + ProcessorObjectState() + { + BPP_INIT(ID_OBJECT_STATE) + } + + virtual void Do(WorldPacket &packet, WorldEvent &event) + { + BaseObjectProcessor::Do(packet, event); + + //event.setObjectStates(ptrCellStore); + } + }; +} + +#endif //OPENMW_PROCESSOROBJECTSTATE_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index dd2347306..cd905ce50 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -180,16 +180,17 @@ add_component_dir (openmw-mp/Packets/Player PacketPlayerBaseInfo PacketPlayerCharGen PacketPlayerActiveSkills PacketPlayerAnimFlags PacketPlayerAnimPlay PacketPlayerAttack PacketPlayerAttribute PacketPlayerBook PacketPlayerBounty PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment PacketPlayerFaction - PacketPlayerInventory PacketPlayerJournal PacketPlayerKillCount PacketPlayerLevel PacketPlayerMap - PacketPlayerPosition PacketPlayerRegionAuthority PacketPlayerRest PacketPlayerResurrect PacketPlayerSkill - PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic + PacketPlayerInventory PacketPlayerJail PacketPlayerJournal PacketPlayerKillCount PacketPlayerLevel + PacketPlayerMap PacketPlayerPosition PacketPlayerRegionAuthority PacketPlayerRest PacketPlayerResurrect + PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic ) add_component_dir (openmw-mp/Packets/World WorldPacket - PacketContainer PacketObjectAnimPlay PacketObjectDelete PacketDoorState PacketObjectLock PacketObjectMove PacketObjectPlace - PacketObjectRotate PacketObjectScale PacketObjectSpawn PacketObjectTrap PacketMusicPlay PacketVideoPlay - PacketScriptLocalShort PacketScriptLocalFloat PacketScriptMemberShort PacketScriptGlobalShort + PacketConsoleCommand PacketContainer PacketObjectAnimPlay PacketObjectDelete PacketDoorState PacketObjectLock + PacketObjectMove PacketObjectPlace PacketObjectRotate PacketObjectScale PacketObjectSpawn PacketObjectState + PacketObjectTrap PacketMusicPlay PacketVideoPlay PacketScriptLocalShort PacketScriptLocalFloat + PacketScriptMemberShort PacketScriptGlobalShort ) add_component_dir (fallback diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 884f4a40f..611e7eb5e 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -253,6 +253,8 @@ namespace mwmp int deathPenaltyJailDays; bool ignoreJailTeleportation; + int jailDays; + unsigned int resurrectType; }; } diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 20487e55a..4d9f8dd48 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -22,6 +22,7 @@ #include "../Packets/Player/PacketPlayerEquipment.hpp" #include "../Packets/Player/PacketPlayerFaction.hpp" #include "../Packets/Player/PacketPlayerInventory.hpp" +#include "../Packets/Player/PacketPlayerJail.hpp" #include "../Packets/Player/PacketPlayerJournal.hpp" #include "../Packets/Player/PacketPlayerKillCount.hpp" #include "../Packets/Player/PacketPlayerLevel.hpp" @@ -73,6 +74,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); diff --git a/components/openmw-mp/Controllers/WorldPacketController.cpp b/components/openmw-mp/Controllers/WorldPacketController.cpp index 2e707fc30..eb0c7292f 100644 --- a/components/openmw-mp/Controllers/WorldPacketController.cpp +++ b/components/openmw-mp/Controllers/WorldPacketController.cpp @@ -6,6 +6,7 @@ #include "../Packets/World/PacketObjectRotate.hpp" #include "../Packets/World/PacketObjectScale.hpp" #include "../Packets/World/PacketObjectSpawn.hpp" +#include "../Packets/World/PacketObjectState.hpp" #include "../Packets/World/PacketObjectTrap.hpp" #include "../Packets/World/PacketContainer.hpp" @@ -13,6 +14,7 @@ #include "../Packets/World/PacketMusicPlay.hpp" #include "../Packets/World/PacketVideoPlay.hpp" +#include "../Packets/World/PacketConsoleCommand.hpp" #include "../Packets/World/PacketScriptLocalShort.hpp" #include "../Packets/World/PacketScriptLocalFloat.hpp" #include "../Packets/World/PacketScriptMemberShort.hpp" @@ -38,6 +40,7 @@ mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *pee AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); @@ -45,6 +48,7 @@ mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *pee AddPacket(&packets, peer); AddPacket(&packets, peer); + AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 4fba4784a..649fd786d 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -38,6 +38,7 @@ enum GameMessages ID_PLAYER_EQUIPMENT, ID_PLAYER_FACTION, ID_PLAYER_INVENTORY, + ID_PLAYER_JAIL, ID_PLAYER_JOURNAL, ID_PLAYER_KILL_COUNT, ID_PLAYER_LEVEL, @@ -74,8 +75,10 @@ enum GameMessages ID_OBJECT_ROTATE, ID_OBJECT_SCALE, ID_OBJECT_SPAWN, + ID_OBJECT_STATE, ID_OBJECT_TRAP, + ID_CONSOLE_COMMAND, ID_CONTAINER, ID_DOOR_STATE, ID_MUSIC_PLAY, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp b/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp new file mode 100644 index 000000000..e7c75d782 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp @@ -0,0 +1,17 @@ +#include "PacketPlayerJail.hpp" +#include +#include + +using namespace mwmp; + +PacketPlayerJail::PacketPlayerJail(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_JAIL; +} + +void PacketPlayerJail::Packet(RakNet::BitStream *bs, bool send) +{ + PlayerPacket::Packet(bs, send); + + RW(player->jailDays, send); +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerJail.hpp b/components/openmw-mp/Packets/Player/PacketPlayerJail.hpp new file mode 100644 index 000000000..836bd1100 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerJail.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETPLAYERJAIL_HPP +#define OPENMW_PACKETPLAYERJAIL_HPP + +#include + +namespace mwmp +{ + class PacketPlayerJail : public PlayerPacket + { + public: + PacketPlayerJail(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETPLAYERJAIL_HPP diff --git a/components/openmw-mp/Packets/World/PacketConsoleCommand.cpp b/components/openmw-mp/Packets/World/PacketConsoleCommand.cpp new file mode 100644 index 000000000..796f7988e --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketConsoleCommand.cpp @@ -0,0 +1,14 @@ +#include +#include "PacketConsoleCommand.hpp" + +using namespace mwmp; + +PacketConsoleCommand::PacketConsoleCommand(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +{ + packetID = ID_CONSOLE_COMMAND; +} + +void PacketConsoleCommand::Object(WorldObject &worldObject, bool send) +{ + WorldPacket::Object(worldObject, send); +} diff --git a/components/openmw-mp/Packets/World/PacketConsoleCommand.hpp b/components/openmw-mp/Packets/World/PacketConsoleCommand.hpp new file mode 100644 index 000000000..f04d2c247 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketConsoleCommand.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETCONSOLECOMMAND_HPP +#define OPENMW_PACKETCONSOLECOMMAND_HPP + +#include + +namespace mwmp +{ + class PacketConsoleCommand : public WorldPacket + { + public: + PacketConsoleCommand(RakNet::RakPeerInterface *peer); + + virtual void Object(WorldObject &obj, bool send); + }; +} + +#endif //OPENMW_PACKETCONSOLECOMMAND_HPP diff --git a/components/openmw-mp/Packets/World/PacketObjectState.cpp b/components/openmw-mp/Packets/World/PacketObjectState.cpp new file mode 100644 index 000000000..8754f37c2 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketObjectState.cpp @@ -0,0 +1,10 @@ +#include +#include "PacketObjectState.hpp" + +using namespace mwmp; + +PacketObjectState::PacketObjectState(RakNet::RakPeerInterface *peer) : WorldPacket(peer) +{ + packetID = ID_OBJECT_STATE; + hasCellData = true; +} diff --git a/components/openmw-mp/Packets/World/PacketObjectState.hpp b/components/openmw-mp/Packets/World/PacketObjectState.hpp new file mode 100644 index 000000000..f598fb874 --- /dev/null +++ b/components/openmw-mp/Packets/World/PacketObjectState.hpp @@ -0,0 +1,15 @@ +#ifndef OPENMW_PACKETOBJECTSTATE_HPP +#define OPENMW_PACKETOBJECTSTATE_HPP + +#include + +namespace mwmp +{ + class PacketObjectState : public WorldPacket + { + public: + PacketObjectState(RakNet::RakPeerInterface *peer); + }; +} + +#endif //OPENMW_PACKETOBJECTSTATE_HPP