Decompile 2 functions in Source/Contents/Items/SelectPackageItemMgr.cpp, Source/Contents/Items/SelectPackageItemMgr.h
Batch #9290 by secret: 0 byte-identical, 2 confirmed by peer review. - fn_04448 CSelectPackageItemMgr::OpenItem: logic confirmed by peer review - fn_04445 CSelectPackageItemMgr::AddTab: logic confirmed by peer review Peer-reviewed-by: ntrl, gordaoprogramas, seumadruga 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
f3b16bdba6
commit
baa3bd7550
2 changed files with 26 additions and 1 deletions
|
|
@ -1,9 +1,13 @@
|
|||
#include "Contents/Items/SelectPackageItemMgr.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Network/TextEncoding.h"
|
||||
#include "Script/LuaInstance.h"
|
||||
#include "UI/SelectPackageItemBox/SelectPackageItemBox.h"
|
||||
#include "UI/Window/UIWindowMgr.h"
|
||||
extern "C" {
|
||||
#include <lua.h>
|
||||
}
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <windows.h>
|
||||
|
||||
|
|
@ -23,7 +27,7 @@ void CSelectPackageItemMgr::AddTab(int packageId, int tabIndex, const std::strin
|
|||
this->m_packages[packageId] = std::map<int, SelectPackageTab>();
|
||||
}
|
||||
|
||||
if (this->m_packages[packageId].find(tabIndex) == this->m_packages[packageId].end()) {
|
||||
if (this->m_packages[packageId].end() == this->m_packages[packageId].find(tabIndex)) {
|
||||
this->m_packages[packageId][tabIndex] = SelectPackageTab();
|
||||
}
|
||||
|
||||
|
|
@ -206,3 +210,23 @@ int CSelectPackageItemMgr::LuaAddTab(lua_State* L) {
|
|||
lua_pushstring(L, "good");
|
||||
return 2;
|
||||
}
|
||||
|
||||
// OFFSET: 0x0061F2F0
|
||||
// FUNCTION: fn_04448
|
||||
bool CSelectPackageItemMgr::OpenItem(unsigned int itemIndex) {
|
||||
const ITEM_INFO item = LookupClientItemByIdentity(g_session.m_inventoryItems, itemIndex);
|
||||
if (item.unknown_0000[1] > 0) {
|
||||
const int packageId = std::atoi(item.itemId.c_str());
|
||||
if (this->m_packages.find(packageId) != this->m_packages.end()) {
|
||||
if (g_windowMgr.LookupWindow(0x2731) == nullptr || g_windowMgr.CloseWindow(0x2731)) {
|
||||
CUISelectPackageItemBox* box = static_cast<CUISelectPackageItemBox*>(g_windowMgr.EnsureWindow(0x2731));
|
||||
if (box != nullptr) {
|
||||
box->Open(itemIndex);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public:
|
|||
|
||||
void AddTab(int packageId, int tabIndex, const std::string& name, int itemCount);
|
||||
std::optional<std::vector<ITEM_INFO>*> FindItems(int packageId, int tabIndex);
|
||||
bool OpenItem(unsigned int itemIndex);
|
||||
};
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue