[Loginserver] Larion loginserver support (#4492)

* Add larion version and opcode path

* WIP: getting server to work

* Identify server_id

* Add missing opcode, add opcodes file

---------

Co-authored-by: KimLS <KimLS@peqtgc.com>
This commit is contained in:
Alex 2024-10-02 18:20:13 -07:00 committed by GitHub
parent dc6c28a52d
commit 7e51e629f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 93 additions and 15 deletions

View File

@ -534,6 +534,7 @@ N(OP_Stamina),
N(OP_Stun), N(OP_Stun),
N(OP_Surname), N(OP_Surname),
N(OP_SwapSpell), N(OP_SwapSpell),
N(OP_SystemFingerprint),
N(OP_TargetBuffs), N(OP_TargetBuffs),
N(OP_TargetCommand), N(OP_TargetCommand),
N(OP_TargetHoTT), N(OP_TargetHoTT),

View File

@ -138,6 +138,13 @@ public:
*/ */
unsigned int GetPlaySequence() const { return m_play_sequence_id; } unsigned int GetPlaySequence() const { return m_play_sequence_id; }
/**
* Gets the client version
*
* @return
*/
LSClientVersion GetClientVersion() const { return m_client_version; }
/** /**
* Gets the connection for this client * Gets the connection for this client
* *

View File

@ -88,6 +88,46 @@ ClientManager::ClientManager()
clients.push_back(c); clients.push_back(c);
} }
); );
int larion_port = server.config.GetVariableInt("client_configuration", "larion_port", 15900);
EQStreamManagerInterfaceOptions larion_opts(larion_port, false, false);
larion_stream = new EQ::Net::EQStreamManager(larion_opts);
larion_ops = new RegularOpcodeManager;
opcodes_path = fmt::format(
"{}/{}",
path.GetServerPath(),
server.config.GetVariableString(
"client_configuration",
"larion_opcodes",
"login_opcodes.conf"
)
);
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
LogError(
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
server.config.GetVariableString("client_configuration", "larion_opcodes", "login_opcodes.conf")
);
run_server = false;
}
larion_stream->OnNewConnection(
[this](std::shared_ptr<EQ::Net::EQStream> stream) {
LogInfo(
"New Larion client connection from [{0}:{1}]",
long2ip(stream->GetRemoteIP()),
stream->GetRemotePort()
);
stream->SetOpcodeManager(&larion_ops);
Client* c = new Client(stream, cv_larion);
clients.push_back(c);
}
);
} }
ClientManager::~ClientManager() ClientManager::~ClientManager()

View File

@ -55,6 +55,8 @@ private:
EQ::Net::EQStreamManager *titanium_stream; EQ::Net::EQStreamManager *titanium_stream;
OpcodeManager *sod_ops; OpcodeManager *sod_ops;
EQ::Net::EQStreamManager *sod_stream; EQ::Net::EQStreamManager *sod_stream;
OpcodeManager *larion_ops;
EQ::Net::EQStreamManager* larion_stream;
}; };
#endif #endif

View File

@ -83,7 +83,8 @@ struct PlayEverquestResponse_Struct {
enum LSClientVersion { enum LSClientVersion {
cv_titanium, cv_titanium,
cv_sod cv_sod,
cv_larion
}; };
enum LSClientStatus { enum LSClientStatus {

View File

@ -0,0 +1,14 @@
#EQEmu Public Login Server OPCodes
OP_SessionReady=0x0001
OP_Login=0x0002
OP_ServerListRequest=0x0004
OP_PlayEverquestRequest=0x000d
OP_PlayEverquestResponse=0x0022
OP_ChatMessage=0x0017
OP_LoginAccepted=0x0018
OP_ServerListResponse=0x0019
OP_Poll=0x0029
OP_EnterChat=0x000f
OP_PollResponse=0x0011
OP_SystemFingerprint=0x0016
OP_ExpansionList=0x0030

View File

@ -137,7 +137,7 @@ std::unique_ptr<EQApplicationPacket> ServerManager::CreateServerListPacket(Clien
use_local_ip ? "Local" : "Remote" use_local_ip ? "Local" : "Remote"
); );
world_server->SerializeForClientServerList(buf, use_local_ip); world_server->SerializeForClientServerList(buf, use_local_ip, client->GetClientVersion());
} }
return std::make_unique<EQApplicationPacket>(OP_ServerListResponse, buf); return std::make_unique<EQApplicationPacket>(OP_ServerListResponse, buf);

View File

@ -977,7 +977,7 @@ bool WorldServer::ValidateWorldServerAdminLogin(
return false; return false;
} }
void WorldServer::SerializeForClientServerList(SerializeBuffer &out, bool use_local_ip) const void WorldServer::SerializeForClientServerList(SerializeBuffer& out, bool use_local_ip, LSClientVersion version) const
{ {
// see LoginClientServerData_Struct // see LoginClientServerData_Struct
if (use_local_ip) { if (use_local_ip) {
@ -987,19 +987,31 @@ void WorldServer::SerializeForClientServerList(SerializeBuffer &out, bool use_lo
out.WriteString(GetRemoteIP()); out.WriteString(GetRemoteIP());
} }
switch (GetServerListID()) { if (version == cv_larion) {
case LS::ServerType::Legends: out.WriteUInt32(9000);
out.WriteInt32(LS::ServerTypeFlags::Legends); }
break;
case LS::ServerType::Preferred: switch (GetServerListID()) {
out.WriteInt32(LS::ServerTypeFlags::Preferred); case LS::ServerType::Legends:
break; out.WriteInt32(LS::ServerTypeFlags::Legends);
default: break;
out.WriteInt32(LS::ServerTypeFlags::Standard); case LS::ServerType::Preferred:
break; out.WriteInt32(LS::ServerTypeFlags::Preferred);
break;
default:
out.WriteInt32(LS::ServerTypeFlags::Standard);
break;
}
if (version == cv_larion) {
auto server_id = GetServerId();
//if this is 0, the client will not show the server in the list
out.WriteUInt32(1);
out.WriteUInt32(server_id);
}
else {
out.WriteUInt32(GetServerId());
} }
out.WriteUInt32(GetServerId());
out.WriteString(GetServerLongName()); out.WriteString(GetServerLongName());
out.WriteString("us"); // country code out.WriteString("us"); // country code
out.WriteString("en"); // language code out.WriteString("en"); // language code

View File

@ -7,6 +7,7 @@
#include "../common/packet_dump.h" #include "../common/packet_dump.h"
#include "database.h" #include "database.h"
#include "../common/event/timer.h" #include "../common/event/timer.h"
#include "login_types.h"
#include <string> #include <string>
#include <memory> #include <memory>
@ -149,7 +150,7 @@ public:
bool HandleNewLoginserverRegisteredOnly(Database::DbWorldRegistration &world_registration); bool HandleNewLoginserverRegisteredOnly(Database::DbWorldRegistration &world_registration);
bool HandleNewLoginserverInfoUnregisteredAllowed(Database::DbWorldRegistration &world_registration); bool HandleNewLoginserverInfoUnregisteredAllowed(Database::DbWorldRegistration &world_registration);
void SerializeForClientServerList(class SerializeBuffer& out, bool use_local_ip) const; void SerializeForClientServerList(class SerializeBuffer& out, bool use_local_ip, LSClientVersion version) const;
private: private: