mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 02:50:45 -05:00
Add new patch from Kaeno that transfers scav quest status data from PMC to scav in the pre-raid screen
This commit is contained in:
parent
9c4b72377b
commit
697bc90c93
@ -3,6 +3,7 @@ using Aki.Common;
|
||||
using Aki.Custom.Airdrops.Patches;
|
||||
using Aki.Custom.Patches;
|
||||
using Aki.Custom.Utils;
|
||||
using Aki.SinglePlayer.Patches.ScavMode;
|
||||
using BepInEx;
|
||||
|
||||
namespace Aki.Custom
|
||||
@ -46,6 +47,7 @@ namespace Aki.Custom
|
||||
new SettingsLocationPatch().Enable();
|
||||
//new RankPanelPatch().Enable();
|
||||
new RagfairFeePatch().Enable();
|
||||
new ScavQuestPatch().Enable();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
43
project/Aki.Custom/Patches/ScavQuestPatch.cs
Normal file
43
project/Aki.Custom/Patches/ScavQuestPatch.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using Aki.Reflection.Patching;
|
||||
using Aki.Reflection.Utils;
|
||||
using EFT.UI.Matchmaker;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Aki.SinglePlayer.Patches.ScavMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy over scav-only quests from PMC profile to scav profile on pre-raid screen
|
||||
/// Allows scavs to see and complete quests
|
||||
/// </summary>
|
||||
public class ScavQuestPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
var desiredType = typeof(MatchmakerOfflineRaidScreen);
|
||||
var desiredMethod = desiredType.GetMethod(nameof(MatchmakerOfflineRaidScreen.Show));
|
||||
|
||||
Logger.LogDebug($"{GetType().Name} Type: {desiredType?.Name}");
|
||||
Logger.LogDebug($"{GetType().Name} Method: {desiredMethod?.Name}");
|
||||
|
||||
return desiredMethod;
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
private static void PatchPostfix()
|
||||
{
|
||||
var pmcProfile = PatchConstants.BackEndSession.Profile;
|
||||
var scavProfile = PatchConstants.BackEndSession.ProfileOfPet;
|
||||
|
||||
// Iterate over all quests on pmc that are flagged as being for scavs
|
||||
foreach (var quest in pmcProfile.QuestsData.Where(x => x.Template?.PlayerGroup == EFT.EPlayerGroup.Scav))
|
||||
{
|
||||
// If quest doesnt exist in scav, add it
|
||||
if (!scavProfile.QuestsData.Any(x => x.Id == quest.Id))
|
||||
{
|
||||
scavProfile.QuestsData.Add(quest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user