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 12:18:38 +00:00
|
|
|
if (send)
|
|
|
|
player->skillChanges.count = (unsigned int)(player->skillChanges.skillIndexes.size());
|
|
|
|
else
|
|
|
|
player->skillChanges.skillIndexes.clear();
|
|
|
|
|
|
|
|
RW(player->skillChanges.count, send);
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < player->skillChanges.count; i++)
|
|
|
|
{
|
|
|
|
int skillId;
|
2016-09-30 01:52:21 +00:00
|
|
|
|
2018-04-19 12:18:38 +00:00
|
|
|
if (send)
|
|
|
|
skillId = player->skillChanges.skillIndexes.at(i);
|
2017-06-02 18:23:23 +00:00
|
|
|
|
2018-04-19 12:18:38 +00:00
|
|
|
RW(skillId, send);
|
2016-09-30 04:15:59 +00:00
|
|
|
|
2018-04-19 12:18:38 +00:00
|
|
|
RW(player->npcStats.mSkills[skillId], send);
|
|
|
|
}
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|