mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
feat(glue): handle GetSelectedCategory script function
This commit is contained in:
parent
529e6c06e3
commit
6811eb49d6
1 changed files with 21 additions and 1 deletions
|
|
@ -216,7 +216,27 @@ int32_t Script_SortRealms(lua_State* L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetSelectedCategory(lua_State* L) {
|
int32_t Script_GetSelectedCategory(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED();
|
if (CRealmList::s_categories.Count() == 0) {
|
||||||
|
lua_pushnumber(L, 1.0);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t selectedCategory = -1;
|
||||||
|
for (uint32_t i = 0; i < CRealmList::s_categories.Count(); i++) {
|
||||||
|
auto realmCategory = CRealmList::s_categories[i];
|
||||||
|
if (realmCategory && realmCategory->uint14) {
|
||||||
|
selectedCategory++;
|
||||||
|
|
||||||
|
if (i >= CRealmList::s_selectedCategory) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_pushnumber(L, selectedCategory + 1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_RealmListDialogCancelled(lua_State* L) {
|
int32_t Script_RealmListDialogCancelled(lua_State* L) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue