From 16bfc054a7deae991ac035e54b8f4988aeb40488 Mon Sep 17 00:00:00 2001 From: Beyley Thomas Date: Wed, 15 May 2024 19:43:35 -0700 Subject: [PATCH] Fix playhash on LBP2 god this game is a disaster See this thread for why we need to revert this on LBP2 https://canary.discord.com/channels/1049223665243389953/1240476031786156162/1240477912516399237 --- .../Endpoints/Game/DataTypes/Response/GameLevelResponse.cs | 4 ++-- Refresh.GameServer/Endpoints/Game/Levels/LevelEndpoints.cs | 2 +- Refresh.GameServer/Types/Levels/GameMinimalLevelResponse.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameLevelResponse.cs b/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameLevelResponse.cs index 83842f8d..f82a748b 100644 --- a/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameLevelResponse.cs +++ b/Refresh.GameServer/Endpoints/Game/DataTypes/Response/GameLevelResponse.cs @@ -94,11 +94,11 @@ public static int LevelIdFromHash(string hash) return rangeStart + Math.Abs(hash.GetHashCode()) % range; } - public static GameLevelResponse FromHash(string hash) + public static GameLevelResponse FromHash(string hash, DataContext dataContext) { return new GameLevelResponse { - LevelId = LevelIdFromHash(hash), + LevelId = dataContext.Game == TokenGame.LittleBigPlanet3 ? LevelIdFromHash(hash) : int.MaxValue, Title = $"Hashed Level - {hash}", IconHash = "0", GameVersion = 0, diff --git a/Refresh.GameServer/Endpoints/Game/Levels/LevelEndpoints.cs b/Refresh.GameServer/Endpoints/Game/Levels/LevelEndpoints.cs index 0c10409a..ac61bfc0 100644 --- a/Refresh.GameServer/Endpoints/Game/Levels/LevelEndpoints.cs +++ b/Refresh.GameServer/Endpoints/Game/Levels/LevelEndpoints.cs @@ -103,7 +103,7 @@ public class LevelEndpoints : EndpointGroup // If the user has had a hash override in the past, and the level id they requested matches the level ID associated with that hash if (overrideService.GetLastHashOverrideForUser(token, out string hash) && GameLevelResponse.LevelIdFromHash(hash) == id) // Return the hashed level info - return GameLevelResponse.FromHash(hash); + return GameLevelResponse.FromHash(hash, dataContext); return GameLevelResponse.FromOld(database.GetLevelByIdAndType(slotType, id), dataContext); } diff --git a/Refresh.GameServer/Types/Levels/GameMinimalLevelResponse.cs b/Refresh.GameServer/Types/Levels/GameMinimalLevelResponse.cs index a0f08fe6..d963a78d 100644 --- a/Refresh.GameServer/Types/Levels/GameMinimalLevelResponse.cs +++ b/Refresh.GameServer/Types/Levels/GameMinimalLevelResponse.cs @@ -58,7 +58,7 @@ private GameMinimalLevelResponse() {} /// public static GameMinimalLevelResponse FromHash(string hash, DataContext dataContext) { - return FromOld(GameLevelResponse.FromHash(hash), dataContext)!; + return FromOld(GameLevelResponse.FromHash(hash, dataContext), dataContext)!; } public static GameMinimalLevelResponse? FromOld(GameLevel? level, DataContext dataContext)