Batch #5979 by Yommy: 0 byte-identical, 16 confirmed by peer review. - fn_10556 UIBarterItemPurchaseWnd::Slot25: logic confirmed by peer review - fn_10557 UIBartermarketWnd::Slot25: logic confirmed by peer review - fn_10558 UIBarterItemPurchaseWnd::Slot28: logic confirmed by peer review - fn_10561 UIBarterItemPurchaseWnd::Slot32: logic confirmed by peer review - fn_10562 UIBartermarketWnd::Slot32: logic confirmed by peer review - fn_10587 UIExpandedBarterItemPurchaseWnd::Slot25: logic confirmed by peer review - fn_10588 UIExpandedBartermarketWnd::Slot25: logic confirmed by peer review - fn_10589 UIExpandedBarterItemPurchaseWnd::Slot28: logic confirmed by peer review - fn_10591 UIExpandedBartermarketWnd::Slot28: logic confirmed by peer review - fn_10592 UIExpandedBarterItemPurchaseWnd::Slot32: logic confirmed by peer review - fn_10593 UIExpandedBartermarketWnd::Slot32: logic confirmed by peer review - fn_18076 BarterMarketItem::ToItemInfo: logic confirmed by peer review - fn_18077 BarterMarketEntry::ToItemInfo: logic confirmed by peer review - fn_21427 ModeDragState::BeginBarterItem: logic confirmed by peer review - fn_21428 ModeDragState::BeginBarterEntry: logic confirmed by peer review - fn_23383 CSession::GetItemNameColor: logic confirmed by peer review Peer-reviewed-by: willerthal, tayoba Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
128 lines
4 KiB
C++
128 lines
4 KiB
C++
#include "Client/Mode/ModeDragState.h"
|
|
#include "Contents/Items/BarterMarketItemMgr.h"
|
|
#include "Contents/Items/ItemDescription.h"
|
|
#include "Contents/Items/ItemInfo.h"
|
|
#include "Contents/Items/ItemResources.h"
|
|
#include "UI/Shortcuts/ShortcutVisibility.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, ItemDescriptions& descriptions, 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 = ItemDragResource(descriptions, 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) {
|
|
reinterpret_cast<WindowVisibility&>(g_windowMgr).Show(15, 0);
|
|
this->Clear();
|
|
this->source = sourceValue;
|
|
this->quantity = quantityValue;
|
|
this->skill = 0;
|
|
ItemDescriptions descriptions{g_itemDescriptions};
|
|
this->resource = ItemDragResource(descriptions, 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) {
|
|
reinterpret_cast<WindowVisibility&>(g_windowMgr).Show(15, 0);
|
|
this->Clear();
|
|
this->source = sourceValue;
|
|
this->quantity = quantityValue;
|
|
this->skill = 0;
|
|
ItemDescriptions descriptions{g_itemDescriptions};
|
|
this->resource = ItemDragResource(descriptions, 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;
|
|
}
|