From c4f72b669aef0c08a2286ea23deb0ba685a75382 Mon Sep 17 00:00:00 2001 From: jvyden Date: Mon, 2 Oct 2023 19:19:04 -0400 Subject: [PATCH] Split LBP PSP user avatars from mainline avatars Closes #184 --- Refresh.GameServer/Database/GameDatabaseProvider.cs | 2 +- .../Game/DataTypes/Response/GameUserResponse.cs | 8 +++++++- Refresh.GameServer/Endpoints/Game/UserEndpoints.cs | 3 +++ Refresh.GameServer/Types/UserData/GameUser.cs | 9 +++++++++ .../Types/UserData/SerializedUpdateData.cs | 1 + 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Refresh.GameServer/Database/GameDatabaseProvider.cs b/Refresh.GameServer/Database/GameDatabaseProvider.cs index 0b95b376..07f1472a 100644 --- a/Refresh.GameServer/Database/GameDatabaseProvider.cs +++ b/Refresh.GameServer/Database/GameDatabaseProvider.cs @@ -32,7 +32,7 @@ protected GameDatabaseProvider(IDateTimeProvider time) this._time = time; } - protected override ulong SchemaVersion => 86; + protected override ulong SchemaVersion => 87; protected override string Filename => "refreshGameServer.realm"; diff --git a/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameUserResponse.cs b/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameUserResponse.cs index d22aecc8..05d1b78b 100644 --- a/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameUserResponse.cs +++ b/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameUserResponse.cs @@ -101,7 +101,7 @@ private void FillInExtraData(GameUser old, TokenGame gameVersion) _ => throw new ArgumentOutOfRangeException(nameof(gameVersion), gameVersion, null), }; - //Fill out the used slots + // Fill out slot usage information switch (gameVersion) { case TokenGame.LittleBigPlanet3: { @@ -140,5 +140,11 @@ private void FillInExtraData(GameUser old, TokenGame gameVersion) default: throw new ArgumentOutOfRangeException(nameof(gameVersion), gameVersion, null); } + + // Apply PSP-specific icon hashes + if (gameVersion == TokenGame.LittleBigPlanetPSP) + { + this.IconHash = old.PspIconHash; + } } } \ No newline at end of file diff --git a/Refresh.GameServer/Endpoints/Game/UserEndpoints.cs b/Refresh.GameServer/Endpoints/Game/UserEndpoints.cs index 20724645..a9c78829 100644 --- a/Refresh.GameServer/Endpoints/Game/UserEndpoints.cs +++ b/Refresh.GameServer/Endpoints/Game/UserEndpoints.cs @@ -128,6 +128,9 @@ public SerializedUserList GetMultipleUsers(RequestContext context, GameDatabaseC case TokenGame.LittleBigPlanet3: data.Lbp3PlanetsHash = data.PlanetsHash; break; + case TokenGame.LittleBigPlanetPSP: + data.PspIconHash = data.IconHash; + break; } database.UpdateUserData(user, data); diff --git a/Refresh.GameServer/Types/UserData/GameUser.cs b/Refresh.GameServer/Types/UserData/GameUser.cs index 9f159799..a2768c90 100644 --- a/Refresh.GameServer/Types/UserData/GameUser.cs +++ b/Refresh.GameServer/Types/UserData/GameUser.cs @@ -22,6 +22,15 @@ public partial class GameUser : IRealmObject, IRateLimitUser public bool ShouldResetPassword { get; set; } public string IconHash { get; set; } = "0"; + + /// + /// The , except only for PSP clients. + /// + /// + /// PSP doesn't support remote assets, and instead only uses it's own GUID icon hashes, which cant be loaded by other clients. + /// Hopefully this explains why this distinction is necessary. + /// + public string PspIconHash { get; set; } = "0"; public string Description { get; set; } = ""; public GameLocation Location { get; set; } = GameLocation.Zero; diff --git a/Refresh.GameServer/Types/UserData/SerializedUpdateData.cs b/Refresh.GameServer/Types/UserData/SerializedUpdateData.cs index 64054c32..fa4cbf79 100644 --- a/Refresh.GameServer/Types/UserData/SerializedUpdateData.cs +++ b/Refresh.GameServer/Types/UserData/SerializedUpdateData.cs @@ -24,6 +24,7 @@ public class SerializedUpdateData [XmlIgnore] public string? Lbp2PlanetsHash { get; set; } [XmlIgnore] public string? Lbp3PlanetsHash { get; set; } [XmlIgnore] public string? VitaPlanetsHash { get; set; } + [XmlIgnore] public string? PspIconHash { get; set; } [XmlElement("icon")] public string? IconHash { get; set; }