feat(client): add ClientServices::GetRealmList (#111)

Co-authored-by: fallenoak <git@fallenoak.me>
This commit is contained in:
Tristan 'Natrist' Cormier 2025-10-08 23:25:19 -04:00 committed by GitHub
parent 0c2db0a97d
commit 3636efec34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View File

@ -200,6 +200,10 @@ REALM_INFO* ClientServices::GetRealmInfoByIndex(int32_t index) {
return &ClientServices::GetInstance()->m_realmList[index];
}
void ClientServices::GetRealmList() {
ClientServices::Connection()->GetRealmList();
}
const char* ClientServices::GetSelectedRealmName() {
if (!ClientServices::s_realmNameVar) {
ClientServices::s_realmNameVar = CVar::Register(

View File

@ -36,6 +36,7 @@ class ClientServices : public LoginResponse {
static const char* GetErrorToken(int32_t errorCode);
static ClientServices* GetInstance();
static REALM_INFO* GetRealmInfoByIndex(int32_t index);
static void GetRealmList();
static const char* GetSelectedRealmName();
static const REALM_INFO* GetSelectedRealm();
static void Initialize();

View File

@ -91,6 +91,17 @@ void ClientConnection::GetCharacterList() {
}
}
void ClientConnection::GetRealmList() {
this->Initiate(COP_GET_REALMS, 35, nullptr);
if (ClientServices::LoginConnection()->IsLoggedOn()) {
ClientServices::LoginConnection()->GetRealmList();
}
else {
ClientServices::LoginConnection()->Reconnect();
}
}
int32_t ClientConnection::HandleConnect() {
this->Complete(1, 5);

View File

@ -37,6 +37,7 @@ class ClientConnection : public RealmConnection {
int32_t Disconnect();
void EnumerateCharacters(ENUMERATE_CHARACTERS_CALLBACK callback, void* param);
void GetCharacterList();
void GetRealmList();
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
int32_t IsConnected();
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);