适用版本:全版本通用
更新时间:2024-12-16
文章编辑:雪舞
函数名称:LuaFnGetItemBindStatus
注册函数:LuaFnGetItemBindStatus
功能说明:对指定背包位置的装备获取物品绑定状态
参数说明: ***付费内容***
IDA伪代码(地址:827CEE0):
int __cdecl LuaFnTbl::LuaFnGetItemBindStatus(lua_State *L)
{
int i; // ebx
unsigned int v2; // esi
Scene_3 *Scene; // ebx
Obj_Human *v4; // ebx
const _ITEM *Item; // eax
SceneManager_1 *const v7; // [esp-10h] [ebp-458h]
double v8; // [esp-Ch] [ebp-454h]
UINT uBagIndex[2]; // [esp+10h] [ebp-438h]
CHAR msg[1048]; // [esp+30h] [ebp-418h] BYREF
for ( i = 1; i <= 3; ++i )
{
if ( L )
{
if ( lua_isnumber((lua_State_0 *)L, i) == 1 )
continue;
sub_804AC20(msg, 512, "ERROR: [%s]Param %d is illegal!", "LuaFnGetItemBindStatus", i);
}
else
{
sub_804AC20(msg, 512, "ERROR: [%s] Lua_State==NULL!", "LuaFnGetItemBindStatus");
}
CacheLog(3, msg);
}
lua_tonumber((lua_State_0 *)L, 1);
v2 = (int)lua_tonumber((lua_State_0 *)L, 2);
*(_QWORD *)uBagIndex = (__int64)lua_tonumber((lua_State_0 *)L, 3);
Scene = SceneManager::GetScene(v7, SceneID);
if ( !Scene )
__assertex__(
"./Script/LuaFnTbl_Ability.h",
0x1891u,
"int LuaFnTbl::LuaFnGetItemBindStatus(lua_State*)",
"pScene",
"Scene ID ErrorLuaFnGetItemBindStatus");
if ( ThreadValueManager::GetCurrentThreadID() != Scene->m_ThreadID )
__assertex__(
"./Script/LuaFnTbl_Ability.h",
0x1891u,
"int LuaFnTbl::LuaFnGetItemBindStatus(lua_State*)",
"ThreadValueManager::GetCurrentThreadID()==pScene->m_ThreadID",
"ThreadValueManager::GetCurrentThreadID()==pScene->m_ThreadIDLuaFnGetItemBindStatus");
if ( v2 > 0x752F || (v4 = (Obj_Human *)Scene->m_pObjManager->m_pObj[v2]) == 0 )
__assertex__(
"./Script/LuaFnTbl_Ability.h",
0x1891u,
"int LuaFnTbl::LuaFnGetItemBindStatus(lua_State*)",
"pObj",
"selfId ErrorLuaFnGetItemBindStatus");
if ( (*((int (__cdecl **)(Obj_Human *))v4->_vptr_Obj + 2))(v4) == 1 )
{
if ( !Obj_Human::IsCanLogic(v4) )
__assertex__(
"./Script/LuaFnTbl_Ability.h",
0x1891u,
"int LuaFnTbl::LuaFnGetItemBindStatus(lua_State*)",
"pHuman->IsCanLogic()",
"IsCanLogic() test return falseLuaFnGetItemBindStatus");
Item = (const _ITEM *)HumanItemLogic::GetItem(v4, uBagIndex[0]);
if ( Item )
{
if ( !Item->m_ItemGUID.m_Serial )
__assert__("./Item/Item.inl", 0x24Au, Item::GetItemBind(void)const::__PRETTY_FUNCTION__, "m_pItem");
if ( _ITEM::GetItemBind(Item) )
HIDWORD(v8) = 1072693248;
else
HIDWORD(v8) = 0;
}
else
{
HIDWORD(v8) = 0x40000000;
}
LODWORD(v8) = 0;
lua_pushnumber((lua_State_0 *)L, v8);
}
else
{
lua_pushnumber((lua_State_0 *)L, -1.0);
}
return 1;
}
详细说明
在 C++ 代码中,函数通过设置 v8
的高位(HIDWORD(v8)
)来传递特定的状态值,并通过 lua_pushnumber
将这些值传递给 Lua 脚本。以下是具体的映射关系:
-
HIDWORD(v8) = 1072693248
-
HIDWORD(v8) = 0
-
HIDWORD(v8) = 1073741824
-
其他异常情况
确保在 Lua 脚本中正确解析这些返回值,以便根据物品的绑定状态采取相应的逻辑处理。
剩余 19% 内容需要支付 5.00
金币 后可完整阅读
支持付费阅读,激励作者创作更好的作品。