Decompile fn_17982 (CItemInfoMgr::Load)
Batch #3700 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_17982 CItemInfoMgr::Load: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, eAthena, superintelligence 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
5ebc218cfe
commit
d1be1f651f
2 changed files with 37 additions and 0 deletions
|
|
@ -1,16 +1,19 @@
|
|||
#include "Contents/Items/ItemInfoMgr.h"
|
||||
|
||||
#include "Contents/Items/ItemDescription.h"
|
||||
#include "Script/NLuaState.h"
|
||||
|
||||
extern "C" {
|
||||
#include <lauxlib.h>
|
||||
#include <lua.h>
|
||||
#include <lualib.h>
|
||||
}
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
#include <windows.h>
|
||||
|
||||
// GLOBAL: gl_24729
|
||||
CItemInfoMgr* g_itemInfoMgr;
|
||||
|
|
@ -72,6 +75,39 @@ int CItemInfoMgr::GetPackageId(int id) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ADFF90
|
||||
// FUNCTION: fn_17982
|
||||
bool CItemInfoMgr::Load() {
|
||||
NLuaState lua;
|
||||
if (lua.IsValid()) {
|
||||
luaL_openlibs(lua.GetState());
|
||||
lua_register(lua.GetState(), "AddItem", CItemInfoMgr::LuaAddItem);
|
||||
lua_register(lua.GetState(), "AddItemUnidentifiedDesc", CItemInfoMgr::LuaAddItemUnidentifiedDesc);
|
||||
lua_register(lua.GetState(), "AddItemIdentifiedDesc", CItemInfoMgr::LuaAddItemIdentifiedDesc);
|
||||
lua_register(lua.GetState(), "AddItemEffectInfo", CItemInfoMgr::LuaAddItemEffectInfo);
|
||||
lua_register(lua.GetState(), "AddItemIsCostume", CItemInfoMgr::LuaAddItemIsCostume);
|
||||
lua_register(lua.GetState(), "AddItemPackageID", CItemInfoMgr::LuaAddItemPackageID);
|
||||
if (luaL_loadfile(lua.GetState(), "SystemEN\\iteminfo.lua") != 0 || lua_pcall(lua.GetState(), 0, 0, 0) != 0) {
|
||||
MessageBoxA(nullptr, lua_tostring(lua.GetState(), -1), "CItemInfoMgr", 0);
|
||||
} else {
|
||||
lua_getglobal(lua.GetState(), "main");
|
||||
if (lua_pcall(lua.GetState(), 0, 2, 0) != 0) {
|
||||
MessageBoxA(nullptr, lua_tostring(lua.GetState(), -1), "CItemInfoMgr", 0);
|
||||
} else if (!lua_isstring(lua.GetState(), -1)) {
|
||||
MessageBoxA(nullptr, "second return value is not string...", "CItemInfoMgr", 0);
|
||||
} else {
|
||||
if (lua_toboolean(lua.GetState(), -2)) {
|
||||
return true;
|
||||
}
|
||||
std::string message = std::string("error found :") + lua_tostring(lua.GetState(), -1);
|
||||
MessageBoxA(nullptr, message.c_str(), "CItemInfoMgr", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00AE0270
|
||||
// FUNCTION: fn_17983
|
||||
static __declspec(noinline) std::string FormatItemInfoMessage(const char* format, ...) {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public:
|
|||
this->m_items[id].identifiedResourceName = resourceName;
|
||||
}
|
||||
|
||||
bool Load();
|
||||
int IsCostume(int id);
|
||||
int GetEffectId(int id);
|
||||
int GetPackageId(int id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue