mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-22 10:23:51 +00:00
39 lines
862 B
C++
39 lines
862 B
C++
//
|
|
// Created by koncord on 17.03.16.
|
|
//
|
|
|
|
#include "PacketPlayerSkill.hpp"
|
|
|
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include <components/esm/creaturestats.hpp>
|
|
|
|
using namespace mwmp;
|
|
|
|
PacketPlayerSkill::PacketPlayerSkill(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
{
|
|
packetID = ID_PLAYER_SKILL;
|
|
}
|
|
|
|
void PacketPlayerSkill::Packet(RakNet::BitStream *bs, bool send)
|
|
{
|
|
PlayerPacket::Packet(bs, send);
|
|
|
|
uint32_t count;
|
|
|
|
if (send)
|
|
count = static_cast<uint32_t>(player->skillChanges.skillIndexes.size());
|
|
|
|
RW(count, send);
|
|
|
|
if (!send)
|
|
{
|
|
player->skillChanges.skillIndexes.clear();
|
|
player->skillChanges.skillIndexes.resize(count);
|
|
}
|
|
|
|
for (auto && skillId : player->skillChanges.skillIndexes)
|
|
{
|
|
RW(skillId, send);
|
|
RW(player->npcStats.mSkills[skillId], send);
|
|
}
|
|
}
|