From cc2250815de9d49ce107e368471050c70e99b310 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 18 Apr 2017 10:03:58 +0300 Subject: [PATCH] [General] Add packet data for attacks on and by Actors --- components/openmw-mp/Base/BaseActor.hpp | 1 + .../Packets/Actor/PacketActorAttack.cpp | 16 ++++++++++++++-- .../Packets/Player/PacketPlayerAttack.cpp | 5 ++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/components/openmw-mp/Base/BaseActor.hpp b/components/openmw-mp/Base/BaseActor.hpp index eb2f65821..6946e65b9 100644 --- a/components/openmw-mp/Base/BaseActor.hpp +++ b/components/openmw-mp/Base/BaseActor.hpp @@ -38,6 +38,7 @@ namespace mwmp std::string sound; Animation animation; + Attack attack; }; class BaseActorList diff --git a/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp b/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp index a1d600814..41c28ea8b 100644 --- a/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp +++ b/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp @@ -37,9 +37,21 @@ void PacketActorAttack::Packet(RakNet::BitStream *bs, bool send) RW(actor.refId, send); RW(actor.refNumIndex, send); RW(actor.mpNum, send); - - // TODO: Fill this in + RW(actor.attack.target.refId, send); + RW(actor.attack.target.refNumIndex, send); + RW(actor.attack.target.mpNum, send); + RW(actor.attack.target.guid, send); + + RW(actor.attack.spellId, send); + RW(actor.attack.type, send); + RW(actor.attack.success, send); + RW(actor.attack.damage, send); + + RW(actor.attack.pressed, send); + RW(actor.attack.knockdown, send); + RW(actor.attack.block, send); + if (!send) { actorList->baseActors.push_back(actor); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp b/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp index ebaf448ac..c1c2cd94d 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp @@ -16,13 +16,16 @@ void PacketPlayerAttack::Packet(RakNet::BitStream *bs, bool send) { PlayerPacket::Packet(bs, send); + RW(player->attack.target.refId, send); + RW(player->attack.target.refNumIndex, send); + RW(player->attack.target.mpNum, send); RW(player->attack.target.guid, send); RW(player->attack.spellId, send); RW(player->attack.type, send); RW(player->attack.success, send); RW(player->attack.damage, send); - // + RW(player->attack.pressed, send); RW(player->attack.knockdown, send); RW(player->attack.block, send);