mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 19:22:30 +00:00
fix(ui): eliminate script errors
This commit is contained in:
parent
dbc140d1e4
commit
9d2b94b0cd
12 changed files with 121 additions and 20 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "gameui/CGTooltipScript.hpp"
|
||||
#include "gameui/CGTooltip.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
|
|
@ -23,11 +24,40 @@ static int32_t Script_GetPadding(lua_State* L) {
|
|||
}
|
||||
|
||||
static int32_t Script_IsOwned(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CGTooltip::GetObjectType();
|
||||
auto tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (lua_type(L, 2) != LUA_TTABLE) {
|
||||
return luaL_error(L, "Usage: %s:IsOwned(frame)", tooltip->GetDisplayName());
|
||||
}
|
||||
|
||||
lua_rawgeti(L, 2, 0);
|
||||
auto frame = static_cast<CScriptObject*>(lua_touserdata(L, -1));
|
||||
lua_settop(L, -2);
|
||||
|
||||
if (!frame) {
|
||||
return luaL_error(L, "%s:IsOwned(): Couldn't find 'this' in frame object", tooltip->GetDisplayName());
|
||||
}
|
||||
|
||||
if (!frame->IsA(CSimpleFrame::GetObjectType())) {
|
||||
return luaL_error(L, "%s:IsOwned(): Wrong object type, expected frame", tooltip->GetDisplayName());
|
||||
}
|
||||
|
||||
if (tooltip->m_parent == frame) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_GetOwner(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CGTooltip::GetObjectType();
|
||||
auto tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_SetOwner(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
void RegisterSimpleFrameScriptMethods();
|
||||
int32_t Script_GetScreenWidth(lua_State* L);
|
||||
int32_t Script_GetScreenHeight(lua_State* L);
|
||||
int32_t Script_GetCursorPosition(lua_State* L);
|
||||
|
||||
|
||||
static int32_t Script_FrameXML_Debug(lua_State* L) {
|
||||
|
|
@ -741,10 +742,6 @@ static int32_t Script_CancelSummon(lua_State* L) {
|
|||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetCursorPosition(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetNetStats(lua_State* L) {
|
||||
// v1 = ClientServices__Connection();
|
||||
// NetClient__GetNetStats(v1, &v5, &v4, (int*)&v3);
|
||||
|
|
@ -1153,11 +1150,17 @@ static int32_t Script_IsAddOnLoadOnDemand(lua_State* L) {
|
|||
}
|
||||
|
||||
static int32_t Script_IsAddOnLoaded(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int32_t Script_LoadAddOn(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, "UNKNOWN_ERROR");
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int32_t Script_PartialPlayTime(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ static int32_t Script_GetBattlefieldStatData(lua_State* L) {
|
|||
}
|
||||
|
||||
static int32_t Script_RequestBattlefieldPositions(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO: sub_54CF60
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t Script_GetNumBattlefieldPositions(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,14 @@ static int32_t Script_ClearInspectPlayer(lua_State* L) {
|
|||
}
|
||||
|
||||
static int32_t Script_GetWeaponEnchantInfo(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
return 6;
|
||||
}
|
||||
|
||||
static int32_t Script_HasWandEquipped(lua_State* L) {
|
||||
|
|
|
|||
|
|
@ -257,7 +257,9 @@ static int32_t Script_UnitIsDeadOrGhost(lua_State* L) {
|
|||
}
|
||||
|
||||
static int32_t Script_UnitIsConnected(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
// TODO
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t Script_UnitAffectingCombat(lua_State* L) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue