rodecomp/Source/UI/Shortcuts/NormalItemSlotLoad.cpp
ragnarok-clanker bd0ade90cd Maintenance: [forced, user-approved] Family G27 (resubmit of 10254 rebased on e235d90a; only conflict was the AsyncWorkMgr.h forward
Batch #10259 by ragnarok-clanker: forced by an admin (1 lower score(s), 11 changed function(s)); checked with 508 compiled unit(s), including every includer of Source/Contents/Async/AsyncWorkMgr.h, Source/Contents/Skills/SkillLevelRegistry.h, Source/Contents/UserData/CharacterLinkedUserDataLoadAsyncWork.h, Source/Contents/UserData/CharacterLinkedUserDataMgr.h, Source/UI/Window/UIWindowMgr.h, Source/UI/Window/UIWindowMgr.inl, Source/Contents/Skills/SkillLevelConfig.h, Source/Contents/UserData/CharacterConfigLoad.h, Source/UI/Shortcuts/NormalItemSlotLoad.h.
Deletes: Source/Contents/Skills/SkillLevelConfig.h, Source/Contents/UserData/CharacterConfigLoad.h, Source/UI/Shortcuts/NormalItemSlotLoad.h
2026-11-03 13:32:00 +00:00

71 lines
1.9 KiB
C++

#include "Client/Session.h"
#include "Contents/UserData/CharacterLinkedUserDataMgr.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/UIWindowMgr.inl"
#include "UI/Window/UIWindow.h"
#include <cstring>
#include <json/value.h>
// OFFSET: 0x005E65E0
// FUNCTION: fn_03929
void CCharacterLinkedUserDataMgr::LoadNormalItemSlots(Json::Value& data) {
NormalItemSlotWindow& saved = g_windowMgr.m_normalItemSlotWindow;
bool& itemSlotActive = g_session.ItemSlotActive();
Json::Value& values = data["NormalItemSlot"];
if (values.isNull()) {
return;
}
g_session.ClearNormalItemSlots();
for (auto entry = values.begin(); entry != values.end(); ++entry) {
Json::Value& value = *entry;
if (!value.isObject()) {
continue;
}
const int item = value.get("ItemID", 0).asInt();
const int index = value.get("SlotNum", 0).asInt();
g_session.m_normalItemSlots[index].itemId = static_cast<std::uint32_t>(item);
}
Json::Value& info = data["SlotInfo"];
if (info.empty()) {
saved.Reset();
} else {
const int x = info.get("SlotX", 0).asInt();
const int y = info.get("SlotY", 0).asInt();
const int width = info.get("SlotWidth", 0).asInt();
const int height = info.get("SlotHeight", 0).asInt();
const int show = info.get("SlotShow", 1).asInt();
saved.x = x;
saved.y = y;
saved.width = width;
saved.height = height;
saved.show = show;
}
Json::Value& active = data["ItemSlotActive"];
itemSlotActive = active.isNull() ? true : active.asBool();
UIWindow* window = g_windowMgr.LookupWindow(36);
if (!window) {
return;
}
window->geometry.x = saved.x;
window->geometry.y = saved.y;
window->geometry.width = saved.width;
window->geometry.height = saved.height;
g_windowMgr.ShowShortcutWindow(saved.show);
window->SendMsg(nullptr, 34, reinterpret_cast<std::intptr_t>(&saved), 0, 0, 0);
window->SendMsg(nullptr, 6, itemSlotActive ? 588 : 589, 0, 0, 0);
}