mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
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
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:
parent
c133d37705
commit
4bf88801ed
@ -1,11 +1,48 @@
|
||||
#include "ui/game/CharacterInfoScript.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user