Decompile 2 functions in Source/UI/UIGradeEnchantWnd.cpp, Source/UI/UIGradeEnchantWnd.h, ...
Batch #6706 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_09748 UIGradeEnchantWnd::sub_7E7050: logic confirmed by peer review - fn_10898 UIEditCtrl::DecodeItemLink: logic confirmed by peer review Peer-reviewed-by: superintelligence, KWDev, Tanke 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
d039786dc1
commit
c7c22b461b
4 changed files with 111 additions and 1 deletions
|
|
@ -3652,3 +3652,57 @@ bool IsInputSuggestionAllowed() {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00860080
|
||||
// FUNCTION: fn_10898
|
||||
bool UIEditCtrl::DecodeItemLink(const std::vector<int>& values, ITEM_INFO& item) {
|
||||
if (values.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ITEM_DESC description = FindItemDescription(values[2]);
|
||||
item.SetName(description.identifiedName);
|
||||
std::string name(description.identifiedName);
|
||||
LowercaseText(name);
|
||||
if (name.find("unknown item") != std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
item.unknown_0000[2] = values[0];
|
||||
item.SetItemId(values[2]);
|
||||
if (values[1] != 0) {
|
||||
item.unknown_0000[0] = 4;
|
||||
}
|
||||
|
||||
if (values.size() > 3) {
|
||||
item.unknown_0060 = values[3];
|
||||
}
|
||||
|
||||
item.unknown_0070 = values[4];
|
||||
int cardCount = 0;
|
||||
item.unknown_0088 = static_cast<std::int16_t>(values[5]);
|
||||
if (values.size() > 6) {
|
||||
cardCount = values[6];
|
||||
for (int i = 1; i < cardCount + 1; ++i) {
|
||||
int index = i - 1;
|
||||
item.SetCard(values[6 + i], index);
|
||||
}
|
||||
}
|
||||
|
||||
if (static_cast<unsigned>(cardCount + 8) < values.size()) {
|
||||
item.unknown_0098 = values[cardCount + 8];
|
||||
int optionCount = item.unknown_0098 + 1;
|
||||
for (int i = 1; i < optionCount; ++i) {
|
||||
const int base = cardCount + 9 + (i - 1) * 3;
|
||||
ItemOption option;
|
||||
option.id = static_cast<std::int16_t>(values[base]);
|
||||
option.value = static_cast<std::int16_t>(values[base + 2]);
|
||||
option.parameter = static_cast<unsigned char>(values[base + 1]);
|
||||
int index = i - 1;
|
||||
item.SetOption(option, index);
|
||||
}
|
||||
}
|
||||
|
||||
item.identified = 1;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class WindowManagerWindows;
|
|||
class NavigationDestination;
|
||||
class UINaviLinkButton;
|
||||
class UIItemTagButton;
|
||||
struct ITEM_INFO;
|
||||
|
||||
struct UIEditContext {
|
||||
InputFocus& focus;
|
||||
|
|
@ -70,6 +71,7 @@ public:
|
|||
void DrawSelection(int x, int width);
|
||||
void MoveCandidateWindow(int x);
|
||||
void MoveReadingWindow(int x);
|
||||
bool DecodeItemLink(const std::vector<int>& values, ITEM_INFO& item);
|
||||
|
||||
/* 007C */ int anchor;
|
||||
/* 0080 */ int cursor;
|
||||
|
|
|
|||
|
|
@ -549,3 +549,56 @@ void UIGradeEnchantWnd::SetResult(int state, int result) {
|
|||
|
||||
this->Invalidate();
|
||||
}
|
||||
|
||||
struct SessionMessengerContext {
|
||||
int GetList0Size() const;
|
||||
};
|
||||
|
||||
// OFFSET: 0x007E7050
|
||||
// FUNCTION: fn_09748
|
||||
void UIGradeEnchantWnd::sub_7E7050() {
|
||||
this->unknown_011C.clear();
|
||||
if (this->state != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string message;
|
||||
if (this->unknown_0118 == 0) {
|
||||
this->unknown_011C.push_back(3821);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->selectedMaterial != -1 && this->materials[this->selectedMaterial].unknown_0010 == 0) {
|
||||
this->unknown_011C.push_back(3822);
|
||||
}
|
||||
|
||||
if (this->selectedMaterial == -1) {
|
||||
this->unknown_011C.push_back(3707);
|
||||
}
|
||||
|
||||
if (this->selectedMaterial != -1 &&
|
||||
LookupClientItem(g_session.m_inventoryItems, this->materials[this->selectedMaterial].itemId, 0).quantity <
|
||||
this->materials[this->selectedMaterial].amount) {
|
||||
this->unknown_011C.push_back(3708);
|
||||
}
|
||||
|
||||
if (g_session.m_zeny < this->SelectedMaterialZeny()) {
|
||||
this->unknown_011C.push_back(3709);
|
||||
}
|
||||
|
||||
if (static_cast<float>(g_session.m_weight) > static_cast<float>(g_session.m_maxWeight) * 0.7f ||
|
||||
reinterpret_cast<const SessionMessengerContext*>(&g_session)->GetList0Size() + g_session.CountItems17F0() +
|
||||
g_session.CountItems2B50() >=
|
||||
g_session.unknown_7FBC + 100) {
|
||||
this->unknown_011C.push_back(3710);
|
||||
}
|
||||
|
||||
if (this->selectedMaterial != -1 && this->materials[this->selectedMaterial].unknown_0010 == 1) {
|
||||
int warning = this->SuccessRate() < 100 ? 3712 : 3822;
|
||||
this->unknown_011C.push_back(warning);
|
||||
}
|
||||
|
||||
if (this->selectedMaterial != -1 && this->materials[this->selectedMaterial].unknown_000C > 0) {
|
||||
this->unknown_011C.push_back(3713);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ struct GradeEnchantMaterial {
|
|||
/* 0000 */ std::uint32_t itemId;
|
||||
/* 0004 */ std::int32_t amount;
|
||||
/* 0008 */ std::int32_t zeny;
|
||||
/* 000C */ unsigned char unknown_000C[5];
|
||||
/* 000C */ std::int32_t unknown_000C;
|
||||
/* 0010 */ unsigned char unknown_0010;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue