mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 01:30:45 -05:00
Fix FixSavageInventoryScreenPatch (!173)
This fixes the logic of FixSavageInventoryScreenPatch. NOTE: The code below is untested and will most likely not work. It's what I theoretically believe is the right way to turn the `JObject` into a string for the server, however BSG has a `JsonWriter` in the client now that might have to be utilized? I will leave it like this until we have more info. ```c# RequestHandler.PutJson("/raid/profile/scavsave", GetProfileAtEndOfRaidPatch.ProfileDescriptor.ToUnparsedData([]).JObject.ToString()); ``` Co-authored-by: Lacyway <20912169+Lacyway@users.noreply.github.com> Reviewed-on: SPT/Modules#173 Co-authored-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com> Co-committed-by: Lacyway <lacyway@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
c2271b0c0e
commit
dd4bc93a97
@ -15,7 +15,8 @@ namespace SPT.SinglePlayer.Patches.ScavMode
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetProfileAtEndOfRaidPatch : ModulePatch
|
public class GetProfileAtEndOfRaidPatch : ModulePatch
|
||||||
{
|
{
|
||||||
public static string Profile { get; private set; }
|
public static GClass1962 ProfileDescriptor { get; private set; }
|
||||||
|
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(LocalGame), nameof(LocalGame.Stop));
|
return AccessTools.Method(typeof(LocalGame), nameof(LocalGame.Stop));
|
||||||
@ -24,8 +25,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
|
|||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void PatchPrefix(LocalGame __instance)
|
public static void PatchPrefix(LocalGame __instance)
|
||||||
{
|
{
|
||||||
//var test = new GClass1962(__instance.Profile_0, GClass1971.Instance);
|
ProfileDescriptor = new GClass1962(__instance.Profile_0, GClass1971.Instance);
|
||||||
//Profile = test.ToUnparsedData([]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,27 +42,24 @@ namespace SPT.SinglePlayer.Patches.ScavMode
|
|||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void PatchPrefix(ref ISession ___iSession)
|
public static void PatchPrefix(ref ISession ___iSession)
|
||||||
{
|
{
|
||||||
var profile = GetProfileAtEndOfRaidPatch.Profile.ParseJsonTo<Profile>();
|
Profile profile = new(GetProfileAtEndOfRaidPatch.ProfileDescriptor);
|
||||||
|
|
||||||
if (profile.Side != EPlayerSide.Savage)
|
if (profile.Side != EPlayerSide.Savage)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var session = (ProfileEndpointFactoryAbstractClass)___iSession;
|
var session = (ProfileEndpointFactoryAbstractClass)___iSession;
|
||||||
session.AllProfiles = new Profile[]
|
session.AllProfiles =
|
||||||
{
|
[
|
||||||
session.AllProfiles.First(x => x.Side != EPlayerSide.Savage),
|
session.AllProfiles.First(x => x.Side != EPlayerSide.Savage),
|
||||||
profile
|
profile
|
||||||
};
|
];
|
||||||
session.ProfileOfPet.LearnAll();
|
session.ProfileOfPet.LearnAll();
|
||||||
|
|
||||||
// make a request to the server, so it knows of the items we might transfer
|
// make a request to the server, so it knows of the items we might transfer
|
||||||
RequestHandler.PutJson("/raid/profile/scavsave", new
|
RequestHandler.PutJson("/raid/profile/scavsave",
|
||||||
{
|
GetProfileAtEndOfRaidPatch.ProfileDescriptor.ToUnparsedData([]).JObject.ToString());
|
||||||
profile = session.ProfileOfPet
|
|
||||||
}
|
|
||||||
.ToJson());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user