Skip to content

Commit

Permalink
Changes towards Update 1.1.4 support, game still refuses to connect t…
Browse files Browse the repository at this point in the history
…hought
  • Loading branch information
HW12Dev committed May 29, 2024
1 parent 9100252 commit 15314e3
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 3 deletions.
31 changes: 31 additions & 0 deletions PayCheckServerLib/Jsons/Profile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PayCheckServerLib.Jsons
{
public class Profile
{
public partial class ProfileResp
{
[JsonProperty("userId")]
public string UserId { get; set; }
[JsonProperty("avatarLargeUrl")]
public string AvatarLargeUrl { get; set; }
[JsonProperty("avatarSmallUrl")]
public string AvatarSmallUrl { get; set; }
[JsonProperty("avatarUrl")]
public string AvatarUrl { get; set; }

[JsonProperty("customAttributes")]
public object CustomAttributes { get; set; }
[JsonProperty("namespace")]
public string Namespace { get; set; }
[JsonProperty("publicId")]
public string PublicId { get; set; }
}
}
}
50 changes: 49 additions & 1 deletion PayCheckServerLib/Responses/BasicResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,51 @@
namespace PayCheckServerLib.Responses
{
public class BasicResponse
{
[HTTP("GET", "/basic/v1/public/namespaces/{namespace}/profiles/public?userIds={userId}")]
public static bool GetUserProfile(HttpRequest _, ServerStruct serverStruct)
{
ResponseCreator response = new ResponseCreator();
response.SetHeader("Content-Type", "application/json");

var resp = new Profile.ProfileResp()
{
UserId = serverStruct.Parameters["userId"],
Namespace = serverStruct.Parameters["namespace"],
PublicId = "AAAAAAAA"
};

response.SetBody(JsonConvert.SerializeObject(resp));
serverStruct.Response = response.GetResponse();
serverStruct.SendResponse();
return true;
}
[HTTP("POST", "/basic/v1/public/namespaces/{namespace}/users/me/profiles")]
public static bool PostCurrentUserProfile(HttpRequest _, ServerStruct serverStruct)
{
[HTTP("HEAD", "/generate_204")]
// take no action
return GetCurrentUserProfile(_, serverStruct);
}
[HTTP("GET", "/basic/v1/public/namespaces/{namespace}/users/me/profiles")]
public static bool GetCurrentUserProfile(HttpRequest _, ServerStruct serverStruct)
{
ResponseCreator response = new ResponseCreator();
response.SetHeader("Content-Type", "application/json");

var resp = new Profile.ProfileResp()
{
UserId = TokenHelper.ReadToken(serverStruct.Headers["authorization"].Split(" ")[1]).UserId,
Namespace = serverStruct.Parameters["namespace"],
PublicId = "AAAAAAAA"
};

response.SetBody(JsonConvert.SerializeObject(resp));
serverStruct.Response = response.GetResponse();
serverStruct.SendResponse();
return true;
}

[HTTP("HEAD", "/generate_204")]
public static bool Generate204(HttpRequest _, ServerStruct serverStruct)
{
serverStruct.Response.MakeOkResponse(204);
Expand All @@ -19,6 +62,11 @@ public static bool Generate204(HttpRequest _, ServerStruct serverStruct)
}


[HTTP("GET", "/qosm/public/namespaces/pd3/qos?status=ACTIVE")]
public static bool GetActiveQOS(HttpRequest _, ServerStruct serverStruct)
{
return QOSM_Public_QOS(_, serverStruct);
}
[HTTP("GET", "/qosm/public/qos")]
public static bool QOSM_Public_QOS(HttpRequest _, ServerStruct serverStruct)
{
Expand Down
40 changes: 38 additions & 2 deletions PayCheckServerLib/Responses/CloudSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,37 @@ namespace PayCheckServerLib.Responses
{
public class CloudSave
{
public static bool TimeBasedPlayerContent(HttpRequest _, ServerStruct serverStruct)
{
var response = new ResponseCreator();
response.SetBody(
JsonConvert.SerializeObject(JsonConvert.DeserializeObject(File.ReadAllText("Files/TimeBasedPlayerContent.json"))));
serverStruct.Response = response.GetResponse();
serverStruct.SendResponse();
return true;
}
public static bool FeatureToggle(HttpRequest _, ServerStruct serverStruct)
{
var response = new ResponseCreator();
response.SetBody(
JsonConvert.SerializeObject(JsonConvert.DeserializeObject(File.ReadAllText("Files/FeatureToggle.json"))));
serverStruct.Response = response.GetResponse();
serverStruct.SendResponse();
return true;
}

[HTTP("GET", "/cloudsave/v1/namespaces/{namespace}/records/{recordtype}")]

public static bool ClientConfiguration(HttpRequest _, ServerStruct serverStruct)
{
var response = new ResponseCreator();
response.SetBody(
JsonConvert.SerializeObject(JsonConvert.DeserializeObject(File.ReadAllText("Files/ClientConfiguration.json"))));
serverStruct.Response = response.GetResponse();
serverStruct.SendResponse();
return true;
}

[HTTP("GET", "/cloudsave/v1/namespaces/{namespace}/records/{recordtype}")]
public static bool MainRecordsSplitter(HttpRequest request, ServerStruct serverStruct)
{
if (serverStruct.Parameters["recordtype"].Contains("weapon-translation-table-"))
Expand All @@ -37,7 +66,14 @@ public static bool MainRecordsSplitter(HttpRequest request, ServerStruct serverS
return challengerecommendations(request, serverStruct);
case "infamy-translation-table":
return InfamyTranslationTable(request, serverStruct);
}
case "time-based-player-content":
return TimeBasedPlayerContent(request, serverStruct);
case "client-configuration":
return ClientConfiguration(request, serverStruct);
case "feature-toggle":
return FeatureToggle(request, serverStruct);
}
Debugger.PrintError(String.Format("Unknown cloudsave item: {0}", serverStruct.Parameters["recordtype"]));
return false;
}

Expand Down
6 changes: 6 additions & 0 deletions PayCheckServerLib/Responses/Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public static bool MePlatforms(HttpRequest _, ServerStruct serverStruct)
return true;
}

[HTTP("GET", "/friends/namespaces/pd3/me/platforms?limit=50&offset=0")]
public static bool MePlatformsLimitOffset(HttpRequest _, ServerStruct serverStruct)
{
return MePlatforms(_, serverStruct);
}

[HTTP("POST", "/friends/namespaces/{namespace}/users/{userId}/add/bulk")]
public static bool FriendAddBulk(HttpRequest request, ServerStruct serverStruct)
{
Expand Down
2 changes: 2 additions & 0 deletions PayCheckServerLib/Responses/IAM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace PayCheckServerLib.Responses
{
public class IAM
{
[HTTP("POST", "/iam/v3/oauth/platforms/steam/token")]
public static bool SteamTokenNoParam(HttpRequest request, ServerStruct serverStruct) { return SteamToken(request, serverStruct); }
[HTTP("POST", "/iam/v3/oauth/platforms/steam/token?createHeadless=false")]
public static bool SteamToken(HttpRequest request, ServerStruct serverStruct)
{
Expand Down
10 changes: 10 additions & 0 deletions PayCheckServerLib/Responses/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ namespace PayCheckServerLib.Responses
{
public class Session
{
[HTTP("GET", "/session/v1/public/namespaces/pd3/recent-player?limit=200")]
public static bool GetRecentPlayersLimit(HttpRequest _, ServerStruct serverStruct)
{
ResponseCreator response = new ResponseCreator();
response.SetHeader("Content-Type", "application/json");
response.SetBody("{\"data\":[]}");
serverStruct.Response = response.GetResponse();
serverStruct.SendResponse();
return true;
}
[HTTP("GET", "/session/v1/public/namespaces/{namespace}/users/me/attributes")]
public static bool GETSessionAttributes(HttpRequest _, ServerStruct serverStruct)
{
Expand Down
1 change: 1 addition & 0 deletions PayCheckServerLib/ServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private static void ReceivedFailed(object? sender, HttpRequest request)
} catch (IOException e) { }
Debugger.logger.Debug(request.Url + "\n" + request);
Console.Write("something isnt good: ");
Console.Write(request.Method + " ");
Console.WriteLine(request.Url);
}
private static void WSError(object? sender, string error)
Expand Down

0 comments on commit 15314e3

Please sign in to comment.