openmw-tes3coop/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp
David Cernat c075496748 [General] Replace deathReason in death packets with a killer variable
Add serverside script functions for determining the killers of both players and actors.

Use unsigned ints for script functions returning an object or actor's refNumIndex or mpNum.

Remove updateDeadState() from LocalPlayer and make its code part of updateStatsDynamic() for simplicity.
2018-07-05 22:24:51 +03:00

39 lines
1.1 KiB
C++

#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerAttack.hpp"
using namespace mwmp;
PacketPlayerAttack::PacketPlayerAttack(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_ATTACK;
}
void PacketPlayerAttack::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
RW(player->attack.target.isPlayer, send);
if (player->attack.target.isPlayer)
{
RW(player->attack.target.guid, send);
}
else
{
RW(player->attack.target.refId, send, true);
RW(player->attack.target.refNumIndex, send);
RW(player->attack.target.mpNum, send);
}
RW(player->attack.spellId, send, true);
RW(player->attack.type, send);
RW(player->attack.success, send);
RW(player->attack.damage, send, false); // never compress damage
RW(player->attack.pressed, send);
RW(player->attack.knockdown, send);
RW(player->attack.block, send);
RW(player->attack.applyWeaponEnchantment, send);
RW(player->attack.applyProjectileEnchantment, send);
}