rodecomp/Source/Client/Mode/ModeDragState.cpp
ragnarok-clanker 33611655e5 Maintenance: [forced, user-approved] Family G17 (coordinator round-5 fixes). (1) ShortcutVisibility.h only held inline UIWindowMgr::S
Batch #10224 by ragnarok-clanker: forced by an admin (0 lower score(s), 2 changed function(s)); checked with 22 compiled unit(s), including every includer of Source/UI/Window/UIWindowMgr.inl, Source/UI/Shortcuts/ShortcutVisibility.h.
Deletes: Source/UI/Shortcuts/ShortcutVisibility.h
2026-11-03 09:09:57 +00:00

126 lines
3.8 KiB
C++

#include "Client/Mode/ModeDragState.h"
#include "Client/Session.h"
#include "Contents/Items/BarterMarketItemMgr.h"
#include "Contents/Items/ItemDescription.h"
#include "Contents/Items/ItemInfo.h"
#include "Contents/Items/ItemResources.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowManagerWindows.h"
#include <cstring>
// OFFSET: 0x00CEC930
// FUNCTION: fn_21357
void ModeDragState::Clear() {
this->identified = 0;
this->id = 0;
this->name.clear();
this->unknown_0310 = 0;
this->resource.clear();
this->source = 0;
this->quantity = 0;
this->slot = -1;
this->skillLevel = 0;
this->refine = 0;
std::memset(this->cards, 0, sizeof(this->cards));
this->unknown_03B0 = -1;
this->grade = 0;
}
// OFFSET: 0x00CFE140
// FUNCTION: fn_21429
void ModeDragState::BeginItem(
WindowManagerWindows& windows, int sourceValue, const ITEM_INFO& item, int quantityValue, int slotValue
) {
UIWindow* window = windows.EnsureWindow(15);
if (window->geometry.visible != 0) {
window->Show(0);
}
this->Clear();
if (item.unknown_0000[1] == 0) {
return;
}
this->source = sourceValue;
this->skill = 0;
this->id = item.unknown_0000[1];
this->quantity = quantityValue;
this->resource = g_session.ItemDragResource(item.itemId.c_str(), item.identified);
this->name = item.itemId;
this->unknown_0310 = item.unknown_0014[0];
this->unknown_0314 = item.unknown_0014[1];
this->type = item.unknown_0000[0];
this->identified = item.identified;
this->slot = slotValue;
this->refine = item.unknown_0060;
std::memcpy(this->cards, item.unknown_001C, sizeof(this->cards));
this->optionCount = item.unknown_0098;
for (int index = 0; index < this->optionCount; ++index) {
std::memcpy(this->options + 5 * index, item.unknown_009C + 5 * index, 5);
}
this->grade = static_cast<std::uint16_t>(item.unknown_0088);
this->unknown_03B6 = item.unknown_0074[3];
this->unknown_03B8 = item.unknown_0000[2];
this->unknown_03C0 = item.unknown_0070;
}
// OFFSET: 0x00CFE2A0
// FUNCTION: fn_21430
void ModeDragState::BeginSkill(
WindowManagerWindows& windows, ResourceMgr& resources, int sourceValue, std::uint32_t idValue, const char* nameValue, int level, int slotValue
) {
UIWindow* window = windows.EnsureWindow(15);
if (window->geometry.visible != 0) {
window->Show(0);
}
this->Clear();
this->source = sourceValue;
this->id = idValue;
this->identified = 0;
this->resource = SkillDragResource(resources, nameValue);
this->name = nameValue;
this->skillName = nameValue;
this->skillLevel = level;
this->skill = 1;
this->slot = slotValue;
}
// OFFSET: 0x00CFDF90
// FUNCTION: fn_21427
void ModeDragState::BeginBarterItem(int sourceValue, const BarterMarketItem& item, int quantityValue, int slotValue) {
g_windowMgr.ShowWindowById(15, 0);
this->Clear();
this->source = sourceValue;
this->quantity = quantityValue;
this->skill = 0;
this->resource = g_session.ItemDragResource(item.name.c_str(), item.flag_24);
this->name = item.name.c_str();
this->unknown_0310 = item.field_20;
this->type = item.field_1c;
this->identified = item.flag_24;
this->slot = slotValue;
this->unknown_03B0 = item.id;
}
// OFFSET: 0x00CFE060
// FUNCTION: fn_21428
void ModeDragState::BeginBarterEntry(int sourceValue, const BarterMarketEntry& entry, int quantityValue, int slotValue) {
g_windowMgr.ShowWindowById(15, 0);
this->Clear();
this->source = sourceValue;
this->quantity = quantityValue;
this->skill = 0;
this->resource = g_session.ItemDragResource(entry.name.c_str(), entry.flag_24);
this->name = entry.name.c_str();
this->unknown_0310 = entry.field_8;
this->type = entry.field_0;
this->identified = entry.flag_24;
this->slot = slotValue;
this->refine = entry.field_28;
this->unknown_03B0 = entry.id;
}