2016-01-12 03:41:44 +00:00
|
|
|
//
|
|
|
|
// Created by koncord on 17.03.16.
|
|
|
|
//
|
|
|
|
|
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);
|
2017-11-28 13:37:46 +00:00
|
|
|
|
|
|
|
uint32_t count;
|
2016-01-12 03:41:44 +00:00
|
|
|
|
2017-11-24 10:38:42 +00:00
|
|
|
if (send)
|
2017-11-28 13:37:46 +00:00
|
|
|
count = static_cast<uint32_t>(player->skillChanges.skillIndexes.size());
|
2017-11-24 10:38:42 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
RW(count, send);
|
2017-11-24 10:38:42 +00:00
|
|
|
|
2017-11-29 11:00:22 +00:00
|
|
|
if (!send)
|
2017-11-24 10:38:42 +00:00
|
|
|
{
|
2017-11-28 13:37:46 +00:00
|
|
|
player->skillChanges.skillIndexes.clear();
|
|
|
|
player->skillChanges.skillIndexes.resize(count);
|
|
|
|
}
|
2017-11-24 10:38:42 +00:00
|
|
|
|
2017-11-28 13:37:46 +00:00
|
|
|
for (auto && skillId : player->skillChanges.skillIndexes)
|
|
|
|
{
|
2017-11-24 10:38:42 +00:00
|
|
|
RW(skillId, send);
|
|
|
|
RW(player->npcStats.mSkills[skillId], send);
|
|
|
|
}
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|