diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/FixSavageInventoryScreenPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/FixSavageInventoryScreenPatch.cs index 793f82e..fc2908f 100644 --- a/project/SPT.SinglePlayer/Patches/ScavMode/FixSavageInventoryScreenPatch.cs +++ b/project/SPT.SinglePlayer/Patches/ScavMode/FixSavageInventoryScreenPatch.cs @@ -15,7 +15,8 @@ namespace SPT.SinglePlayer.Patches.ScavMode /// public class GetProfileAtEndOfRaidPatch : ModulePatch { - public static string Profile { get; private set; } + public static GClass1962 ProfileDescriptor { get; private set; } + protected override MethodBase GetTargetMethod() { return AccessTools.Method(typeof(LocalGame), nameof(LocalGame.Stop)); @@ -24,8 +25,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode [PatchPrefix] public static void PatchPrefix(LocalGame __instance) { - //var test = new GClass1962(__instance.Profile_0, GClass1971.Instance); - //Profile = test.ToUnparsedData([]); + ProfileDescriptor = new GClass1962(__instance.Profile_0, GClass1971.Instance); } } /// @@ -42,27 +42,24 @@ namespace SPT.SinglePlayer.Patches.ScavMode [PatchPrefix] public static void PatchPrefix(ref ISession ___iSession) { - var profile = GetProfileAtEndOfRaidPatch.Profile.ParseJsonTo(); - - if (profile.Side != EPlayerSide.Savage) + Profile profile = new(GetProfileAtEndOfRaidPatch.ProfileDescriptor); + + if (profile.Side != EPlayerSide.Savage) { return; } var session = (ProfileEndpointFactoryAbstractClass)___iSession; - session.AllProfiles = new Profile[] - { - session.AllProfiles.First(x => x.Side != EPlayerSide.Savage), + session.AllProfiles = + [ + session.AllProfiles.First(x => x.Side != EPlayerSide.Savage), profile - }; + ]; session.ProfileOfPet.LearnAll(); - - // make a request to the server, so it knows of the items we might transfer - RequestHandler.PutJson("/raid/profile/scavsave", new - { - profile = session.ProfileOfPet - } - .ToJson()); + + // make a request to the server, so it knows of the items we might transfer + RequestHandler.PutJson("/raid/profile/scavsave", + GetProfileAtEndOfRaidPatch.ProfileDescriptor.ToUnparsedData([]).JObject.ToString()); } } }