feat(net): implement ClientServices::GetRealmList (second request of Realm List)

This commit is contained in:
VDm 2025-04-12 16:58:49 +04:00
parent afc6c3666b
commit 06eeedbb68
7 changed files with 28 additions and 3 deletions

View File

@ -190,7 +190,13 @@ void ClientServices::SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler
}
void ClientServices::GetRealmList() {
// TODO
STORM_ASSERT(ClientServices::s_currentConnection);
ClientServices::s_currentConnection->Initiate(COP_GET_REALMS, 35, nullptr);
if (ClientServices::s_loginObj->IsLoggedOn()) {
ClientServices::s_loginObj->GetRealmList();
} else {
ClientServices::s_loginObj->Reconnect();
}
}
void ClientServices::GetCharacterList() {
@ -367,6 +373,7 @@ void ClientServices::LoginServerStatus(LOGIN_STATE state, LOGIN_RESULT result, c
void ClientServices::RealmEnumCallback(uint32_t a2) {
auto connection = ClientServices::Connection();
STORM_ASSERT(connection);
if (a2 == 1) {
connection->Complete(0, 23);
@ -378,7 +385,13 @@ void ClientServices::RealmEnumCallback(uint32_t a2) {
return;
}
// TODO statusCop checks
// TODO: Proper implementation
if (connection->m_statusCop != COP_CONNECT) {
if (connection->m_statusCop == COP_GET_REALMS) {
connection->Complete(1, 36);
}
return;
}
if (ClientServices::LoginConnection()->GetLoginServerType() == 1) {
// TODO Battlenet logic

View File

@ -20,6 +20,7 @@ class Grunt::ClientResponse {
virtual void RealmListResult(CDataStore* msg) = 0;
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state) = 0;
virtual int32_t GetServerId() = 0;
virtual void Reconnect() = 0;
virtual void GetRealmList() = 0;
virtual void Logon(const char* a2, const char* a3) = 0;
virtual void ProveVersion(const uint8_t* versionChecksum) = 0;

View File

@ -88,6 +88,10 @@ int32_t GruntLogin::GetServerId() {
return 0;
}
void GruntLogin::Reconnect() {
// TODO
}
void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) {
if (this->IsReconnect()) {
// TODO

View File

@ -22,6 +22,7 @@ class GruntLogin : public Login {
virtual void LogonResult(Grunt::Result result, const uint8_t* sessionKey, uint32_t sessionKeyLen, uint16_t flags);
virtual LOGIN_STATE NextSecurityState(LOGIN_STATE state);
virtual int32_t GetServerId();
virtual void Reconnect();
virtual void GetRealmList();
virtual void Logon(const char* a2, const char* a3);
virtual void ProveVersion(const uint8_t* versionChecksum);

View File

@ -13,6 +13,10 @@ bool Login::IsReconnect() {
return this->m_reconnect;
}
bool Login::IsLoggedOn() {
return this->m_loggedOn;
}
bool Login::OnlineIdle() {
// TODO

View File

@ -22,6 +22,7 @@ class Login : public Grunt::ClientResponse {
virtual bool OnlineIdle();
virtual void RealmListResult(CDataStore* msg);
virtual bool IsReconnect();
virtual bool IsLoggedOn();
// Member functions
void SetLogonCreds(const char* accountName, const char* password);

View File

@ -11,7 +11,8 @@
#include <storm/String.hpp>
int32_t Script_RequestRealmList(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
CGlueMgr::GetRealmList(StringToBOOL(L, 1, 0));
return 0;
}
int32_t Script_RealmListUpdateRate(lua_State* L) {