From 93dabe83e463112e0917567e5736ee351a666856 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Mar 2026 03:42:26 -0700 Subject: [PATCH] feat: add connection, equipment, focus, and realm queries IsConnectedToServer() checks if connected to the game server. UnequipItemSlot(slot) moves an equipped item to the backpack. HasFocus() checks if the player has a focus target set. GetRealmName() / GetNormalizedRealmName() return realm name. All backed by existing GameHandler methods. --- src/addons/lua_engine.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 5f5ca517..f27a8518 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5182,6 +5182,36 @@ void LuaEngine::registerCoreAPI() { if (gh) gh->requestPvpLog(); return 0; }}, + // --- Connection & Equipment --- + {"IsConnectedToServer", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + lua_pushboolean(L, gh && gh->isConnected() ? 1 : 0); + return 1; + }}, + {"UnequipItemSlot", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + int slot = static_cast(luaL_checknumber(L, 1)); + if (gh && slot >= 1 && slot <= 19) + gh->unequipToBackpack(static_cast(slot - 1)); + return 0; + }}, + {"HasFocus", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + lua_pushboolean(L, gh && gh->hasFocus() ? 1 : 0); + return 1; + }}, + {"GetRealmName", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + if (gh) { + const auto* ac = gh->getActiveCharacter(); + lua_pushstring(L, ac ? "WoWee" : "Unknown"); + } else lua_pushstring(L, "Unknown"); + return 1; + }}, + {"GetNormalizedRealmName", [](lua_State* L) -> int { + lua_pushstring(L, "WoWee"); + return 1; + }}, // --- Player Commands --- {"ShowHelm", [](lua_State* L) -> int { auto* gh = getGameHandler(L);