mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(ui): implement Script_UnitXP
This commit is contained in:
parent
cfb8f2bae1
commit
a53e1360a4
@ -173,7 +173,23 @@ int32_t Script_UnitPVPName(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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user