diff --git a/Source/Client/Mode/CGameMode.h b/Source/Client/Mode/CGameMode.h index 3174ec9e..47d8f3a0 100644 --- a/Source/Client/Mode/CGameMode.h +++ b/Source/Client/Mode/CGameMode.h @@ -36,6 +36,7 @@ struct vector3d; struct ItemCardSlots; struct ItemSlotOptions; struct ReputePointEntry; +struct GuildStorageLogItem; struct MiniMapMember { /* 0000 */ int x; @@ -777,6 +778,9 @@ public: void ReceiveQuestHuntUpdate2(const unsigned char* data); void ReceiveGuildMemberExpelled(const unsigned char* data); void ReceiveGuildPositionUpdate(const unsigned char* data); + void ReceiveGuildPositionNames(const unsigned char* data); + void ReceiveMapMove(const unsigned char* data); + void ApplyGuildStorageLog(std::uint16_t result, const std::vector& items); void ReceiveGuildMemberLeft(const unsigned char* data); std::FILE* OpenRandomOptionSimulatorFile(const std::string& folder, const std::string& itemName); void ReceiveRandomOptionSimulation(const unsigned char* packet); diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index d6bf5638..d7d644fa 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -9971,3 +9971,64 @@ struct EquipItemNoticePacket { static_assert(sizeof(EquipItemNoticePacket) == 7); // OFFSET: 0x00D50AA0 + +#include "UI/Guild/UIGuild_Storage_Log.h" +#include + +#pragma pack(push, 1) +struct MapMovePacket { + /* 0000 */ std::uint16_t packetType; + /* 0002 */ char mapName[16]; + /* 0012 */ std::int16_t x; + /* 0014 */ std::int16_t y; +}; + +struct GuildPositionNameEntry { + /* 0000 */ int positionId; + /* 0004 */ char name[24]; +}; + +struct GuildPositionNamePacket { + /* 0000 */ std::uint16_t packetType; + /* 0002 */ std::int16_t length; + /* 0004 */ GuildPositionNameEntry entries[1]; +}; +#pragma pack(pop) + +static_assert(sizeof(MapMovePacket) == 0x16); +static_assert(sizeof(GuildPositionNameEntry) == 0x1C); + +struct GuildStorageLogItem { + /* 0000 */ ITEM_INFO item; + /* 00F8 */ unsigned char unknown_00F8; +}; + +static_assert(sizeof(GuildStorageLogItem) == 0x100); + +// OFFSET: 0x00D3A1E0 + +// OFFSET: 0x00D50E40 +// FUNCTION: fn_21888 +void CGameMode::ReceiveGuildPositionNames(const unsigned char* data) { + const auto* packet = reinterpret_cast(data); + GuildInfo* guildInfo = reinterpret_cast(reinterpret_cast(&g_guildId) - offsetof(GuildInfo, m_guildId)); + const int count = (packet->length - 4) / sizeof(GuildPositionNameEntry); + for (int i = 0; i < count; ++i) { + const GuildPositionNameEntry& position = packet->entries[i]; + char name[25]; + std::memcpy(name, position.name, sizeof(position.name)); + name[24] = '\0'; + if (g_forbiddenWords.Contains(name)) { + std::string masked; + g_forbiddenWords.Mask(name, &masked); + } + + guildInfo->m_positions[position.positionId] = name; + } + + g_windowMgr.RefreshGuildWindows(); +} + +// OFFSET: 0x00D5A4C0 + +// OFFSET: 0x00D5B3C0