2017-04-16 06:00:18 +00:00
|
|
|
#include "PacketPlayerStatsDynamic.hpp"
|
2016-01-12 03:41:44 +00:00
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-04-16 06:00:18 +00:00
|
|
|
PacketPlayerStatsDynamic::PacketPlayerStatsDynamic(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2017-04-16 06:00:18 +00:00
|
|
|
packetID = ID_PLAYER_STATS_DYNAMIC;
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
2017-04-16 06:00:18 +00:00
|
|
|
void PacketPlayerStatsDynamic::Packet(RakNet::BitStream *bs, bool send)
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2017-03-06 09:44:08 +00:00
|
|
|
PlayerPacket::Packet(bs, send);
|
2017-12-02 16:29:30 +00:00
|
|
|
|
|
|
|
uint32_t count;
|
|
|
|
if (send)
|
|
|
|
count = static_cast<uint32_t>(player->statsDynamicIndexChanges.size());
|
|
|
|
|
|
|
|
RW(count, send);
|
|
|
|
|
|
|
|
if (!send)
|
|
|
|
{
|
|
|
|
player->statsDynamicIndexChanges.clear();
|
|
|
|
player->statsDynamicIndexChanges.resize(count);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &&statsDynamicIndex : player->statsDynamicIndexChanges)
|
|
|
|
{
|
|
|
|
RW(statsDynamicIndex, send);
|
|
|
|
|
|
|
|
RW(player->creatureStats.mDynamic[statsDynamicIndex], send);
|
|
|
|
}
|
2017-01-26 04:17:29 +00:00
|
|
|
}
|