mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-19 03:20:11 +03:00
feat(glue): handle GetNumRealms script function
This commit is contained in:
parent
7359f741f1
commit
529e6c06e3
@ -22,7 +22,34 @@ int32_t Script_CancelRealmListQuery(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_GetNumRealms(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED();
|
||||
if (lua_isnumber(L, 1)) {
|
||||
int32_t categoryIndex = lua_tonumber(L, 1) - 1;
|
||||
categoryIndex = CRealmList::Sub4DE910(categoryIndex);
|
||||
|
||||
int32_t numRealms = 0;
|
||||
if (categoryIndex < CRealmList::s_categories.Count()) {
|
||||
auto realmCategory = CRealmList::s_categories[categoryIndex];
|
||||
if (realmCategory) {
|
||||
numRealms = realmCategory->uint14;
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushnumber(L, numRealms);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t numRealms = 0;
|
||||
for (int32_t i = 0; i < CRealmList::s_categories.Count(); i++) {
|
||||
auto realmCategory = CRealmList::s_categories[i];
|
||||
if (realmCategory) {
|
||||
numRealms += realmCategory->uint14;
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushnumber(L, numRealms);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t Script_GetRealmInfo(lua_State* L) {
|
||||
|
Loading…
Reference in New Issue
Block a user