0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 01:30:45 -05:00

Fixes for Raidsettings not applying correctly. (Needs revisitng) Restore InsurancePatch. Remove CultistAmuletRemovalpatch

This commit is contained in:
Kaeno 2024-07-11 09:12:44 +01:00
parent 93e9405d57
commit b4c699bd40
5 changed files with 74 additions and 37 deletions

View File

@ -1,36 +0,0 @@
using SPT.Reflection.Patching;
using EFT;
using EFT.InventoryLogic;
using EFT.UI.DragAndDrop;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace SPT.Custom.Patches
{
public class CultistAmuletRemovalPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(CultistEventsClass), nameof(CultistEventsClass.method_4));
}
[PatchPostfix]
private static void PatchPostfix(DamageInfo damageInfo, Player victim)
{
var player = damageInfo.Player.iPlayer;
var amulet = player.FindCultistAmulet();
if (victim.Profile.Info.Settings.Role.IsSectant() && amulet != null)
{
var list = (player.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Pockets).ContainedItem as SearchableItemClass).Slots;
var amuletslot = list.Single(x => x.ContainedItem == amulet);
amuletslot.RemoveItem();
}
}
}
}

View File

@ -36,7 +36,6 @@ namespace SPT.Custom
new RagfairFeePatch().Enable();
new ScavQuestPatch().Enable();
new ScavItemCheckmarkPatch().Enable();
new CultistAmuletRemovalPatch().Enable();
new HalloweenExtractPatch().Enable();
// Needed but needs editing

View File

@ -0,0 +1,33 @@
using EFT;
using EFT.UI;
using EFT.UI.Matchmaker;
using HarmonyLib;
using SPT.Reflection.Patching;
using System.Reflection;
namespace SPT.SinglePlayer.Patches.MainMenu
{
public class ApplyRaidSettingsPatch : ModulePatch
{
/// <summary>
/// Since Scav is never meant to have the RaidSettingsWindow If you choose scav first and modify options then go to PMC you will remain Scav until you restart the game (Same other way around).
/// This Patch Basically overwrites the original settings so they dont get set back original settings from scav page
/// </summary>
/// <returns></returns>
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(RaidSettingsWindow), nameof(RaidSettingsWindow.RestoreOriginalOfflineSettings));
}
[PatchPrefix]
private static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1)
{
// If Raidsettingswindow is never opened it will soft lock game
if (___raidSettings_0 == null)
{
return;
}
___raidSettings_1.Apply(___raidSettings_0);
}
}
}

View File

@ -0,0 +1,39 @@
using SPT.Reflection.Patching;
using EFT;
using System.Reflection;
using HarmonyLib;
namespace SPT.SinglePlayer.Patches.MainMenu
{
/// <summary>
/// Force ERaidMode to online to make interface show insurance page
/// </summary>
public class InsuranceScreenPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
//[CompilerGenerated]
//private void method_XX()
//{
// if (this.raidSettings_0.SelectedLocation.Id == "laboratory")
// {
// this.raidSettings_0.WavesSettings.IsBosses = true;
// }
// if (this.raidSettings_0.RaidMode == ERaidMode.Online)
// {
// this.method_40();
// return;
// }
// this.method_41();
//}
return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_76));
}
[PatchPrefix]
private static void PrefixPatch(RaidSettings ___raidSettings_0)
{
___raidSettings_0.RaidMode = ERaidMode.Online;
}
}
}

View File

@ -65,6 +65,8 @@ namespace SPT.SinglePlayer
new ScavFoundInRaidPatch().Enable();
new GetProfileAtEndOfRaidPatch().Enable();
new FixSavageInventoryScreenPatch().Enable();
new InsuranceScreenPatch().Enable();
new ApplyRaidSettingsPatch().Enable();
}
catch (Exception ex)
{