0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 20:30:43 -05:00

mid raid achievement patch no longer needed as we assign our own, added patch to fix achievements

This commit is contained in:
CWX 2024-07-11 21:09:38 +01:00
parent 34e84ff737
commit 5bad769a44
3 changed files with 27 additions and 26 deletions

View File

@ -1,25 +0,0 @@
using System.Reflection;
using SPT.Reflection.Patching;
namespace SPT.SinglePlayer.Patches.Progression
{
/// <summary>
/// BSG have disabled notifications for local raids, set updateAchievements in the achievement controller to always be true
/// This enables the achievement notifications and the client to save completed achievement data into profile.Achievements
/// </summary>
public class MidRaidAchievementChangePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(AchievementControllerClass).GetConstructors()[0];
}
[PatchPrefix]
private static bool PatchPrefix(ref bool updateAchievements)
{
updateAchievements = true;
return true; // Do original method
}
}
}

View File

@ -0,0 +1,26 @@
using System.Reflection;
using EFT;
using HarmonyLib;
using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
namespace SPT.SinglePlayer.Patches.RaidFix
{
public class FixAchievementsPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(Player), nameof(Player.Init));
}
[PatchPostfix]
public static void PatchPostfix(Profile profile, InventoryControllerClass inventoryController, ref AbstractAchievementControllerClass ____achievementsController, ref AbstractQuestControllerClass ____questController)
{
var achievementController = new GClass3233(profile, inventoryController, PatchConstants.BackEndSession, true);
achievementController.Init();
achievementController.Run();
____achievementsController = achievementController;
}
}
}

View File

@ -58,7 +58,6 @@ namespace SPT.SinglePlayer
new MapReadyButtonPatch().Enable();
new LabsKeycardRemovalPatch().Enable();
new ScavLateStartPatch().Enable();
new MidRaidAchievementChangePatch().Enable();
new GetTraderServicesPatch().Enable();
new PurchaseTraderServicePatch().Enable();
new ScavSellAllPriceStorePatch().Enable();
@ -69,6 +68,7 @@ namespace SPT.SinglePlayer
new ScavRepAdjustmentPatch().Enable();
new AmmoUsedCounterPatch().Enable();
new ArmorDamageCounterPatch().Enable();
new FixAchievementsPatch().Enable();
}
catch (Exception ex)
{