mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 01:55:21 +03:00
feat(client): implement auth response handler in realm adapter
This commit is contained in:
parent
23d537103e
commit
1b27761d0c
@ -1,5 +1,18 @@
|
|||||||
#include "client/ClientRealmResponseAdapter.hpp"
|
#include "client/ClientRealmResponseAdapter.hpp"
|
||||||
|
|
||||||
void ClientRealmResponseAdapter::HandleAuthResponse(RealmConnection* connection, uint8_t authResult) {
|
void AccountDataInitialize(bool a1) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientRealmResponseAdapter::HandleAuthResponse(RealmConnection* realmConnection, uint8_t authResult) {
|
||||||
|
auto clientConnection = static_cast<ClientConnection*>(realmConnection);
|
||||||
|
|
||||||
|
// AUTH_WAIT_QUEUE
|
||||||
|
if (authResult == 27) {
|
||||||
|
clientConnection->AccountLogin_Queued();
|
||||||
|
} else {
|
||||||
|
clientConnection->AccountLogin_Finish(authResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountDataInitialize(true);
|
||||||
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
class ClientRealmResponseAdapter : public RealmResponse {
|
class ClientRealmResponseAdapter : public RealmResponse {
|
||||||
public:
|
public:
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual void HandleAuthResponse(RealmConnection* connection, uint8_t authResult);
|
virtual void HandleAuthResponse(RealmConnection* realmConnection, uint8_t authResult);
|
||||||
virtual void GameServerResult(RealmConnection* connection, const char* a2, const char* a3, const char* a4) {};
|
virtual void GameServerResult(RealmConnection* realmConnection, const char* a2, const char* a3, const char* a4) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,12 +22,12 @@ bool ClientServices::s_selectRealmInfoValid;
|
|||||||
|
|
||||||
void ClientServices::ConnectToSelectedServer() {
|
void ClientServices::ConnectToSelectedServer() {
|
||||||
if (!ClientServices::s_selectRealmInfoValid && !ClientServices::SetSelectedRealmInfo(0)) {
|
if (!ClientServices::s_selectRealmInfoValid && !ClientServices::SetSelectedRealmInfo(0)) {
|
||||||
ClientServices::Connection()->SetStatus(0, 39);
|
ClientServices::Connection()->Complete(0, 39);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClientServices::Connection()->GetState() != NS_INITIALIZED) {
|
if (ClientServices::Connection()->GetState() != NS_INITIALIZED) {
|
||||||
ClientServices::Connection()->SetStatus(0, 39);
|
ClientServices::Connection()->Complete(0, 39);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,12 +210,12 @@ void ClientServices::RealmEnumCallback(uint32_t a2) {
|
|||||||
auto connection = ClientServices::Connection();
|
auto connection = ClientServices::Connection();
|
||||||
|
|
||||||
if (a2 == 1) {
|
if (a2 == 1) {
|
||||||
connection->SetStatus(0, 23);
|
connection->Complete(0, 23);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a2 == 2 || a2 == 3 || a2 == 4) {
|
if (a2 == 2 || a2 == 3 || a2 == 4) {
|
||||||
connection->SetStatus(0, 37);
|
connection->Complete(0, 37);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,15 +110,22 @@ const char* s_errorCodeTokens[] = {
|
|||||||
"CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME",
|
"CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ClientConnection::AccountLogin_Finish(int32_t errorCode) {
|
||||||
|
this->Complete(errorCode == 12, errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientConnection::AccountLogin_Queued() {
|
||||||
|
this->m_statusCop = COP_WAIT_QUEUE;
|
||||||
|
this->m_errorCode = 27;
|
||||||
|
this->m_statusComplete = 0;
|
||||||
|
|
||||||
|
// TODO LogConnectionStatus(this->m_statusCop, 27, 1);
|
||||||
|
|
||||||
|
// TODO CGlueMgr::UpdateWaitQueue(this->m_queuePosition);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::Cancel(int32_t errorCode) {
|
void ClientConnection::Cancel(int32_t errorCode) {
|
||||||
this->Cleanup();
|
this->Complete(0, errorCode);
|
||||||
|
|
||||||
this->m_statusResult = 0;
|
|
||||||
this->m_errorCode = errorCode;
|
|
||||||
this->m_statusComplete = 1;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
// LogConnectionStatus(this->m_statusCop, errorCode, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::Cleanup() {
|
void ClientConnection::Cleanup() {
|
||||||
@ -128,6 +135,16 @@ void ClientConnection::Cleanup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientConnection::Complete(int32_t result, int32_t errorCode) {
|
||||||
|
this->Cleanup();
|
||||||
|
|
||||||
|
this->m_statusResult = result;
|
||||||
|
this->m_errorCode = errorCode;
|
||||||
|
this->m_statusComplete = 1;
|
||||||
|
|
||||||
|
// TODO LogConnectionStatus(this->m_statusCop, errorCode, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::Connect() {
|
void ClientConnection::Connect() {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
@ -146,6 +163,15 @@ int32_t ClientConnection::Disconnect() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientConnection::Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)()) {
|
||||||
|
this->m_cleanup = cleanup;
|
||||||
|
this->m_statusCop = op;
|
||||||
|
this->m_errorCode = errorCode;
|
||||||
|
this->m_statusComplete = 0;
|
||||||
|
|
||||||
|
// TODO LogConnectionStatus(this->m_statusCop, errorCode, 1);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t ClientConnection::IsConnected() {
|
int32_t ClientConnection::IsConnected() {
|
||||||
return this->m_connected;
|
return this->m_connected;
|
||||||
}
|
}
|
||||||
@ -179,13 +205,3 @@ int32_t ClientConnection::PollStatus(WOWCS_OPS& op, const char** msg, int32_t& r
|
|||||||
|
|
||||||
return this->m_statusComplete;
|
return this->m_statusComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::SetStatus(int32_t result, int32_t errorCode) {
|
|
||||||
this->Cleanup();
|
|
||||||
|
|
||||||
this->m_statusResult = result;
|
|
||||||
this->m_errorCode = errorCode;
|
|
||||||
this->m_statusComplete = 1;
|
|
||||||
|
|
||||||
// TODO LogConnectionStatus(this->m_statusCop, errorCode, 0);
|
|
||||||
}
|
|
||||||
|
@ -20,13 +20,16 @@ class ClientConnection : public RealmConnection {
|
|||||||
ClientConnection(RealmResponse* realmResponse)
|
ClientConnection(RealmResponse* realmResponse)
|
||||||
: RealmConnection(realmResponse)
|
: RealmConnection(realmResponse)
|
||||||
{};
|
{};
|
||||||
|
void AccountLogin_Finish(int32_t authResult);
|
||||||
|
void AccountLogin_Queued();
|
||||||
void Cancel(int32_t errorCode);
|
void Cancel(int32_t errorCode);
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
|
void Complete(int32_t result, int32_t errorCode);
|
||||||
void Connect();
|
void Connect();
|
||||||
int32_t Disconnect();
|
int32_t Disconnect();
|
||||||
|
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
||||||
int32_t IsConnected();
|
int32_t IsConnected();
|
||||||
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);
|
int32_t PollStatus(WOWCS_OPS& op, const char** msg, int32_t& result, int32_t& errorCode);
|
||||||
void SetStatus(int32_t result, int32_t errorCode);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user