Skip to content

Commit

Permalink
Added second client definition and endpoints for the new protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
sven-n committed Sep 24, 2024
1 parent 50489a9 commit 4a021d8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
16 changes: 16 additions & 0 deletions src/DataModel/Configuration/ConnectServerDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,20 @@ public partial class ConnectServerDefinition : IConnectServerSettings
/// Gets or sets the maximum server list requests per connection.
/// </summary>
public int MaxServerListRequests { get; set; }

public void InitializeDefaults()
{
this.DisconnectOnUnknownPacket = true;
this.MaximumReceiveSize = 6;
this.Timeout = new TimeSpan(0, 1, 0);
this.CurrentPatchVersion = new byte[] { 1, 3, 0x2B };
this.PatchAddress = "patch.muonline.webzen.com";
this.MaxConnectionsPerAddress = 30;
this.CheckMaxConnectionsPerAddress = true;
this.MaxConnections = 10000;
this.ListenerBacklog = 100;
this.MaxFtpRequests = 1;
this.MaxIpRequests = 5;
this.MaxServerListRequests = 20;
}
}
34 changes: 15 additions & 19 deletions src/Persistence/Initialization/DataInitializationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,28 +227,23 @@ private void AddAllUpdateEntries(PlugInManager plugInManager)

private async ValueTask CreateConnectServerDefinitionAsync()
{
var client = (await this.Context.GetAsync<GameClientDefinition>().ConfigureAwait(false)).First();
var connectServer = this.Context.CreateNew<ConnectServerDefinition>();
connectServer.SetGuid(1);
connectServer.Client = client;
connectServer.ClientListenerPort = 44405;
connectServer.Description = $"Connect Server ({new ClientVersion(client.Season, client.Episode, client.Language)})";
connectServer.DisconnectOnUnknownPacket = true;
connectServer.MaximumReceiveSize = 6;
connectServer.Timeout = new TimeSpan(0, 1, 0);
connectServer.CurrentPatchVersion = new byte[] { 1, 3, 0x2B };
connectServer.PatchAddress = "patch.muonline.webzen.com";
connectServer.MaxConnectionsPerAddress = 30;
connectServer.CheckMaxConnectionsPerAddress = true;
connectServer.MaxConnections = 10000;
connectServer.ListenerBacklog = 100;
connectServer.MaxFtpRequests = 1;
connectServer.MaxIpRequests = 5;
connectServer.MaxServerListRequests = 20;
var port = 44405;
var clients = await this.Context.GetAsync<GameClientDefinition>().ConfigureAwait(false);
foreach (var client in clients.OrderBy(c => c.Season))
{
var connectServer = this.Context.CreateNew<ConnectServerDefinition>();
connectServer.InitializeDefaults();
connectServer.SetGuid(client.Season, client.Episode);
connectServer.Client = client;
connectServer.ClientListenerPort = port;
connectServer.Description = $"Connect Server ({client.Description})";
port++;
}
}

private async ValueTask CreateGameServerDefinitionsAsync(GameServerConfiguration gameServerConfiguration, int numberOfServers)
{
var port = 50901;
for (int i = 0; i < numberOfServers; i++)
{
var server = this.Context!.CreateNew<GameServerDefinition>();
Expand All @@ -264,8 +259,9 @@ private async ValueTask CreateGameServerDefinitionsAsync(GameServerConfiguration
var endPoint = this.Context.CreateNew<GameServerEndpoint>();
endPoint.SetGuid((short)i, (short)server.Endpoints.Count);
endPoint.Client = client;
endPoint.NetworkPort = 55901 + i;
endPoint.NetworkPort = port;
server.Endpoints.Add(endPoint);
port++;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,22 @@ public DataInitialization(IPersistenceContextProvider persistenceContextProvider
/// <inheritdoc />
protected override void CreateGameClientDefinition()
{
var clientDefinition = this.Context.CreateNew<GameClientDefinition>();
clientDefinition.SetGuid(0x104D);
clientDefinition.Season = 6;
clientDefinition.Episode = 3;
clientDefinition.Language = ClientLanguage.English;
clientDefinition.Version = new byte[] { 0x31, 0x30, 0x34, 0x30, 0x34 };
clientDefinition.Serial = Encoding.ASCII.GetBytes("k1Pk2jcET48mxL3b");
clientDefinition.Description = "Season 6 Episode 3 GMO Client";
var season6GmoClient = this.Context.CreateNew<GameClientDefinition>();
season6GmoClient.SetGuid(0x104D);
season6GmoClient.Season = 6;
season6GmoClient.Episode = 3;
season6GmoClient.Language = ClientLanguage.English;
season6GmoClient.Version = [0x31, 0x30, 0x34, 0x30, 0x34];
season6GmoClient.Serial = "k1Pk2jcET48mxL3b"u8.ToArray();
season6GmoClient.Description = "Season 6 Episode 3 GMO Client";

var season6OpenSource = this.Context.CreateNew<GameClientDefinition>();
season6OpenSource.SetGuid(0x204D);
season6OpenSource.Season = 106;
season6OpenSource.Episode = 3;
season6OpenSource.Language = ClientLanguage.English;
season6OpenSource.Version = new byte[] { 0x32, 0x30, 0x34, 0x30, 0x34 };
season6OpenSource.Serial = "k1Pk2jcET48mxL3b"u8.ToArray();
season6OpenSource.Description = "Season 6 Episode 3 Open Source Client";
}
}

0 comments on commit 4a021d8

Please sign in to comment.