2017-02-04 12:25:43 +00:00
|
|
|
#include "PacketPlayerSkill.hpp"
|
2016-01-12 03:41:44 +00:00
|
|
|
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
|
|
#include <components/esm/creaturestats.hpp>
|
|
|
|
|
|
|
|
using namespace mwmp;
|
|
|
|
|
2017-02-04 12:25:43 +00:00
|
|
|
PacketPlayerSkill::PacketPlayerSkill(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2017-02-04 12:25:43 +00:00
|
|
|
packetID = ID_PLAYER_SKILL;
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
2017-03-06 09:44:08 +00:00
|
|
|
void PacketPlayerSkill::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);
|
2016-01-12 03:41:44 +00:00
|
|
|
|
2018-04-19 20:28:03 +00:00
|
|
|
uint32_t count;
|
|
|
|
|
2018-04-19 12:18:38 +00:00
|
|
|
if (send)
|
2018-04-19 20:28:03 +00:00
|
|
|
count = static_cast<uint32_t>(player->skillIndexChanges.size());
|
2018-04-19 12:18:38 +00:00
|
|
|
|
2018-04-19 20:28:03 +00:00
|
|
|
RW(count, send);
|
2018-04-19 12:18:38 +00:00
|
|
|
|
2018-04-19 20:28:03 +00:00
|
|
|
if (!send)
|
2018-04-19 12:18:38 +00:00
|
|
|
{
|
2018-04-19 20:28:03 +00:00
|
|
|
player->skillIndexChanges.clear();
|
|
|
|
player->skillIndexChanges.resize(count);
|
|
|
|
}
|
2017-06-02 18:23:23 +00:00
|
|
|
|
2018-04-19 20:28:03 +00:00
|
|
|
for (auto &&skillId : player->skillIndexChanges)
|
|
|
|
{
|
2018-04-19 12:18:38 +00:00
|
|
|
RW(skillId, send);
|
|
|
|
RW(player->npcStats.mSkills[skillId], send);
|
|
|
|
}
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|