commit 497a601c424e8e728ef0a8e61f049982f2d4af16 Author: Persson-dev <sim16.prib@gmail.com> Date: Sat Aug 12 10:32:52 2023 +0200 fix warning commit 1bfd019a1ea00dcdb6323d1f285e2cdd3ebb4020 Author: Persson-dev <sim16.prib@gmail.com> Date: Tue Jul 25 19:05:13 2023 +0200 refactor: update cast commit 5bbc23a7d37e53eb74a885685f18e714f9448fd9 Author: Persson-dev <sim16.prib@gmail.com> Date: Tue Jul 25 19:04:15 2023 +0200 moved GetImguiTeamColor commit fd0e2d2470ea5cca3553acf280aa371de5c06f4c Author: Persson-dev <sim16.prib@gmail.com> Date: Tue Jul 25 19:03:37 2023 +0200 packets forward declaration commit 06eb9b99a96731f4b9a2167c00ed0bcd03702e3b Author: Persson-dev <sim16.prib@gmail.com> Date: Tue Jul 25 18:30:55 2023 +0200 remove Protocol.h includes commit 165f63d2e8b468f3e38992baddc221270010f801 Author: Persson-dev <sim16.prib@gmail.com> Date: Tue Jul 25 18:30:30 2023 +0200 split packets into separate source files commit f247f146c6c1e804a44b86f65cf3059859c07c6c Author: Persson-dev <sim16.prib@gmail.com> Date: Tue Jul 25 17:45:24 2023 +0200 split packets into separate headers
39 lines
948 B
C++
39 lines
948 B
C++
#pragma once
|
|
|
|
#include "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
|