feat(glue): handle GetSelectedCategory script function

This commit is contained in:
fallenoak 2023-02-18 14:40:34 -06:00
parent 529e6c06e3
commit 6811eb49d6
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -216,7 +216,27 @@ int32_t Script_SortRealms(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) {