From 0fa1aa6d0f0422cb18ce3eedac6d819808a92eab Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 3 Mar 2023 20:10:42 -0400 Subject: TPlyInventory: Add `TPlyInventory` --- context.h | 68 ++++++++++++++++++++++++++++++++++++++++----- include/pso/TPlyInventory.h | 61 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 include/pso/TPlyInventory.h diff --git a/context.h b/context.h index 366a014..142fb4c 100644 --- a/context.h +++ b/context.h @@ -562,13 +562,6 @@ struct vec2f { float y; }; -// pso/TPlyGuildCardTag.h -struct gc_tag { - u8 tag0; - u8 tag1; - u16 tag2; -}; - // pso/TPlyDispData.h struct stats { void bswap(); @@ -622,6 +615,32 @@ struct disp_data_part2 { vec2f proportions; }; +// pso/TPlyGuildCardTag.h +struct gc_tag { + u8 tag0; + u8 tag1; + u16 tag2; +}; + +// pso/TPlyInventory.h +struct TItemData { + TItemData(); + void bswap(); + TItemData &assign(const TItemData &src); + + union { + TArray data_u8; + TArray data_u16; + TArray data_u32; + } data1; + u32 id; + union { + TArray data_u8; + TArray data_u16; + u32 data_u32; + } data2; +}; + // TTcpSocket.cpp, but they're really from AVE-TCP struct at_ip4_opt { u8 ttl; @@ -783,6 +802,41 @@ private: u32 m_guildcard_number; } __packed__; +// pso/TPlyInventory.h +class TPlyInventoryItem { +public: + TPlyInventoryItem() {}; + + void bswap(); + TPlyInventoryItem &assign(const TPlyInventoryItem &src); + + PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, present, 4); + PRIVATE_MEMBER_ACCESSORS(u32, flags); + PRIVATE_MEMBER_ACCESSORS(TItemData, data); +private: + TArray m_present; + u32 m_flags; + TItemData m_data; +}; + +class TPlyInventory { +public: + void bswap(); + TPlyInventory &assign(const TPlyInventory &src); + + PRIVATE_MEMBER_ACCESSORS(u8, num_items); + PRIVATE_MEMBER_ACCESSORS(u8, hp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, tp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, language); + PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyInventoryItem, items, 30); +private: + u8 m_num_items; + u8 m_hp_materials_used; + u8 m_tp_materials_used; + u8 m_language; + TArray m_items; +}; + // pso/PSOV3EncryptionTCP.h class PSOV3EncryptionTCP : public PSOV3Encryption { public: diff --git a/include/pso/TPlyInventory.h b/include/pso/TPlyInventory.h new file mode 100644 index 0000000..6143a06 --- /dev/null +++ b/include/pso/TPlyInventory.h @@ -0,0 +1,61 @@ +#ifndef TPLYINVENTORY_H +#define TPLYINVENTORY_H + +#include +#include +#include +#include + +struct TItemData { + TItemData(); + void bswap(); + TItemData &assign(const TItemData &src); + + union { + TArray data_u8; + TArray data_u16; + TArray data_u32; + } data1; + u32 id; + union { + TArray data_u8; + TArray data_u16; + u32 data_u32; + } data2; +}; + +class TPlyInventoryItem { +public: + TPlyInventoryItem() {}; + + void bswap(); + TPlyInventoryItem &assign(const TPlyInventoryItem &src); + + PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, present, 4); + PRIVATE_MEMBER_ACCESSORS(u32, flags); + PRIVATE_MEMBER_ACCESSORS(TItemData, data); +private: + TArray m_present; + u32 m_flags; + TItemData m_data; +}; + +class TPlyInventory { +public: + void bswap(); + TPlyInventory &assign(const TPlyInventory &src); + + PRIVATE_MEMBER_ACCESSORS(u8, num_items); + PRIVATE_MEMBER_ACCESSORS(u8, hp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, tp_materials_used); + PRIVATE_MEMBER_ACCESSORS(u8, language); + PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyInventoryItem, items, 30); +private: + u8 m_num_items; + u8 m_hp_materials_used; + u8 m_tp_materials_used; + u8 m_language; + TArray m_items; +}; + +#endif -- cgit v1.2.3-13-gbd6f