feat(ui): implement Script_GetInventorySlotInfo
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run

This commit is contained in:
fallenoak 2026-02-06 06:43:00 -06:00
parent c133d37705
commit 4bf88801ed
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -1,11 +1,48 @@
#include "ui/game/CharacterInfoScript.hpp" #include "ui/game/CharacterInfoScript.hpp"
#include "db/Db.hpp"
#include "ui/FrameScript.hpp" #include "ui/FrameScript.hpp"
#include "util/Lua.hpp"
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
namespace { namespace {
int32_t Script_GetInventorySlotInfo(lua_State* L) { int32_t Script_GetInventorySlotInfo(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (!lua_isstring(L, 1)) {
luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo");
return 0;
}
auto slotName = lua_tostring(L, 1);
PaperDollItemFrameRec* slotRec = nullptr;
for (int32_t i = 0; i < g_paperDollItemFrameDB.GetNumRecords(); i++) {
auto paperDollItemFrameRec = g_paperDollItemFrameDB.GetRecordByIndex(i);
if (paperDollItemFrameRec && !SStrCmpI(slotName, paperDollItemFrameRec->m_itemButtonName)) {
slotRec = paperDollItemFrameRec;
break;
}
}
if (!slotRec) {
luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo");
return 0;
}
// id
lua_pushnumber(L, slotRec->m_slotNumber);
// textureName
lua_pushstring(L, slotRec->m_slotIcon);
// checkRelic
if (slotRec->m_slotNumber == EQUIPPED_LAST) {
lua_pushnumber(L, 1.0);
} else {
lua_pushnil(L);
}
return 3;
} }
int32_t Script_GetInventoryItemsForSlot(lua_State* L) { int32_t Script_GetInventoryItemsForSlot(lua_State* L) {