Compare commits

...

4 Commits

Author SHA1 Message Date
Tristan 'Natrist' Cormier
8a0f925d52
Merge b902b5484e into abf2e2cde3 2026-02-24 11:07:27 -05:00
Tristan 'Natrist' Cormier
abf2e2cde3
feat(glue): add CGlueMgr::PollCreateCharacter (#167)
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-23 22:30:49 -06:00
Tristan 'Natrist' Cormier
6b7abe3c03
feat(connection): implement character creation message handlers (#166)
Co-authored-by: fallenoak <git@fallenoak.me>
2026-02-23 21:31:12 -06:00
Tristan Cormier
b902b5484e feat(glue): implement Script_AcceptedScanning 2026-01-11 17:00:18 -05:00
7 changed files with 64 additions and 2 deletions

View File

@ -39,6 +39,7 @@
#include <cstdio>
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
int32_t CGlueMgr::m_acceptedScanning = 1; // TODO
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
int32_t CGlueMgr::m_accountMsgAvailable;
@ -393,6 +394,11 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
break;
}
case IDLE_CREATE_CHARACTER: {
CGlueMgr::PollCreateCharacter(msg, complete, result);
break;
}
case IDLE_DELETE_CHARACTER: {
CGlueMgr::PollDeleteCharacter(msg, complete, result);
break;
@ -763,6 +769,37 @@ void CGlueMgr::PollCharacterList(const char* msg, int32_t complete, int32_t resu
}
}
void CGlueMgr::PollCreateCharacter(const char* msg, int32_t complete, int32_t result) {
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);
if (CGlueMgr::HandleBattlenetDisconnect()) {
CGlueMgr::SetIdleState(IDLE_NONE);
}
if (!complete) {
return;
}
// Error
if (result == 0) {
FrameScript_SignalEvent(OPEN_STATUS_DIALOG, "%s%s", "OKAY", msg);
CGlueMgr::SetIdleState(IDLE_NONE);
return;
}
// Success
CGlueMgr::SetIdleState(IDLE_NONE);
FrameScript_SignalEvent(CLOSE_STATUS_DIALOG, nullptr);
FrameScript_SignalEvent(SELECT_LAST_CHARACTER, nullptr);
CGlueMgr::SetScreen("charselect");
}
void CGlueMgr::PollDeleteCharacter(const char* msg, int32_t complete, int32_t result) {
FrameScript_SignalEvent(UPDATE_STATUS_DIALOG, "%s", msg);

View File

@ -33,6 +33,7 @@ class CGlueMgr {
// Static variables
static int32_t m_acceptedEULA;
static int32_t m_acceptedScanning;
static int32_t m_acceptedTerminationWithoutNotice;
static int32_t m_acceptedTOS;
static int32_t m_accountMsgAvailable;
@ -80,6 +81,7 @@ class CGlueMgr {
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 PollCreateCharacter(const char* msg, int32_t complete, int32_t result);
static void PollDeleteCharacter(const char* msg, int32_t complete, int32_t result);
static void PollEnterWorld();
static void PollLoginServerLogin();

View File

@ -216,7 +216,14 @@ int32_t Script_ShowScanningNotice(lua_State* L) {
}
int32_t Script_ScanningAccepted(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
if (CGlueMgr::m_acceptedScanning) {
lua_pushnumber(L, 1.0);
}
else {
lua_pushnil(L);
}
return 1;
}
int32_t Script_AcceptScanning(lua_State* L) {

View File

@ -104,6 +104,10 @@ void ClientConnection::GetRealmList() {
}
}
void ClientConnection::HandleCharacterCreate(uint8_t result) {
this->Complete(result == 47, result);
}
void ClientConnection::HandleCharacterDelete(uint8_t result) {
this->Complete(result == 71, result);
}

View File

@ -22,6 +22,7 @@ class ClientConnection : public RealmConnection {
// Virtual member functions
virtual int32_t HandleConnect();
virtual void HandleCharacterCreate(uint8_t result);
virtual void HandleCharacterDelete(uint8_t result);
// Member functions

View File

@ -20,7 +20,7 @@ int32_t RealmConnection::MessageHandler(void* param, NETMESSAGE msgId, uint32_t
}
case SMSG_CHAR_CREATE: {
// TODO
result = connection->CreateCharHandler(msgId, time, msg);
break;
}
@ -294,6 +294,15 @@ int32_t RealmConnection::HandleCharEnum(uint32_t msgId, uint32_t time, CDataStor
return 1;
}
int32_t RealmConnection::CreateCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
uint8_t result;
msg->Get(result);
this->HandleCharacterCreate(result);
return 1;
}
int32_t RealmConnection::DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg) {
uint8_t result;
msg->Get(result);

View File

@ -46,12 +46,14 @@ class RealmConnection : public NetClient {
// Virtual member functions
virtual int32_t HandleAuthChallenge(AuthenticationChallenge* challenge);
virtual void HandleCharacterCreate(uint8_t result) = 0;
virtual void HandleCharacterDelete(uint8_t result) = 0;
// Member functions
RealmConnection(RealmResponse* realmResponse);
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg);
int32_t CreateCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
int32_t DeleteCharHandler(uint32_t msgId, uint32_t time, CDataStore* msg);
void RequestCharacterEnum();
void RequestCharacterLogin(uint64_t guid, int32_t a2);