int KCustomEquipInfo::LuaGetSetAttrib(Lua_State* L) { int nResult = 0; int nSetEquipCount = 0; int nIndex = 0; int nEquipedNum = 0; KSetInfo* pSetInfo = NULL; KPlayer* pPlayer = NULL; int nTable = 0; KG_PROCESS_ERROR(nSetID > 0); pSetInfo = g_pSO3World->m_ItemManager.m_ItemLib.GetSetInfo(nSetID); KGLOG_PROCESS_ERROR(pSetInfo); pPlayer = g_pSO3World->m_PlayerSet.GetObj(g_pSO3World->m_dwClientPlayerID); KGLOG_PROCESS_ERROR(pPlayer); Lua_PushNumber(L, pSetInfo->dwUiID); Lua_NewTable(L); nTable = Lua_GetTopIndex(L); for (int i = 0; i < MAX_SET_PART_NUM; ++i) { KCustomEquipInfo *pInfo = pSetInfo->pEquipList[i]; if (pInfo) { ++nSetEquipCount; Lua_PushNumber(L, nSetEquipCount); Lua_NewTable(L); int nAttrib = Lua_GetTopIndex(L); Lua_PushString(L, "nUiId"); Lua_PushNumber(L, pInfo->nUiId); Lua_SetTable(L, nAttrib); Lua_PushString(L, "bEquiped"); int nEquiped = pPlayer->IsEquiped(pInfo); if (nEquiped) ++nEquipedNum; Lua_PushBoolean(L, nEquiped); Lua_SetTable(L, nAttrib); Lua_SetTable(L, nTable); } } Lua_PushNumber(L, nSetEquipCount); Lua_PushNumber(L, nEquipedNum); Lua_NewTable(L); nTable = Lua_GetTopIndex(L); nIndex = 0; for (int i = 1; i <= nSetEquipCount; ++i) { KAttribute Attribute; if (g_pSO3World->m_ItemManager.GetSetAttrib(Attribute, nUiId, i)) { if (Attribute.nKey != atInvalid) { ++nIndex; Lua_PushNumber(L, nIndex); Lua_NewTable(L); int nAttrib = Lua_GetTopIndex(L); Lua_PushString(L, "nID"); Lua_PushNumber(L, Attribute.nKey); Lua_SetTable(L, nAttrib); Lua_PushString(L, "nCount"); Lua_PushNumber(L, i); Lua_SetTable(L, nAttrib); Lua_PushString(L, "nValue1"); Lua_PushNumber(L, Attribute.nValue1); Lua_SetTable(L, nAttrib); Lua_PushString(L, "nValue2"); Lua_PushNumber(L, Attribute.nValue2); Lua_SetTable(L, nAttrib); Lua_PushString(L, "bEquiped"); int nHave = false; if (nEquipedNum >= i) nHave = true; Lua_PushBoolean(L, nHave); Lua_SetTable(L, nAttrib); Lua_SetTable(L, nTable); } } } nResult = 5; Exit0: return nResult; }