main quest works

This commit is contained in:
Mikhail Thompson
2024-06-29 15:11:42 +03:00
parent 1229104086
commit 846b72ce9d
21 changed files with 299 additions and 49 deletions

View File

@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EmbedIO;
namespace nksrv.LobbyServer.Msgs.Auth
{
@@ -16,17 +17,25 @@ namespace nksrv.LobbyServer.Msgs.Auth
{
var req = await ReadData<EnterServerRequest>();
// request has auth token
UsedAuthToken = req.AuthToken;
foreach (var item in JsonDb.Instance.LauncherAccessTokens)
{
if (item.Token == UsedAuthToken)
{
UserId = item.UserID;
}
}
if (UserId == 0) throw new HttpException(403);
var user = GetUser();
var response = new EnterServerResponse();
var rsp = LobbyHandler.GenGameClientTok(req.ClientPublicKey, req.AuthToken);
response.GameClientToken = rsp.ClientAuthToken;
response.FeatureDataInfo = new NetFeatureDataInfo() { UseFeatureData = true };
response.Identifier = new NetLegacyUserIdentifier() { Server = 21769, Usn = 10984769 };
response.Identifier = new NetLegacyUserIdentifier() { Server = 21769, Usn = (long)user.ID };
response.ShouldRestartAfter = Duration.FromTimeSpan(TimeSpan.FromSeconds(86400));
// This was probably the public key for communication at some point during the game's development
// But, the developers chose to hardcode server public key in the client, which prevents this
// private server from "just working", so thats why hex patch is required.
// The only point of encrypting packets is to make it harder for me to develop this and users to use this.
response.EncryptionToken = ByteString.CopyFromUtf8(rsp.ClientAuthToken);
WriteData(response);
}