mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 09:09:39 +00:00
[General] Turn WorldKillCount into a Worldstate packet
Rename the old WorldKillCount that was a Player packet into PlayerPlaceholder. Rename the unused CellCreate that was a Worldstate packet into WorldKillCount. On the server, move kill count-related script functions from QuestFunctions to WorldstateFunctions.
This commit is contained in:
parent
4a34666c59
commit
d163f1b6da
30 changed files with 306 additions and 311 deletions
|
@ -101,7 +101,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/ProcessorPlayerItemUse.hpp
|
||||
processors/player/ProcessorPlayerJournal.hpp processors/player/ProcessorWorldKillCount.hpp
|
||||
processors/player/ProcessorPlayerJournal.hpp processors/player/ProcessorPlayerPlaceholder.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
|
||||
|
@ -129,8 +129,8 @@ set(PROCESSORS_OBJECT
|
|||
source_group(tes3mp-server\\processors\\object FILES ${PROCESSORS_OBJECT})
|
||||
|
||||
set(PROCESSORS_WORLDSTATE
|
||||
processors/worldstate/ProcessorRecordDynamic.hpp processors/worldstate/ProcessorWorldMap.hpp
|
||||
processors/worldstate/ProcessorWorldWeather.hpp
|
||||
processors/worldstate/ProcessorRecordDynamic.hpp processors/worldstate/ProcessorWorldKillCount.hpp
|
||||
processors/worldstate/ProcessorWorldMap.hpp processors/worldstate/ProcessorWorldWeather.hpp
|
||||
)
|
||||
|
||||
source_group(tes3mp-server\\processors\\worldstate FILES ${PROCESSORS_WORLDSTATE})
|
||||
|
|
|
@ -16,14 +16,6 @@ void QuestFunctions::ClearJournalChanges(unsigned short pid) noexcept
|
|||
player->journalChanges.journalItems.clear();
|
||||
}
|
||||
|
||||
void QuestFunctions::ClearKillChanges(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->killChanges.kills.clear();
|
||||
}
|
||||
|
||||
unsigned int QuestFunctions::GetJournalChangesSize(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -32,14 +24,6 @@ unsigned int QuestFunctions::GetJournalChangesSize(unsigned short pid) noexcept
|
|||
return player->journalChanges.count;
|
||||
}
|
||||
|
||||
unsigned int QuestFunctions::GetKillChangesSize(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->killChanges.count;
|
||||
}
|
||||
|
||||
void QuestFunctions::AddJournalEntry(unsigned short pid, const char* quest, unsigned int index, const char* actorRefId) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -88,18 +72,6 @@ void QuestFunctions::AddJournalIndex(unsigned short pid, const char* quest, unsi
|
|||
player->journalChanges.journalItems.push_back(journalItem);
|
||||
}
|
||||
|
||||
void QuestFunctions::AddKill(unsigned short pid, const char* refId, int number) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::Kill kill;
|
||||
kill.refId = refId;
|
||||
kill.number = number;
|
||||
|
||||
player->killChanges.kills.push_back(kill);
|
||||
}
|
||||
|
||||
void QuestFunctions::SetReputation(unsigned short pid, int value) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -143,25 +115,6 @@ const char *QuestFunctions::GetJournalItemActorRefId(unsigned short pid, unsigne
|
|||
return player->journalChanges.journalItems.at(index).actorRefId.c_str();
|
||||
}
|
||||
|
||||
const char *QuestFunctions::GetKillRefId(unsigned short pid, unsigned int index) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, "");
|
||||
|
||||
if (index >= player->killChanges.count)
|
||||
return "invalid";
|
||||
|
||||
return player->killChanges.kills.at(index).refId.c_str();
|
||||
}
|
||||
|
||||
int QuestFunctions::GetKillNumber(unsigned short pid, unsigned int index) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, 0);
|
||||
|
||||
return player->killChanges.kills.at(index).number;
|
||||
}
|
||||
|
||||
int QuestFunctions::GetReputation(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -184,20 +137,6 @@ void QuestFunctions::SendJournalChanges(unsigned short pid, bool sendToOtherPlay
|
|||
packet->Send(true);
|
||||
}
|
||||
|
||||
void QuestFunctions::SendKillChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_WORLD_KILL_COUNT);
|
||||
packet->setPlayer(player);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
packet->Send(false);
|
||||
if (sendToOtherPlayers)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void QuestFunctions::SendReputation(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
@ -218,8 +157,3 @@ void QuestFunctions::InitializeJournalChanges(unsigned short pid) noexcept
|
|||
{
|
||||
ClearJournalChanges(pid);
|
||||
}
|
||||
|
||||
void QuestFunctions::InitializeKillChanges(unsigned short pid) noexcept
|
||||
{
|
||||
ClearKillChanges(pid);
|
||||
}
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
|
||||
#define QUESTAPI \
|
||||
{"ClearJournalChanges", QuestFunctions::ClearJournalChanges},\
|
||||
{"ClearKillChanges", QuestFunctions::ClearKillChanges},\
|
||||
\
|
||||
{"GetJournalChangesSize", QuestFunctions::GetJournalChangesSize},\
|
||||
{"GetKillChangesSize", QuestFunctions::GetKillChangesSize},\
|
||||
\
|
||||
{"AddJournalEntry", QuestFunctions::AddJournalEntry},\
|
||||
{"AddJournalEntryWithTimestamp", QuestFunctions::AddJournalEntryWithTimestamp},\
|
||||
{"AddJournalIndex", QuestFunctions::AddJournalIndex},\
|
||||
{"AddKill", QuestFunctions::AddKill},\
|
||||
\
|
||||
{"SetReputation", QuestFunctions::SetReputation},\
|
||||
\
|
||||
|
@ -19,17 +16,13 @@
|
|||
{"GetJournalItemIndex", QuestFunctions::GetJournalItemIndex},\
|
||||
{"GetJournalItemType", QuestFunctions::GetJournalItemType},\
|
||||
{"GetJournalItemActorRefId", QuestFunctions::GetJournalItemActorRefId},\
|
||||
{"GetKillRefId", QuestFunctions::GetKillRefId},\
|
||||
{"GetKillNumber", QuestFunctions::GetKillNumber},\
|
||||
\
|
||||
{"GetReputation", QuestFunctions::GetReputation},\
|
||||
\
|
||||
{"SendJournalChanges", QuestFunctions::SendJournalChanges},\
|
||||
{"SendKillChanges", QuestFunctions::SendKillChanges},\
|
||||
{"SendReputation", QuestFunctions::SendReputation},\
|
||||
\
|
||||
{"InitializeJournalChanges", QuestFunctions::InitializeJournalChanges},\
|
||||
{"InitializeKillChanges", QuestFunctions::InitializeKillChanges}
|
||||
{"InitializeJournalChanges", QuestFunctions::InitializeJournalChanges}
|
||||
|
||||
class QuestFunctions
|
||||
{
|
||||
|
@ -45,16 +38,6 @@ public:
|
|||
*/
|
||||
static void ClearJournalChanges(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the last recorded kill count changes for a player.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
static void ClearKillChanges(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the number of indexes in a player's latest journal changes.
|
||||
*
|
||||
|
@ -63,14 +46,6 @@ public:
|
|||
*/
|
||||
static unsigned int GetJournalChangesSize(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the number of indexes in a player's latest kill count changes.
|
||||
*
|
||||
* \param pid The player ID whose kill count changes should be used.
|
||||
* \return The number of indexes.
|
||||
*/
|
||||
static unsigned int GetKillChangesSize(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add a new journal item of type ENTRY to the journal changes for a player,
|
||||
* with a specific timestamp.
|
||||
|
@ -109,16 +84,6 @@ public:
|
|||
*/
|
||||
static void AddJournalIndex(unsigned short pid, const char* quest, unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add a new kill count to the kill count changes for a player.
|
||||
*
|
||||
* \param pid The player ID whose kill count changes should be used.
|
||||
* \param refId The refId of the kill count.
|
||||
* \param number The number of kills in the kill count.
|
||||
* \return void
|
||||
*/
|
||||
static void AddKill(unsigned short pid, const char* refId, int number) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the reputation of a certain player.
|
||||
*
|
||||
|
@ -166,24 +131,6 @@ public:
|
|||
*/
|
||||
static const char *GetJournalItemActorRefId(unsigned short pid, unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the refId at a certain index in a player's latest kill count changes.
|
||||
*
|
||||
* \param pid The player ID whose kill count changes should be used.
|
||||
* \param index The index of the kill count.
|
||||
* \return The refId.
|
||||
*/
|
||||
static const char *GetKillRefId(unsigned short pid, unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the number of kills at a certain index in a player's latest kill count changes.
|
||||
*
|
||||
* \param pid The player ID whose kill count changes should be used.
|
||||
* \param index The index of the kill count.
|
||||
* \return The number of kills.
|
||||
*/
|
||||
static int GetKillNumber(unsigned short pid, unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the a certain player's reputation.
|
||||
*
|
||||
|
@ -204,18 +151,6 @@ public:
|
|||
*/
|
||||
static void SendJournalChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \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
|
||||
* player attached to the packet (false by default).
|
||||
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
||||
* to the packet (false by default).
|
||||
* \return void
|
||||
*/
|
||||
static void SendKillChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a PlayerReputation packet with a player's recorded reputation.
|
||||
*
|
||||
|
@ -231,7 +166,6 @@ public:
|
|||
// All methods below are deprecated versions of methods from above
|
||||
|
||||
static void InitializeJournalChanges(unsigned short pid) noexcept;
|
||||
static void InitializeKillChanges(unsigned short pid) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -23,16 +23,36 @@ void WorldstateFunctions::CopyReceivedWorldstateToStore() noexcept
|
|||
writeWorldstate = *readWorldstate;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::ClearKillChanges() noexcept
|
||||
{
|
||||
writeWorldstate.killChanges.clear();
|
||||
}
|
||||
|
||||
void WorldstateFunctions::ClearMapChanges() noexcept
|
||||
{
|
||||
writeWorldstate.mapTiles.clear();
|
||||
}
|
||||
|
||||
unsigned int WorldstateFunctions::GetKillChangesSize() noexcept
|
||||
{
|
||||
return readWorldstate->killChanges.size();
|
||||
}
|
||||
|
||||
unsigned int WorldstateFunctions::GetMapChangesSize() noexcept
|
||||
{
|
||||
return readWorldstate->mapTiles.size();
|
||||
}
|
||||
|
||||
const char *WorldstateFunctions::GetKillRefId(unsigned int index) noexcept
|
||||
{
|
||||
return readWorldstate->killChanges.at(index).refId.c_str();
|
||||
}
|
||||
|
||||
int WorldstateFunctions::GetKillNumber(unsigned int index) noexcept
|
||||
{
|
||||
return readWorldstate->killChanges.at(index).number;
|
||||
}
|
||||
|
||||
const char *WorldstateFunctions::GetWeatherRegion() noexcept
|
||||
{
|
||||
return readWorldstate->weather.region.c_str();
|
||||
|
@ -153,6 +173,15 @@ void WorldstateFunctions::UseActorCollisionForPlacedObjects(bool useActorCollisi
|
|||
writeWorldstate.useActorCollisionForPlacedObjects = useActorCollision;
|
||||
}
|
||||
|
||||
void WorldstateFunctions::AddKill(const char* refId, int number) noexcept
|
||||
{
|
||||
mwmp::Kill kill;
|
||||
kill.refId = refId;
|
||||
kill.number = number;
|
||||
|
||||
writeWorldstate.killChanges.push_back(kill);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::AddSynchronizedClientScriptId(const char *scriptId) noexcept
|
||||
{
|
||||
writeWorldstate.synchronizedClientScriptIds.push_back(scriptId);
|
||||
|
@ -232,6 +261,23 @@ void WorldstateFunctions::SendClientScriptSettings(unsigned short pid, bool send
|
|||
packet->Send(true);
|
||||
}
|
||||
|
||||
|
||||
void WorldstateFunctions::SendWorldKillCount(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
writeWorldstate.guid = player->guid;
|
||||
|
||||
mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_KILL_COUNT);
|
||||
packet->setWorldstate(&writeWorldstate);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
packet->Send(false);
|
||||
if (sendToOtherPlayers)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SendWorldMap(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
Player *player;
|
||||
|
|
|
@ -9,10 +9,15 @@
|
|||
\
|
||||
{"CopyReceivedWorldstateToStore", WorldstateFunctions::CopyReceivedWorldstateToStore},\
|
||||
\
|
||||
{"ClearKillChanges", WorldstateFunctions::ClearKillChanges},\
|
||||
{"ClearMapChanges", WorldstateFunctions::ClearMapChanges},\
|
||||
\
|
||||
{"GetKillChangesSize", WorldstateFunctions::GetKillChangesSize},\
|
||||
{"GetMapChangesSize", WorldstateFunctions::GetMapChangesSize},\
|
||||
\
|
||||
{"GetKillRefId", WorldstateFunctions::GetKillRefId},\
|
||||
{"GetKillNumber", WorldstateFunctions::GetKillNumber},\
|
||||
\
|
||||
{"GetWeatherRegion", WorldstateFunctions::GetWeatherRegion},\
|
||||
{"GetWeatherCurrent", WorldstateFunctions::GetWeatherCurrent},\
|
||||
{"GetWeatherNext", WorldstateFunctions::GetWeatherNext},\
|
||||
|
@ -43,6 +48,7 @@
|
|||
{"SetPlacedObjectCollisionState", WorldstateFunctions::SetPlacedObjectCollisionState},\
|
||||
{"UseActorCollisionForPlacedObjects", WorldstateFunctions::UseActorCollisionForPlacedObjects},\
|
||||
\
|
||||
{"AddKill", WorldstateFunctions::AddKill},\
|
||||
{"AddSynchronizedClientScriptId", WorldstateFunctions::AddSynchronizedClientScriptId},\
|
||||
{"AddSynchronizedClientGlobalId", WorldstateFunctions::AddSynchronizedClientGlobalId},\
|
||||
{"AddEnforcedCollisionRefId", WorldstateFunctions::AddEnforcedCollisionRefId},\
|
||||
|
@ -55,6 +61,7 @@
|
|||
{"LoadMapTileImageFile", WorldstateFunctions::LoadMapTileImageFile},\
|
||||
\
|
||||
{"SendClientScriptSettings", WorldstateFunctions::SendClientScriptSettings},\
|
||||
{"SendWorldKillCount", WorldstateFunctions::SendWorldKillCount},\
|
||||
{"SendWorldMap", WorldstateFunctions::SendWorldMap},\
|
||||
{"SendWorldTime", WorldstateFunctions::SendWorldTime},\
|
||||
{"SendWorldWeather", WorldstateFunctions::SendWorldWeather},\
|
||||
|
@ -87,6 +94,15 @@ public:
|
|||
*/
|
||||
static void CopyReceivedWorldstateToStore() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the kill count changes for the write-only worldstate.
|
||||
*
|
||||
* This is used to initialize the sending of new WorldKillCount packets.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void ClearKillChanges() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the map changes for the write-only worldstate.
|
||||
*
|
||||
|
@ -103,6 +119,29 @@ public:
|
|||
*/
|
||||
static unsigned int GetMapChangesSize() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the number of indexes in the read worldstate's kill changes.
|
||||
*
|
||||
* \return The number of indexes.
|
||||
*/
|
||||
static unsigned int GetKillChangesSize() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the refId at a certain index in the read worldstate's kill count changes.
|
||||
*
|
||||
* \param index The index of the kill count.
|
||||
* \return The refId.
|
||||
*/
|
||||
static const char *GetKillRefId(unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the number of kills at a certain index in the read worldstate's kill count changes.
|
||||
*
|
||||
* \param index The index of the kill count.
|
||||
* \return The number of kills.
|
||||
*/
|
||||
static int GetKillNumber(unsigned int index) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the weather region in the read worldstate.
|
||||
*
|
||||
|
@ -299,6 +338,15 @@ public:
|
|||
*/
|
||||
static void UseActorCollisionForPlacedObjects(bool useActorCollision) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add a new kill count to the kill count changes.
|
||||
*
|
||||
* \param refId The refId of the kill count.
|
||||
* \param number The number of kills in the kill count.
|
||||
* \return void
|
||||
*/
|
||||
static void AddKill(const char* refId, int number) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add an ID to the list of script IDs whose variable changes should be sent to the
|
||||
* the server by clients.
|
||||
|
@ -384,6 +432,19 @@ public:
|
|||
*/
|
||||
static void SendClientScriptSettings(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a WorldKillCount packet with the current set of kill count changes in the write-only
|
||||
* worldstate.
|
||||
*
|
||||
* \param pid The player ID attached to the packet.
|
||||
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
||||
* player attached to the packet (false by default).
|
||||
* \param skipAttachedPlayer Whether the packet should skip being sent to the player attached
|
||||
* to the packet (false by default).
|
||||
* \return void
|
||||
*/
|
||||
static void SendWorldKillCount(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a WorldRegionAuthority packet establishing a certain player as the only one who
|
||||
* should process certain region-specific events (such as weather changes).
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "player/ProcessorPlayerInventory.hpp"
|
||||
#include "player/ProcessorPlayerItemUse.hpp"
|
||||
#include "player/ProcessorPlayerJournal.hpp"
|
||||
#include "player/ProcessorWorldKillCount.hpp"
|
||||
#include "player/ProcessorPlayerPlaceholder.hpp"
|
||||
#include "player/ProcessorPlayerInput.hpp"
|
||||
#include "player/ProcessorPlayerLevel.hpp"
|
||||
#include "player/ProcessorPlayerMiscellaneous.hpp"
|
||||
|
@ -77,6 +77,7 @@
|
|||
#include "object/ProcessorVideoPlay.hpp"
|
||||
#include "WorldstateProcessor.hpp"
|
||||
#include "worldstate/ProcessorRecordDynamic.hpp"
|
||||
#include "worldstate/ProcessorWorldKillCount.hpp"
|
||||
#include "worldstate/ProcessorWorldMap.hpp"
|
||||
#include "worldstate/ProcessorWorldWeather.hpp"
|
||||
|
||||
|
@ -104,7 +105,7 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorPlayerInventory());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerItemUse());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
|
||||
PlayerProcessor::AddProcessor(new ProcessorWorldKillCount());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerPlaceholder());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerInput());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous());
|
||||
|
@ -157,6 +158,7 @@ void ProcessorInitializer()
|
|||
ObjectProcessor::AddProcessor(new ProcessorVideoPlay());
|
||||
|
||||
WorldstateProcessor::AddProcessor(new ProcessorRecordDynamic());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldKillCount());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldMap());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldWeather());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef OPENMW_PROCESSORPLACEHOLDER_HPP
|
||||
#define OPENMW_PROCESSORPLACEHOLDER_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerPlaceholder : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerPlaceholder()
|
||||
{
|
||||
BPP_INIT(ID_WORLD_KILL_COUNT)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLACEHOLDER_HPP
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
#define OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
#include "../WorldstateProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorWorldKillCount : public PlayerProcessor
|
||||
class ProcessorWorldKillCount : public WorldstateProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorWorldKillCount()
|
||||
|
@ -13,7 +13,7 @@ namespace mwmp
|
|||
BPP_INIT(ID_WORLD_KILL_COUNT)
|
||||
}
|
||||
|
||||
void Do(PlayerPacket &packet, Player &player) override
|
||||
void Do(WorldstatePacket &packet, Player &player, BaseWorldstate &worldstate) override
|
||||
{
|
||||
DEBUG_PRINTF(strPacketID.c_str());
|
||||
|
|
@ -117,9 +117,10 @@ add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageB
|
|||
ProcessorPlayerBounty ProcessorPlayerCast ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass
|
||||
ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction
|
||||
ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerItemUse ProcessorPlayerJail ProcessorPlayerJournal
|
||||
ProcessorWorldKillCount ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition
|
||||
ProcessorPlayerQuickKeys ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill
|
||||
ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys
|
||||
ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill
|
||||
ProcessorPlayerSpeech ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic
|
||||
ProcessorPlayerPlaceholder
|
||||
)
|
||||
|
||||
add_openmw_dir (mwmp/processors/object BaseObjectProcessor
|
||||
|
@ -134,8 +135,8 @@ add_openmw_dir (mwmp/processors/object BaseObjectProcessor
|
|||
ProcessorScriptGlobalFloat
|
||||
)
|
||||
|
||||
add_openmw_dir (mwmp/processors/worldstate ProcessorCellCreate ProcessorCellReset ProcessorClientScriptSettings
|
||||
ProcessorRecordDynamic ProcessorWorldCollisionOverride ProcessorWorldMap ProcessorWorldRegionAuthority ProcessorWorldTime
|
||||
add_openmw_dir (mwmp/processors/worldstate ProcessorCellReset ProcessorClientScriptSettings ProcessorRecordDynamic
|
||||
ProcessorWorldCollisionOverride ProcessorWorldKillCount ProcessorWorldMap ProcessorWorldRegionAuthority ProcessorWorldTime
|
||||
ProcessorWorldWeather
|
||||
)
|
||||
|
||||
|
|
|
@ -1860,7 +1860,7 @@ namespace MWMechanics
|
|||
std::string refId = Misc::StringUtils::lowerCase(actor.getCellRef().getRefId());
|
||||
int number = mDeathCount[refId];
|
||||
|
||||
mwmp::Main::get().getLocalPlayer()->sendKill(refId, number);
|
||||
mwmp::Main::get().getNetworking()->getWorldstate()->sendKill(refId, number);
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -1314,27 +1314,6 @@ void LocalPlayer::setFactions()
|
|||
}
|
||||
}
|
||||
|
||||
void LocalPlayer::setKills()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_WORLD_KILL_COUNT with the following kill counts:");
|
||||
std::string debugMessage = "";
|
||||
|
||||
for (const auto &kill : killChanges.kills)
|
||||
{
|
||||
if (TimedLog::GetLevel() <= TimedLog::LOG_INFO)
|
||||
{
|
||||
if (!debugMessage.empty())
|
||||
debugMessage += ", ";
|
||||
|
||||
debugMessage += kill.refId + ": " + std::to_string(kill.number);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setDeaths(kill.refId, kill.number);
|
||||
}
|
||||
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- %s", debugMessage.c_str());
|
||||
}
|
||||
|
||||
void LocalPlayer::setBooks()
|
||||
{
|
||||
MWWorld::Ptr ptrPlayer = getPlayerPtr();
|
||||
|
@ -1620,22 +1599,6 @@ void LocalPlayer::sendTopic(const std::string& topicId)
|
|||
getNetworking()->getPlayerPacket(ID_PLAYER_TOPIC)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::sendKill(const std::string& refId, int number)
|
||||
{
|
||||
killChanges.kills.clear();
|
||||
|
||||
mwmp::Kill kill;
|
||||
kill.refId = refId;
|
||||
kill.number = number;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Sending ID_WORLD_KILL_COUNT with refId %s, number %i", refId.c_str(), number);
|
||||
|
||||
killChanges.kills.push_back(kill);
|
||||
|
||||
getNetworking()->getPlayerPacket(ID_WORLD_KILL_COUNT)->setPlayer(this);
|
||||
getNetworking()->getPlayerPacket(ID_WORLD_KILL_COUNT)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::sendBook(const std::string& bookId)
|
||||
{
|
||||
bookChanges.books.clear();
|
||||
|
|
|
@ -70,7 +70,6 @@ namespace mwmp
|
|||
void setSpellbook();
|
||||
void setQuickKeys();
|
||||
void setFactions();
|
||||
void setKills();
|
||||
void setBooks();
|
||||
void setShapeshift();
|
||||
void setMarkLocation();
|
||||
|
@ -90,7 +89,6 @@ namespace mwmp
|
|||
void sendFactionExpulsionState(const std::string& factionId, bool isExpelled);
|
||||
void sendFactionReputation(const std::string& factionId, int reputation);
|
||||
void sendTopic(const std::string& topic);
|
||||
void sendKill(const std::string& refId, int number);
|
||||
void sendBook(const std::string& bookId);
|
||||
void sendWerewolfState(bool isWerewolf);
|
||||
void sendMarkLocation(const ESM::Cell& newMarkCell, const ESM::Position& newMarkPosition);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "../mwgui/windowmanagerimp.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/worldimp.hpp"
|
||||
|
||||
|
@ -311,6 +313,27 @@ void Worldstate::markExploredMapTile(int cellX, int cellY)
|
|||
exploredMapTiles.push_back(exploredTile);
|
||||
}
|
||||
|
||||
void Worldstate::setKills()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_WORLD_KILL_COUNT with the following kill counts:");
|
||||
std::string debugMessage = "";
|
||||
|
||||
for (const auto &killChange : killChanges)
|
||||
{
|
||||
if (TimedLog::GetLevel() <= TimedLog::LOG_INFO)
|
||||
{
|
||||
if (!debugMessage.empty())
|
||||
debugMessage += ", ";
|
||||
|
||||
debugMessage += killChange.refId + ": " + std::to_string(killChange.number);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setDeaths(killChange.refId, killChange.number);
|
||||
}
|
||||
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- %s", debugMessage.c_str());
|
||||
}
|
||||
|
||||
void Worldstate::setMapExplored()
|
||||
{
|
||||
for (const auto &mapTile : mapTiles)
|
||||
|
@ -345,6 +368,22 @@ void Worldstate::setWeather()
|
|||
weather.queuedWeather, weather.transitionFactor, forceWeather);
|
||||
}
|
||||
|
||||
void Worldstate::sendKill(const std::string& refId, int number)
|
||||
{
|
||||
killChanges.clear();
|
||||
|
||||
mwmp::Kill killChange;
|
||||
killChange.refId = refId;
|
||||
killChange.number = number;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Sending ID_WORLD_KILL_COUNT with refId %s, number %i", refId.c_str(), number);
|
||||
|
||||
killChanges.push_back(killChange);
|
||||
|
||||
getNetworking()->getWorldstatePacket(ID_WORLD_KILL_COUNT)->setWorldstate(this);
|
||||
getNetworking()->getWorldstatePacket(ID_WORLD_KILL_COUNT)->Send();
|
||||
}
|
||||
|
||||
void Worldstate::sendMapExplored(int cellX, int cellY, const std::vector<char>& imageData)
|
||||
{
|
||||
mapTiles.clear();
|
||||
|
|
|
@ -18,9 +18,11 @@ namespace mwmp
|
|||
bool containsExploredMapTile(int cellX, int cellY);
|
||||
void markExploredMapTile(int cellX, int cellY);
|
||||
|
||||
void setKills();
|
||||
void setMapExplored();
|
||||
void setWeather();
|
||||
|
||||
void sendKill(const std::string& refId, int number);
|
||||
void sendMapExplored(int cellX, int cellY, const std::vector<char>& imageData);
|
||||
void sendWeather(std::string region, int currentWeather, int nextWeather, int queuedWeather, float transitionFactor);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "player/ProcessorPlayerItemUse.hpp"
|
||||
#include "player/ProcessorPlayerJail.hpp"
|
||||
#include "player/ProcessorPlayerJournal.hpp"
|
||||
#include "player/ProcessorWorldKillCount.hpp"
|
||||
#include "player/ProcessorPlayerPlaceholder.hpp"
|
||||
#include "player/ProcessorPlayerLevel.hpp"
|
||||
#include "player/ProcessorPlayerMiscellaneous.hpp"
|
||||
#include "player/ProcessorPlayerMomentum.hpp"
|
||||
|
@ -89,11 +89,11 @@
|
|||
#include "actor/ProcessorActorTest.hpp"
|
||||
|
||||
#include "WorldstateProcessor.hpp"
|
||||
#include "worldstate/ProcessorCellCreate.hpp"
|
||||
#include "worldstate/ProcessorCellReset.hpp"
|
||||
#include "worldstate/ProcessorClientScriptSettings.hpp"
|
||||
#include "worldstate/ProcessorRecordDynamic.hpp"
|
||||
#include "worldstate/ProcessorWorldCollisionOverride.hpp"
|
||||
#include "worldstate/ProcessorWorldKillCount.hpp"
|
||||
#include "worldstate/ProcessorWorldMap.hpp"
|
||||
#include "worldstate/ProcessorWorldRegionAuthority.hpp"
|
||||
#include "worldstate/ProcessorWorldTime.hpp"
|
||||
|
@ -130,7 +130,7 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorPlayerItemUse());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerJail());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerJournal());
|
||||
PlayerProcessor::AddProcessor(new ProcessorWorldKillCount());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerPlaceholder());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerLevel());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMiscellaneous());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerMomentum());
|
||||
|
@ -188,7 +188,7 @@ void ProcessorInitializer()
|
|||
ActorProcessor::AddProcessor(new ProcessorActorStatsDynamic());
|
||||
ActorProcessor::AddProcessor(new ProcessorActorTest());
|
||||
|
||||
WorldstateProcessor::AddProcessor(new ProcessorCellCreate());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorWorldKillCount());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorCellReset());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorClientScriptSettings());
|
||||
WorldstateProcessor::AddProcessor(new ProcessorRecordDynamic());
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
#define OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
#ifndef OPENMW_PROCESSORPLACEHOLDER_HPP
|
||||
#define OPENMW_PROCESSORPLACEHOLDER_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorWorldKillCount : public PlayerProcessor
|
||||
class ProcessorPlayerPlaceholder : public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorWorldKillCount()
|
||||
ProcessorPlayerPlaceholder()
|
||||
{
|
||||
BPP_INIT(ID_WORLD_KILL_COUNT)
|
||||
BPP_INIT(ID_PLACEHOLDER)
|
||||
}
|
||||
|
||||
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
||||
|
@ -21,10 +21,10 @@ namespace mwmp
|
|||
}
|
||||
else if (player != 0)
|
||||
{
|
||||
static_cast<LocalPlayer*>(player)->setKills();
|
||||
// Placeholder
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
#endif //OPENMW_PROCESSORPLACEHOLDER_HPP
|
|
@ -1,23 +0,0 @@
|
|||
#ifndef OPENMW_PROCESSORCELLCREATE_HPP
|
||||
#define OPENMW_PROCESSORCELLCREATE_HPP
|
||||
|
||||
#include "../WorldstateProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorCellCreate : public WorldstateProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorCellCreate()
|
||||
{
|
||||
BPP_INIT(ID_PLACEHOLDER)
|
||||
}
|
||||
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate)
|
||||
{
|
||||
// Placeholder
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORCELLCREATE_HPP
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
#define OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
||||
|
||||
#include "../WorldstateProcessor.hpp"
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorWorldKillCount : public WorldstateProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorWorldKillCount()
|
||||
{
|
||||
BPP_INIT(ID_WORLD_KILL_COUNT)
|
||||
}
|
||||
|
||||
virtual void Do(WorldstatePacket &packet, Worldstate &worldstate)
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldstate()->setKills();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORWORLDKILLCOUNT_HPP
|
|
@ -187,10 +187,12 @@ add_component_dir (openmw-mp/Packets/Player
|
|||
PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty
|
||||
PacketPlayerCast PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath
|
||||
PacketPlayerEquipment PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerItemUse
|
||||
PacketPlayerJail PacketPlayerJournal PacketWorldKillCount PacketPlayerLevel PacketPlayerMiscellaneous
|
||||
PacketPlayerMomentum PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerReputation PacketPlayerRest
|
||||
PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook
|
||||
PacketPlayerStatsDynamic PacketPlayerTopic
|
||||
PacketPlayerJail PacketPlayerJournal PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum
|
||||
PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect
|
||||
PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic
|
||||
PacketPlayerTopic
|
||||
|
||||
PacketPlayerPlaceholder
|
||||
)
|
||||
|
||||
add_component_dir (openmw-mp/Packets/Object
|
||||
|
@ -209,7 +211,7 @@ add_component_dir (openmw-mp/Packets/Worldstate
|
|||
WorldstatePacket
|
||||
|
||||
PacketCellCreate PacketCellReset PacketClientScriptSettings PacketRecordDynamic PacketWorldCollisionOverride
|
||||
PacketWorldMap PacketWorldRegionAuthority PacketWorldTime PacketWorldWeather
|
||||
PacketWorldKillCount PacketWorldMap PacketWorldRegionAuthority PacketWorldTime PacketWorldWeather
|
||||
)
|
||||
|
||||
add_component_dir (fallback
|
||||
|
|
|
@ -54,12 +54,6 @@ namespace mwmp
|
|||
std::string topicId;
|
||||
};
|
||||
|
||||
struct Kill
|
||||
{
|
||||
std::string refId;
|
||||
int number;
|
||||
};
|
||||
|
||||
struct Book
|
||||
{
|
||||
std::string bookId;
|
||||
|
@ -121,12 +115,6 @@ namespace mwmp
|
|||
unsigned int count;
|
||||
};
|
||||
|
||||
struct KillChanges
|
||||
{
|
||||
std::vector<Kill> kills;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
struct BookChanges
|
||||
{
|
||||
std::vector<Book> books;
|
||||
|
@ -260,7 +248,6 @@ namespace mwmp
|
|||
JournalChanges journalChanges;
|
||||
FactionChanges factionChanges;
|
||||
TopicChanges topicChanges;
|
||||
KillChanges killChanges;
|
||||
BookChanges bookChanges;
|
||||
CellStateChanges cellStateChanges;
|
||||
|
||||
|
|
|
@ -297,6 +297,12 @@ namespace mwmp
|
|||
float transitionFactor;
|
||||
};
|
||||
|
||||
struct Kill
|
||||
{
|
||||
std::string refId;
|
||||
int number;
|
||||
};
|
||||
|
||||
class BaseWorldstate
|
||||
{
|
||||
public:
|
||||
|
@ -325,6 +331,7 @@ namespace mwmp
|
|||
|
||||
std::string authorityRegion;
|
||||
|
||||
std::vector<Kill> killChanges;
|
||||
std::vector<std::string> enforcedCollisionRefIds;
|
||||
|
||||
std::vector<MapTile> mapTiles;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "../Packets/Player/PacketPlayerItemUse.hpp"
|
||||
#include "../Packets/Player/PacketPlayerJail.hpp"
|
||||
#include "../Packets/Player/PacketPlayerJournal.hpp"
|
||||
#include "../Packets/Player/PacketWorldKillCount.hpp"
|
||||
#include "../Packets/Player/PacketPlayerPlaceholder.hpp"
|
||||
#include "../Packets/Player/PacketPlayerLevel.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMiscellaneous.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMomentum.hpp"
|
||||
|
@ -83,7 +83,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
|
|||
AddPacket<PacketPlayerItemUse>(&packets, peer);
|
||||
AddPacket<PacketPlayerJail>(&packets, peer);
|
||||
AddPacket<PacketPlayerJournal>(&packets, peer);
|
||||
AddPacket<PacketWorldKillCount>(&packets, peer);
|
||||
AddPacket<PacketPlayerPlaceholder>(&packets, peer);
|
||||
AddPacket<PacketPlayerLevel>(&packets, peer);
|
||||
AddPacket<PacketPlayerMiscellaneous>(&packets, peer);
|
||||
AddPacket<PacketPlayerMomentum>(&packets, peer);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "../Packets/Worldstate/PacketCellCreate.hpp"
|
||||
#include "../Packets/Worldstate/PacketCellReset.hpp"
|
||||
#include "../Packets/Worldstate/PacketClientScriptSettings.hpp"
|
||||
#include "../Packets/Worldstate/PacketRecordDynamic.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldCollisionOverride.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldKillCount.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldMap.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldRegionAuthority.hpp"
|
||||
#include "../Packets/Worldstate/PacketWorldTime.hpp"
|
||||
|
@ -20,11 +20,11 @@ inline void AddPacket(mwmp::WorldstatePacketController::packets_t *packets, RakN
|
|||
|
||||
mwmp::WorldstatePacketController::WorldstatePacketController(RakNet::RakPeerInterface *peer)
|
||||
{
|
||||
AddPacket<PacketCellCreate>(&packets, peer);
|
||||
AddPacket<PacketCellReset>(&packets, peer);
|
||||
AddPacket<PacketClientScriptSettings>(&packets, peer);
|
||||
AddPacket<PacketRecordDynamic>(&packets, peer);
|
||||
AddPacket<PacketWorldCollisionOverride>(&packets, peer);
|
||||
AddPacket<PacketWorldKillCount>(&packets, peer);
|
||||
AddPacket<PacketWorldMap>(&packets, peer);
|
||||
AddPacket<PacketWorldRegionAuthority>(&packets, peer);
|
||||
AddPacket<PacketWorldTime>(&packets, peer);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketPlayerPlaceholder.hpp"
|
||||
|
||||
mwmp::PacketPlayerPlaceholder::PacketPlayerPlaceholder(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLACEHOLDER;
|
||||
}
|
||||
|
||||
void mwmp::PacketPlayerPlaceholder::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
// Placeholder
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef OPENMW_PACKETPLACEHOLDER_HPP
|
||||
#define OPENMW_PACKETPLACEHOLDER_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPlayerPlaceholder : public PlayerPacket
|
||||
{
|
||||
public:
|
||||
PacketPlayerPlaceholder(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETPLACEHOLDER_HPP
|
|
@ -1,33 +0,0 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketWorldKillCount.hpp"
|
||||
|
||||
mwmp::PacketWorldKillCount::PacketWorldKillCount(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_WORLD_KILL_COUNT;
|
||||
}
|
||||
|
||||
void mwmp::PacketWorldKillCount::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(bs, send);
|
||||
|
||||
if (send)
|
||||
player->killChanges.count = (unsigned int)(player->killChanges.kills.size());
|
||||
else
|
||||
player->killChanges.kills.clear();
|
||||
|
||||
RW(player->killChanges.count, send);
|
||||
|
||||
for (unsigned int i = 0; i < player->killChanges.count; i++)
|
||||
{
|
||||
Kill kill;
|
||||
|
||||
if (send)
|
||||
kill = player->killChanges.kills.at(i);
|
||||
|
||||
RW(kill.refId, send, true);
|
||||
RW(kill.number, send);
|
||||
|
||||
if (!send)
|
||||
player->killChanges.kills.push_back(kill);
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#include "PacketCellCreate.hpp"
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketCellCreate::PacketCellCreate(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
|
||||
{
|
||||
packetID = ID_PLACEHOLDER;
|
||||
orderChannel = CHANNEL_SYSTEM;
|
||||
}
|
||||
|
||||
void PacketCellCreate::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldstatePacket::Packet(bs, send);
|
||||
|
||||
// Placeholder
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef OPENMW_PACKETCELLCREATE_HPP
|
||||
#define OPENMW_PACKETCELLCREATE_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketCellCreate: public WorldstatePacket
|
||||
{
|
||||
public:
|
||||
PacketCellCreate(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *bs, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETCELLCREATE_HPP
|
|
@ -0,0 +1,34 @@
|
|||
#include "PacketWorldKillCount.hpp"
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
using namespace mwmp;
|
||||
|
||||
PacketWorldKillCount::PacketWorldKillCount(RakNet::RakPeerInterface *peer) : WorldstatePacket(peer)
|
||||
{
|
||||
packetID = ID_WORLD_KILL_COUNT;
|
||||
orderChannel = CHANNEL_SYSTEM;
|
||||
}
|
||||
|
||||
void PacketWorldKillCount::Packet(RakNet::BitStream *bs, bool send)
|
||||
{
|
||||
WorldstatePacket::Packet(bs, send);
|
||||
|
||||
uint32_t killChangesCount;
|
||||
|
||||
if (send)
|
||||
killChangesCount = static_cast<uint32_t>(worldstate->killChanges.size());
|
||||
|
||||
RW(killChangesCount, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
worldstate->killChanges.clear();
|
||||
worldstate->killChanges.resize(killChangesCount);
|
||||
}
|
||||
|
||||
for (auto &&killChange : worldstate->killChanges)
|
||||
{
|
||||
RW(killChange.refId, send, true);
|
||||
RW(killChange.number, send);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef OPENMW_PACKETWORLDKILLCOUNT_HPP
|
||||
#define OPENMW_PACKETWORLDKILLCOUNT_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
#include <components/openmw-mp/Packets/Worldstate/WorldstatePacket.hpp>
|
||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketWorldKillCount : public PlayerPacket
|
||||
class PacketWorldKillCount: public WorldstatePacket
|
||||
{
|
||||
public:
|
||||
PacketWorldKillCount(RakNet::RakPeerInterface *peer);
|
Loading…
Reference in a new issue