mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-15 17:46:03 +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"
|
||||
|
||||
void ClientRealmResponseAdapter::HandleAuthResponse(RealmConnection* connection, uint8_t authResult) {
|
||||
void AccountDataInitialize(bool a1) {
|
||||
// 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 {
|
||||
public:
|
||||
// Virtual member functions
|
||||
virtual void HandleAuthResponse(RealmConnection* connection, uint8_t authResult);
|
||||
virtual void GameServerResult(RealmConnection* connection, const char* a2, const char* a3, const char* a4) {};
|
||||
virtual void HandleAuthResponse(RealmConnection* realmConnection, uint8_t authResult);
|
||||
virtual void GameServerResult(RealmConnection* realmConnection, const char* a2, const char* a3, const char* a4) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -22,12 +22,12 @@ bool ClientServices::s_selectRealmInfoValid;
|
||||
|
||||
void ClientServices::ConnectToSelectedServer() {
|
||||
if (!ClientServices::s_selectRealmInfoValid && !ClientServices::SetSelectedRealmInfo(0)) {
|
||||
ClientServices::Connection()->SetStatus(0, 39);
|
||||
ClientServices::Connection()->Complete(0, 39);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClientServices::Connection()->GetState() != NS_INITIALIZED) {
|
||||
ClientServices::Connection()->SetStatus(0, 39);
|
||||
ClientServices::Connection()->Complete(0, 39);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -210,12 +210,12 @@ void ClientServices::RealmEnumCallback(uint32_t a2) {
|
||||
auto connection = ClientServices::Connection();
|
||||
|
||||
if (a2 == 1) {
|
||||
connection->SetStatus(0, 23);
|
||||
connection->Complete(0, 23);
|
||||
return;
|
||||
}
|
||||
|
||||
if (a2 == 2 || a2 == 3 || a2 == 4) {
|
||||
connection->SetStatus(0, 37);
|
||||
connection->Complete(0, 37);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,15 +110,22 @@ const char* s_errorCodeTokens[] = {
|
||||
"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) {
|
||||
this->Cleanup();
|
||||
|
||||
this->m_statusResult = 0;
|
||||
this->m_errorCode = errorCode;
|
||||
this->m_statusComplete = 1;
|
||||
|
||||
// TODO
|
||||
// LogConnectionStatus(this->m_statusCop, errorCode, 0);
|
||||
this->Complete(0, errorCode);
|
||||
}
|
||||
|
||||
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() {
|
||||
// TODO
|
||||
|
||||
@ -146,6 +163,15 @@ int32_t ClientConnection::Disconnect() {
|
||||
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() {
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
: RealmConnection(realmResponse)
|
||||
{};
|
||||
void AccountLogin_Finish(int32_t authResult);
|
||||
void AccountLogin_Queued();
|
||||
void Cancel(int32_t errorCode);
|
||||
void Cleanup();
|
||||
void Complete(int32_t result, int32_t errorCode);
|
||||
void Connect();
|
||||
int32_t Disconnect();
|
||||
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);
|
||||
void SetStatus(int32_t result, int32_t errorCode);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user