fix: don't crash if some configs aren't present

remove not starting if ini's aren't present since everything can run from env vars now
This commit is contained in:
Aaron Kimbre
2024-01-04 18:21:03 -06:00
parent d283bbd1c4
commit 321d354e96
10 changed files with 65 additions and 72 deletions

View File

@@ -54,14 +54,12 @@ void AuthPackets::HandleHandshake(dServer* server, Packet* packet) {
void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort, const ServerType serverType) {
RakNet::BitStream bitStream;
BitStreamUtils::WriteHeader(bitStream, eConnectionType::SERVER, eServerMessageType::VERSION_CONFIRM);
uint32_t netVersion;
const std::string& expectedVersion = Game::config->GetValue("client_net_version");
LOG("Expected Version: '%s'", expectedVersion.c_str());
if (!GeneralUtils::TryParse(expectedVersion, netVersion)) {
LOG("Failed to parse client_net_version. Cannot authenticate to %s:%i", nextServerIP.c_str(), nextServerPort);
return;
}
bitStream.Write<uint32_t>(netVersion);
uint32_t clientNetVersion = 171022;
const auto clientNetVersionString = Game::config->GetValue("client_net_version");
if (!clientNetVersionString.empty()) GeneralUtils::TryParse(clientNetVersionString, clientNetVersion);
bitStream.Write<uint32_t>(clientNetVersion);
bitStream.Write<uint32_t>(0x93);
if (serverType == ServerType::Auth) bitStream.Write(uint32_t(1)); //Conn: auth
@@ -95,7 +93,6 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) {
}
if (Game::config->GetValue("dont_use_keys") != "1" && accountInfo->maxGmLevel == eGameMasterLevel::CIVILIAN) {
LOG("");
//Check to see if we have a play key:
if (accountInfo->playKeyId == 0) {
AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your account doesn't have a play key associated with it!", "", 2001, username);

View File

@@ -14,6 +14,7 @@
#include "BitStreamUtils.h"
#include "MasterPackets.h"
#include "ZoneInstanceManager.h"
#include "StringifiedEnum.h"
//! Replica Constructor class
class ReplicaConstructor : public ReceiveConstructionInterface {
@@ -65,9 +66,9 @@ dServer::dServer(const std::string& ip, int port, int instanceID, int maxConnect
if (mIsOkay) {
if (zoneID == 0)
LOG("Server is listening on %s:%i with encryption: %i", ip.c_str(), port, int(useEncryption));
LOG("%s Server is listening on %s:%i with encryption: %i", StringifiedEnum::ToString(serverType).data(), ip.c_str(), port, int(useEncryption));
else
LOG("Server is listening on %s:%i with encryption: %i, running zone %i / %i", ip.c_str(), port, int(useEncryption), zoneID, instanceID);
LOG("%s Server is listening on %s:%i with encryption: %i, running zone %i / %i", StringifiedEnum::ToString(serverType).data(), ip.c_str(), port, int(useEncryption), zoneID, instanceID);
} else { LOG("FAILED TO START SERVER ON IP/PORT: %s:%i", ip.c_str(), port); return; }
mLogger->SetLogToConsole(prevLogSetting);