mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): implement Script_GetCharacterListUpdate
This commit is contained in:
parent
0b1c478f33
commit
a5e7ca9a22
@ -1,4 +1,5 @@
|
||||
#include "glue/CCharacterSelection.hpp"
|
||||
#include "glue/CGlueMgr.hpp"
|
||||
#include "model/CM2Shared.hpp"
|
||||
#include "ui/CSimpleModelFFX.hpp"
|
||||
|
||||
@ -9,6 +10,18 @@ void CCharacterSelection::ClearCharacterList() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterSelection::ClearCharacterModel() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterSelection::OnGetCharacterList() {
|
||||
CCharacterSelection::s_characterList.SetCount(0);
|
||||
|
||||
CCharacterSelection::ClearCharacterModel();
|
||||
|
||||
CGlueMgr::GetCharacterList();
|
||||
}
|
||||
|
||||
void CCharacterSelection::RenderPrep() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -17,6 +17,8 @@ class CCharacterSelection {
|
||||
|
||||
// Static functions
|
||||
static void ClearCharacterList();
|
||||
static void ClearCharacterModel();
|
||||
static void OnGetCharacterList();
|
||||
static void RenderPrep();
|
||||
static void SetBackgroundModel(const char* modelPath);
|
||||
};
|
||||
|
||||
@ -171,6 +171,20 @@ void CGlueMgr::DisplayLoginStatus() {
|
||||
}
|
||||
}
|
||||
|
||||
void CGlueMgr::GetCharacterList() {
|
||||
if (CGlueMgr::m_idleState == IDLE_WORLD_LOGIN) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGlueMgr::m_idleState = IDLE_CHARACTER_LIST;
|
||||
CGlueMgr::m_showedDisconnect = 0;
|
||||
|
||||
auto retrieveingText = FrameScript_GetText("CHAR_LIST_RETRIEVING", -1, GENDER_NOT_APPLICABLE);
|
||||
FrameScript_SignalEvent(3, "%s%s", "CANCEL", retrieveingText);
|
||||
|
||||
ClientServices::Connection()->GetCharacterList();
|
||||
}
|
||||
|
||||
int32_t CGlueMgr::HandleDisplaySizeChanged(const CSizeEvent& event) {
|
||||
if (
|
||||
CGlueMgr::m_screenWidth > 0
|
||||
|
||||
@ -58,9 +58,9 @@ class CGlueMgr {
|
||||
// Static functions
|
||||
static void ChangeRealm(const REALM_INFO* realmInfo);
|
||||
static void DisplayLoginStatus();
|
||||
// TODO a1: const EVENT_DATA_IDLE*
|
||||
static void GetCharacterList();
|
||||
static int32_t HandleDisplaySizeChanged(const CSizeEvent& event);
|
||||
static int32_t Idle(const void* a1, void* a2);
|
||||
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);
|
||||
|
||||
@ -173,6 +173,16 @@ int32_t ClientConnection::Disconnect() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ClientConnection::GetCharacterList() {
|
||||
this->Initiate(COP_GET_CHARACTERS, 43, nullptr);
|
||||
|
||||
if (this->m_connected) {
|
||||
this->RequestCharacterEnum();
|
||||
} else {
|
||||
this->Cancel(4);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t ClientConnection::HandleConnect() {
|
||||
this->Complete(1, 5);
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ class ClientConnection : public RealmConnection {
|
||||
void Complete(int32_t result, int32_t errorCode);
|
||||
void Connect();
|
||||
int32_t Disconnect();
|
||||
void GetCharacterList();
|
||||
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);
|
||||
|
||||
@ -278,6 +278,16 @@ int32_t RealmConnection::HandleCharEnum(uint32_t msgId, uint32_t time, CDataStor
|
||||
return 1;
|
||||
}
|
||||
|
||||
void RealmConnection::RequestCharacterEnum() {
|
||||
CDataStore msg;
|
||||
|
||||
msg.Put(static_cast<uint32_t>(CMSG_ENUM_CHARACTERS));
|
||||
|
||||
msg.Finalize();
|
||||
|
||||
this->Send(&msg);
|
||||
}
|
||||
|
||||
void RealmConnection::SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ class RealmConnection : public NetClient {
|
||||
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);
|
||||
void RequestCharacterEnum();
|
||||
void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4);
|
||||
};
|
||||
|
||||
|
||||
@ -35,7 +35,9 @@ int32_t Script_SetCharSelectBackground(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_GetCharacterListUpdate(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
CCharacterSelection::OnGetCharacterList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_GetNumCharacters(lua_State* L) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user