Decompiled source of HuntressAutoaimFix v1.1.3

HuntressAutoaimFix.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HuntressAutoaimFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HuntressAutoaimFix")]
[assembly: AssemblyTitle("HuntressAutoaimFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HuntressAutoaimFix;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("HIFU.HuntressAutoaimFix", "HuntressAutoaimFix", "1.1.2")]
public class Main : BaseUnityPlugin
{
	public const string PluginGUID = "HIFU.HuntressAutoaimFix";

	public const string PluginAuthor = "HIFU";

	public const string PluginName = "HuntressAutoaimFix";

	public const string PluginVersion = "1.1.2";

	public AssetBundle huntressautoaimfix;

	public static ConfigEntry<float> maxTrackingAngle { get; set; }

	public static ConfigEntry<float> maxTrackingDistance { get; set; }

	public void Awake()
	{
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Expected O, but got Unknown
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Expected O, but got Unknown
		huntressautoaimfix = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("HuntressAutoaimFix.dll", "huntressautoaimfix"));
		maxTrackingAngle = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Tracking Angle", 30f, "Vanilla is 30");
		maxTrackingDistance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Tracking Distance", 60f, "Vanilla is 60");
		ModSettingsManager.SetModIcon(huntressautoaimfix.LoadAsset<Sprite>("texModIconHAF.png"));
		ModSettingsManager.AddOption((BaseOption)new StepSliderOption(maxTrackingAngle, new StepSliderConfig
		{
			increment = 1f,
			min = 1f,
			max = 360f
		}));
		ModSettingsManager.AddOption((BaseOption)new StepSliderOption(maxTrackingDistance, new StepSliderConfig
		{
			increment = 5f,
			min = 5f,
			max = 1000f
		}));
		HuntressTracker.SearchForTarget += new hook_SearchForTarget(HuntressTracker_SearchForTarget);
	}

	private void HuntressTracker_SearchForTarget(orig_SearchForTarget orig, HuntressTracker self, Ray aimRay)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		self.search.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.teamComponent.teamIndex);
		self.search.filterByLoS = true;
		self.search.searchOrigin = ((Ray)(ref aimRay)).origin;
		self.search.searchDirection = ((Ray)(ref aimRay)).direction;
		self.search.sortMode = (SortMode)2;
		self.search.maxDistanceFilter = ((maxTrackingDistance.Value != 60f) ? maxTrackingDistance.Value : self.maxTrackingDistance);
		self.search.maxAngleFilter = ((maxTrackingAngle.Value != 30f) ? maxTrackingAngle.Value : self.maxTrackingAngle);
		self.search.RefreshCandidates();
		self.search.FilterOutGameObject(((Component)self).gameObject);
		self.trackingTarget = self.search.GetResults().FirstOrDefault();
	}
}