Replace Location table with packed 64-bit int (#679)

* Replace Location table with packed 64 bit int

* Remove double Include and fix Slot documentation

* Fix compilation errors from merge

* Fix namespaces and add expected values to unit tests
This commit is contained in:
Josh 2023-02-21 14:53:38 -06:00 committed by GitHub
commit 35ea2682b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 996 additions and 930 deletions

View file

@ -0,0 +1,25 @@
using LBPUnion.ProjectLighthouse.Serialization;
using Microsoft.EntityFrameworkCore;
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users;
[Keyless]
public class ClientsConnected
{
public bool Lbp1 { get; set; }
public bool Lbp2 { get; set; }
public bool LbpMe { get; set; }
public bool Lbp3Ps3 { get; set; }
public bool Lbp3Ps4 { get; set; }
public string Serialize()
=> LbpSerializer.StringElement
(
"clientsConnected",
LbpSerializer.StringElement("lbp1", this.Lbp1) +
LbpSerializer.StringElement("lbp2", this.Lbp2) +
LbpSerializer.StringElement("lbpme", this.LbpMe) +
LbpSerializer.StringElement("lbp3ps3", this.Lbp3Ps3) +
LbpSerializer.StringElement("lbp3ps4", this.Lbp3Ps4)
);
}

View file

@ -0,0 +1,21 @@
using System.Xml.Serialization;
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users;
/// <summary>
/// Sent by the game client to inform the server
/// of the user's friend list
/// Used to filter activities from friends
/// </summary>
[XmlRoot("npdata")]
[XmlType("npdata")]
public class NPData
{
[XmlArray("friends")]
[XmlArrayItem("npHandle")]
public List<string>? Friends { get; set; }
[XmlArray("blocked")]
[XmlArrayItem("npHandle")]
public List<string>? BlockedUsers { get; set; }
}

View file

@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users;
public class Pins
{
[JsonPropertyName("progress")]
public long[]? Progress { get; set; }
[JsonPropertyName("awards")]
public long[]? Awards { get; set; }
[JsonPropertyName("profile_pins")]
public long[]? ProfilePins { get; set; }
}

View file

@ -0,0 +1,24 @@
#nullable enable
using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Serialization;
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users;
[XmlRoot("privacySettings")]
[XmlType("privacySettings")]
public class PrivacySettings
{
[XmlElement("levelVisiblity")]
public string? LevelVisibility { get; set; }
[XmlElement("profileVisiblity")]
public string? ProfileVisibility { get; set; }
public string Serialize()
=> LbpSerializer.StringElement
(
"privacySettings",
LbpSerializer.StringElement("levelVisibility", this.LevelVisibility) +
LbpSerializer.StringElement("profileVisibility", this.ProfileVisibility)
);
}

View file

@ -0,0 +1,54 @@
#nullable enable
using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Types.Levels;
using LBPUnion.ProjectLighthouse.Types.Misc;
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users;
/// <summary>
/// Used by the games to update details about a user's profile
/// LBP1 only uses Location and IconHash
/// LBP2 and onward uses the rest
/// </summary>
public class UserUpdate
{
[XmlElement("location")]
public Location? Location { get; set; }
[XmlElement("biography")]
public string? Biography { get; set; }
[XmlElement("icon")]
public string? IconHash { get; set; }
[XmlElement("planets")]
public string? PlanetHash { get; set; }
[XmlElement("crossControlPlanet")]
public string? PlanetHashLBP2CC { get; set; }
[XmlArray("slots")]
[XmlArrayItem("slot")]
public List<UserUpdateSlot>? Slots { get; set; }
[XmlElement("yay2")]
public string? YayHash { get; set; }
[XmlElement("meh2")]
public string? MehHash { get; set; }
[XmlElement("boo2")]
public string? BooHash { get; set; }
}
[XmlRoot("slot")]
public class UserUpdateSlot
{
[XmlElement("type")]
public SlotType? Type { get; set; }
[XmlElement("id")]
public int? SlotId { get; set; }
[XmlElement("location")]
public Location? Location { get; set; }
}