[Loginserver] Modernize codebase (#4647)

* Beginning of cleanup

* More cleanup

* More cleanup

* Enc cleanup

* client manager cleanup

* client cleanup

* More cleanup

* More cleanup

* Cleanup

* More cleanup, account  context, account management

* Remove positional fmt bindings

* Use LoginAccountContext

* Update loginserver_webserver.cpp

* Remove comments

* Port CreateLoginServerAccount to repositories

* More cleanup

* More cleanup

* More cleanup

* More cleanup

* Remove a ton of functions

* More cleanup

* More cleanup

* More cleanup

* Cleanup SendClientAuthToWorld

* Consolidate world server logic

* Update login_accounts_repository.h

* Update login_accounts_repository.h

* Move api tokens to repositories

* Cleanup options

* Move everything else to repositories

* Update account_management.cpp

* uint64 account

* Update login_schema.sql

* Fix

* Update world_server.cpp

* auto
This commit is contained in:
Chris Miles
2025-02-06 12:47:02 -06:00
committed by GitHub
parent 1650efa787
commit 1a48add20e
33 changed files with 1566 additions and 3990 deletions
+57 -29
View File
@@ -4,30 +4,30 @@
#pragma pack(1)
// unencrypted base message header in all packets
struct LoginBaseMessage_Struct {
struct LoginBaseMessage {
int32_t sequence; // request type/login sequence (2: handshake, 3: login, 4: serverlist, ...)
bool compressed; // true: deflated
int8_t encrypt_type; // 1: invert (unused) 2: des (2 for encrypted player logins and order expansions) (client uses what it sent, ignores in reply)
int32_t unk3; // unused?
};
struct LoginBaseReplyMessage_Struct {
struct LoginBaseReplyMessage {
bool success; // 0: failure (shows error string) 1: success
int32_t error_str_id; // last error eqlsstr id, default: 101 (no error)
char str[1]; // variable length, unknown (may be unused, this struct is a common pattern elsewhere)
};
struct LoginHandShakeReply_Struct {
LoginBaseMessage_Struct base_header;
LoginBaseReplyMessage_Struct base_reply;
char unknown[1]; // variable length string
struct LoginHandShakeReply {
LoginBaseMessage base_header;
LoginBaseReplyMessage base_reply;
char unknown[1]; // variable length string
};
// variable length, can use directly if not serializing strings
struct PlayerLoginReply_Struct {
struct PlayerLoginReply {
// base header excluded to make struct data easier to encrypt
//LoginBaseMessage_Struct base_header;
LoginBaseReplyMessage_Struct base_reply;
//LoginBaseMessage base_header;
LoginBaseReplyMessage base_reply;
int8_t unk1; // (default: 0)
int8_t unk2; // (default: 0)
@@ -47,7 +47,7 @@ struct PlayerLoginReply_Struct {
};
// variable length, for reference
struct LoginClientServerData_Struct {
struct LoginClientServerData {
char ip[1];
int32_t server_type; // legends, preferred, standard
int32_t server_id;
@@ -59,24 +59,24 @@ struct LoginClientServerData_Struct {
};
// variable length, for reference
struct ServerListReply_Struct {
LoginBaseMessage_Struct base_header;
LoginBaseReplyMessage_Struct base_reply;
struct ServerListReply {
LoginBaseMessage base_header;
LoginBaseReplyMessage base_reply;
int32_t server_count;
LoginClientServerData_Struct servers[0];
int32_t server_count;
LoginClientServerData servers[0];
};
struct PlayEverquestRequest_Struct {
LoginBaseMessage_Struct base_header;
uint32 server_number;
struct PlayEverquestRequest {
LoginBaseMessage base_header;
uint32 server_number;
};
// SCJoinServerReply
struct PlayEverquestResponse_Struct {
LoginBaseMessage_Struct base_header;
LoginBaseReplyMessage_Struct base_reply;
uint32 server_number;
struct PlayEverquestResponse {
LoginBaseMessage base_header;
LoginBaseReplyMessage base_reply;
uint32 server_number;
};
#pragma pack()
@@ -95,6 +95,34 @@ enum LSClientStatus {
cs_logged_in
};
struct LoginWorldContext {
std::string long_name;
std::string short_name;
std::string password;
std::string password_hash;
int64 admin_id = 0;
};
struct LoginWorldAdminAccountContext {
int64 id;
std::string username;
std::string password;
std::string password_hash;
std::string email;
std::string first_name;
std::string last_name;
std::string ip_address;
};
struct LoginAccountContext {
std::string username;
std::string password;
std::string email;
std::string source_loginserver = "local";
uint32 login_account_id = 0;
bool password_is_encrypted = false;
};
namespace LS {
namespace ServerStatusFlags {
enum eServerStatusFlags {
@@ -123,13 +151,13 @@ namespace LS {
};
namespace ErrStr {
constexpr static int ERROR_NONE = 101; // No Error
constexpr static int ERROR_UNKNOWN = 102; // Error - Unknown Error Occurred
constexpr static int ERROR_ACTIVE_CHARACTER = 111; // Error 1018: You currently have an active character on that EverQuest Server, please allow a minute for synchronization and try again.
constexpr static int ERROR_SERVER_UNAVAILABLE = 326; // That server is currently unavailable. Please check the EverQuest webpage for current server status and try again later.
constexpr static int ERROR_ACCOUNT_SUSPENDED = 337; // This account is currently suspended. Please contact customer service for more information.
constexpr static int ERROR_ACCOUNT_BANNED = 338; // This account is currently banned. Please contact customer service for more information.
constexpr static int ERROR_WORLD_MAX_CAPACITY = 339; // The world server is currently at maximum capacity and not allowing further logins until the number of players online decreases. Please try again later.
constexpr static int ERROR_NONE = 101; // No Error
constexpr static int ERROR_UNKNOWN = 102; // Error - Unknown Error Occurred
constexpr static int ERROR_ACTIVE_CHARACTER = 111; // Error 1018: You currently have an active character on that EverQuest Server, please allow a minute for synchronization and try again.
constexpr static int ERROR_SERVER_UNAVAILABLE = 326; // That server is currently unavailable. Please check the EverQuest webpage for current server status and try again later.
constexpr static int ERROR_ACCOUNT_SUSPENDED = 337; // This account is currently suspended. Please contact customer service for more information.
constexpr static int ERROR_ACCOUNT_BANNED = 338; // This account is currently banned. Please contact customer service for more information.
constexpr static int ERROR_WORLD_MAX_CAPACITY = 339; // The world server is currently at maximum capacity and not allowing further logins until the number of players online decreases. Please try again later.
};
}