mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
9350e1d484
Create an entirely new PlayerCast packet for that purpose, but rename the already existing but unused ActorInteraction into ActorCast.
42 lines
1,000 B
C++
42 lines
1,000 B
C++
#include <components/openmw-mp/NetworkMessages.hpp>
|
|
#include "PacketPlayerCast.hpp"
|
|
|
|
#include <components/openmw-mp/TimedLog.hpp>
|
|
|
|
using namespace mwmp;
|
|
|
|
PacketPlayerCast::PacketPlayerCast(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
|
{
|
|
packetID = ID_PLAYER_CAST;
|
|
}
|
|
|
|
void PacketPlayerCast::Packet(RakNet::BitStream *bs, bool send)
|
|
{
|
|
PlayerPacket::Packet(bs, send);
|
|
|
|
RW(player->cast.target.isPlayer, send);
|
|
|
|
if (player->cast.target.isPlayer)
|
|
{
|
|
RW(player->cast.target.guid, send);
|
|
}
|
|
else
|
|
{
|
|
RW(player->cast.target.refId, send, true);
|
|
RW(player->cast.target.refNum, send);
|
|
RW(player->cast.target.mpNum, send);
|
|
}
|
|
|
|
RW(player->cast.type, send);
|
|
|
|
if (player->cast.type == mwmp::Cast::ITEM)
|
|
RW(player->cast.itemId, send, true);
|
|
else
|
|
{
|
|
RW(player->cast.pressed, send);
|
|
RW(player->cast.success, send);
|
|
|
|
RW(player->cast.instant, send);
|
|
RW(player->cast.spellId, send, true);
|
|
}
|
|
}
|