1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-23 21:23:51 +00:00
openmw-tes3mp/components/openmw-mp/Packets/Player/PacketPlayerItemUse.cpp
David Cernat 8df08c7d10 [General] Implement PlayerItemUse packet
Players can no longer unilaterally use items on themselves in their inventory. When they try to use an item, they send a PlayerItemUse packet to the server with the item's details. A serverside script can then check the item and either send the packet back to make the item use go through or drop it.
2018-08-09 18:25:20 +03:00

21 lines
568 B
C++

#include "PacketPlayerItemUse.hpp"
#include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp;
PacketPlayerItemUse::PacketPlayerItemUse(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_ITEM_USE;
}
void PacketPlayerItemUse::Packet(RakNet::BitStream *bs, bool send)
{
PlayerPacket::Packet(bs, send);
RW(player->usedItem.refId, send, true);
RW(player->usedItem.count, send);
RW(player->usedItem.charge, send);
RW(player->usedItem.enchantmentCharge, send);
RW(player->usedItem.soul, send, true);
}