[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
+4 -3
View File
@@ -164,9 +164,9 @@ void ClientListEntry::LSUpdate(ZoneServer *iZS)
if (WorldConfig::get()->UpdateStats) {
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSZoneInfo;
pack->size = sizeof(ZoneInfo_Struct);
pack->size = sizeof(LoginserverZoneInfoUpdate);
pack->pBuffer = new uchar[pack->size];
ZoneInfo_Struct *zone = (ZoneInfo_Struct *) pack->pBuffer;
auto *zone = (LoginserverZoneInfoUpdate *) pack->pBuffer;
zone->count = iZS->NumPlayers();
zone->zone = iZS->GetZoneID();
zone->zone_wid = iZS->GetID();
@@ -174,6 +174,7 @@ void ClientListEntry::LSUpdate(ZoneServer *iZS)
safe_delete(pack);
}
}
void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
{
if (WorldConfig::get()->UpdateStats) {
@@ -181,7 +182,7 @@ void ClientListEntry::LSZoneChange(ZoneToZone_Struct *ztz)
pack->opcode = ServerOP_LSPlayerZoneChange;
pack->size = sizeof(ServerLSPlayerZoneChange_Struct);
pack->pBuffer = new uchar[pack->size];
ServerLSPlayerZoneChange_Struct *zonechange = (ServerLSPlayerZoneChange_Struct *) pack->pBuffer;
auto *zonechange = (ServerLSPlayerZoneChange_Struct *) pack->pBuffer;
zonechange->lsaccount_id = LSID();
zonechange->from = ztz->current_zone_id;
zonechange->to = ztz->requested_zone_id;
+7 -28
View File
@@ -1,20 +1,3 @@
/* EQEMu: Everquest Server Emulator
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY except by those people which sell it, which
are required to give you total support for your newly bought product;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "../common/global_define.h"
#include <iostream>
#include <string.h>
@@ -37,7 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "cliententry.h"
#include "world_config.h"
extern ZSList zoneserver_list;
extern ClientList client_list;
extern uint32 numzones;
@@ -609,11 +591,11 @@ void LoginServer::SendInfo()
auto pack = new ServerPacket;
pack->opcode = ServerOP_NewLSInfo;
pack->size = sizeof(ServerNewLSInfo_Struct);
pack->size = sizeof(LoginserverNewWorldRequest);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
auto *l = (ServerNewLSInfo_Struct *) pack->pBuffer;
auto *l = (LoginserverNewWorldRequest *) pack->pBuffer;
strcpy(l->protocol_version, EQEMU_PROTOCOL_VERSION);
strcpy(l->server_version, LOGIN_VERSION);
strcpy(l->server_long_name, Config->LongName.c_str());
@@ -657,10 +639,10 @@ void LoginServer::SendStatus()
auto pack = new ServerPacket;
pack->opcode = ServerOP_LSStatus;
pack->size = sizeof(ServerLSStatus_Struct);
pack->size = sizeof(LoginserverWorldStatusUpdate);
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
auto loginserver_status = (ServerLSStatus_Struct *) pack->pBuffer;
auto loginserver_status = (LoginserverWorldStatusUpdate *) pack->pBuffer;
if (WorldConfig::get()->Locked) {
loginserver_status->status = -2;
@@ -678,9 +660,6 @@ void LoginServer::SendStatus()
delete pack;
}
/**
* @param pack
*/
void LoginServer::SendPacket(ServerPacket *pack)
{
if (m_legacy_client) {
@@ -698,15 +677,15 @@ void LoginServer::SendAccountUpdate(ServerPacket *pack)
return;
}
auto *ls_account_update = (ServerLSAccountUpdate_Struct *) pack->pBuffer;
auto *req = (LoginserverAccountUpdate *) pack->pBuffer;
if (CanUpdate()) {
LogInfo(
"Sending ServerOP_LSAccountUpdate packet to loginserver: [{0}]:[{1}]",
m_loginserver_address,
m_loginserver_port
);
strn0cpy(ls_account_update->worldaccount, m_login_account.c_str(), 30);
strn0cpy(ls_account_update->worldpassword, m_login_password.c_str(), 30);
strn0cpy(req->world_account, m_login_account.c_str(), 30);
strn0cpy(req->world_password, m_login_password.c_str(), 30);
SendPacket(pack);
}
}