UniformAim/TarkovUniformAim/UniformAimPatch.cs

97 lines
2.6 KiB
C#

using System.Reflection;
using Aki.Reflection.Patching;
using EFT;
using HarmonyLib;
namespace UniformAim
{
public class UpdateSensitivityPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(Player.FirearmController).GetMethod("UpdateSensitivity");
}
[PatchPostfix]
public static void PatchPostfix(ref float ____aimingSens)
{
____aimingSens = Plugin.mySens;
}
}
public class get_AimingSensitivityPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(Player.FirearmController).GetMethod("get_AimingSensitivity");
}
[PatchPostfix]
public static void PatchPostfix(ref float ____aimingSens)
{
____aimingSens = Plugin.mySens;
}
}
public class get_SelectedScopeIndexPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(EFT.InventoryLogic.SightComponent).GetMethod("get_SelectedScopeIndex");
}
[PatchPostfix]
public static void PatchPostfix(ref int ___SelectedScope)
{
Plugin.SelectedScope = ___SelectedScope;
}
}
public class get_SelectedScopeModePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(EFT.InventoryLogic.SightComponent).GetMethod("get_SelectedScopeMode");
}
[PatchPostfix]
public static void PatchPostfix(ref int[] ___ScopesSelectedModes)
{
Plugin.SelectedScopeMode = ___ScopesSelectedModes[Plugin.SelectedScope];
}
}
public class get_IsAimingPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(Player.FirearmController).GetMethod("get_IsAiming");
}
[PatchPostfix]
public static void PatchPostfix(ref bool ____isAiming)
{
Plugin.isAiming = ____isAiming;
}
}
//public class ScopesSelectedModesPatch : ModulePatch
//{
// protected override MethodBase GetTargetMethod()
// {
// return typeof(EFT.InventoryLogic.SightComponent).GetMethod("ScopesSelectedModes");
// }
// [PatchPostfix]
// public static void PatchPostfix(ref int[] ScopesSelectedModes)
// {
// ScopesSelectedModes.CopyTo(Plugin.CurrentScopeValue, 0);
// }
//}
//patch bool HasCurrentZoomGreaterThenOne()
//EFT.InventoryLogic.SightComponent seems like a decent route to sort it all out
//
}