Skip to content

Commit

Permalink
well well well
Browse files Browse the repository at this point in the history
Cleaned + fixed
  • Loading branch information
SlejmUr committed Oct 8, 2023
1 parent 8b3827d commit ec2b686
Show file tree
Hide file tree
Showing 26 changed files with 122 additions and 140 deletions.
4 changes: 2 additions & 2 deletions PayCheckServerLib/Helpers/ConfigHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ static ConfigHelper()
Port = 443
},
DS_Servers = new()
{
{
new()
{
{
Alias = "eu-central-1",
Ip = "127.0.0.1",
Port = 6969,
Expand Down
18 changes: 9 additions & 9 deletions PayCheckServerLib/Helpers/GSController.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Newtonsoft.Json;
using PayCheckServerLib.Jsons.GS;
using PayCheckServerLib.Responses;
using PayCheckServerLib.Jsons.PartyStuff;
using PayCheckServerLib.Responses;
using PayCheckServerLib.WSController;

namespace PayCheckServerLib.Helpers
Expand All @@ -22,7 +22,7 @@ public static void Make(MatchTickets.TicketReqJson ticketReq, PC3Server.PC3Sessi
{
Debugger.PrintError("NO Code???? WHAT THE FUCK");
}

var id = UserIdHelper.CreateNewID();
var gs = new GameSession()
{
Expand Down Expand Up @@ -50,10 +50,10 @@ public static void Make(MatchTickets.TicketReqJson ticketReq, PC3Server.PC3Sessi
Teams = new(),
UpdatedAt = DateTime.UtcNow.ToString("o"),
Version = 1
};
};
Debugger.PrintDebug("gs!!");
var team = new Team()
{
{
Parties = new(),
UserIDs = new()
};
Expand Down Expand Up @@ -144,7 +144,7 @@ public static GameSession JoinSession(string id, string UserId, string NameSpace
{
session.LeaderID = UserId;
}
Sessions[NameSpace + "_" + id] = session;
Sessions[NameSpace + "_" + id] = session;
return session;
}

Expand All @@ -161,7 +161,7 @@ public static GameSession Patch(PatchGameSessions patchGameSessions, string id,
int index = random.Next(mlist.Count);
var middleMan = mlist[index];
//todo get client info
string Req = "DSInfoReq-END-" + "eu-central-1,"+ "624677," + session.Id + ","+ NameSpace;
string Req = "DSInfoReq-END-" + "eu-central-1," + "624677," + session.Id + "," + NameSpace;
Debugger.PrintDebug("Sending to middleman");
middleMan.Send(Req);
//recieve back here?
Expand All @@ -177,15 +177,15 @@ public static GameSession Patch(PatchGameSessions patchGameSessions, string id,


OnDSStatusChanged.Basic onDSStatusChanged = new()
{
{
SessionID = id,
GameServer = DSInfo[id],
Session = new()
{
{
ID = id,
IsFull = session.IsFull,
DSInformation = new()
{
{
Server = session.DSInformation.Server,
Status = "AVAILABLE",
StatusV2 = "AVAILABLE"
Expand Down
8 changes: 4 additions & 4 deletions PayCheckServerLib/Helpers/PartyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static PartyPost.Response CreateParty(PartyPostReq partyPost, string name
foreach (var item in partyPost.Members)
{
rsp.Members.Add(new()
{
{
Id = item.ID,
PlatformId = item.PlatformId.ToUpper(),
PlatformUserId = item.PlatformUserId,
Expand All @@ -77,7 +77,7 @@ public static PartyPost.Response CreateParty(PartyPostReq partyPost, string name
}

SavedStuff saved = new()
{
{
Code = code,
SessionType = partyPost.ConfigurationName,
CreatedAt = rsp.CreatedAt,
Expand All @@ -97,7 +97,7 @@ public static PartyPost.Response CreateParty(PartyPostReq partyPost, string name


public static PartyPost.Response JoinParty(string Code, TokenHelper.Token token)
{
{
if (!PartySaves.ContainsKey(Code))
{
Debugger.PrintError("NO Code???? WHAT THE FUCK");
Expand All @@ -120,7 +120,7 @@ public static PartyPost.Response JoinParty(string Code, TokenHelper.Token token)

public static PartyPost.Response UpdateParty(string PartyId, PartyPatch body)
{
var party = PartySaves.Where(x=>x.Value.Id == PartyId).FirstOrDefault().Value;
var party = PartySaves.Where(x => x.Value.Id == PartyId).FirstOrDefault().Value;
if (party == null)
{
Debugger.PrintError("NO Code???? WHAT THE FUCK");
Expand Down
6 changes: 3 additions & 3 deletions PayCheckServerLib/Helpers/UrlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ private static string ExtractParameter(string pattern)

return string.Empty;
}

private static string[] SplitUrl(string url)
{
string[] urlPaths = url.Split('/', StringSplitOptions.RemoveEmptyEntries);;
string[] urlPaths = url.Split('/', StringSplitOptions.RemoveEmptyEntries); ;
urlPaths = SplitUrl(urlPaths, '?');
urlPaths = SplitUrl(urlPaths, '&');

Expand All @@ -85,7 +85,7 @@ private static string[] SplitUrl(string[] urlParts, char splitChar)

return parts.ToArray();
}

#endregion
}
}
2 changes: 1 addition & 1 deletion PayCheckServerLib/Helpers/UserIdHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static string ConvertStringtoMD5(string strword)
public static string getsai(string str)
{
return BitConverter.ToUInt32(Convert.FromHexString(str)[72..(72 + 4)]).ToString();
}
}

/// <summary>
/// Getting the SteamID from IAM Login body
Expand Down
9 changes: 4 additions & 5 deletions PayCheckServerLib/Helpers/UserStatController.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using Newtonsoft.Json;
using PayCheckServerLib.Jsons;
using PayCheckServerLib.Responses;

namespace PayCheckServerLib.Helpers
{
public class UserStatController
{
public static List<UserStatItemsData> GetStatItems(string NameSpace)
{
{
return JsonConvert.DeserializeObject<List<UserStatItemsData>>(File.ReadAllText($"Files/StatItems_{NameSpace.ToLower()}.json"));
}

Expand Down Expand Up @@ -82,13 +81,13 @@ public static List<StatItemsBulkRsp> AddStat(List<StatItemsBulkReq> req, TokenHe
Debugger.PrintWarn($"what the fuck.");
}
resp.Add(new()
{
{
Details = new()
{
{
CurrentValue = statItem.Value
},
StatCode = item.StatCode,
Success = true
Success = true
});
}
SaveStat(stat, token.UserId, token.Namespace);
Expand Down
2 changes: 1 addition & 1 deletion PayCheckServerLib/Jsons/GS/OnDSStatusChanged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Session
public List<PartyStuff.PartyPost.Memberv2> Members { get; set; }

[JsonProperty("Attributes")]
public Dictionary<string,object> Attributes { get; set; }
public Dictionary<string, object> Attributes { get; set; }

[JsonProperty("CreatedAt")]
public string CreatedAt { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion PayCheckServerLib/Jsons/GS/OnGameSessionUpdated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class OnGameSessionUpdated
public List<PartyStuff.PartyPost.Memberv2> Members { get; set; }

[JsonProperty("Attributes")]
public Dictionary<string,object> Attributes { get; set; }
public Dictionary<string, object> Attributes { get; set; }

[JsonProperty("CreatedAt")]
public string CreatedAt { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions PayCheckServerLib/Jsons/GS/OnSessionMembersChanged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Session
public List<PartyStuff.PartyPost.Memberv2> Members { get; set; }

[JsonProperty("Attributes")]
public Dictionary<string,object> Attributes { get; set; }
public Dictionary<string, object> Attributes { get; set; }

[JsonProperty("CreatedAt")]
public string CreatedAt { get; set; }
Expand All @@ -53,7 +53,7 @@ public class Session
public int Version { get; set; }

[JsonProperty("Configuration")]
public Dictionary<string,object> Configuration { get; set; }
public Dictionary<string, object> Configuration { get; set; }

[JsonProperty("ConfigurationName")]
public string ConfigurationName { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion PayCheckServerLib/Jsons/GS/PatchGameSessions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace PayCheckServerLib.Jsons.GS
public class PatchGameSessions
{
[JsonProperty("attributes")]
public Dictionary<string,object> Attributes { get; set; }
public Dictionary<string, object> Attributes { get; set; }

[JsonProperty("version")]
public int version { get; set; }
Expand Down
1 change: 0 additions & 1 deletion PayCheckServerLib/Jsons/OrdersJson.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using PayCheckServerLib.Responses;

namespace PayCheckServerLib.Jsons
{
Expand Down
2 changes: 1 addition & 1 deletion PayCheckServerLib/Jsons/Party/PartyPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace PayCheckServerLib.Jsons.PartyStuff
public class PartyPatch
{
[JsonProperty("attributes")]
public Dictionary<string,object> Attributes { get; set; }
public Dictionary<string, object> Attributes { get; set; }

[JsonProperty("inactiveTimeout", NullValueHandling = NullValueHandling.Ignore)]
public int? InactiveTimeout { get; set; }
Expand Down
6 changes: 2 additions & 4 deletions PayCheckServerLib/Jsons/Progression.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Globalization;

namespace PayCheckServerLib.Jsons
{
Expand Down
2 changes: 1 addition & 1 deletion PayCheckServerLib/Responses/BasicResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static bool QOSM_Public_QOS(HttpRequest request, PC3Server.PC3Session ses
foreach (var server in ConfigHelper.ServerConfig.DS_Servers)
{
rsp.Servers.Add(new()
{
{
Alias = server.Alias,
Status = server.Status,
Ip = server.Ip,
Expand Down
4 changes: 2 additions & 2 deletions PayCheckServerLib/Responses/CloudSave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public static bool PlatformBlockedPlayerData(HttpRequest _, PC3Server.PC3Session
var userID = session.HttpParam["userId"];
ResponseCreator response = new(404);
ErrorMSG errorMSG = new()
{
{
ErrorCode = 18022,
ErrorMessage = $"unable to get_player_record: player record not found, user ID: {userID}, key: PlatformBlockedPlayerData"
};
Expand Down Expand Up @@ -200,7 +200,7 @@ public static bool ProgressionsavegamePOST(HttpRequest request, PC3Server.PC3Ses
SaveHandler.SaveUser(userID, session.HttpParam["namespace"], request.BodyBytes);
if (ConfigHelper.ServerConfig.Saves.SaveRequest)
SaveHandler.SaveUser_Request(userID, session.HttpParam["namespace"], request.Body);

Progression.Basic? save = null;
try
{
Expand Down
11 changes: 3 additions & 8 deletions PayCheckServerLib/Responses/DLCs.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
using NetCoreServer;
using Newtonsoft.Json;
using PayCheckServerLib.Jsons.Basic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PayCheckServerLib.Responses
{
public class DLCs
{
public class PutDLC
{
{
public string steamId { get; set; }
public string appId { get; set; }
}
Expand Down Expand Up @@ -43,14 +38,14 @@ public static bool PUT_DLC_SteamSync(HttpRequest request, PC3Server.PC3Session s
public static bool GETdlcentitlements(HttpRequest request, PC3Server.PC3Session session)
{
TopLevel<DLC_Value> dlc = new()
{
{
SetBy = "SERVER",
CreatedAt = "2023-09-25T12:01:02.096Z",
Key = "dlc-entitlements",
Namespace = session.HttpParam["namespace"],
UpdatedAt = "2023-09-25T12:01:02.096Z",
Value = new()
{
{
Data = new(),
DlcType = "PSN"
}
Expand Down
2 changes: 1 addition & 1 deletion PayCheckServerLib/Responses/Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static bool MePlatforms(HttpRequest _, PC3Server.PC3Session session)
{
var auth = session.Headers["authorization"].Replace("Bearer ", "");
var token = TokenHelper.ReadToken(auth);
var MainUser = UserController.GetUser(token.UserId,token.Namespace) ?? throw new Exception("MainUser is null!");
var MainUser = UserController.GetUser(token.UserId, token.Namespace) ?? throw new Exception("MainUser is null!");
ResponseCreator response = new();
response.SetHeader("Content-Type", "application/json");
FriendsPlatfrom friends = new FriendsPlatfrom()
Expand Down
Loading

0 comments on commit ec2b686

Please sign in to comment.