You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp

40 lines
830 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->skillIndexChanges.size());
RW(count, send);
if (!send)
{
player->skillIndexChanges.clear();
player->skillIndexChanges.resize(count);
}
for (auto && skillId : player->skillIndexChanges)
{
RW(skillId, send);
RW(player->npcStats.mSkills[skillId], send);
}
}