[Code Cleanup] More login <-> world code cleanup (#4724)

* More cleanup

* More cleanup
This commit is contained in:
Chris Miles
2025-02-28 16:08:06 -06:00
committed by GitHub
parent cb634cf57d
commit eb6ac25540
13 changed files with 412 additions and 424 deletions
+14 -14
View File
@@ -447,30 +447,30 @@ void Client::SendPostEnterWorld() {
bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
{
if (app->size != sizeof(LoginInfo_Struct)) {
if (app->size != sizeof(LoginInfo)) {
return false;
}
auto *login_info = (LoginInfo_Struct *) app->pBuffer;
auto *r = (LoginInfo *) app->pBuffer;
// Quagmire - max len for name is 18, pass 15
char name[19] = {0};
char password[16] = {0};
strn0cpy(name, (char *) login_info->login_info, 18);
strn0cpy(password, (char *) &(login_info->login_info[strlen(name) + 1]), 15);
strn0cpy(name, (char *) r->login_info, 18);
strn0cpy(password, (char *) &(r->login_info[strlen(name) + 1]), 15);
LogDebug("Receiving Login Info Packet from Client | name [{0}] password [{1}]", name, password);
LogDebug("Receiving login info packet from client | name [{}] password [{}]", name, password);
if (strlen(password) <= 1) {
LogInfo("Login without a password");
return false;
}
is_player_zoning = (login_info->zoning == 1);
is_player_zoning = (r->zoning == 1);
uint32 id = Strings::ToInt(name);
if (id == 0) {
LogWarning("Receiving Login Info Packet from Client | account_id is 0 - disconnecting");
LogWarning("Receiving login info packet from client | account_id is 0 - disconnecting");
return false;
}
@@ -480,15 +480,15 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
LogClientLogin("Checking authentication id [{}] passed", id);
if (!is_player_zoning) {
// Track who is in and who is out of the game
char *inout= (char *) "";
std::string in_out;
if (cle->GetOnline() == CLE_Status::Never){
if (cle->GetOnline() == CLE_Status::Never) {
// Desktop -> Char Select
inout = (char *) "In";
in_out = "in";
}
else {
// Game -> Char Select
inout=(char *) "Out";
in_out = "out";
}
// Always at Char select at this point.
@@ -497,7 +497,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
// Could use a Logging Out Completely message somewhere.
cle->SetOnline(CLE_Status::CharSelect);
LogInfo("Account ({}) Logging({}) to character select :: LSID [{}] ", cle->AccountName(), inout, cle->LSID());
LogInfo("Account ({}) Logging ({}) to character select :: LSID [{}] ", cle->AccountName(), in_out, cle->LSID());
}
else {
cle->SetOnline();
@@ -545,7 +545,7 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
if (!skip_char_info && !custom_files_key.empty() && cle->Admin() < RuleI(World, CustomFilesAdminLevel)) {
// Modified clients can utilize this unused block in login_info to send custom payloads on login
// which indicates they are using custom client files with the correct version, based on key payload.
const auto client_key = std::string(reinterpret_cast<char*>(login_info->unknown064));
const auto client_key = std::string(reinterpret_cast<char*>(r->unknown064));
if (custom_files_key != client_key) {
std::string message = fmt::format("Missing Files [{}]", RuleS(World, CustomFilesUrl) );
SendUnsupportedClientPacket(message);
@@ -1434,7 +1434,7 @@ void Client::EnterWorld(bool TryBootup) {
}
else {
if (TryBootup) {
LogInfo("Attempting autobootup of [{}] ([{}]:[{}])", zone_name, zone_id, instance_id);
LogInfo("Attempting autobootup of [{}] [{}] [{}]", zone_name, zone_id, instance_id);
autobootup_timeout.Start();
zone_waiting_for_bootup = zoneserver_list.TriggerBootup(zone_id, instance_id);
if (zone_waiting_for_bootup == 0) {