mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-28 09:33:52 +00:00
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.
This commit is contained in:
parent
c874ffc6b6
commit
93dabe83e4
1 changed files with 30 additions and 0 deletions
|
|
@ -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<int>(luaL_checknumber(L, 1));
|
||||
if (gh && slot >= 1 && slot <= 19)
|
||||
gh->unequipToBackpack(static_cast<game::EquipSlot>(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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue