summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-03 20:10:42 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-03 20:10:42 -0400
commit0fa1aa6d0f0422cb18ce3eedac6d819808a92eab (patch)
tree7f88914baf0516f05fcc01720a7dda87bcc89b4b
parent307b4a54c95e08ad01e2c6b7c27a3eca54f05f42 (diff)
TPlyInventory: Add `TPlyInventory`
-rw-r--r--context.h68
-rw-r--r--include/pso/TPlyInventory.h61
2 files changed, 122 insertions, 7 deletions
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<u8, 12> data_u8;
+ TArray<u16, 6> data_u16;
+ TArray<u32, 3> data_u32;
+ } data1;
+ u32 id;
+ union {
+ TArray<u8, 4> data_u8;
+ TArray<u8, 2> 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<u8, 4> 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<TPlyInventoryItem, 30> 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 <global_types.h>
+#include <pso/macros.h>
+#include <pso/protocol.h>
+#include <pso/TArray.h>
+
+struct TItemData {
+ TItemData();
+ void bswap();
+ TItemData &assign(const TItemData &src);
+
+ union {
+ TArray<u8, 12> data_u8;
+ TArray<u16, 6> data_u16;
+ TArray<u32, 3> data_u32;
+ } data1;
+ u32 id;
+ union {
+ TArray<u8, 4> data_u8;
+ TArray<u8, 2> 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<u8, 4> 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<TPlyInventoryItem, 30> m_items;
+};
+
+#endif