1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-01 15:39:40 +00:00

[General] Rename PlayerKillCount into WorldKillCount

This should clarify the real meaning of the packet and its associated event.

The event itself has been renamed from OnPlayerKillCount to OnWorldKillCount.
This commit is contained in:
David Cernat 2018-07-15 05:34:59 +03:00
parent 18a2d238ab
commit 3649cf553f
18 changed files with 80 additions and 53 deletions

View file

@ -107,7 +107,7 @@ set(PROCESSORS_PLAYER
processors/player/ProcessorPlayerDisposition.hpp processors/player/ProcessorPlayerEquipment.hpp processors/player/ProcessorPlayerDisposition.hpp processors/player/ProcessorPlayerEquipment.hpp
processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInput.hpp processors/player/ProcessorPlayerFaction.hpp processors/player/ProcessorPlayerInput.hpp
processors/player/ProcessorPlayerInventory.hpp processors/player/ProcessorPlayerJournal.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/ProcessorPlayerMiscellaneous.hpp processors/player/ProcessorPlayerPosition.hpp
processors/player/ProcessorPlayerQuickKeys.hpp processors/player/ProcessorPlayerRest.hpp processors/player/ProcessorPlayerQuickKeys.hpp processors/player/ProcessorPlayerRest.hpp
processors/player/ProcessorPlayerResurrect.hpp processors/player/ProcessorPlayerShapeshift.hpp processors/player/ProcessorPlayerResurrect.hpp processors/player/ProcessorPlayerShapeshift.hpp

View file

@ -168,7 +168,7 @@ void QuestFunctions::SendKillChanges(unsigned short pid, bool sendToOtherPlayers
Player *player; Player *player;
GET_PLAYER(pid, 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); packet->setPlayer(player);
if (!skipAttachedPlayer) if (!skipAttachedPlayer)

View file

@ -44,7 +44,7 @@ public:
/** /**
* \brief Clear the last recorded kill count changes for a player. * \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. * \param pid The player ID whose kill count changes should be used.
* \return void * \return void
@ -184,7 +184,7 @@ public:
static void SendJournalChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; 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 pid The player ID whose kill count changes should be used.
* \param sendToOtherPlayers Whether this packet should be sent to players other than the * \param sendToOtherPlayers Whether this packet should be sent to players other than the

View file

@ -157,7 +157,6 @@ public:
{"OnPlayerDeath", Function<void, unsigned short>()}, {"OnPlayerDeath", Function<void, unsigned short>()},
{"OnPlayerResurrect", Function<void, unsigned short>()}, {"OnPlayerResurrect", Function<void, unsigned short>()},
{"OnPlayerCellChange", Function<void, unsigned short>()}, {"OnPlayerCellChange", Function<void, unsigned short>()},
{"OnPlayerKillCount", Function<void, unsigned short>()},
{"OnPlayerAttribute", Function<void, unsigned short>()}, {"OnPlayerAttribute", Function<void, unsigned short>()},
{"OnPlayerSkill", Function<void, unsigned short>()}, {"OnPlayerSkill", Function<void, unsigned short>()},
{"OnPlayerLevel", Function<void, unsigned short>()}, {"OnPlayerLevel", Function<void, unsigned short>()},
@ -200,6 +199,7 @@ public:
{"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()}, {"OnPlayerSendMessage", Function<bool, unsigned short, const char*>()},
{"OnPlayerEndCharGen", Function<void, unsigned short>()}, {"OnPlayerEndCharGen", Function<void, unsigned short>()},
{"OnGUIAction", Function<void, unsigned short, int, const char*>()}, {"OnGUIAction", Function<void, unsigned short, int, const char*>()},
{"OnWorldKillCount", Function<void, unsigned short>()},
{"OnWorldMap", Function<void, unsigned short>()}, {"OnWorldMap", Function<void, unsigned short>()},
{"OnMpNumIncrement", Function<void, int>()}, {"OnMpNumIncrement", Function<void, int>()},
{"OnRequestPluginList", Function<const char *, unsigned int, unsigned int>()} {"OnRequestPluginList", Function<const char *, unsigned int, unsigned int>()}

View file

@ -23,7 +23,7 @@
#include "player/ProcessorPlayerFaction.hpp" #include "player/ProcessorPlayerFaction.hpp"
#include "player/ProcessorPlayerInventory.hpp" #include "player/ProcessorPlayerInventory.hpp"
#include "player/ProcessorPlayerJournal.hpp" #include "player/ProcessorPlayerJournal.hpp"
#include "player/ProcessorPlayerKillCount.hpp" #include "player/ProcessorWorldKillCount.hpp"
#include "player/ProcessorPlayerInput.hpp" #include "player/ProcessorPlayerInput.hpp"
#include "player/ProcessorPlayerLevel.hpp" #include "player/ProcessorPlayerLevel.hpp"
#include "player/ProcessorPlayerMiscellaneous.hpp" #include "player/ProcessorPlayerMiscellaneous.hpp"
@ -101,7 +101,7 @@ void ProcessorInitializer()
PlayerProcessor::AddProcessor(new ProcessorPlayerFaction()); PlayerProcessor::AddProcessor(new ProcessorPlayerFaction());
PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory());
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount()); PlayerProcessor::AddProcessor(new ProcessorWorldKillCount());
PlayerProcessor::AddProcessor(new ProcessorPlayerInput()); PlayerProcessor::AddProcessor(new ProcessorPlayerInput());
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous()); PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous());

View file

@ -1,16 +1,16 @@
#ifndef OPENMW_PROCESSORPLAYERKILLCOUNT_HPP #ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP
#define OPENMW_PROCESSORPLAYERKILLCOUNT_HPP #define OPENMW_PROCESSORWORLDKILLCOUNT_HPP
#include "../PlayerProcessor.hpp" #include "../PlayerProcessor.hpp"
namespace mwmp namespace mwmp
{ {
class ProcessorPlayerKillCount : public PlayerProcessor class ProcessorWorldKillCount : public PlayerProcessor
{ {
public: public:
ProcessorPlayerKillCount() ProcessorWorldKillCount()
{ {
BPP_INIT(ID_PLAYER_KILL_COUNT) BPP_INIT(ID_WORLD_KILL_COUNT)
} }
void Do(PlayerPacket &packet, Player &player) override void Do(PlayerPacket &packet, Player &player) override
@ -19,9 +19,9 @@ namespace mwmp
packet.Send(true); packet.Send(true);
Script::Call<Script::CallbackIdentity("OnPlayerKillCount")>(player.getId()); Script::Call<Script::CallbackIdentity("OnWorldKillCount")>(player.getId());
} }
}; };
} }
#endif //OPENMW_PROCESSORPLAYERKILLCOUNT_HPP #endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP

View file

@ -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<Script::CallbackIdentity("OnWorldKillCount")>(player.getId());
}
};
}
#endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP

View file

@ -116,7 +116,7 @@ add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageB
ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerAnimPlay ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior
ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerBook ProcessorPlayerBounty ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass
ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction
ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerKillCount ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerJail ProcessorPlayerJournal ProcessorWorldKillCount
ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys
ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech
ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic

View file

@ -1744,7 +1744,7 @@ namespace MWMechanics
Only increment death count for an actor if we are its authority, to avoid 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 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); bool isLocalActor = mwmp::Main::get().getCellController()->isLocalActor(iter->first);
@ -1757,7 +1757,7 @@ namespace MWMechanics
/* /*
Start of tes3mp addition 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 as long as we are the authority over the actor's cell
*/ */
if (isLocalActor) if (isLocalActor)

View file

@ -1573,12 +1573,12 @@ void LocalPlayer::sendKill(const std::string& refId, int number)
kill.refId = refId; kill.refId = refId;
kill.number = number; 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); killChanges.kills.push_back(kill);
getNetworking()->getPlayerPacket(ID_PLAYER_KILL_COUNT)->setPlayer(this); getNetworking()->getPlayerPacket(ID_WORLD_KILL_COUNT)->setPlayer(this);
getNetworking()->getPlayerPacket(ID_PLAYER_KILL_COUNT)->Send(); getNetworking()->getPlayerPacket(ID_WORLD_KILL_COUNT)->Send();
} }
void LocalPlayer::sendBook(const std::string& bookId) void LocalPlayer::sendBook(const std::string& bookId)

