feat(ui): implement Script_UnitXP

This commit is contained in:
fallenoak 2026-02-05 16:12:04 -06:00
parent cfb8f2bae1
commit a53e1360a4
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -173,7 +173,23 @@ int32_t Script_UnitPVPName(lua_State* L) {
} }
int32_t Script_UnitXP(lua_State* L) { int32_t Script_UnitXP(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (!lua_isstring(L, 1)) {
luaL_error(L, "Usage: UnitXP(\"unit\")");
return 0;
}
auto name = lua_tostring(L, 1);
auto unit = Script_GetUnitFromName(name);
float xp = 0.0f;
if (unit && unit->IsA(TYPE_PLAYER)) {
xp = static_cast<CGPlayer_C*>(unit)->GetActiveXP();
}
lua_pushnumber(L, xp);
return 1;
} }
int32_t Script_UnitXPMax(lua_State* L) { int32_t Script_UnitXPMax(lua_State* L) {