适用版本:大仓库 or 大河马引擎
文章编辑:雪舞
更新时间:2024-12-15
LuaFnShenBingTransition(sceneId,selfId,nSourcePos,nTargetPos)
使用方法:nSourcePos
源装备, nTargetPos
新装备。具体动作由引擎处理
IDA伪代码
地址:804351F
int __cdecl LuaFnShenBingTransition(lua_State_0 *L)
{
long double v1; // fst7
SceneManager_1 *v2; // eax
UINT v3; // eax
UINT v4; // eax
int v5; // eax
int v6; // eax
char v8; // [esp+6h] [ebp-A2h]
int j; // [esp+8h] [ebp-A0h]
int k; // [esp+8h] [ebp-A0h]
unsigned int i; // [esp+Ch] [ebp-9Ch]
CHAR v12[16]; // [esp+10h] [ebp-98h] BYREF
CHAR pOut[16]; // [esp+20h] [ebp-88h] BYREF
UINT pIn[17]; // [esp+30h] [ebp-78h] BYREF
int v15; // [esp+74h] [ebp-34h]
_ITEM *v16; // [esp+78h] [ebp-30h]
_ITEM *m_pItem; // [esp+7Ch] [ebp-2Ch]
Item *v18; // [esp+80h] [ebp-28h]
Item *Item; // [esp+84h] [ebp-24h]
Obj_Human *pHuman; // [esp+88h] [ebp-20h]
Scene_3 *Scene; // [esp+8Ch] [ebp-1Ch]
UINT v22; // [esp+90h] [ebp-18h]
UINT uBagIndex; // [esp+94h] [ebp-14h]
int v24; // [esp+98h] [ebp-10h]
int v25; // [esp+9Ch] [ebp-Ch]
v25 = (int)lua_tonumber(L, 1);
v24 = (int)lua_tonumber(L, 2);
uBagIndex = (int)lua_tonumber(L, 3);
v1 = lua_tonumber(L, 4);
LOBYTE(v2) = v8;
BYTE1(v2) = 12;
v22 = (int)v1;
if ( v24 > 14999 && v24 <= 29999 )
{
Scene = SceneManager::GetScene(v2, SceneID);
if ( (int)Scene > 0 )
{
pHuman = (Obj_Human *)Scene->m_pObjManager->m_pObj[v24];
if ( (int)pHuman > 0 && uBagIndex <= 0x64 && v22 <= 0x64 )
{
Item = HumanItemLogic::GetItem(pHuman, uBagIndex);
v18 = HumanItemLogic::GetItem(pHuman, v22);
if ( Item )
{
if ( v18 )
{
m_pItem = Item->m_pItem;
v16 = v18->m_pItem;
v15 = 0;
memset(pIn, 0, 0x3Au);
sub_804AE40(pIn, "%s", m_pItem->m_Creator);
v3 = sub_7FF6AC3(pIn);
DBStr2Binary((const CHAR *)pIn, v3, pOut, 0x10u, pIn);
sub_804AE40(pIn, "%s", v16->m_Creator);
v4 = sub_7FF6AC3(pIn);
DBStr2Binary((const CHAR *)pIn, v4, v12, 0x10u, pIn);
for ( i = 0; i < *(_DWORD *)dword_22B63A2C; ++i )
{
if ( *(_DWORD *)(dword_22B63A2C + 52 * i + 4) == m_pItem->m_ItemIndex )
{
v12[0] = pOut[0];
pOut[0] = 1;
for ( j = 0; j <= 2; ++j )
{
*(_WORD *)&v12[2 * j + 1] = *(_WORD *)&pOut[2 * j + 1];
*(_WORD *)&pOut[2 * j + 1] = *(_WORD *)(dword_22B63A2C + 2 * (j + 26 * i) + 26);
}
for ( k = 0; k <= 2; ++k )
{
v12[3 * k + 7] = pOut[3 * k + 7];
*(_WORD *)&v12[3 * k + 8] = *(_WORD *)&pOut[3 * k + 8];
pOut[3 * k + 7] = 0;
*(_WORD *)&pOut[3 * k + 8] = *(_WORD *)(dword_22B63A2C + 2 * (k + 26 * i) + 32);
}
Binary2String(pOut, 0x10u, (CHAR *)pIn);
v5 = sub_7FF6AC3(pIn);
sub_804AD80(&m_pItem->m_DarksInfo, pIn, v5);
m_pItem->m_Creator[57] = 0;
_ITEM::SetCreatorVar(m_pItem, 1);
Binary2String(v12, 0x10u, (CHAR *)pIn);
v6 = sub_7FF6AC3(pIn);
sub_804AD80(&v16->m_DarksInfo, pIn, v6);
v16->m_Creator[57] = 0;
_ITEM::SetCreatorVar(v16, 1);
lua_pushnumber(L, 1.0);
return 1;
}
}
}
}
}
}
lua_pushnumber(L, -1.0);
}
else
{
lua_pushnumber(L, -1.0);
}
return 1;
}