View file

@ -27,7 +27,7 @@
#include "player/ProcessorPlayerInventory.hpp" #include "player/ProcessorPlayerInventory.hpp"
#include "player/ProcessorPlayerJail.hpp" #include "player/ProcessorPlayerJail.hpp"
#include "player/ProcessorPlayerJournal.hpp" #include "player/ProcessorPlayerJournal.hpp"
#include "player/ProcessorPlayerKillCount.hpp" #include "player/ProcessorWorldKillCount.hpp"
#include "player/ProcessorPlayerLevel.hpp" #include "player/ProcessorPlayerLevel.hpp"
#include "player/ProcessorPlayerMiscellaneous.hpp" #include "player/ProcessorPlayerMiscellaneous.hpp"
#include "player/ProcessorPlayerMomentum.hpp" #include "player/ProcessorPlayerMomentum.hpp"
@ -126,7 +126,7 @@ void ProcessorInitializer()
PlayerProcessor::AddProcessor(new ProcessorPlayerInventory()); PlayerProcessor::AddProcessor(new ProcessorPlayerInventory());
PlayerProcessor::AddProcessor(new ProcessorPlayerJail()); PlayerProcessor::AddProcessor(new ProcessorPlayerJail());
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal()); PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
PlayerProcessor::AddProcessor(new ProcessorPlayerKillCount()); PlayerProcessor::AddProcessor(new ProcessorWorldKillCount());
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel()); PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous()); PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous());
PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum()); PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum());

View file

