diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index c9eb075bf..caf2aeef0 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -107,7 +107,7 @@ set(PROCESSORS_PLAYER processors/player/ProcessorPlayerDisposition.hpp processors/player/ProcessorPlayerEquipment.hpp processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInput.hpp processors/player/ProcessorPlayerInventory.hpp processors/player/ProcessorPlayerJournal.hpp - processors/player/ProcessorPlayerKillCount.hpp processors/player/ProcessorPlayerLevel.hpp + processors/player/ProcessorWorldKillCount.hpp processors/player/ProcessorPlayerLevel.hpp processors/player/ProcessorPlayerMiscellaneous.hpp processors/player/ProcessorPlayerPosition.hpp processors/player/ProcessorPlayerQuickKeys.hpp processors/player/ProcessorPlayerRest.hpp processors/player/ProcessorPlayerResurrect.hpp processors/player/ProcessorPlayerShapeshift.hpp diff --git a/apps/openmw-mp/Script/Functions/Quests.cpp b/apps/openmw-mp/Script/Functions/Quests.cpp index 383b0992a..7dc94560d 100644 --- a/apps/openmw-mp/Script/Functions/Quests.cpp +++ b/apps/openmw-mp/Script/Functions/Quests.cpp @@ -168,7 +168,7 @@ void QuestFunctions::SendKillChanges(unsigned short pid, bool sendToOtherPlayers Player *player; GET_PLAYER(pid, player, ); - mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_KILL_COUNT); + mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_WORLD_KILL_COUNT); packet->setPlayer(player); if (!skipAttachedPlayer) diff --git a/apps/openmw-mp/Script/Functions/Quests.hpp b/apps/openmw-mp/Script/Functions/Quests.hpp index 615bff486..76c5ce5b6 100644 --- a/apps/openmw-mp/Script/Functions/Quests.hpp +++ b/apps/openmw-mp/Script/Functions/Quests.hpp @@ -44,7 +44,7 @@ public: /** * \brief Clear the last recorded kill count changes for a player. * - * This is used to initialize the sending of new PlayerKillCount packets. + * This is used to initialize the sending of new WorldKillCount packets. * * \param pid The player ID whose kill count changes should be used. * \return void @@ -184,7 +184,7 @@ public: static void SendJournalChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** - * \brief Send a PlayerKillCount packet with a player's recorded kill count changes. + * \brief Send a WorldKillCount packet with a player's recorded kill count changes. * * \param pid The player ID whose kill count changes should be used. * \param sendToOtherPlayers Whether this packet should be sent to players other than the diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index 9d6d84de7..f8b92482a 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -157,7 +157,6 @@ public: {"OnPlayerDeath", Function()}, {"OnPlayerResurrect", Function()}, {"OnPlayerCellChange", Function()}, - {"OnPlayerKillCount", Function()}, {"OnPlayerAttribute", Function()}, {"OnPlayerSkill", Function()}, {"OnPlayerLevel", Function()}, @@ -200,6 +199,7 @@ public: {"OnPlayerSendMessage", Function()}, {"OnPlayerEndCharGen", Function()}, {"OnGUIAction", Function()}, + {"OnWorldKillCount", Function()}, {"OnWorldMap", Function()}, {"OnMpNumIncrement", Function()}, {"OnRequestPluginList", Function()} diff --git a/apps/openmw-mp/processors/ProcessorInitializer.cpp b/apps/openmw-mp/processors/ProcessorInitializer.cpp index f8e311f82..775a08887 100644 --- a/apps/openmw-mp/processors/ProcessorInitializer.cpp +++ b/apps/openmw-mp/processors/ProcessorInitializer.cpp @@ -23,7 +23,7 @@ #include "player/ProcessorPlayerFaction.hpp" #include "player/ProcessorPlayerInventory.hpp" #include "player/ProcessorPlayerJournal.hpp" -#include "player/ProcessorPlayerKillCount.hpp" +#include "player/ProcessorWorldKillCount.hpp" #include "player/ProcessorPlayerInput.hpp" #include "player/ProcessorPlayerLevel.hpp" #include "player/ProcessorPlayerMiscellaneous.hpp" @@ -101,7 +101,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerFaction()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); - PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount()); + PlayerProcessor::AddProcessor(new ProcessorWorldKillCount()); PlayerProcessor::AddProcessor(new ProcessorPlayerInput()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous()); diff --git a/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp b/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp index 609b3d676..2cde7e3af 100644 --- a/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp +++ b/apps/openmw-mp/processors/player/ProcessorPlayerKillCount.hpp @@ -1,16 +1,16 @@ -#ifndef OPENMW_PROCESSORPLAYERKILLCOUNT_HPP -#define OPENMW_PROCESSORPLAYERKILLCOUNT_HPP +#ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP +#define OPENMW_PROCESSORWORLDKILLCOUNT_HPP #include "../PlayerProcessor.hpp" namespace mwmp { - class ProcessorPlayerKillCount : public PlayerProcessor + class ProcessorWorldKillCount : public PlayerProcessor { public: - ProcessorPlayerKillCount() + ProcessorWorldKillCount() { - BPP_INIT(ID_PLAYER_KILL_COUNT) + BPP_INIT(ID_WORLD_KILL_COUNT) } void Do(PlayerPacket &packet, Player &player) override @@ -19,9 +19,9 @@ namespace mwmp packet.Send(true); - Script::Call(player.getId()); + Script::Call(player.getId()); } }; } -#endif //OPENMW_PROCESSORPLAYERKILLCOUNT_HPP +#endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP diff --git a/apps/openmw-mp/processors/player/ProcessorWorldKillCount.hpp b/apps/openmw-mp/processors/player/ProcessorWorldKillCount.hpp new file mode 100644 index 000000000..2cde7e3af --- /dev/null +++ b/apps/openmw-mp/processors/player/ProcessorWorldKillCount.hpp @@ -0,0 +1,27 @@ +#ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP +#define OPENMW_PROCESSORWORLDKILLCOUNT_HPP + +#include "../PlayerProcessor.hpp" + +namespace mwmp +{ + class ProcessorWorldKillCount : public PlayerProcessor + { + public: + ProcessorWorldKillCount() + { + BPP_INIT(ID_WORLD_KILL_COUNT) + } + + void Do(PlayerPacket &packet, Player &player) override + { + DEBUG_PRINTF(strPacketID.c_str()); + + packet.Send(true); + + Script::Call(player.getId()); + } + }; +} + +#endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index da0a9bb2c..01c84c908 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -116,7 +116,7 @@ add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageB ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction - ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount + ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorWorldKillCount ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index c37965ee6..036c7bf21 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1744,7 +1744,7 @@ namespace MWMechanics Only increment death count for an actor if we are its authority, to avoid situations where we increment it locally after having already received an - ID_PLAYER_KILL_COUNT packet about it + ID_WORLD_KILL_COUNT packet about it */ bool isLocalActor = mwmp::Main::get().getCellController()->isLocalActor(iter->first); @@ -1757,7 +1757,7 @@ namespace MWMechanics /* Start of tes3mp addition - Send an ID_PLAYER_KILL_COUNT packet every time the kill count changes, + Send an ID_WORLD_KILL_COUNT packet every time the kill count changes, as long as we are the authority over the actor's cell */ if (isLocalActor) diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 01a4c18f7..5a4714019 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -1573,12 +1573,12 @@ void LocalPlayer::sendKill(const std::string& refId, int number) kill.refId = refId; kill.number = number; - LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_KILL_COUNT with refId %s, number %i", refId.c_str(), number); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_WORLD_KILL_COUNT with refId %s, number %i", refId.c_str(), number); killChanges.kills.push_back(kill); - getNetworking()->getPlayerPacket(ID_PLAYER_KILL_COUNT)->setPlayer(this); - getNetworking()->getPlayerPacket(ID_PLAYER_KILL_COUNT)->Send(); + getNetworking()->getPlayerPacket(ID_WORLD_KILL_COUNT)->setPlayer(this); + getNetworking()->getPlayerPacket(ID_WORLD_KILL_COUNT)->Send(); } void LocalPlayer::sendBook(const std::string& bookId) diff --git a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp index aa093fe7e..b71246b44 100644 --- a/apps/openmw/mwmp/processors/ProcessorInitializer.cpp +++ b/apps/openmw/mwmp/processors/ProcessorInitializer.cpp @@ -27,7 +27,7 @@ #include "player/ProcessorPlayerInventory.hpp" #include "player/ProcessorPlayerJail.hpp" #include "player/ProcessorPlayerJournal.hpp" -#include "player/ProcessorPlayerKillCount.hpp" +#include "player/ProcessorWorldKillCount.hpp" #include "player/ProcessorPlayerLevel.hpp" #include "player/ProcessorPlayerMiscellaneous.hpp" #include "player/ProcessorPlayerMomentum.hpp" @@ -126,7 +126,7 @@ void ProcessorInitializer() PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerJail()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); - PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount()); + PlayerProcessor::AddProcessor(new ProcessorWorldKillCount()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous()); PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum()); diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerKillCount.hpp b/apps/openmw/mwmp/processors/player/ProcessorWorldKillCount.hpp similarity index 62% rename from apps/openmw/mwmp/processors/player/ProcessorPlayerKillCount.hpp rename to apps/openmw/mwmp/processors/player/ProcessorWorldKillCount.hpp index 17b9440ae..eb1782602 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerKillCount.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorWorldKillCount.hpp @@ -1,16 +1,16 @@ -#ifndef OPENMW_PROCESSORPLAYERKILLCOUNT_HPP -#define OPENMW_PROCESSORPLAYERKILLCOUNT_HPP +#ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP +#define OPENMW_PROCESSORWORLDKILLCOUNT_HPP #include "../PlayerProcessor.hpp" namespace mwmp { - class ProcessorPlayerKillCount : public PlayerProcessor + class ProcessorWorldKillCount : public PlayerProcessor { public: - ProcessorPlayerKillCount() + ProcessorWorldKillCount() { - BPP_INIT(ID_PLAYER_KILL_COUNT) + BPP_INIT(ID_WORLD_KILL_COUNT) } virtual void Do(PlayerPacket &packet, BasePlayer *player) @@ -27,4 +27,4 @@ namespace mwmp }; } -#endif //OPENMW_PROCESSORPLAYERKILLCOUNT_HPP +#endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index f60f0c1bb..32d2e1330 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -182,7 +182,7 @@ add_component_dir (openmw-mp/Packets/Player PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerJail PacketPlayerJournal - PacketPlayerKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition + PacketWorldKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerTopic diff --git a/components/openmw-mp/Controllers/PlayerPacketController.cpp b/components/openmw-mp/Controllers/PlayerPacketController.cpp index 2975c5706..2645769f3 100644 --- a/components/openmw-mp/Controllers/PlayerPacketController.cpp +++ b/components/openmw-mp/Controllers/PlayerPacketController.cpp @@ -25,7 +25,7 @@ #include "../Packets/Player/PacketPlayerInventory.hpp" #include "../Packets/Player/PacketPlayerJail.hpp" #include "../Packets/Player/PacketPlayerJournal.hpp" -#include "../Packets/Player/PacketPlayerKillCount.hpp" +#include "../Packets/Player/PacketWorldKillCount.hpp" #include "../Packets/Player/PacketPlayerLevel.hpp" #include "../Packets/Player/PacketPlayerMiscellaneous.hpp" #include "../Packets/Player/PacketPlayerMomentum.hpp" @@ -82,7 +82,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); AddPacket(&packets, peer); diff --git a/components/openmw-mp/NetworkMessages.hpp b/components/openmw-mp/NetworkMessages.hpp index 8c0f890f8..27aa5dd36 100644 --- a/components/openmw-mp/NetworkMessages.hpp +++ b/components/openmw-mp/NetworkMessages.hpp @@ -41,7 +41,7 @@ enum GameMessages ID_PLAYER_INVENTORY, ID_PLAYER_JAIL, ID_PLAYER_JOURNAL, - ID_PLAYER_KILL_COUNT, + ID_WORLD_KILL_COUNT, ID_PLAYER_LEVEL, ID_PLAYER_MISCELLANEOUS, ID_PLAYER_MOMENTUM, diff --git a/components/openmw-mp/Packets/Player/PacketPlayerKillCount.hpp b/components/openmw-mp/Packets/Player/PacketPlayerKillCount.hpp deleted file mode 100644 index 6883d3507..000000000 --- a/components/openmw-mp/Packets/Player/PacketPlayerKillCount.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef OPENMW_PACKETPLAYERREGIONCHANGE_HPP -#define OPENMW_PACKETPLAYERREGIONCHANGE_HPP - -#include - -namespace mwmp -{ - class PacketPlayerKillCount : public PlayerPacket - { - public: - PacketPlayerKillCount(RakNet::RakPeerInterface *peer); - - virtual void Packet(RakNet::BitStream *bs, bool send); - }; -} - -#endif //OPENMW_PACKETPLAYERREGIONCHANGE_HPP diff --git a/components/openmw-mp/Packets/Player/PacketPlayerKillCount.cpp b/components/openmw-mp/Packets/Player/PacketWorldKillCount.cpp similarity index 70% rename from components/openmw-mp/Packets/Player/PacketPlayerKillCount.cpp rename to components/openmw-mp/Packets/Player/PacketWorldKillCount.cpp index 26623c785..2cc77bab2 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerKillCount.cpp +++ b/components/openmw-mp/Packets/Player/PacketWorldKillCount.cpp @@ -1,12 +1,12 @@ #include -#include "PacketPlayerKillCount.hpp" +#include "PacketWorldKillCount.hpp" -mwmp::PacketPlayerKillCount::PacketPlayerKillCount(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) +mwmp::PacketWorldKillCount::PacketWorldKillCount(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { - packetID = ID_PLAYER_KILL_COUNT; + packetID = ID_WORLD_KILL_COUNT; } -void mwmp::PacketPlayerKillCount::Packet(RakNet::BitStream *bs, bool send) +void mwmp::PacketWorldKillCount::Packet(RakNet::BitStream *bs, bool send) { PlayerPacket::Packet(bs, send); diff --git a/components/openmw-mp/Packets/Player/PacketWorldKillCount.hpp b/components/openmw-mp/Packets/Player/PacketWorldKillCount.hpp new file mode 100644 index 000000000..b55a617b9 --- /dev/null +++ b/components/openmw-mp/Packets/Player/PacketWorldKillCount.hpp @@ -0,0 +1,17 @@ +#ifndef OPENMW_PACKETWORLDKILLCOUNT_HPP +#define OPENMW_PACKETWORLDKILLCOUNT_HPP + +#include + +namespace mwmp +{ + class PacketWorldKillCount : public PlayerPacket + { + public: + PacketWorldKillCount(RakNet::RakPeerInterface *peer); + + virtual void Packet(RakNet::BitStream *bs, bool send); + }; +} + +#endif //OPENMW_PACKETWORLDKILLCOUNT_HPP