feat(glue): implement more of CGlueMgr::PollAccountLogin

This commit is contained in:
fallenoak 2025-10-04 00:44:32 -05:00
parent d3d28c1bce
commit f479d6ab53
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 69 additions and 31 deletions

View File

@ -3,7 +3,9 @@
#include "client/ClientServices.hpp"
#include "client/Util.hpp"
#include "console/CVar.hpp"
#include "db/Db.hpp"
#include "glue/CCharacterSelection.hpp"
#include "glue/Character.hpp"
#include "glue/CRealmList.hpp"
#include "gx/Coordinate.hpp"
#include "gx/Device.hpp"
@ -375,46 +377,69 @@ void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t comp
FrameScript_SignalEvent(4, "%s", msg);
}
if (complete) {
if (result == 0) {
if (errorCode != 2) {
if (!complete) {
return;
}
// Error
if (result == 0) {
if (errorCode != 2) {
// TODO
}
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
if (errorCode == 2) {
CGlueMgr::m_disconnectPending = 1;
ClientServices::Connection()->Disconnect();
}
if (errorCode != 13) {
CCharacterSelection::ClearCharacterList();
if (ClientServices::GetInstance()->m_realmList.Count()) {
FrameScript_SignalEvent(5, nullptr);
CRealmList::UpdateList();
} else {
// TODO
}
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
if (errorCode == 2) {
// TODO CGlueMgr::m_disconnectPending = 1;
// TODO ClientServices::Connection()->Disconnect();
}
if (errorCode != 13) {
// TODO CCharacterSelection::ClearCharacterList();
if (ClientServices::GetInstance()->m_realmList.Count()) {
FrameScript_SignalEvent(5, nullptr);
CRealmList::UpdateList();
} else {
// TODO
}
return;
}
if (!SStrCmpI(CGlueMgr::m_currentScreen, "charselect", STORM_MAX_STR)) {
CGlueMgr::SetScreen("login");
return;
}
return;
}
if (op == COP_CONNECT) {
ClientServices::Connection()->AccountLogin(CGlueMgr::m_accountName, "", CURRENT_REGION, CURRENT_LANGUAGE);
if (!SStrCmpI(CGlueMgr::m_currentScreen, "charselect", STORM_MAX_STR)) {
CGlueMgr::SetScreen("login");
return;
}
return;
}
// Success
if (op == COP_CONNECT) {
ClientServices::Connection()->AccountLogin(CGlueMgr::m_accountName, "", CURRENT_REGION, CURRENT_LANGUAGE);
return;
}
CGlueMgr::m_idleState = IDLE_NONE;
CGlueMgr::m_showedDisconnect = 0;
CCharacterSelection::ClearCharacterList();
// TODO streaming, trial, and expansion checks
auto realm = ClientServices::GetSelectedRealm();
auto categoryRec = g_cfg_CategoriesDB.GetRecord(realm->category);
if (categoryRec) {
ValidateNameInitialize(categoryRec->m_localeMask, categoryRec->m_createCharsetMask);
} else {
ValidateNameInitialize(1 << CURRENT_LANGUAGE, 0);
}
CGlueMgr::SetScreen("charselect");
}
void CGlueMgr::PollEnterWorld() {

5
src/glue/Character.cpp Normal file
View File

@ -0,0 +1,5 @@
#include "glue/Character.hpp"
void ValidateNameInitialize(int32_t localeMask, int32_t charsetMask) {
// TODO
}

8
src/glue/Character.hpp Normal file
View File

@ -0,0 +1,8 @@
#ifndef GLUE_CHARACTER_HPP
#define GLUE_CHARACTER_HPP
#include <cstdint>
void ValidateNameInitialize(int32_t localeMask, int32_t charsetMask);
#endif