From 85b75aaa74f2ee4c8aa1481bc99df80ae2675dbd Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 31 Oct 2026 05:17:32 +0000 Subject: [PATCH] Decompile fn_04220 (UILapineUpgradeBox_IngredientListWnd::AddIngredient) Batch #7245 by alisonrag: 0 byte-identical, 1 confirmed by peer review. - fn_04220 UILapineUpgradeBox_IngredientListWnd::AddIngredient: logic confirmed by peer review Peer-reviewed-by: eAthena, Lumen Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/UILapineUpgradeBoxWnd.cpp | 39 +++++++++++++++++++++++++++++ Source/UI/UILapineUpgradeBoxWnd.h | 3 +++ 2 files changed, 42 insertions(+) diff --git a/Source/UI/UILapineUpgradeBoxWnd.cpp b/Source/UI/UILapineUpgradeBoxWnd.cpp index 2621c8ca..f2669cb9 100644 --- a/Source/UI/UILapineUpgradeBoxWnd.cpp +++ b/Source/UI/UILapineUpgradeBoxWnd.cpp @@ -253,6 +253,8 @@ void UILapineUpgradeBox_IngredientInfoWnd::Slot32(int x, int y) { } } +// OFFSET: 0x006059B0 + // OFFSET: 0x00605BB0 // FUNCTION: fn_04225 void UILapineUpgradeBoxWnd::SetWaiting(unsigned char value) { @@ -264,6 +266,8 @@ void UILapineUpgradeBoxWnd::SetWaiting(unsigned char value) { // OFFSET: 0x006049B0 +// OFFSET: 0x006041E0 + // OFFSET: 0x00603680 // FUNCTION: fn_04196 void UILapineUpgradeBox_IngredientListWnd::Slot10(int x, int y, std::intptr_t value) { @@ -451,6 +455,41 @@ void UILapineUpgradeBoxWnd::AddMaterial(int id) { } // OFFSET: 0x006052F0 +// FUNCTION: fn_04220 +bool UILapineUpgradeBox_IngredientListWnd::AddIngredient(std::uint32_t identity) { + ITEM_INFO owned = LookupClientItemByIdentity(g_session.m_inventoryItems, identity); + if (owned.unknown_0000[1] == 0) { + return false; + } + const int itemId = std::atoi(owned.itemId.c_str()); + if (owned.unknown_0060 < this->minRefine || owned.unknown_0060 > this->maxRefine || owned.unknown_0098 < this->minOptionCount) { + return false; + } + if ((g_session.IsPetEgg(itemId) == 1 && owned.unknown_005D == 1) || g_session.HasItem61B8(owned.unknown_0000[1]) == 1) { + return false; + } + const auto material = std::find_if(this->materials.begin(), this->materials.end(), [itemId](ITEM_INFO value) { + return std::atoi(value.itemId.c_str()) == itemId; + }); + if (material == this->materials.end()) { + return false; + } + for (UILapineUpgradeBox_IngredientInfoWnd* entry : this->items) { + if (entry->item.unknown_0000[1] == identity) { + return true; + } + } + auto* owner = static_cast(this->parent); + auto* entry = new UILapineUpgradeBox_IngredientInfoWnd(*this->m_context, owner->FrameContext()); + entry->SetSize(136, 30); + entry->SetItem(identity); + entry->quantity = 1; + this->AddScrollChild(entry); + entry->Invalidate(); + this->items.push_back(entry); + this->SendMsg(this, 0x57, 0, 0, 0, 0); + return true; +} // OFFSET: 0x00605750 // FUNCTION: fn_04222 diff --git a/Source/UI/UILapineUpgradeBoxWnd.h b/Source/UI/UILapineUpgradeBoxWnd.h index 50963f56..07e84a98 100644 --- a/Source/UI/UILapineUpgradeBoxWnd.h +++ b/Source/UI/UILapineUpgradeBoxWnd.h @@ -4,6 +4,7 @@ #include "Contents/Items/ItemInfo.h" #include "UI/Window/UIFrameWnd.h" +#include #include class UIBitmapButton; @@ -25,6 +26,7 @@ public: void Slot31(int x, int y) override; void Slot32(int x, int y) override; void Slot35(int argument) override; + void SetItem(std::uint32_t identity); /* 00B8 */ ITEM_INFO item; /* 01B0 */ unsigned char selected; @@ -48,6 +50,7 @@ public: void Slot26(int x, int y) override; void Slot28(int x, int y) override; void Slot32(int x, int y) override; + int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; void SetWaiting(unsigned char value); UILapineUpgradeBox_IngredientInfoWnd* FindSelected(); void SetIngredient(int id);