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).
This commit is contained in:
parent
ff4bd0398d
commit
85b75aaa74
2 changed files with 42 additions and 0 deletions
|
|
@ -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<UILapineUpgradeBoxWnd*>(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
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "Contents/Items/ItemInfo.h"
|
||||
#include "UI/Window/UIFrameWnd.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue