39 lines
951 B
C++
39 lines
951 B
C++
#pragma once
|
|
|
|
#include "td/protocol/Protocol.h"
|
|
|
|
namespace td {
|
|
namespace protocol {
|
|
|
|
enum class ItemType : std::uint8_t {
|
|
// Upgrades
|
|
ClickerUpgrade,
|
|
GoldPerSecUpgrade,
|
|
|
|
// Items
|
|
};
|
|
|
|
/** Packet used by the client to buy items or upgrades
|
|
Packet used by the server to confirm transaction */
|
|
class PlayerBuyItemPacket : public Packet {
|
|
private:
|
|
ItemType m_ItemType;
|
|
std::uint8_t m_Count;
|
|
public:
|
|
PlayerBuyItemPacket() {}
|
|
PlayerBuyItemPacket(ItemType itemType, std::uint8_t count) : m_ItemType(itemType), m_Count(count) {}
|
|
virtual ~PlayerBuyItemPacket() {}
|
|
|
|
virtual DataBuffer Serialize(bool packetID = true) const;
|
|
virtual void Deserialize(DataBuffer& data);
|
|
virtual void Dispatch(PacketHandler* handler) const;
|
|
|
|
ItemType GetItemType() const { return m_ItemType; }
|
|
std::uint8_t GetCount() const { return m_Count; }
|
|
|
|
virtual PacketType GetType() const { return PacketType::PlayerBuyItem; }
|
|
};
|
|
|
|
} // namespace protocol
|
|
} // namespace td
|