2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Reflection.Patching;
|
2024-02-25 17:36:27 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.Custom.Patches
|
2024-02-25 17:36:27 +00:00
|
|
|
|
{
|
|
|
|
|
public class CultistAmuletRemovalPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-02-27 18:57:49 +00:00
|
|
|
|
return AccessTools.Method(typeof(CultistEventsClass), nameof(CultistEventsClass.method_4));
|
2024-02-25 17:36:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
2024-02-28 20:34:15 +00:00
|
|
|
|
private static void PatchPostfix(DamageInfo damageInfo, Player victim)
|
2024-02-25 17:36:27 +00:00
|
|
|
|
{
|
|
|
|
|
var player = damageInfo.Player.iPlayer;
|
2024-02-28 20:34:15 +00:00
|
|
|
|
var amulet = player.FindCultistAmulet();
|
2024-02-25 17:36:27 +00:00
|
|
|
|
if (victim.Profile.Info.Settings.Role.IsSectant() && amulet != null)
|
|
|
|
|
{
|
2024-02-28 20:34:15 +00:00
|
|
|
|
var list = (player.Profile.Inventory.Equipment.GetSlot(EquipmentSlot.Pockets).ContainedItem as SearchableItemClass).Slots;
|
2024-02-25 17:36:27 +00:00
|
|
|
|
var amuletslot = list.Single(x => x.ContainedItem == amulet);
|
|
|
|
|
amuletslot.RemoveItem();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|