Files
Blitz/include/blitz/protocol/packets/PlayerDeathPacket.h
Persson-dev 95e6967d0d
All checks were successful
Linux arm64 / Build (push) Successful in 4m29s
fart sound on death
2024-04-15 16:53:44 +02:00

61 lines
1.4 KiB
C++

#pragma once
/**
* \file PlayerDeathPacket.h
* \brief File containing the blitz::protocol::PlayerDeathPacket class
*/
#include "blitz/common/Defines.h"
#include "blitz/protocol/Protocol.h"
namespace blitz {
namespace protocol {
/**
* \class PlayerDeathPacket
* \brief Packet for when a player leaves the game.
* %Packet structure :
* | PacketType |
* |------------------------|
* | PacketType::PlayerDeath|
*
* | Field Name | Field Type | Notes |
* |--------------------|-------------------|-------------------------------|
* | m_PlayerID | PlayerID |The ID of the player that died |
*/
class PlayerDeathPacket : public Packet {
private:
game::PlayerID m_PlayerID;
public:
/**
* \brief Default constructor.
*/
PlayerDeathPacket() {}
/**
* \brief Constructor.
* \param playerID The ID of the player that died.
*/
PlayerDeathPacket(game::PlayerID playerID) : m_PlayerID(playerID) {}
virtual ~PlayerDeathPacket() {}
virtual DataBuffer Serialize(bool packetID = true) const;
virtual void Deserialize(DataBuffer& data);
virtual void Dispatch(PacketHandler* handler) const;
/**
* \brief Get the ID of the player that died.
* \return The ID of the player that died.
*/
game::PlayerID GetPlayerID() const {
return m_PlayerID;
}
virtual PacketType GetType() const {
return PacketType::PlayerDeath;
}
};
} // namespace protocol
} // namespace blitz