mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(client): implement more of ClientServices::Logon
This commit is contained in:
parent
8f992159f2
commit
eccd46684f
@ -52,6 +52,18 @@ ClientConnection* ClientServices::Connection() {
|
||||
return ClientServices::s_currentConnection;
|
||||
}
|
||||
|
||||
const char* ClientServices::GetCurrentLoginPortal() {
|
||||
return ClientServices::s_loginObj->GetLoginServerType() == 1
|
||||
? ClientServices::s_darkPortalVar->GetString()
|
||||
: "";
|
||||
}
|
||||
|
||||
const char* ClientServices::GetCurrentLoginServer() {
|
||||
return ClientServices::s_loginObj->GetLoginServerType() == 1
|
||||
? ClientServices::s_realmListBNVar->GetString()
|
||||
: ClientServices::s_realmListVar->GetString();
|
||||
}
|
||||
|
||||
ClientServices* ClientServices::GetInstance() {
|
||||
if (ClientServices::s_instance) {
|
||||
return ClientServices::s_instance;
|
||||
@ -237,9 +249,10 @@ void ClientServices::Logon(const char* accountName, const char* password) {
|
||||
|
||||
ClientServices::s_loginObj->SetLogonCreds(accountName, password);
|
||||
|
||||
// TODO
|
||||
|
||||
ClientServices::s_loginObj->Logon(nullptr, nullptr);
|
||||
ClientServices::s_loginObj->Logon(
|
||||
ClientServices::GetCurrentLoginServer(),
|
||||
ClientServices::GetCurrentLoginPortal()
|
||||
);
|
||||
}
|
||||
|
||||
void ClientServices::SelectRealm(const char* realmName) {
|
||||
@ -281,6 +294,12 @@ int32_t ClientServices::SetSelectedRealmInfo(int32_t a1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* ClientServices::GetLoginServer() {
|
||||
return ClientServices::s_loginObj->GetLoginServerType() == 1
|
||||
? ClientServices::s_realmListBNVar->GetString()
|
||||
: ClientServices::s_realmListVar->GetString();
|
||||
}
|
||||
|
||||
int32_t ClientServices::GetLoginServerType() {
|
||||
if (!ClientServices::LoginConnection()) {
|
||||
return 0;
|
||||
|
||||
@ -30,6 +30,8 @@ class ClientServices : public LoginResponse {
|
||||
// Static functions
|
||||
static void ConnectToSelectedServer();
|
||||
static ClientConnection* Connection();
|
||||
static const char* GetCurrentLoginPortal();
|
||||
static const char* GetCurrentLoginServer();
|
||||
static ClientServices* GetInstance();
|
||||
static REALM_INFO* GetRealmInfoByIndex(int32_t index);
|
||||
static const char* GetSelectedRealmName();
|
||||
@ -44,6 +46,7 @@ class ClientServices : public LoginResponse {
|
||||
static int32_t SetSelectedRealmInfo(int32_t a1);
|
||||
|
||||
// Virtual member functions
|
||||
virtual const char* GetLoginServer();
|
||||
virtual int32_t GetLoginServerType();
|
||||
virtual void LoginServerStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, const char* stateStr, const char* resultStr, uint8_t flags);
|
||||
virtual void RealmEnumCallback(uint32_t a2);
|
||||
|
||||
@ -26,7 +26,7 @@ class Grunt::ClientResponse {
|
||||
virtual const uint8_t* GetVersionChallenge() = 0;
|
||||
virtual void GetRealmList() = 0;
|
||||
virtual void Reconnect() = 0;
|
||||
virtual void Logon(const char* a2, const char* a3) = 0;
|
||||
virtual void Logon(const char* loginServer, const char* loginPortal) = 0;
|
||||
virtual void ProveVersion(const uint8_t* versionChecksum) = 0;
|
||||
virtual void Logoff() = 0;
|
||||
virtual void Init(LoginResponse* loginResponse) = 0;
|
||||
|
||||
@ -125,7 +125,7 @@ void GruntLogin::Logoff() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GruntLogin::Logon(const char* a2, const char* a3) {
|
||||
void GruntLogin::Logon(const char* loginServer, const char* loginPortal) {
|
||||
if (this->m_loggedOn) {
|
||||
return;
|
||||
}
|
||||
@ -141,11 +141,11 @@ void GruntLogin::Logon(const char* a2, const char* a3) {
|
||||
0x0
|
||||
);
|
||||
|
||||
if (!a2) {
|
||||
a2 = "us.logon.worldofwarcraft.com:3724";
|
||||
if (!loginServer) {
|
||||
loginServer = "us.logon.worldofwarcraft.com:3724";
|
||||
}
|
||||
|
||||
this->m_clientLink->Connect(a2);
|
||||
this->m_clientLink->Connect(loginServer);
|
||||
}
|
||||
|
||||
void GruntLogin::LogonResult(Grunt::Result result, const uint8_t* sessionKey, uint32_t sessionKeyLen, uint16_t flags) {
|
||||
|
||||
@ -26,7 +26,7 @@ class GruntLogin : public Login {
|
||||
virtual const uint8_t* GetVersionChallenge();
|
||||
virtual void GetRealmList();
|
||||
virtual void Reconnect();
|
||||
virtual void Logon(const char* a2, const char* a3);
|
||||
virtual void Logon(const char* loginServer, const char* loginPortal);
|
||||
virtual void ProveVersion(const uint8_t* versionChecksum);
|
||||
virtual void Logoff();
|
||||
virtual void Init(LoginResponse* loginResponse);
|
||||
|
||||
@ -16,6 +16,7 @@ class LoginResponse {
|
||||
LOGIN_RESULT m_loginResult;
|
||||
|
||||
// Virtual member functions
|
||||
virtual const char* GetLoginServer() = 0;
|
||||
virtual int32_t GetLoginServerType() = 0;
|
||||
virtual void LoginServerStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, const char* stateStr, const char* resultStr, uint8_t flags) = 0;
|
||||
virtual void RealmEnumCallback(uint32_t a2) = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user