thunderbrew/src/client/ClientServices.hpp
VDm 957a4c7e2f
feat(glue): add realm and character handling (#7)
* fix(build): make project compilable

* feat(glue): update Character Selection screen to support switching

* fix(ui): fix CSimpleFontString::GetHeight() to use proper method

* feat(db): add static database classes from whoa-autocode

* feat(ui): use class and area IDs for Character Selection

* chore(db): update ItemRandomPropertiesRec

* feat(glue): update CCharacterSelection methods

* chore(db): uncomment DB records

* feat(glue): implement character deletion

* feat(gx): update supported text tags in GxuDetermineQuotedCode

* fix(ui): fix CSimpleFontString to use the FixedColor flag only if the string does not contain color tags

* feat(net): implement GrunLogin::LogOff

* feat(net): implement NetClient::Disconnect

* feat(login): implement trimming of realm name in LoginResponse::HandleRealmData

* feat(net): implement proper disconnection from login and realm servers

* feat(net): implement PING/PONG messages

* feat(net): add NetClient::Destroy method

* feat(net): implement ClientServices::GetRealmList (second request of Realm List)

* feat(glue): implement CGlueMgr::PollRealmList

* feat(glue): implement CGlueMgr::PollCreateCharacter

* chore(glue): add skeleton of CCharacterComponent class

* fix(build): fix build using latest features

* fix(glue): kill gotos in CGlueMgr::NetDisconnectHandler

* fix(build): include SDL3

---------

Co-authored-by: superp00t <superp00t@tutanota.com>
2025-04-16 17:32:37 -04:00

67 lines
2.6 KiB
C++

#ifndef CLIENT_CLIENT_SERVICES_HPP
#define CLIENT_CLIENT_SERVICES_HPP
#include "net/login/LoginResponse.hpp"
#include "net/connection/NetClient.hpp"
#include <tempest/Vector.hpp>
class ClientConnection;
class CVar;
class Login;
class RealmResponse;
class ClientServices : public LoginResponse {
public:
// Static variables
static char s_accountName[1280];
static RealmResponse* s_clientRealmResponse;
static ClientConnection* s_currentConnection;
static ClientServices* s_instance;
static Login* s_loginObj;
static bool s_newLogin;
static REALM_INFO s_selectRealmInfo;
static bool s_selectRealmInfoValid;
// Static console variables
static CVar* s_realmNameVar;
static CVar* s_decorateAccountName;
static CVar* s_realmListBNVar;
static CVar* s_darkPortalVar;
static CVar* s_ServerAlertVar;
static CVar* s_realmListVar;
static CVar* s_patchListVar;
// Static functions
static const char* GetErrorToken(uint32_t token);
static bool ValidDisconnect(const void* client);
static void ConnectToSelectedServer();
static ClientConnection* Connection();
static ClientServices* GetInstance();
static void SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param);
static void GetRealmList();
static void GetCharacterList();
static void EnumerateCharacters(ENUMERATE_CHARACTERS_CALLBACK fcn, void* param);
static void CharacterLogin(uint64_t id, const C3Vector& position);
static REALM_INFO* GetRealmInfoByIndex(int32_t index);
static const char* GetSelectedRealmName();
static const REALM_INFO* GetSelectedRealm();
static void CharacterDelete(uint64_t guid);
static void Initialize();
static Login* LoginConnection();
static void Logon(const char* accountName, const char* password);
static void SelectRealm(const char* realmName);
static void SetAccountName(const char* accountName);
static int32_t SetSelectedRealmInfo(int32_t a1);
static void InitLoginServerCVars(int32_t overwrite, const char* locale);
static const char* GetDefaultRealmlistString();
static const char* GetDefaultPatchListString();
static bool LoadCDKey();
// Virtual member functions
virtual int32_t GetLoginServerType();
virtual void LoginServerStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, const char* stateStr, const char* resultStr, uint8_t flags);
virtual void RealmEnumCallback(uint32_t a2);
};
#endif