rodecomp/Source/Client/Mode/GameModeEquipWindow.cpp
ragnarok-clanker c932ad6499 Maintenance: Resubmission of 15134 without the 12 struct/type renames (their new names changed mangled symbols in 17 functions). Rena
Batch #15141 by ragnarok-clanker: no function's compiled code changes; checked with 537 compiled unit(s), including every includer of Source/Client/Input/LanguageTC.h, Source/Client/Mode/CGameMode.h, Source/Client/Mode/CLoginMode.h, Source/Client/Replay.h, Source/Client/Session.h, Source/Contents/AchievementMgr.h, Source/Contents/Actors/CharacterRender.h, Source/Contents/Actors/EffectActors.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/EnchantMgr.h, Source/Contents/GuildInfo.h, Source/Contents/Messenger/MessengerWindows.h, Source/Contents/Schedule/TimeScheduler.h, Source/Contents/Sound/SoundMgr.h, Source/Contents/SpriteLayerDrawing.h, Source/Contents/TableMng.h, Source/Contents/World/SkyBox.h, Source/UI/Chat/UINewChatWnd.h, Source/UI/Text/CreateLineInfo.h, Source/UI/UIGradeEnchantWnd.h, Source/UI/Window/UINewSelectCharWnd.h, Source/UI/Window/UINewSkillListWnd.h, Source/UI/Window/UIPetInfoWnd.h, Source/UI/Window/UIReplayRECControlWnd.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl.
2026-11-09 12:21:09 +00:00

66 lines
2.6 KiB
C++

#include "Client/Mode/CGameMode.h"
#include "UI/Window/WindowId.h"
#include "Client/Mode/EquipWindowLook.h"
#include "Client/Session.h"
#include "Contents/Items/ItemInfo.h"
#include "UI/Window/UIWindowMgr.h"
#include <cstdint>
#include <cstring>
// GLOBAL: gl_25085
EquipWindowLook g_equipWindowLook;
// OFFSET: 0x00D325F0
// FUNCTION: fn_21743
void CGameMode::ReceiveEquipWindowMicroscope(const unsigned char* packet) {
g_session.ResetEquipped();
g_session.ResetAlternateCostumeItems();
const int length = *reinterpret_cast<const std::int16_t*>(packet + 2);
const int count = static_cast<unsigned>(length - 45) / 37u;
const unsigned char* entry = packet + 45;
for (int index = 0; index < count; ++index, entry += 37) {
ITEM_INFO item;
item.identity[0] = entry[6];
item.identity[2] = *reinterpret_cast<const std::uint16_t*>(entry + 7);
item.identity[1] = *reinterpret_cast<const std::int16_t*>(entry);
item.identity[3] = *reinterpret_cast<const std::uint16_t*>(entry + 9);
item.quantity = 1;
std::memcpy(item.cards, entry + 12, sizeof(item.cards));
item.SetItemId(*reinterpret_cast<const int*>(entry + 2));
const unsigned char flags = entry[36];
item.identified = flags & 1;
item.damaged = (flags >> 1) & 1;
item.refiningLevel = entry[11];
item.expireTime = *reinterpret_cast<const std::uint32_t*>(entry + 28);
item.bindOnEquip = *reinterpret_cast<const std::uint16_t*>(entry + 32);
item.sprite = *reinterpret_cast<const std::uint16_t*>(entry + 34);
item.flags[0] = (flags >> 2) & 1;
if (item.identity[3] != 0) {
if (g_session.IsCostumeLocation(item.identity[3])) {
g_session.EquipAlternateCostumeItem(item);
} else {
g_session.Equip(item);
}
}
}
g_equipWindowLook.job = *reinterpret_cast<const std::int16_t*>(packet + 0x1C);
g_equipWindowLook.sex = packet[0x2C];
g_equipWindowLook.head = *reinterpret_cast<const std::int16_t*>(packet + 0x1E);
g_equipWindowLook.accessory = *reinterpret_cast<const std::int16_t*>(packet + 0x20);
g_equipWindowLook.accessory2 = *reinterpret_cast<const std::int16_t*>(packet + 0x22);
g_equipWindowLook.accessory3 = *reinterpret_cast<const std::int16_t*>(packet + 0x24);
g_equipWindowLook.bodyPalette = *reinterpret_cast<const std::int16_t*>(packet + 0x2A);
g_equipWindowLook.headPalette = *reinterpret_cast<const std::int16_t*>(packet + 0x28);
std::memcpy(g_equipWindowLook.name, packet + 4, sizeof(g_equipWindowLook.name));
g_equipWindowLook.robe = *reinterpret_cast<const std::int16_t*>(packet + 0x26);
if (!g_windowMgr.CloseWindow(WID_EQUIPWND_VIEWOTHER_1)) {
g_windowMgr.EnsureWindow(WID_EQUIPWND_VIEWOTHER_1);
}
}