mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-10-25 21:36:05 +03:00
feat(gameui): implement Script_GetInventorySlotInfo
This commit is contained in:
parent
b554cf9d9e
commit
9d88498809
@ -13,7 +13,9 @@ static int32_t Script_GetActionTexture(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_GetActionCount(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_GetActionCooldown(lua_State* L) {
|
||||
@ -29,7 +31,9 @@ static int32_t Script_GetActionText(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_HasAction(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UseAction(lua_State* L) {
|
||||
@ -81,11 +85,14 @@ static int32_t Script_IsActionInRange(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_GetBonusBarOffset(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_GetMultiCastBarOffset(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
lua_pushnumber(L, 6.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_ChangeActionBarPage(lua_State* L) {
|
||||
|
||||
@ -1,11 +1,43 @@
|
||||
#include "gameui/GameScriptFunctions.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
|
||||
static int32_t Script_GetInventorySlotInfo(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
const char* buttonName = nullptr;
|
||||
|
||||
if (lua_isstring(L, 1)) {
|
||||
buttonName = lua_tolstring(L, 1, nullptr);
|
||||
}
|
||||
|
||||
if (!buttonName || g_paperDollItemFrameDB.GetNumRecords() < 1) {
|
||||
return luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo");
|
||||
}
|
||||
|
||||
PaperDollItemFrameRec* record = nullptr;
|
||||
bool found = false;
|
||||
for (int32_t i = 0; i < g_paperDollItemFrameDB.GetNumRecords(); ++i) {
|
||||
record = g_paperDollItemFrameDB.GetRecordByIndex(i);
|
||||
if (!SStrCmpI(record->m_itemButtonName, buttonName, STORM_MAX_STR)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
return luaL_error(L, "Invalid inventory slot in GetInventorySlotInfo");
|
||||
}
|
||||
|
||||
lua_pushnumber(L, record->m_slotNumber);
|
||||
lua_pushstring(L, record->m_slotIcon);
|
||||
if (record->m_slotNumber == 18) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int32_t Script_GetInventoryItemsForSlot(lua_State* L) {
|
||||
|
||||
@ -177,39 +177,57 @@ static int32_t Script_UnitPVPName(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_UnitXP(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 50.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitXPMax(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 100.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitHealth(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 50.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitHealthMax(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 100.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitMana(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 50.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitManaMax(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 100.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitPower(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 50.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitPowerMax(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 100.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitPowerType(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitOnTaxi(lua_State* L) {
|
||||
@ -221,15 +239,21 @@ static int32_t Script_UnitIsFeignDeath(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_UnitIsDead(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushboolean(L, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitIsGhost(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushboolean(L, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitIsDeadOrGhost(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushboolean(L, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitIsConnected(lua_State* L) {
|
||||
|
||||
@ -21,7 +21,9 @@ static int32_t Script_StopMusic(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_GameSystem_GetNumInputDrivers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||
@ -29,7 +31,9 @@ static int32_t Script_Sound_GameSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_GameSystem_GetNumOutputDrivers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_GameSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
||||
@ -41,7 +45,9 @@ static int32_t Script_Sound_GameSystem_RestartSoundSystem(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_ChatSystem_GetNumInputDrivers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||
@ -49,7 +55,9 @@ static int32_t Script_Sound_ChatSystem_GetInputDriverNameByIndex(lua_State* L) {
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_ChatSystem_GetNumOutputDrivers(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_Sound_ChatSystem_GetOutputDriverNameByIndex(lua_State* L) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user