mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:50:44 -05:00
fixed questing and achievements controller, removed un-needed patches for midraid changes
This commit is contained in:
parent
b1b0c9d151
commit
338a8c015f
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using Comfort.Common;
|
|
||||||
using EFT;
|
|
||||||
using HarmonyLib;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace SPT.SinglePlayer.Patches.Progression
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// After picking up a quest item, trigger CheckForStatusChange() from the questController to fully update a quest sub-tasks to show (e.g. `survive and extract item from raid` task)
|
|
||||||
/// </summary>
|
|
||||||
public class MidRaidQuestChangePatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(Profile), nameof(Profile.AddToCarriedQuestItems));
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPostfix]
|
|
||||||
private static void PatchPostfix()
|
|
||||||
{
|
|
||||||
var gameWorld = Singleton<GameWorld>.Instance;
|
|
||||||
if (gameWorld == null)
|
|
||||||
{
|
|
||||||
Logger.LogDebug("[MidRaidQuestChangePatch] gameWorld instance was null");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var player = gameWorld.MainPlayer;
|
|
||||||
var questController = Traverse.Create(player).Field<AbstractQuestControllerClass>("_questController").Value;
|
|
||||||
if (questController != null)
|
|
||||||
{
|
|
||||||
foreach (var quest in questController.Quests.ToList())
|
|
||||||
{
|
|
||||||
quest.CheckForStatusChange(true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using EFT;
|
||||||
|
using HarmonyLib;
|
||||||
|
using SPT.Reflection.Patching;
|
||||||
|
using SPT.Reflection.Utils;
|
||||||
|
|
||||||
|
namespace SPT.SinglePlayer.Patches.RaidFix
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// this patch aims to allow achievements and quests to activate/change and finish whilst inraid
|
||||||
|
/// </summary>
|
||||||
|
public class FixQuestAchieveControllersPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(Player), nameof(Player.Init));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPostfix]
|
||||||
|
public static void PatchPostfix(Profile profile, InventoryControllerClass inventoryController, ref AbstractQuestControllerClass ____questController, ref AbstractAchievementControllerClass ____achievementsController)
|
||||||
|
{
|
||||||
|
var questController = new LocalQuestControllerClass(profile, inventoryController, PatchConstants.BackEndSession, true);
|
||||||
|
questController.Init();
|
||||||
|
questController.Run();
|
||||||
|
|
||||||
|
var achievementController =
|
||||||
|
new AchievementControllerClass(profile, inventoryController, PatchConstants.BackEndSession, true);
|
||||||
|
achievementController.Init();
|
||||||
|
achievementController.Run();
|
||||||
|
|
||||||
|
____questController = questController;
|
||||||
|
____achievementsController = achievementController;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -20,8 +20,7 @@ namespace SPT.SinglePlayer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO: check if these patches are needed
|
// TODO: check if these patches are needed
|
||||||
new MidRaidQuestChangePatch().Enable();
|
new InRaidQuestAvailablePatch().Enable();
|
||||||
new MidRaidAchievementChangePatch().Enable();
|
|
||||||
new TinnitusFixPatch().Enable();
|
new TinnitusFixPatch().Enable();
|
||||||
new SmokeGrenadeFuseSoundFixPatch().Enable();
|
new SmokeGrenadeFuseSoundFixPatch().Enable();
|
||||||
new EmptyInfilFixPatch().Enable();
|
new EmptyInfilFixPatch().Enable();
|
||||||
@ -30,7 +29,6 @@ namespace SPT.SinglePlayer
|
|||||||
new PlayerPatch().Enable();
|
new PlayerPatch().Enable();
|
||||||
new MaxBotPatch().Enable();
|
new MaxBotPatch().Enable();
|
||||||
new PostRaidHealingPricePatch().Enable();
|
new PostRaidHealingPricePatch().Enable();
|
||||||
new InRaidQuestAvailablePatch().Enable();
|
|
||||||
new ExfilPointManagerPatch().Enable();
|
new ExfilPointManagerPatch().Enable();
|
||||||
new HideoutQuestIgnorePatch().Enable();
|
new HideoutQuestIgnorePatch().Enable();
|
||||||
new SpawnProcessNegativeValuePatch().Enable();
|
new SpawnProcessNegativeValuePatch().Enable();
|
||||||
@ -67,6 +65,7 @@ namespace SPT.SinglePlayer
|
|||||||
new FixSavageInventoryScreenPatch().Enable();
|
new FixSavageInventoryScreenPatch().Enable();
|
||||||
new InsuranceScreenPatch().Enable();
|
new InsuranceScreenPatch().Enable();
|
||||||
new ApplyRaidSettingsPatch().Enable();
|
new ApplyRaidSettingsPatch().Enable();
|
||||||
|
new FixQuestAchieveControllersPatch().Enable();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user