2022-06-20 12:26:57 +02:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Aki.Reflection.Patching;
|
|
|
|
|
using EFT;
|
2022-06-20 20:06:49 +02:00
|
|
|
|
using HarmonyLib;
|
2022-06-20 15:43:15 +02:00
|
|
|
|
|
|
|
|
|
namespace UniformAim
|
2022-06-20 12:26:57 +02:00
|
|
|
|
{
|
|
|
|
|
public class UpdateSensitivityPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return typeof(Player.FirearmController).GetMethod("UpdateSensitivity");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
|
public static void PatchPostfix(ref float ____aimingSens)
|
|
|
|
|
{
|
2022-06-20 15:43:15 +02:00
|
|
|
|
____aimingSens = Plugin.mySens;
|
2022-06-20 12:26:57 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-20 20:06:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-22 14:56:37 +02:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
2022-06-20 20:06:49 +02:00
|
|
|
|
}
|