mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(client): add ClientServices::InitLoginServerCVars
This commit is contained in:
parent
87361e5c6c
commit
971984e004
@ -1,9 +1,10 @@
|
|||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
#include "client/ClientRealmResponseAdapter.hpp"
|
#include "client/ClientRealmResponseAdapter.hpp"
|
||||||
|
#include "console/CVar.hpp"
|
||||||
|
#include "console/Command.hpp"
|
||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
#include "net/Connection.hpp"
|
#include "net/Connection.hpp"
|
||||||
#include "net/Login.hpp"
|
#include "net/Login.hpp"
|
||||||
#include "console/CVar.hpp"
|
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
#include <new>
|
#include <new>
|
||||||
@ -13,12 +14,17 @@ ClientConnection* g_clientConnection;
|
|||||||
char ClientServices::s_accountName[1280];
|
char ClientServices::s_accountName[1280];
|
||||||
RealmResponse* ClientServices::s_clientRealmResponse;
|
RealmResponse* ClientServices::s_clientRealmResponse;
|
||||||
ClientConnection* ClientServices::s_currentConnection;
|
ClientConnection* ClientServices::s_currentConnection;
|
||||||
|
CVar* ClientServices::s_darkPortalVar;
|
||||||
|
CVar* ClientServices::s_decorateAccountName;
|
||||||
ClientServices* ClientServices::s_instance;
|
ClientServices* ClientServices::s_instance;
|
||||||
Login* ClientServices::s_loginObj;
|
Login* ClientServices::s_loginObj;
|
||||||
bool ClientServices::s_newLogin;
|
bool ClientServices::s_newLogin;
|
||||||
|
CVar* ClientServices::s_realmListVar;
|
||||||
|
CVar* ClientServices::s_realmListBNVar;
|
||||||
CVar* ClientServices::s_realmNameVar;
|
CVar* ClientServices::s_realmNameVar;
|
||||||
REALM_INFO ClientServices::s_selectRealmInfo;
|
REALM_INFO ClientServices::s_selectRealmInfo;
|
||||||
bool ClientServices::s_selectRealmInfoValid;
|
bool ClientServices::s_selectRealmInfoValid;
|
||||||
|
CVar* ClientServices::s_serverAlertVar;
|
||||||
|
|
||||||
void ClientServices::ConnectToSelectedServer() {
|
void ClientServices::ConnectToSelectedServer() {
|
||||||
if (!ClientServices::s_selectRealmInfoValid && !ClientServices::SetSelectedRealmInfo(0)) {
|
if (!ClientServices::s_selectRealmInfoValid && !ClientServices::SetSelectedRealmInfo(0)) {
|
||||||
@ -104,6 +110,99 @@ void ClientServices::Initialize() {
|
|||||||
// TODO ConsoleCommandRegister("logout", &Sub6B2030, 5, nullptr);
|
// TODO ConsoleCommandRegister("logout", &Sub6B2030, 5, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientServices::InitLoginServerCVars(int32_t force, const char* locale) {
|
||||||
|
if (!ClientServices::s_realmListBNVar || !ClientServices::s_realmListVar || force) {
|
||||||
|
ClientServices::s_decorateAccountName = CVar::Register(
|
||||||
|
"decorateAccountName",
|
||||||
|
"",
|
||||||
|
0x0,
|
||||||
|
"0",
|
||||||
|
nullptr,
|
||||||
|
NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
char dataPath[STORM_MAX_PATH];
|
||||||
|
if (locale && *locale) {
|
||||||
|
SStrPrintf(dataPath, sizeof(dataPath), "data\\%s\\", locale);
|
||||||
|
} else {
|
||||||
|
dataPath[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClientServices::s_realmListBNVar || force) {
|
||||||
|
ClientServices::s_realmListBNVar = CVar::Register(
|
||||||
|
"realmListbn",
|
||||||
|
"Address of Battle.net server",
|
||||||
|
0x0,
|
||||||
|
"",
|
||||||
|
nullptr,
|
||||||
|
NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
char realmListPath[STORM_MAX_PATH];
|
||||||
|
SStrPrintf(realmListPath, sizeof(realmListPath), "%srealmlistbn.wtf", dataPath);
|
||||||
|
|
||||||
|
if (!CVar::Load(realmListPath)) {
|
||||||
|
CVar::Load("realmlistbn.wtf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClientServices::s_darkPortalVar || force) {
|
||||||
|
ClientServices::s_darkPortalVar = CVar::Register(
|
||||||
|
"portal",
|
||||||
|
"Name of Battle.net portal to use",
|
||||||
|
0x0,
|
||||||
|
"",
|
||||||
|
nullptr,
|
||||||
|
NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClientServices::s_serverAlertVar || force) {
|
||||||
|
ClientServices::s_serverAlertVar = CVar::Register(
|
||||||
|
"serverAlert",
|
||||||
|
"Get the glue-string tag for the URL",
|
||||||
|
0x0,
|
||||||
|
"SERVER_ALERT_URL",
|
||||||
|
nullptr,
|
||||||
|
NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClientServices::s_realmListVar || force) {
|
||||||
|
ClientServices::s_realmListVar = CVar::Register(
|
||||||
|
"realmList",
|
||||||
|
"Address of realm list server",
|
||||||
|
0x0,
|
||||||
|
"us.logon.worldofwarcraft.com:3724",
|
||||||
|
nullptr,
|
||||||
|
NET,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
char realmListPath[STORM_MAX_PATH];
|
||||||
|
SStrPrintf(realmListPath, sizeof(realmListPath), "%srealmlist.wtf", dataPath);
|
||||||
|
|
||||||
|
if (!CVar::Load(realmListPath)) {
|
||||||
|
CVar::Load("realmlist.wtf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Login* ClientServices::LoginConnection() {
|
Login* ClientServices::LoginConnection() {
|
||||||
return ClientServices::s_loginObj;
|
return ClientServices::s_loginObj;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,12 +15,17 @@ class ClientServices : public LoginResponse {
|
|||||||
static char s_accountName[1280];
|
static char s_accountName[1280];
|
||||||
static RealmResponse* s_clientRealmResponse;
|
static RealmResponse* s_clientRealmResponse;
|
||||||
static ClientConnection* s_currentConnection;
|
static ClientConnection* s_currentConnection;
|
||||||
|
static CVar* s_darkPortalVar;
|
||||||
|
static CVar* s_decorateAccountName;
|
||||||
static ClientServices* s_instance;
|
static ClientServices* s_instance;
|
||||||
static Login* s_loginObj;
|
static Login* s_loginObj;
|
||||||
static bool s_newLogin;
|
static bool s_newLogin;
|
||||||
|
static CVar* s_realmListVar;
|
||||||
|
static CVar* s_realmListBNVar;
|
||||||
static CVar* s_realmNameVar;
|
static CVar* s_realmNameVar;
|
||||||
static REALM_INFO s_selectRealmInfo;
|
static REALM_INFO s_selectRealmInfo;
|
||||||
static bool s_selectRealmInfoValid;
|
static bool s_selectRealmInfoValid;
|
||||||
|
static CVar* s_serverAlertVar;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static void ConnectToSelectedServer();
|
static void ConnectToSelectedServer();
|
||||||
@ -30,6 +35,7 @@ class ClientServices : public LoginResponse {
|
|||||||
static const char* GetSelectedRealmName();
|
static const char* GetSelectedRealmName();
|
||||||
static const REALM_INFO* GetSelectedRealm();
|
static const REALM_INFO* GetSelectedRealm();
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
static void InitLoginServerCVars(int32_t force, const char* locale);
|
||||||
static Login* LoginConnection();
|
static Login* LoginConnection();
|
||||||
static void Logon(const char* accountName, const char* password);
|
static void Logon(const char* accountName, const char* password);
|
||||||
static void SelectRealm(const char* realmName);
|
static void SelectRealm(const char* realmName);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user