1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:49:56 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Actor/PacketActorCast.cpp

39 lines
924 B
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/TimedLog.hpp>
#include "PacketActorCast.hpp"
using namespace mwmp;
PacketActorCast::PacketActorCast(RakNet::RakPeerInterface *peer) : ActorPacket(peer)
{
packetID = ID_ACTOR_CAST;
}
void PacketActorCast::Actor(BaseActor &actor, bool send)
{
RW(actor.cast.target.isPlayer, send);
if (actor.cast.target.isPlayer)
{
RW(actor.cast.target.guid, send);
}
else
{
RW(actor.cast.target.refId, send, true);
RW(actor.cast.target.refNum, send);
RW(actor.cast.target.mpNum, send);
}
RW(actor.cast.type, send);
if (actor.cast.type == mwmp::Cast::ITEM)
RW(actor.cast.itemId, send, true);
else
{
RW(actor.cast.pressed, send);
RW(actor.cast.success, send);
RW(actor.cast.instant, send);
RW(actor.cast.spellId, send, true);
}
}