diff --git a/src/glue/CCharacterSelection.cpp b/src/glue/CCharacterSelection.cpp index 115864f..546609e 100644 --- a/src/glue/CCharacterSelection.cpp +++ b/src/glue/CCharacterSelection.cpp @@ -50,3 +50,7 @@ void CCharacterSelection::SetBackgroundModel(const char* modelPath) { model->IsDrawable(1, 1); } } + +void CCharacterSelection::UpdateCharacterList() { + // TODO +} diff --git a/src/glue/CCharacterSelection.hpp b/src/glue/CCharacterSelection.hpp index a40fe9f..bcb0d7c 100644 --- a/src/glue/CCharacterSelection.hpp +++ b/src/glue/CCharacterSelection.hpp @@ -21,6 +21,7 @@ class CCharacterSelection { static void OnGetCharacterList(); static void RenderPrep(); static void SetBackgroundModel(const char* modelPath); + static void UpdateCharacterList(); }; #endif diff --git a/src/glue/CGlueMgr.cpp b/src/glue/CGlueMgr.cpp index 01f6e0b..5b6d7e2 100644 --- a/src/glue/CGlueMgr.cpp +++ b/src/glue/CGlueMgr.cpp @@ -185,6 +185,17 @@ void CGlueMgr::GetCharacterList() { ClientServices::Connection()->GetCharacterList(); } +void CGlueMgr::GetRealmList(int32_t a1) { + // TODO +} + + +int32_t CGlueMgr::HandleBattlenetDisconnect() { + // TODO + + return 0; +} + int32_t CGlueMgr::HandleDisplaySizeChanged(const CSizeEvent& event) { if ( CGlueMgr::m_screenWidth > 0 @@ -261,6 +272,11 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) { break; } + case IDLE_CHARACTER_LIST: { + CGlueMgr::PollCharacterList(msg, complete, result, errorCode); + break; + } + case IDLE_ENTER_WORLD: { CGlueMgr::PollEnterWorld(); break; @@ -456,6 +472,51 @@ void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t comp CGlueMgr::SetScreen("charselect"); } +void CGlueMgr::PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode) { + FrameScript_SignalEvent(4, "%s", msg); + + if (CGlueMgr::HandleBattlenetDisconnect()) { + CGlueMgr::m_idleState = IDLE_NONE; + CGlueMgr::m_showedDisconnect = 0; + } + + if (!complete) { + return; + } + + // Error + + if (result == 0) { + if (errorCode == 2) { + CCharacterSelection::ClearCharacterList(); + CGlueMgr::GetRealmList(1); + + return; + } + + FrameScript_SignalEvent(3, "%s%s", "OKAY", msg); + + CGlueMgr::m_idleState = IDLE_NONE; + CGlueMgr::m_showedDisconnect = 0; + + return; + } + + // Success + + CGlueMgr::m_idleState = IDLE_NONE; + CGlueMgr::m_showedDisconnect = 0; + + FrameScript_SignalEvent(5, nullptr); + + CCharacterSelection::UpdateCharacterList(); + + if (CGlueMgr::m_accountMsgAvailable) { + FrameScript_SignalEvent(34, nullptr); + CGlueMgr::m_accountMsgAvailable = 0; + } +} + void CGlueMgr::PollEnterWorld() { if (!LoadingScreenDrawing()) { return; diff --git a/src/glue/CGlueMgr.hpp b/src/glue/CGlueMgr.hpp index c7d5cbe..5faf7b5 100644 --- a/src/glue/CGlueMgr.hpp +++ b/src/glue/CGlueMgr.hpp @@ -59,12 +59,15 @@ class CGlueMgr { static void ChangeRealm(const REALM_INFO* realmInfo); static void DisplayLoginStatus(); static void GetCharacterList(); + static void GetRealmList(int32_t a1); + static int32_t HandleBattlenetDisconnect(); static int32_t HandleDisplaySizeChanged(const CSizeEvent& event); static int32_t Idle(const void* a1, void* a2); // TODO a1: const EVENT_DATA_IDLE* static void Initialize(); static void LoginServerLogin(const char* accountName, const char* password); static int32_t OnKickReasonMsg(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg); static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op); + static void PollCharacterList(const char* msg, int32_t complete, int32_t result, int32_t errorCode); static void PollEnterWorld(); static void PollLoginServerLogin(); static void QuitGame();