From ad388c7e128910d2e1bcf345f17d65a92463ed17 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 16 May 2017 19:25:31 +0300 Subject: [PATCH] [General] Add placeholders for ActorEquipment & PlayerFaction packets Also reorder packets and packet processors. --- apps/openmw-mp/CMakeLists.txt | 16 ++-- apps/openmw-mp/ProcessorInitializer.cpp | 62 +++++++------- apps/openmw-mp/Script/ScriptFunctions.hpp | 3 +- .../actor/ProcessorActorEquipment.hpp | 27 ++++++ .../player/ProcessorPlayerFaction.hpp | 26 ++++++ apps/openmw/CMakeLists.txt | 31 +++---- apps/openmw/mwmp/ProcessorInitializer.cpp | 80 +++++++++--------- .../actor/ProcessorActorEquipment.hpp | 26 ++++++ .../player/ProcessorPlayerFaction.hpp | 25 ++++++ components/CMakeLists.txt | 12 +-- .../Controllers/ActorPacketController.cpp | 6 +- .../Controllers/PlayerPacketController.cpp | 84 +++++++++---------- components/openmw-mp/NetworkMessages.hpp | 42 +++++----- .../Packets/Actor/PacketActorEquipment.cpp | 46 ++++++++++ .../Packets/Actor/PacketActorEquipment.hpp | 17 ++++ .../Packets/Player/PacketPlayerFaction.cpp | 15 ++++ .../Packets/Player/PacketPlayerFaction.hpp | 18 ++++ 17 files changed, 374 insertions(+), 162 deletions(-) create mode 100644 apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp create mode 100644 apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp create mode 100644 apps/openmw/mwmp/processors/actor/ProcessorActorEquipment.hpp create mode 100644 apps/openmw/mwmp/processors/player/ProcessorPlayerFaction.hpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorEquipment.cpp create mode 100644 components/openmw-mp/Packets/Actor/PacketActorEquipment.hpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp create mode 100644 components/openmw-mp/Packets/Player/PacketPlayerFaction.hpp diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index e7de55dcc..b23e5eb87 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -104,9 +104,10 @@ source_group(tes3mp-server FILES ${SERVER} ${SERVER_HEADER}) set(PROCESSORS_ACTOR processors/actor/ProcessorActorAnimFlags.hpp processors/actor/ProcessorActorAnimPlay.hpp processors/actor/ProcessorActorAttack.hpp processors/actor/ProcessorActorAuthority.hpp - processors/actor/ProcessorActorCellChange.hpp processors/actor/ProcessorActorList.hpp - processors/actor/ProcessorActorPosition.hpp processors/actor/ProcessorActorSpeech.hpp - processors/actor/ProcessorActorStatsDynamic.hpp processors/actor/ProcessorActorTest.hpp + processors/actor/ProcessorActorCellChange.hpp processors/actor/ProcessorActorEquipment.hpp + processors/actor/ProcessorActorList.hpp processors/actor/ProcessorActorPosition.hpp + processors/actor/ProcessorActorSpeech.hpp processors/actor/ProcessorActorStatsDynamic.hpp + processors/actor/ProcessorActorTest.hpp ) source_group(tes3mp-server\\processors\\actor FILES ${PROCESSORS_ACTOR}) @@ -118,10 +119,11 @@ set(PROCESSORS_PLAYER processors/player/ProcessorPlayerCellChange.hpp processors/player/ProcessorPlayerCellState.hpp processors/player/ProcessorPlayerCharClass.hpp processors/player/ProcessorPlayerCharGen.hpp processors/player/ProcessorPlayerDeath.hpp processors/player/ProcessorPlayerEquipment.hpp - processors/player/ProcessorPlayerInventory.hpp processors/player/ProcessorPlayerJournal.hpp - processors/player/ProcessorPlayerLevel.hpp processors/player/ProcessorPlayerPosition.hpp - processors/player/ProcessorPlayerResurrect.hpp processors/player/ProcessorPlayerSkill.hpp - processors/player/ProcessorPlayerSpellbook.hpp processors/player/ProcessorPlayerStatsDynamic.hpp + processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInventory.hpp + processors/player/ProcessorPlayerJournal.hpp processors/player/ProcessorPlayerLevel.hpp + processors/player/ProcessorPlayerPosition.hpp processors/player/ProcessorPlayerResurrect.hpp + processors/player/ProcessorPlayerSkill.hpp processors/player/ProcessorPlayerSpellbook.hpp + processors/player/ProcessorPlayerStatsDynamic.hpp ) source_group(tes3mp-server\\processors\\player FILES ${PROCESSORS_PLAYER}) diff --git a/apps/openmw-mp/ProcessorInitializer.cpp b/apps/openmw-mp/ProcessorInitializer.cpp index 98caff28a..7c39948a2 100644 --- a/apps/openmw-mp/ProcessorInitializer.cpp +++ b/apps/openmw-mp/ProcessorInitializer.cpp @@ -5,26 +5,27 @@ #include "ProcessorInitializer.hpp" #include "PlayerProcessor.hpp" -#include "processors/player/ProcessorPlayerPosition.hpp" -#include "processors/player/ProcessorPlayerCellChange.hpp" -#include "processors/player/ProcessorPlayerCellState.hpp" +#include "processors/player/ProcessorChatMsg.hpp" +#include "processors/player/ProcessorGUIMessageBox.hpp" +#include "processors/player/ProcessorPlayerCharGen.hpp" +#include "processors/player/ProcessorPlayerAnimFlags.hpp" +#include "processors/player/ProcessorPlayerAttack.hpp" #include "processors/player/ProcessorPlayerAttribute.hpp" -#include "processors/player/ProcessorPlayerSkill.hpp" -#include "processors/player/ProcessorPlayerLevel.hpp" #include "processors/player/ProcessorPlayerBounty.hpp" +#include "processors/player/ProcessorPlayerCellChange.hpp" +#include "processors/player/ProcessorPlayerCellState.hpp" +#include "processors/player/ProcessorPlayerCharClass.hpp" +#include "processors/player/ProcessorPlayerDeath.hpp" #include "processors/player/ProcessorPlayerEquipment.hpp" +#include "processors/player/ProcessorPlayerFaction.hpp" #include "processors/player/ProcessorPlayerInventory.hpp" -#include "processors/player/ProcessorPlayerSpellbook.hpp" #include "processors/player/ProcessorPlayerJournal.hpp" -#include "processors/player/ProcessorPlayerAttack.hpp" -#include "processors/player/ProcessorPlayerStatsDynamic.hpp" -#include "processors/player/ProcessorPlayerDeath.hpp" +#include "processors/player/ProcessorPlayerLevel.hpp" +#include "processors/player/ProcessorPlayerPosition.hpp" #include "processors/player/ProcessorPlayerResurrect.hpp" -#include "processors/player/ProcessorPlayerAnimFlags.hpp" -#include "processors/player/ProcessorChatMsg.hpp" -#include "processors/player/ProcessorPlayerCharGen.hpp" -#include "processors/player/ProcessorGUIMessageBox.hpp" -#include "processors/player/ProcessorPlayerCharClass.hpp" +#include "processors/player/ProcessorPlayerSkill.hpp" +#include "processors/player/ProcessorPlayerSpellbook.hpp" +#include "processors/player/ProcessorPlayerStatsDynamic.hpp" #include "ActorProcessor.hpp" #include "processors/actor/ProcessorActorList.hpp" #include "processors/actor/ProcessorActorAuthority.hpp" @@ -33,6 +34,7 @@ #include "processors/actor/ProcessorActorAnimPlay.hpp" #include "processors/actor/ProcessorActorAttack.hpp" #include "processors/actor/ProcessorActorCellChange.hpp" +#include "processors/actor/ProcessorActorEquipment.hpp" #include "processors/actor/ProcessorActorStatsDynamic.hpp" #include "processors/actor/ProcessorActorPosition.hpp" #include "processors/actor/ProcessorActorSpeech.hpp" @@ -59,26 +61,27 @@ using namespace mwmp; void ProcessorInitializer() { - PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); - PlayerProcessor::AddProcessor(new ProcessorPlayerCellChange()); - PlayerProcessor::AddProcessor(new ProcessorPlayerCellState()); + PlayerProcessor::AddProcessor(new ProcessorChatMsg()); + PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen()); + PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); + PlayerProcessor::AddProcessor(new ProcessorPlayerAttack()); PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute()); - PlayerProcessor::AddProcessor(new ProcessorPlayerSkill()); - PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerBounty()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCellChange()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCellState()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass()); + PlayerProcessor::AddProcessor(new ProcessorPlayerDeath()); PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment()); + PlayerProcessor::AddProcessor(new ProcessorPlayerFaction()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); - PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); - PlayerProcessor::AddProcessor(new ProcessorPlayerAttack()); - PlayerProcessor::AddProcessor(new ProcessorPlayerStatsDynamic()); - PlayerProcessor::AddProcessor(new ProcessorPlayerDeath()); + PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); + PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); PlayerProcessor::AddProcessor(new ProcessorPlayerResurrect()); - PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); - PlayerProcessor::AddProcessor(new ProcessorChatMsg()); - PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen()); - PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox()); - PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass()); + PlayerProcessor::AddProcessor(new ProcessorPlayerSkill()); + PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook()); + PlayerProcessor::AddProcessor(new ProcessorPlayerStatsDynamic()); ActorProcessor::AddProcessor(new ProcessorActorList()); ActorProcessor::AddProcessor(new ProcessorActorAuthority()); @@ -86,9 +89,10 @@ void ProcessorInitializer() ActorProcessor::AddProcessor(new ProcessorActorAnimPlay()); ActorProcessor::AddProcessor(new ProcessorActorAttack()); ActorProcessor::AddProcessor(new ProcessorActorCellChange()); - ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic()); + ActorProcessor::AddProcessor(new ProcessorActorEquipment()); ActorProcessor::AddProcessor(new ProcessorActorPosition()); ActorProcessor::AddProcessor(new ProcessorActorSpeech()); + ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic()); ActorProcessor::AddProcessor(new ProcessorActorTest()); WorldProcessor::AddProcessor(new ProcessorContainer()); diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index af6fef31b..36804b15f 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -126,8 +126,9 @@ public: {"OnPlayerBountyChange", Function()}, {"OnPlayerEquipmentChange", Function()}, {"OnPlayerInventoryChange", Function()}, - {"OnPlayerSpellbookChange", Function()}, {"OnPlayerJournalChange", Function()}, + {"OnPlayerFactionChange", Function()}, + {"OnPlayerSpellbookChange", Function()}, {"OnCellLoad", Function()}, {"OnCellUnload", Function()}, {"OnCellDeletion", Function()}, diff --git a/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp b/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp new file mode 100644 index 000000000..eb7f7e757 --- /dev/null +++ b/apps/openmw-mp/processors/actor/ProcessorActorEquipment.hpp @@ -0,0 +1,27 @@ +#ifndef OPENMW_PROCESSORACTOREQUIPMENT_HPP +#define OPENMW_PROCESSORACTOREQUIPMENT_HPP + +#include "apps/openmw-mp/ActorProcessor.hpp" + +namespace mwmp +{ + class ProcessorActorEquipment : public ActorProcessor + { + public: + ProcessorActorEquipment() + { + BPP_INIT(ID_ACTOR_EQUIPMENT) + } + + void Do(ActorPacket &packet, Player &player, BaseActorList &actorList) override + { + // Send only to players who have the cell loaded + Cell *serverCell = CellController::get()->getCell(&actorList.cell); + + if (serverCell != nullptr) + serverCell->sendToLoaded(&packet, &actorList); + } + }; +} + +#endif //OPENMW_PROCESSORACTOREQUIPMENT_HPP diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp new file mode 100644 index 000000000..8614d0d24 --- /dev/null +++ b/apps/openmw-mp/processors/player/ProcessorPlayerFaction.hpp @@ -0,0 +1,26 @@ +#ifndef OPENMW_PROCESSORPLAYERFACTION_HPP +#define OPENMW_PROCESSORPLAYERFACTION_HPP + + +#include "apps/openmw-mp/PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorPlayerFaction : public PlayerProcessor + { + public: + ProcessorPlayerFaction() + { + BPP_INIT(ID_PLAYER_FACTION) + } + + void Do(PlayerPacket &packet, Player &player) override + { + DEBUG_PRINTF(strPacketID.c_str()); + + Script::Call(player.getId()); + } + }; +} + +#endif //OPENMW_PROCESSORPLAYERFACTION_HPP diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index d0179478c..eca8770b8 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -97,27 +97,28 @@ add_openmw_dir (mwbase ) add_openmw_dir (mwmp Main Networking LocalPlayer DedicatedPlayer PlayerList LocalActor DedicatedActor ActorList WorldEvent - Cell CellController MechanicsHelper GUIChat GUILogin GUIController PlayerMarkerCollection GUIDialogList - BaseClientPacketProcessor PlayerProcessor WorldProcessor ActorProcessor ProcessorInitializer) + Cell CellController MechanicsHelper GUIChat GUILogin GUIController PlayerMarkerCollection GUIDialogList + BaseClientPacketProcessor PlayerProcessor WorldProcessor ActorProcessor ProcessorInitializer + ) add_openmw_dir (mwmp\\processors\\actor ProcessorActorAnimFlags ProcessorActorAnimPlay ProcessorActorAttack - ProcessorActorAuthority ProcessorActorCellChange ProcessorActorList ProcessorActorPosition ProcessorActorSpeech - ProcessorActorStatsDynamic ProcessorActorTest - ) + ProcessorActorAuthority ProcessorActorCellChange ProcessorActorEquipment ProcessorActorList ProcessorActorPosition + ProcessorActorSpeech ProcessorActorStatsDynamic ProcessorActorTest + ) add_openmw_dir (mwmp\\processors\\player ProcessorChatMessage ProcessorGameConsole ProcessorGameTime ProcessorGUIMessageBox - ProcessorHandshake ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBounty - ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath - ProcessorPlayerAnimFlags ProcessorPlayerStatsDynamic ProcessorPlayerEquipment ProcessorPlayerInventory - ProcessorPlayerJournal ProcessorPlayerLevel ProcessorPlayerPosition ProcessorPlayerResurrect ProcessorPlayerSkill - ProcessorPlayerSpellbook ProcessorUserDisconnected ProcessorUserMyID - ) + ProcessorHandshake ProcessorUserDisconnected ProcessorUserMyID ProcessorPlayerBaseInfo + ProcessorPlayerAnimFlags ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBounty ProcessorPlayerCellChange + ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerEquipment + ProcessorPlayerInventory ProcessorPlayerJournal ProcessorPlayerLevel ProcessorPlayerPosition ProcessorPlayerResurrect + ProcessorPlayerSkill ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic + ) add_openmw_dir (mwmp\\processors\\world BaseObjectProcessor ProcessorContainer ProcessorDoorState ProcessorMusicPlay - ProcessorObjectAnimPlay ProcessorObjectDelete ProcessorObjectLock ProcessorObjectMove ProcessorObjectPlace - ProcessorObjectRotate ProcessorObjectScale ProcessorObjectUnlock ProcessorScriptGlobalShort ProcessorScriptLocalFloat - ProcessorScriptLocalShort ProcessorScriptMemberShort ProcessorVideoPlay - ) + ProcessorObjectAnimPlay ProcessorObjectDelete ProcessorObjectLock ProcessorObjectMove ProcessorObjectPlace + ProcessorObjectRotate ProcessorObjectScale ProcessorObjectUnlock ProcessorScriptGlobalShort ProcessorScriptLocalFloat + ProcessorScriptLocalShort ProcessorScriptMemberShort ProcessorVideoPlay + ) # Main executable diff --git a/apps/openmw/mwmp/ProcessorInitializer.cpp b/apps/openmw/mwmp/ProcessorInitializer.cpp index ac59714af..cb2dd46a5 100644 --- a/apps/openmw/mwmp/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/ProcessorInitializer.cpp @@ -5,32 +5,33 @@ #include "ProcessorInitializer.hpp" #include "PlayerProcessor.hpp" -#include "processors/player/ProcessorPlayerPosition.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/ProcessorPlayerBounty.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/ProcessorPlayerStatsDynamic.hpp" -#include "processors/player/ProcessorPlayerDeath.hpp" -#include "processors/player/ProcessorPlayerResurrect.hpp" -#include "processors/player/ProcessorPlayerAnimFlags.hpp" + #include "processors/player/ProcessorChatMessage.hpp" #include "processors/player/ProcessorGameConsole.hpp" #include "processors/player/ProcessorGameTime.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 "processors/player/ProcessorPlayerBaseInfo.hpp" +#include "processors/player/ProcessorPlayerCharGen.hpp" +#include "processors/player/ProcessorPlayerAnimFlags.hpp" +#include "processors/player/ProcessorPlayerAttack.hpp" +#include "processors/player/ProcessorPlayerAttribute.hpp" +#include "processors/player/ProcessorPlayerBounty.hpp" +#include "processors/player/ProcessorPlayerCellChange.hpp" +#include "processors/player/ProcessorPlayerCellState.hpp" +#include "processors/player/ProcessorPlayerCharClass.hpp" +#include "processors/player/ProcessorPlayerDeath.hpp" +#include "processors/player/ProcessorPlayerEquipment.hpp" +#include "processors/player/ProcessorPlayerInventory.hpp" +#include "processors/player/ProcessorPlayerJournal.hpp" +#include "processors/player/ProcessorPlayerLevel.hpp" +#include "processors/player/ProcessorPlayerPosition.hpp" +#include "processors/player/ProcessorPlayerResurrect.hpp" +#include "processors/player/ProcessorPlayerSkill.hpp" +#include "processors/player/ProcessorPlayerSpellbook.hpp" +#include "processors/player/ProcessorPlayerStatsDynamic.hpp" #include "WorldProcessor.hpp" #include "processors/world/ProcessorContainer.hpp" @@ -55,6 +56,7 @@ #include "processors/actor/ProcessorActorAttack.hpp" #include "processors/actor/ProcessorActorAuthority.hpp" #include "processors/actor/ProcessorActorCellChange.hpp" +#include "processors/actor/ProcessorActorEquipment.hpp" #include "processors/actor/ProcessorActorList.hpp" #include "processors/actor/ProcessorActorPosition.hpp" #include "processors/actor/ProcessorActorSpeech.hpp" @@ -65,32 +67,33 @@ using namespace mwmp; void ProcessorInitializer() { - PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); - PlayerProcessor::AddProcessor(new ProcessorPlayerCellChange()); - PlayerProcessor::AddProcessor(new ProcessorPlayerCellState()); - PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute()); - PlayerProcessor::AddProcessor(new ProcessorPlayerSkill()); - PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); - PlayerProcessor::AddProcessor(new ProcessorPlayerBounty()); - PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment()); - PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); - PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook()); - PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); - PlayerProcessor::AddProcessor(new ProcessorPlayerAttack()); - PlayerProcessor::AddProcessor(new ProcessorPlayerStatsDynamic()); - PlayerProcessor::AddProcessor(new ProcessorPlayerDeath()); - PlayerProcessor::AddProcessor(new ProcessorPlayerResurrect()); - PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); PlayerProcessor::AddProcessor(new ProcessorChatMessage()); PlayerProcessor::AddProcessor(new ProcessorGameConsole()); PlayerProcessor::AddProcessor(new ProcessorGameTime()); - 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()); + PlayerProcessor::AddProcessor(new ProcessorPlayerBaseInfo()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCharGen()); + PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags()); + PlayerProcessor::AddProcessor(new ProcessorPlayerAttack()); + PlayerProcessor::AddProcessor(new ProcessorPlayerAttribute()); + PlayerProcessor::AddProcessor(new ProcessorPlayerBounty()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCellChange()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCellState()); + PlayerProcessor::AddProcessor(new ProcessorPlayerCharClass()); + PlayerProcessor::AddProcessor(new ProcessorPlayerDeath()); + PlayerProcessor::AddProcessor(new ProcessorPlayerEquipment()); + PlayerProcessor::AddProcessor(new ProcessorPlayerFaction()); + PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); + PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); + PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); + PlayerProcessor::AddProcessor(new ProcessorPlayerPosition()); + PlayerProcessor::AddProcessor(new ProcessorPlayerResurrect()); + PlayerProcessor::AddProcessor(new ProcessorPlayerSkill()); + PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook()); + PlayerProcessor::AddProcessor(new ProcessorPlayerStatsDynamic()); WorldProcessor::AddProcessor(new ProcessorContainer()); WorldProcessor::AddProcessor(new ProcessorDoorState()); @@ -114,6 +117,7 @@ void ProcessorInitializer() ActorProcessor::AddProcessor(new ProcessorActorAttack()); ActorProcessor::AddProcessor(new ProcessorActorAuthority()); ActorProcessor::AddProcessor(new ProcessorActorCellChange()); + ActorProcessor::AddProcessor(new ProcessorActorEquipment()); ActorProcessor::AddProcessor(new ProcessorActorList()); ActorProcessor::AddProcessor(new ProcessorActorPosition()); ActorProcessor::AddProcessor(new ProcessorActorSpeech()); diff --git a/apps/openmw/mwmp/processors/actor/ProcessorActorEquipment.hpp b/apps/openmw/mwmp/processors/actor/ProcessorActorEquipment.hpp new file mode 100644 index 000000000..3e6c76daa --- /dev/null +++ b/apps/openmw/mwmp/processors/actor/ProcessorActorEquipment.hpp @@ -0,0 +1,26 @@ +#ifndef OPENMW_PROCESSORACTOREQUIPMENT_HPP +#define OPENMW_PROCESSORACTOREQUIPMENT_HPP + + +#include "apps/openmw/mwmp/ActorProcessor.hpp" +#include "apps/openmw/mwmp/Main.hpp" +#include "apps/openmw/mwmp/CellController.hpp" + +namespace mwmp +{ + class ProcessorActorEquipment : public ActorProcessor + { + public: + ProcessorActorEquipment() + { + BPP_INIT(ID_ACTOR_EQUIPMENT); + } + + virtual void Do(ActorPacket &packet, ActorList &actorList) + { + + } + }; +} + +#endif //OPENMW_PROCESSORACTOREQUIPMENT_HPP diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerFaction.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerFaction.hpp new file mode 100644 index 000000000..ef6d4f83a --- /dev/null +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerFaction.hpp @@ -0,0 +1,25 @@ +#ifndef OPENMW_PROCESSORPLAYERFACTION_HPP +#define OPENMW_PROCESSORPLAYERFACTION_HPP + + +#include "apps/openmw/mwmp/PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorPlayerFaction : public PlayerProcessor + { + public: + ProcessorPlayerFaction() + { + BPP_INIT(ID_PLAYER_FACTION) + } + + virtual void Do(PlayerPacket &packet, BasePlayer *player) + { + if (!isLocal()) return; + } + }; +} + + +#endif //OPENMW_PROCESSORPLAYERFACTION_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index dfec0ef22..a003b6d1b 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -170,16 +170,16 @@ add_component_dir (openmw-mp\\Packets add_component_dir (openmw-mp\\Packets\\Actor ActorPacket PacketActorList PacketActorAuthority PacketActorTest PacketActorAnimPlay PacketActorAttack PacketActorCellChange - PacketActorAnimFlags PacketActorStatsDynamic PacketActorPosition PacketActorSpeech + PacketActorAnimFlags PacketActorEquipment PacketActorPosition PacketActorSpeech PacketActorStatsDynamic ) add_component_dir (openmw-mp\\Packets\\Player PlayerPacket - PacketHandshake PacketChatMessage PacketPlayerBaseInfo PacketPlayerPosition PacketPlayerEquipment - PacketPlayerAttack PacketPlayerStatsDynamic PacketPlayerAnimFlags PacketPlayerCharGen PacketPlayerAttribute - PacketPlayerSkill PacketPlayerLevel PacketPlayerBounty PacketPlayerClass PacketPlayerInventory - PacketPlayerSpellbook PacketPlayerJournal PacketPlayerActiveSkills PacketPlayerCellChange PacketPlayerCellState - PacketPlayerDeath PacketPlayerResurrect PacketGUIBoxes PacketTime + PacketHandshake PacketChatMessage PacketPlayerBaseInfo PacketPlayerCharGen PacketPlayerAnimFlags PacketPlayerAttack + PacketPlayerAttribute PacketPlayerBounty PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass + PacketPlayerDeath PacketPlayerEquipment PacketPlayerFaction PacketPlayerInventory PacketPlayerJournal PacketPlayerLevel + PacketPlayerPosition PacketPlayerResurrect PacketPlayerSkill PacketPlayerSpellbook PacketPlayerStatsDynamic + PacketPlayerActiveSkills PacketGUIBoxes PacketTime ) add_component_dir (openmw-mp\\Packets\\World diff --git a/components/openmw-mp/Controllers/ActorPacketController.cpp b/components/openmw-mp/Controllers/ActorPacketController.cpp index 40adc1402..9af948a84 100644 --- a/components/openmw-mp/Controllers/ActorPacketController.cpp +++ b/components/openmw-mp/Controllers/ActorPacketController.cpp @@ -9,8 +9,9 @@ #include "../Packets/Actor/PacketActorAnimPlay.hpp" #include "../Packets/Actor/PacketActorAttack.hpp" #include "../Packets/Actor/PacketActorCellChange.hpp" -#include "../Packets/Actor/PacketActorStatsDynamic.hpp" +#include "../Packets/Actor/PacketActorEquipment.hpp" #include "../Packets/Actor/PacketActorPosition.hpp" +#include "../Packets/Actor/PacketActorStatsDynamic.hpp" #include "../Packets/Actor/PacketActorSpeech.hpp" @@ -33,9 +34,10 @@ mwmp::ActorPacketController::ActorPacketController(RakNet::RakPeerInterface *pee AddPacket(&packets, peer); 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/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 0395b4263..b9552ccea 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -2,34 +2,35 @@ #include #include -#include "../Packets/Player/PacketPlayerClass.hpp" -#include "../Packets/Player/PacketPlayerPosition.hpp" -#include "../Packets/Player/PacketPlayerCellChange.hpp" -#include "../Packets/Player/PacketPlayerCellState.hpp" -#include "../Packets/Player/PacketPlayerBaseInfo.hpp" -#include "../Packets/Player/PacketPlayerEquipment.hpp" -#include "../Packets/Player/PacketPlayerAttack.hpp" -#include "../Packets/Player/PacketPlayerStatsDynamic.hpp" -#include "../Packets/Player/PacketPlayerResurrect.hpp" -#include "../Packets/Player/PacketPlayerDeath.hpp" #include "../Packets/Player/PacketSendMyID.hpp" #include "../Packets/Player/PacketDisconnect.hpp" -#include "../Packets/Player/PacketPlayerAnimFlags.hpp" #include "../Packets/Player/PacketChatMessage.hpp" #include "../Packets/Player/PacketPlayerCharGen.hpp" -#include "../Packets/Player/PacketPlayerAttribute.hpp" -#include "../Packets/Player/PacketPlayerSkill.hpp" -#include "../Packets/Player/PacketPlayerLevel.hpp" -#include "../Packets/Player/PacketPlayerBounty.hpp" #include "../Packets/Player/PacketHandshake.hpp" #include "../Packets/Player/PacketGUIBoxes.hpp" #include "../Packets/Player/PacketTime.hpp" #include "../Packets/Player/PacketLoaded.hpp" -#include "../Packets/Player/PacketPlayerInventory.hpp" -#include "../Packets/Player/PacketPlayerSpellbook.hpp" -#include "../Packets/Player/PacketPlayerJournal.hpp" #include "../Packets/Player/PacketConsole.hpp" #include "../Packets/Player/PacketPlayerActiveSkills.hpp" +#include "../Packets/Player/PacketPlayerBaseInfo.hpp" +#include "../Packets/Player/PacketPlayerAnimFlags.hpp" +#include "../Packets/Player/PacketPlayerAttack.hpp" +#include "../Packets/Player/PacketPlayerAttribute.hpp" +#include "../Packets/Player/PacketPlayerBounty.hpp" +#include "../Packets/Player/PacketPlayerCellChange.hpp" +#include "../Packets/Player/PacketPlayerCellState.hpp" +#include "../Packets/Player/PacketPlayerClass.hpp" +#include "../Packets/Player/PacketPlayerDeath.hpp" +#include "../Packets/Player/PacketPlayerEquipment.hpp" +#include "../Packets/Player/PacketPlayerFaction.hpp" +#include "../Packets/Player/PacketPlayerInventory.hpp" +#include "../Packets/Player/PacketPlayerJournal.hpp" +#include "../Packets/Player/PacketPlayerLevel.hpp" +#include "../Packets/Player/PacketPlayerPosition.hpp" +#include "../Packets/Player/PacketPlayerResurrect.hpp" +#include "../Packets/Player/PacketPlayerSkill.hpp" +#include "../Packets/Player/PacketPlayerSpellbook.hpp" +#include "../Packets/Player/PacketPlayerStatsDynamic.hpp" #include "PlayerPacketController.hpp" @@ -43,41 +44,36 @@ inline void AddPacket(mwmp::PlayerPacketController::packets_t *packets, RakNet:: mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *peer) { - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - - AddPacket(&packets, peer); - AddPacket(&packets, peer); - - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - - AddPacket(&packets, peer); - AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - AddPacket(&packets, peer); - + AddPacket(&packets, peer); AddPacket(&packets, peer); - AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + AddPacket(&packets, peer); + 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/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index f24098efe..a690e196c 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -10,46 +10,48 @@ enum GameMessages { _ID_UNUSED = ID_USER_PACKET_ENUM+1, - ID_PLAYER_BASEINFO, - ID_PLAYER_CHARGEN, - ID_PLAYER_POSITION, - ID_PLAYER_STATS_DYNAMIC, - ID_PLAYER_ATTACK, ID_USER_MYID, - ID_PLAYER_EQUIPMENT, ID_USER_DISCONNECTED, - ID_PLAYER_DEATH, - ID_PLAYER_RESURRECT, ID_CHAT_MESSAGE, - ID_PLAYER_ANIM_FLAGS, - ID_PLAYER_ATTRIBUTE, - ID_PLAYER_SKILL, - ID_PLAYER_LEVEL, - ID_PLAYER_BOUNTY, - ID_PLAYER_CHARCLASS, ID_HANDSHAKE, ID_LOADED, ID_GUI_MESSAGEBOX, ID_GAME_TIME, - ID_PLAYER_INVENTORY, - ID_PLAYER_SPELLBOOK, - ID_PLAYER_JOURNAL, + + ID_PLAYER_BASEINFO, + ID_PLAYER_CHARGEN, ID_PLAYER_ACTIVESKILLS, - + ID_PLAYER_ANIM_FLAGS, + ID_PLAYER_ATTACK, + ID_PLAYER_ATTRIBUTE, + ID_PLAYER_BOUNTY, ID_PLAYER_CELL_CHANGE, ID_PLAYER_CELL_STATE, + ID_PLAYER_CHARCLASS, + ID_PLAYER_DEATH, + ID_PLAYER_EQUIPMENT, + ID_PLAYER_FACTION, + ID_PLAYER_INVENTORY, + ID_PLAYER_JOURNAL, + ID_PLAYER_LEVEL, + ID_PLAYER_POSITION, + ID_PLAYER_RESURRECT, + ID_PLAYER_SKILL, + ID_PLAYER_SPELLBOOK, + ID_PLAYER_STATS_DYNAMIC, ID_ACTOR_LIST, ID_ACTOR_AUTHORITY, ID_ACTOR_TEST, + ID_ACTOR_ANIM_FLAGS, ID_ACTOR_ANIM_PLAY, ID_ACTOR_ATTACK, ID_ACTOR_CELL_CHANGE, - ID_ACTOR_ANIM_FLAGS, - ID_ACTOR_STATS_DYNAMIC, + ID_ACTOR_EQUIPMENT, ID_ACTOR_POSITION, ID_ACTOR_SPEECH, + ID_ACTOR_STATS_DYNAMIC, ID_OBJECT_PLACE, ID_OBJECT_DELETE, diff --git a/components/openmw-mp/Packets/Actor/PacketActorEquipment.cpp b/components/openmw-mp/Packets/Actor/PacketActorEquipment.cpp new file mode 100644 index 000000000..f4999a8c4 --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorEquipment.cpp @@ -0,0 +1,46 @@ +#include +#include +#include "PacketActorEquipment.hpp" + +using namespace mwmp; + +PacketActorEquipment::PacketActorEquipment(RakNet::RakPeerInterface *peer) : ActorPacket(peer) +{ + packetID = ID_ACTOR_EQUIPMENT; +} + +void PacketActorEquipment::Packet(RakNet::BitStream *bs, bool send) +{ + ActorPacket::Packet(bs, send); + + if (!send) + actorList->baseActors.clear(); + else + actorList->count = (unsigned int)(actorList->baseActors.size()); + + RW(actorList->count, send); + + RW(actorList->cell.mData.mFlags, send); + RW(actorList->cell.mData.mX, send); + RW(actorList->cell.mData.mY, send); + RW(actorList->cell.mName, send); + + BaseActor actor; + + for (unsigned int i = 0; i < actorList->count; i++) + { + if (send) + { + actor = actorList->baseActors.at(i); + } + + RW(actor.refId, send); + RW(actor.refNumIndex, send); + RW(actor.mpNum, send); + + if (!send) + { + actorList->baseActors.push_back(actor); + } + } +} diff --git a/components/openmw-mp/Packets/Actor/PacketActorEquipment.hpp b/components/openmw-mp/Packets/Actor/PacketActorEquipment.hpp new file mode 100644 index 000000000..264f5cd6a --- /dev/null +++ b/components/openmw-mp/Packets/Actor/PacketActorEquipment.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETACTOREQUIPMENT_HPP +#define OPENMW_PACKETACTOREQUIPMENT_HPP + +#include + +namespace mwmp +{ + class PacketActorEquipment : public ActorPacket + { + public: + PacketActorEquipment(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETACTOREQUIPMENT_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp b/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp new file mode 100644 index 000000000..57c037a80 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerFaction.cpp @@ -0,0 +1,15 @@ +#include +#include "PacketPlayerFaction.hpp" + +using namespace std; +using namespace mwmp; + +PacketPlayerFaction::PacketPlayerFaction(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +{ + packetID = ID_PLAYER_FACTION; +} + +void PacketPlayerFaction::Packet(RakNet::BitStream *bs, bool send) +{ + PlayerPacket::Packet(bs, send); +} diff --git a/components/openmw-mp/Packets/Player/PacketPlayerFaction.hpp b/components/openmw-mp/Packets/Player/PacketPlayerFaction.hpp new file mode 100644 index 000000000..fb6fe3c4a --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketPlayerFaction.hpp @@ -0,0 +1,18 @@ +#ifndef OPENMW_PACKETPLAYERFACTION_HPP +#define OPENMW_PACKETPLAYERFACTION_HPP + +#include + +namespace mwmp +{ + class PacketPlayerFaction : public PlayerPacket + { + public: + PacketPlayerFaction(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + + +#endif //OPENMW_PACKETPLAYERFACTION_HPP