mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-19 20:42:29 +03:00
feat(ui): implement Script_SelectCharacter
This commit is contained in:
3 files changed
+21
-1
No files matched your search
@@ -51,7 +51,22 @@ int32_t Script_GetCharacterInfo(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_SelectCharacter(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: SelectCharacter(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
|
||||
if (index < 0 || index >= CCharacterSelection::s_characterList.Count()) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
CCharacterSelection::s_selectionIndex = index;
|
||||
CCharacterSelection::ShowCharacter();
|
||||
|
||||
FrameScript_SignalEvent(8, "%d", CCharacterSelection::s_selectionIndex + 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_DeleteCharacter(lua_State* L) {
|
||||
|
||||
Reference in new issue
Block a user