mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 02:50:45 -05:00
Add patch to fix post-raid screen not showing scav xp gained during raid (!17)
Co-authored-by: Kaeno <e> Co-authored-by: Dev <dev@dev.sp-tarkov.com> Reviewed-on: SPT-AKI/Modules#17
This commit is contained in:
parent
49acd11765
commit
bbc8e4d1c8
@ -22,6 +22,7 @@ namespace Aki.SinglePlayer
|
|||||||
new OfflineSaveProfilePatch().Enable();
|
new OfflineSaveProfilePatch().Enable();
|
||||||
new OfflineSpawnPointPatch().Enable();
|
new OfflineSpawnPointPatch().Enable();
|
||||||
new ExperienceGainPatch().Enable();
|
new ExperienceGainPatch().Enable();
|
||||||
|
new ScavExperienceGainPatch().Enable();
|
||||||
new MainMenuControllerPatch().Enable();
|
new MainMenuControllerPatch().Enable();
|
||||||
new PlayerPatch().Enable();
|
new PlayerPatch().Enable();
|
||||||
new SelectLocationScreenPatch().Enable();
|
new SelectLocationScreenPatch().Enable();
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using Aki.Reflection.Utils;
|
||||||
|
using EFT;
|
||||||
|
using EFT.Counters;
|
||||||
|
using EFT.UI.SessionEnd;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Aki.SinglePlayer.Patches.Progression
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Fix xp gained value being 0 after a scav raid
|
||||||
|
/// </summary>
|
||||||
|
public class ScavExperienceGainPatch : ModulePatch
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Looking for SessionResultExitStatus Show() (private)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
var desiredType = typeof(SessionResultExitStatus);
|
||||||
|
var desiredMethod = desiredType.GetMethods(PatchConstants.PrivateFlags).FirstOrDefault(IsTargetMethod);
|
||||||
|
|
||||||
|
Logger.LogDebug($"{this.GetType().Name} Type: {desiredType?.Name}");
|
||||||
|
Logger.LogDebug($"{this.GetType().Name} Method: {desiredMethod?.Name}");
|
||||||
|
|
||||||
|
return desiredMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsTargetMethod(MethodInfo mi)
|
||||||
|
{
|
||||||
|
var parameters = mi.GetParameters();
|
||||||
|
return (parameters.Length == 7
|
||||||
|
&& parameters[0].Name == "activeProfile"
|
||||||
|
&& parameters[1].Name == "lastPlayerState"
|
||||||
|
&& parameters[2].Name == "side"
|
||||||
|
&& parameters[3].Name == "exitStatus"
|
||||||
|
&& parameters[4].Name == "raidTime");
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
private static bool PatchPrefix(ref Profile activeProfile,ref EPlayerSide side)
|
||||||
|
{
|
||||||
|
if (activeProfile.Side == EPlayerSide.Savage)
|
||||||
|
{
|
||||||
|
side = EPlayerSide.Savage; // Also set side to correct value (defaults to usec/bear when playing as scav)
|
||||||
|
int xpGainedInSession = activeProfile.Stats.SessionCounters.GetAllInt(new object[] { CounterTag.Exp });
|
||||||
|
activeProfile.Stats.TotalSessionExperience = (int)(xpGainedInSession * activeProfile.Stats.SessionExperienceMult * activeProfile.Stats.ExperienceBonusMult);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Always do original method
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user