@ -1,16 +1,16 @@
#ifndef OPENMW_PROCESSORPLAYERKILLCOUNT_HPP #ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP
#define OPENMW_PROCESSORPLAYERKILLCOUNT_HPP #define OPENMW_PROCESSORWORLDKILLCOUNT_HPP
#include "../PlayerProcessor.hpp" #include "../PlayerProcessor.hpp"
namespace mwmp namespace mwmp
{ {
class ProcessorPlayerKillCount : public PlayerProcessor class ProcessorWorldKillCount : public PlayerProcessor
{ {
public: public:
ProcessorPlayerKillCount() ProcessorWorldKillCount()
{ {
BPP_INIT(ID_PLAYER_KILL_COUNT) BPP_INIT(ID_WORLD_KILL_COUNT)
} }
virtual void Do(PlayerPacket &packet, BasePlayer *player) virtual void Do(PlayerPacket &packet, BasePlayer *player)
@ -27,4 +27,4 @@ namespace mwmp
}; };
} }
#endif //OPENMW_PROCESSORPLAYERKILLCOUNT_HPP #endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP

View file

@ -182,7 +182,7 @@ add_component_dir (openmw-mp/Packets/Player
PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty
PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath PacketPlayerEquipment
PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerJail PacketPlayerJournal PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerJail PacketPlayerJournal
PacketPlayerKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition PacketWorldKillCount PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum PacketPlayerPosition
PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect PacketPlayerQuickKeys PacketPlayerRegionAuthority PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect
PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic
PacketPlayerTopic PacketPlayerTopic

View file

@ -25,7 +25,7 @@
#include "../Packets/Player/PacketPlayerInventory.hpp" #include "../Packets/Player/PacketPlayerInventory.hpp"
#include "../Packets/Player/PacketPlayerJail.hpp" #include "../Packets/Player/PacketPlayerJail.hpp"
#include "../Packets/Player/PacketPlayerJournal.hpp" #include "../Packets/Player/PacketPlayerJournal.hpp"
#include "../Packets/Player/PacketPlayerKillCount.hpp" #include "../Packets/Player/PacketWorldKillCount.hpp"
#include "../Packets/Player/PacketPlayerLevel.hpp" #include "../Packets/Player/PacketPlayerLevel.hpp"
#include "../Packets/Player/PacketPlayerMiscellaneous.hpp" #include "../Packets/Player/PacketPlayerMiscellaneous.hpp"
#include "../Packets/Player/PacketPlayerMomentum.hpp" #include "../Packets/Player/PacketPlayerMomentum.hpp"
@ -82,7 +82,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
AddPacket<PacketPlayerInventory>(&packets, peer); AddPacket<PacketPlayerInventory>(&packets, peer);
AddPacket<PacketPlayerJail>(&packets, peer); AddPacket<PacketPlayerJail>(&packets, peer);
AddPacket<PacketPlayerJournal>(&packets, peer); AddPacket<PacketPlayerJournal>(&packets, peer);
AddPacket<PacketPlayerKillCount>(&packets, peer); AddPacket<PacketWorldKillCount>(&packets, peer);
AddPacket<PacketPlayerLevel>(&packets, peer); AddPacket<PacketPlayerLevel>(&packets, peer);
AddPacket<PacketPlayerMiscellaneous>(&packets, peer); AddPacket<PacketPlayerMiscellaneous>(&packets, peer);
AddPacket<PacketPlayerMomentum>(&packets, peer); AddPacket<PacketPlayerMomentum>(&packets, peer);

View file

@ -41,7 +41,7 @@ enum GameMessages
ID_PLAYER_INVENTORY, ID_PLAYER_INVENTORY,
ID_PLAYER_JAIL, ID_PLAYER_JAIL,
ID_PLAYER_JOURNAL, ID_PLAYER_JOURNAL,
ID_PLAYER_KILL_COUNT, ID_WORLD_KILL_COUNT,
ID_PLAYER_LEVEL, ID_PLAYER_LEVEL,
ID_PLAYER_MISCELLANEOUS, ID_PLAYER_MISCELLANEOUS,
ID_PLAYER_MOMENTUM, ID_PLAYER_MOMENTUM,

View file

@ -1,17 +0,0 @@
#ifndef OPENMW_PACKETPLAYERREGIONCHANGE_HPP
#define OPENMW_PACKETPLAYERREGIONCHANGE_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
namespace mwmp
{
class PacketPlayerKillCount : public PlayerPacket
{
public:
PacketPlayerKillCount(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETPLAYERREGIONCHANGE_HPP

View file

@ -1,12 +1,12 @@
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#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); PlayerPacket::Packet(bs, send);

View file

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETWORLDKILLCOUNT_HPP
#define OPENMW_PACKETWORLDKILLCOUNT_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
namespace mwmp
{
class PacketWorldKillCount : public PlayerPacket
{
public:
PacketWorldKillCount(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, bool send);
};
}
#endif //OPENMW_PACKETWORLDKILLCOUNT_HPP