Decompiled source of Better Weapon HUDs v1.4.0

BetterWeaponHUDs.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using JadeLib;
using JadeLib.PluginConfigurator.Fields;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using SettingsMenu.Components.Pages;
using TMPro;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BetterWeaponHUDs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+c15f59919fda2b53f25f2b832722e3c68ff1bd60")]
[assembly: AssemblyProduct("BetterWeaponHUDs")]
[assembly: AssemblyTitle("BetterWeaponHUDs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BetterWeaponHUDs
{
	[HarmonyPatch]
	internal static class Patches
	{
		private static readonly Vector2 speedometerPos = new Vector2(-79f, 590f);

		private static readonly Vector2 altSpeedometerPos = new Vector2(-79f, 190f);

		private static GameObject AltGunCanvas { get; set; }

		public static GameObject HardDamageNumber { get; private set; }

		public static GameObject CrosshairRailcannonSlider { get; private set; }

		public static Transform CrosshairFistIconFill { get; private set; }

		public static GameObject CrosshairWeaponIcon { get; private set; }

		[HarmonyPatch(typeof(HudController), "Awake")]
		[HarmonyPostfix]
		private static void HudController_Awake(HudController __instance)
		{
			if (!__instance.altHud)
			{
				if (!Object.op_Implicit((Object)(object)AltGunCanvas))
				{
					AltGunCanvas = ObjectExtensions.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Gun Canvas"), ((Component)__instance).transform, false);
					SetIconParent(Settings.AltIndicatorPosition);
				}
				if (!Object.op_Implicit((Object)(object)HardDamageNumber))
				{
					HardDamageNumber = ObjectExtensions.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Hard Damage"), ObjectExtensions.Find((Component)(object)__instance, "GunCanvas/StatsPanel/Filler/Panel (2)/Filler"), false);
					__instance.textElements = CollectionExtensions.AddToArray<TMP_Text>(__instance.textElements, HardDamageNumber.GetComponent<TMP_Text>());
					HardDamageNumber.SetActive(Settings.HardDamageNumber);
				}
			}
		}

		[HarmonyPatch(typeof(HudController), "CheckSituation")]
		[HarmonyPostfix]
		private static void HudController_CheckSituation(HudController __instance)
		{
			if (!__instance.altHud && Object.op_Implicit((Object)(object)AltGunCanvas))
			{
				((Behaviour)AltGunCanvas.GetComponent<Canvas>()).enabled = !HideUI.Active && MonoSingleton<PrefsManager>.Instance.GetInt("hudType", 0) == 1;
			}
		}

		[HarmonyPatch(typeof(RailcannonMeter), "CheckStatus")]
		[HarmonyPostfix]
		private static void RailcannonMeter_CheckStatus(RailcannonMeter __instance)
		{
			if (MonoSingleton<PrefsManager>.Instance.GetBool("weaponIcons", false) && (Settings.AltIndicatorPosition || Settings.ForceAltRailcannonCharge))
			{
				((Behaviour)__instance.self).enabled = false;
				__instance.miniVersion.SetActive(__instance.RailcannonStatus());
			}
		}

		[HarmonyPatch(typeof(Crosshair), "Start")]
		[HarmonyPrefix]
		private static void Crosshair_Start(Crosshair __instance)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)CrosshairRailcannonSlider))
			{
				CrosshairRailcannonSlider = ObjectExtensions.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Railcannon Slider"), ObjectExtensions.Find((Component)(object)__instance, "PowerUpBar"), false);
				CrosshairRailcannonSlider.SetActive(Settings.CrosshairRailcannonCharge);
				RectTransform obj = ObjectExtensions.FindAsRect((Component)(object)__instance, "PowerUpBar/HealthSliderAfterImage (2)");
				obj.sizeDelta = new Vector2(50f, 50f);
				((Component)obj).GetComponent<Image>().fillClockwise = true;
				((Component)obj).GetComponent<Image>().fillOrigin = 4;
			}
			if (!Object.op_Implicit((Object)(object)CrosshairFistIconFill) && Object.op_Implicit((Object)(object)HudController.Instance))
			{
				GameObject val = ObjectExtensions.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Fist Icon"), ((Component)__instance).transform, false);
				MonoSingleton<FistControl>.Instance.fistPanels = CollectionExtensions.AddToArray<GameObject>(MonoSingleton<FistControl>.Instance.fistPanels, val);
				val.GetComponent<CopyImage>().imgToCopy = HudController.Instance.fistBackground;
				((Component)(CrosshairFistIconFill = ObjectExtensions.Find(val, "Fill"))).GetComponent<CopyImage>().imgToCopy = HudController.Instance.fistFill;
				val.SetActive(Settings.CrosshairFistIcon);
			}
			if (!Object.op_Implicit((Object)(object)CrosshairWeaponIcon))
			{
				if (!Object.op_Implicit((Object)(object)MonoSingleton<WeaponHUD>.Instance))
				{
					((MonoSingleton<WeaponHUD>)(object)Object.FindObjectOfType<WeaponHUD>())?.Awake();
				}
				CrosshairWeaponIcon = ObjectExtensions.Instantiate<GameObject>(Plugin.Assets.LoadAsset<GameObject>("Weapon Icon"), ((Component)__instance).transform, false);
				CrosshairWeaponIcon.SetActive(Settings.CrosshairWeaponIcon);
			}
		}

		[HarmonyPatch(typeof(Crosshair), "CheckCrossHair")]
		[HarmonyPostfix]
		private static void Crosshair_CheckCrossHair(Crosshair __instance)
		{
			if (Settings.AlternateCrosshair)
			{
				((Behaviour)__instance.mainch).enabled = false;
				CollectionExtensions.Do<Image>((IEnumerable<Image>)__instance.altchs, (Action<Image>)delegate(Image image)
				{
					((Behaviour)image).enabled = true;
				});
			}
		}

		[HarmonyPatch(typeof(PowerUpMeter), "UpdateMeter")]
		[HarmonyPostfix]
		private static void PowerUpMeter_UpdateMeter(PowerUpMeter __instance)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)CrosshairRailcannonSlider) && Settings.CrosshairRailcannonCharge)
			{
				Image component = CrosshairRailcannonSlider.GetComponent<Image>();
				component.fillAmount = Mathf.Lerp(0f, 0.5f, MonoSingleton<WeaponCharges>.Instance.raicharge / 4f);
				((Graphic)component).color = ((MonoSingleton<WeaponCharges>.Instance.raicharge >= 5f) ? MonoSingleton<ColorBlindSettings>.Instance.railcannonFullColor : MonoSingleton<ColorBlindSettings>.Instance.railcannonChargingColor);
				Image meter = __instance.meter;
				meter.fillAmount /= 2f;
			}
		}

		[HarmonyPatch(typeof(HUDSettings), "OnPrefChanged")]
		[HarmonyPostfix]
		private static void HUDSettings_OnPrefChanged(string key, object value)
		{
			if (key == "weaponIcons" && (bool)value)
			{
				FixSpeedometer();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(StyleHUD), "DescendRank")]
		private static void SetRankImage(StyleHUD __instance)
		{
			if (Settings.CustomStyleImages.Length > __instance.rankIndex)
			{
				Sprite val = Settings.CustomStyleImages[__instance.rankIndex];
				if (val != null)
				{
					__instance.rankImage.sprite = val;
				}
			}
		}

		[HarmonyPatch(typeof(NewMovement), "Update")]
		[HarmonyPostfix]
		private static void NewMovement_Update(NewMovement __instance)
		{
			//IL_0013: 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)
			if (!Settings.ViewmodelAcceleration)
			{
				__instance.hudCam.transform.localPosition = __instance.camOriginalPos;
			}
			if (!Settings.HUDAcceleration)
			{
				__instance.screenHud.transform.localPosition = __instance.hudOriginalPos;
			}
		}

		[HarmonyPatch(typeof(WalkingBob), "Awake")]
		[HarmonyPostfix]
		private static void WalkingBob_Awake(WalkingBob __instance)
		{
			((Behaviour)__instance).enabled = Settings.WalkingBob;
		}

		[HarmonyPatch(typeof(FistControl), "Update")]
		[HarmonyPostfix]
		private static void FistControl_Update(FistControl __instance)
		{
			if (Object.op_Implicit((Object)(object)CrosshairFistIconFill) && Object.op_Implicit((Object)(object)HudController.Instance))
			{
				((Component)CrosshairFistIconFill).GetComponent<Image>().fillAmount = HudController.Instance.fistFill.fillAmount;
			}
		}

		[HarmonyPatch(typeof(StyleHUD), "GetLocalizedName")]
		[HarmonyPostfix]
		private static void StyleHUD_GetLocalizedName(string id, string __result)
		{
			Settings.AddStyleBonusEntry(id, __result);
		}

		public static void SetIconParent(bool alt)
		{
			HudController instance = HudController.Instance;
			if (instance != null)
			{
				ObjectExtensions.SetParent(instance.weaponIcon, alt ? AltGunCanvas : HudController.Instance.gunCanvas, false);
			}
			RailcannonMeter instance2 = MonoSingleton<RailcannonMeter>.Instance;
			if (instance2 != null)
			{
				instance2.CheckStatus();
			}
			FixSpeedometer();
		}

		private static void FixSpeedometer()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)HudController.Instance))
			{
				HudController.Instance.speedometer.rect.anchoredPosition = (Settings.AltIndicatorPosition ? altSpeedometerPos : speedometerPos);
			}
		}
	}
	[BepInPlugin("BetterWeaponHUDs", "BetterWeaponHUDs", "1.4.0")]
	internal class Plugin : BaseUnityPlugin
	{
		public static readonly AssetBundle Assets = AssetBundle.LoadFromFile(Path.Combine(ModDir, "betterweaponhuds.bundle"));

		private static GameObject FUPIndicator;

		private static string ModDir => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		private void Awake()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			Settings.Initialize(this);
			SceneManager.sceneLoaded += OnSceneLoaded;
			new Harmony("BetterWeaponHUDs").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterWeaponHUDs is loaded!");
		}

		private void Update()
		{
			GameObject fUPIndicator = FUPIndicator;
			if (fUPIndicator == null)
			{
				return;
			}
			int active;
			if (Settings.FUPAlert)
			{
				HookArm instance = MonoSingleton<HookArm>.Instance;
				if (instance != null && instance.returning)
				{
					Grenade val = default(Grenade);
					active = (instance.caughtObjects.Any((Rigidbody rb) => Object.op_Implicit((Object)(object)rb) && ((Component)rb).TryGetComponent<Grenade>(ref val)) ? 1 : 0);
					goto IL_004f;
				}
			}
			active = 0;
			goto IL_004f;
			IL_004f:
			fUPIndicator.SetActive((byte)active != 0);
		}

		private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (Object.op_Implicit((Object)(object)FUPIndicator))
			{
				return;
			}
			GameObject val = GameObject.Find("/Canvas");
			if (val != null)
			{
				Transform transform = val.transform;
				if (transform != null)
				{
					FUPIndicator = ObjectExtensions.Instantiate<GameObject>(Assets.LoadAsset<GameObject>("FUP Indicator"), transform, false);
				}
			}
		}
	}
	internal static class Settings
	{
		[CompilerGenerated]
		private sealed class <<Initialize>g__AddStyleBonuses|37_7>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <<Initialize>g__AddStyleBonuses|37_7>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)MonoSingleton<StyleHUD>.Instance) && Object.op_Implicit((Object)(object)MonoSingleton<PrefsManager>.Instance)));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					CollectionExtensions.DoIf<KeyValuePair<string, object>>((IEnumerable<KeyValuePair<string, object>>)MonoSingleton<PrefsManager>.Instance.localPrefMap, (Func<KeyValuePair<string, object>, bool>)((KeyValuePair<string, object> pair) => pair.Key.StartsWith("BetterWeaponHUDs_stylebonusdefault_")), (Action<KeyValuePair<string, object>>)delegate(KeyValuePair<string, object> pair)
					{
						string key = pair.Key;
						int length = "BetterWeaponHUDs_stylebonusdefault_".Length;
						AddStyleBonusEntry(key.Substring(length, key.Length - length));
					});
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static PostBoolValueChangeEvent <>9__37_0;

			public static PostBoolValueChangeEvent <>9__37_1;

			public static PostBoolValueChangeEvent <>9__37_2;

			public static PostBoolValueChangeEvent <>9__37_3;

			public static PostBoolValueChangeEvent <>9__37_4;

			public static PostBoolValueChangeEvent <>9__37_5;

			public static PostBoolValueChangeEvent <>9__37_6;

			public static Func<bool> <>9__37_10;

			public static Func<KeyValuePair<string, object>, bool> <>9__37_11;

			public static Action<KeyValuePair<string, object>> <>9__37_12;

			public static PostBoolValueChangeEvent <>9__37_8;

			internal void <Initialize>b__37_0(bool _)
			{
				CanvasController instance = MonoSingleton<CanvasController>.Instance;
				if (instance != null)
				{
					instance.crosshair.CheckCrossHair();
				}
			}

			internal void <Initialize>b__37_1(bool _)
			{
				GameObject crosshairRailcannonSlider = Patches.CrosshairRailcannonSlider;
				if (crosshairRailcannonSlider != null)
				{
					crosshairRailcannonSlider.SetActive(CrosshairRailcannonCharge);
				}
			}

			internal void <Initialize>b__37_2(bool value)
			{
				Transform crosshairFistIconFill = Patches.CrosshairFistIconFill;
				if (crosshairFistIconFill != null)
				{
					ObjectExtensions.SetActive(crosshairFistIconFill.parent, value);
				}
			}

			internal void <Initialize>b__37_3(bool value)
			{
				GameObject crosshairWeaponIcon = Patches.CrosshairWeaponIcon;
				if (crosshairWeaponIcon != null)
				{
					crosshairWeaponIcon.SetActive(value);
				}
			}

			internal void <Initialize>b__37_4(bool value)
			{
				GameObject hardDamageNumber = Patches.HardDamageNumber;
				if (hardDamageNumber != null)
				{
					hardDamageNumber.SetActive(value);
				}
			}

			internal void <Initialize>b__37_5(bool value)
			{
				((ConfigField)forceAltRailcannonCharge).interactable = !value;
				Patches.SetIconParent(value);
			}

			internal void <Initialize>b__37_6(bool _)
			{
				RailcannonMeter instance = MonoSingleton<RailcannonMeter>.Instance;
				if (instance != null)
				{
					instance.CheckStatus();
				}
			}

			internal bool <Initialize>b__37_10()
			{
				if (Object.op_Implicit((Object)(object)MonoSingleton<StyleHUD>.Instance))
				{
					return Object.op_Implicit((Object)(object)MonoSingleton<PrefsManager>.Instance);
				}
				return false;
			}

			internal bool <Initialize>b__37_11(KeyValuePair<string, object> pair)
			{
				return pair.Key.StartsWith("BetterWeaponHUDs_stylebonusdefault_");
			}

			internal void <Initialize>b__37_12(KeyValuePair<string, object> pair)
			{
				string key = pair.Key;
				int length = "BetterWeaponHUDs_stylebonusdefault_".Length;
				AddStyleBonusEntry(key.Substring(length, key.Length - length));
			}

			internal void <Initialize>b__37_8(bool value)
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				WalkingBob val = ((instance != null) ? ((Component)instance).GetComponentInChildren<WalkingBob>(true) : null);
				if (val != null)
				{
					((Behaviour)val).enabled = value;
					((Component)val).transform.localPosition = Vector3.zero;
				}
			}
		}

		private static BoolField hudAcceleration;

		private static BoolField alternateCrosshair;

		private static BoolField crosshairRailcannonCharge;

		private static BoolField crosshairFistIcon;

		private static BoolField crosshairWeaponIcon;

		private static BoolField hardDamageNumber;

		private static BoolField altIndicatorPosition;

		private static BoolField forceAltRailcannonCharge;

		public static readonly Sprite[] CustomStyleImages = (Sprite[])(object)new Sprite[8];

		private const string DefaultStyleGUID = "BetterWeaponHUDs_stylebonusdefault_";

		private static ConfigDivision customStyleBonusesDivision;

		private static readonly HashSet<string> registeredStyleIDs = new HashSet<string>();

		private static BoolField fupAlert;

		private static BoolField walkingBob;

		private static BoolField viewmodelAcceleration;

		public static bool HUDAcceleration => hudAcceleration.value;

		public static bool AlternateCrosshair => alternateCrosshair.value;

		public static bool CrosshairRailcannonCharge
		{
			get
			{
				if (crosshairRailcannonCharge.value)
				{
					return MonoSingleton<RailcannonMeter>.Instance.RailcannonStatus();
				}
				return false;
			}
		}

		public static bool CrosshairFistIcon => crosshairFistIcon.value;

		public static bool CrosshairWeaponIcon => crosshairWeaponIcon.value;

		public static bool HardDamageNumber => hardDamageNumber.value;

		public static bool AltIndicatorPosition => altIndicatorPosition.value;

		public static bool ForceAltRailcannonCharge => forceAltRailcannonCharge.value;

		public static bool FUPAlert => fupAlert.value;

		public static bool WalkingBob => walkingBob.value;

		public static bool ViewmodelAcceleration => viewmodelAcceleration.value;

		internal static void Initialize(Plugin plugin)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00cb: 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_00d6: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Expected O, but got Unknown
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Expected O, but got Unknown
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Expected O, but got Unknown
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Expected O, but got Unknown
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Expected O, but got Unknown
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Expected O, but got Unknown
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Expected O, but got Unknown
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Expected O, but got Unknown
			PluginConfigurator val = PluginConfigurator.Create("BetterWeaponHUDs", "BetterWeaponHUDs");
			val.icon = Plugin.Assets.LoadAsset<Sprite>("Icon");
			hudAcceleration = new BoolField(val.rootPanel, "HUD FOLLOWS SPEED", "hudacceleration", true);
			new ConfigHeader(val.rootPanel, "CROSSHAIR HUD", 24);
			alternateCrosshair = new BoolField(val.rootPanel, "ALTERNATE CROSSHAIR", "use_alt_crosshair", false);
			BoolField obj = alternateCrosshair;
			object obj2 = <>c.<>9__37_0;
			if (obj2 == null)
			{
				PostBoolValueChangeEvent val2 = delegate
				{
					CanvasController instance4 = MonoSingleton<CanvasController>.Instance;
					if (instance4 != null)
					{
						instance4.crosshair.CheckCrossHair();
					}
				};
				<>c.<>9__37_0 = val2;
				obj2 = (object)val2;
			}
			obj.postValueChangeEvent += (PostBoolValueChangeEvent)obj2;
			crosshairRailcannonCharge = new BoolField(val.rootPanel, "RAILCANNON CHARGE", "crosshair_rc_charge", false);
			BoolField obj3 = crosshairRailcannonCharge;
			object obj4 = <>c.<>9__37_1;
			if (obj4 == null)
			{
				PostBoolValueChangeEvent val3 = delegate
				{
					GameObject crosshairRailcannonSlider = Patches.CrosshairRailcannonSlider;
					if (crosshairRailcannonSlider != null)
					{
						crosshairRailcannonSlider.SetActive(CrosshairRailcannonCharge);
					}
				};
				<>c.<>9__37_1 = val3;
				obj4 = (object)val3;
			}
			obj3.postValueChangeEvent += (PostBoolValueChangeEvent)obj4;
			crosshairFistIcon = new BoolField(val.rootPanel, "FIST ICON", "crosshair_fist_icon", false);
			BoolField obj5 = crosshairFistIcon;
			object obj6 = <>c.<>9__37_2;
			if (obj6 == null)
			{
				PostBoolValueChangeEvent val4 = delegate(bool value)
				{
					Transform crosshairFistIconFill = Patches.CrosshairFistIconFill;
					if (crosshairFistIconFill != null)
					{
						ObjectExtensions.SetActive(crosshairFistIconFill.parent, value);
					}
				};
				<>c.<>9__37_2 = val4;
				obj6 = (object)val4;
			}
			obj5.postValueChangeEvent += (PostBoolValueChangeEvent)obj6;
			crosshairWeaponIcon = new BoolField(val.rootPanel, "WEAPON ICON", "crosshair_weapon_icon", false);
			BoolField obj7 = crosshairWeaponIcon;
			object obj8 = <>c.<>9__37_3;
			if (obj8 == null)
			{
				PostBoolValueChangeEvent val5 = delegate(bool value)
				{
					GameObject obj18 = Patches.CrosshairWeaponIcon;
					if (obj18 != null)
					{
						obj18.SetActive(value);
					}
				};
				<>c.<>9__37_3 = val5;
				obj8 = (object)val5;
			}
			obj7.postValueChangeEvent += (PostBoolValueChangeEvent)obj8;
			new ConfigHeader(val.rootPanel, "STATUS HUD", 24);
			hardDamageNumber = new BoolField(val.rootPanel, "HARD DAMAGE INDICATOR", "show_hard_damage", false);
			BoolField obj9 = hardDamageNumber;
			object obj10 = <>c.<>9__37_4;
			if (obj10 == null)
			{
				PostBoolValueChangeEvent val6 = delegate(bool value)
				{
					GameObject obj17 = Patches.HardDamageNumber;
					if (obj17 != null)
					{
						obj17.SetActive(value);
					}
				};
				<>c.<>9__37_4 = val6;
				obj10 = (object)val6;
			}
			obj9.postValueChangeEvent += (PostBoolValueChangeEvent)obj10;
			altIndicatorPosition = new BoolField(val.rootPanel, "ALTERNATE WEAPON ICON POSITION", "alt_equipped_indicator_pos", false);
			BoolField obj11 = altIndicatorPosition;
			object obj12 = <>c.<>9__37_5;
			if (obj12 == null)
			{
				PostBoolValueChangeEvent val7 = delegate(bool value)
				{
					((ConfigField)forceAltRailcannonCharge).interactable = !value;
					Patches.SetIconParent(value);
				};
				<>c.<>9__37_5 = val7;
				obj12 = (object)val7;
			}
			obj11.postValueChangeEvent += (PostBoolValueChangeEvent)obj12;
			forceAltRailcannonCharge = new BoolField(val.rootPanel, "FORCE ALTERNATE RAILCANNON DISPLAY", "force_alt_railcannon_charge", false)
			{
				interactable = !altIndicatorPosition.value
			};
			BoolField obj13 = forceAltRailcannonCharge;
			object obj14 = <>c.<>9__37_6;
			if (obj14 == null)
			{
				PostBoolValueChangeEvent val8 = delegate
				{
					RailcannonMeter instance3 = MonoSingleton<RailcannonMeter>.Instance;
					if (instance3 != null)
					{
						instance3.CheckStatus();
					}
				};
				<>c.<>9__37_6 = val8;
				obj14 = (object)val8;
			}
			obj13.postValueChangeEvent += (PostBoolValueChangeEvent)obj14;
			new ConfigHeader(val.rootPanel, "STYLE HUD", 24);
			new ConfigHeader(val.rootPanel, "CUSTOM STYLE RANK IMAGES", 16);
			new ConfigHeader(val.rootPanel, "MUST BE THE FULL PATH TO A .PNG .JPG OR .EXF FILE\nLEAVE BLANK TO USE DEFAULT IMAGE", 12);
			for (int i = 0; i < 8; i++)
			{
				string prevValue = "";
				int index = i;
				StringField stringField = new StringField(val.rootPanel, GenericExtensions.GetRankText(i), "customrankimages_" + i, "", true);
				SpriteField spriteField = new SpriteField(val.rootPanel, 100f, (Sprite)null);
				stringField.postValueChangeEvent += new PostStringValueChangeEvent(TrySetSprite);
				TrySetSprite(stringField.value);
				void TrySetSprite(string path)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Invalid comparison between Unknown and I4
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Invalid comparison between Unknown and I4
					Error val10 = default(Error);
					Sprite val11 = ImageImporter.LoadFromFile(path, ref val10);
					if ((int)val10 > 1)
					{
						if (val10 - 2 <= 1)
						{
							stringField.value = prevValue;
							return;
						}
					}
					else
					{
						prevValue = path ?? "";
					}
					Sprite[] customStyleImages = CustomStyleImages;
					int num = index;
					Sprite val13 = (spriteField.Sprite = val11);
					customStyleImages[num] = val13;
					StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
					if (instance != null && index != instance.rankIndex)
					{
						instance.rankImage.sprite = spriteField.Sprite ?? instance.ranks[index].sprite;
					}
				}
			}
			new ConfigHeader(val.rootPanel, "CUSTOM STYLE BONUSES", 16);
			new ConfigHeader(val.rootPanel, "NEW STYLE BONUSES ARE AUTOMATICALLY REGISTERED WHEN ENCOUNTERED\nKEEP PLAYING TO FIND ADDITIONAL STYLE BONUSES", 12);
			customStyleBonusesDivision = new ConfigDivision(val.rootPanel, "customstylebonuses");
			((MonoBehaviour)plugin).StartCoroutine(AddStyleBonuses());
			new ConfigHeader(val.rootPanel, "OTHER", 24);
			fupAlert = new BoolField(val.rootPanel, "ROCKET WHIPLASH ALERT", "fup_alert", false);
			new ConfigHeader(val.rootPanel, "VIEWMODEL", 24);
			walkingBob = new BoolField(val.rootPanel, "WALKING BOB", "walkingbob", true);
			BoolField obj15 = walkingBob;
			object obj16 = <>c.<>9__37_8;
			if (obj16 == null)
			{
				PostBoolValueChangeEvent val9 = delegate(bool value)
				{
					//IL_0024: Unknown result type (might be due to invalid IL or missing references)
					NewMovement instance2 = MonoSingleton<NewMovement>.Instance;
					WalkingBob val14 = ((instance2 != null) ? ((Component)instance2).GetComponentInChildren<WalkingBob>(true) : null);
					if (val14 != null)
					{
						((Behaviour)val14).enabled = value;
						((Component)val14).transform.localPosition = Vector3.zero;
					}
				};
				<>c.<>9__37_8 = val9;
				obj16 = (object)val9;
			}
			obj15.postValueChangeEvent += (PostBoolValueChangeEvent)obj16;
			viewmodelAcceleration = new BoolField(val.rootPanel, "WEAPONS FOLLOW SPEED", "viewmodelacceleration", true);
			[IteratorStateMachine(typeof(<<Initialize>g__AddStyleBonuses|37_7>d))]
			static IEnumerator AddStyleBonuses()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<Initialize>g__AddStyleBonuses|37_7>d(0);
			}
		}

		internal static void AddStyleBonusEntry(string id, string defaultValue = null)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			if (registeredStyleIDs.Add(id))
			{
				if (defaultValue == null)
				{
					defaultValue = MonoSingleton<PrefsManager>.Instance.GetStringLocal("BetterWeaponHUDs_stylebonusdefault_" + id, id);
				}
				else
				{
					MonoSingleton<PrefsManager>.Instance.SetStringLocal("BetterWeaponHUDs_stylebonusdefault_" + id, defaultValue);
				}
				StringField val = new StringField((ConfigPanel)(object)customStyleBonusesDivision, Utility.IsNullOrWhiteSpace(defaultValue) ? id : defaultValue, "customstylebonus_" + id, defaultValue, true);
				val.postValueChangeEvent += new PostStringValueChangeEvent(SetStyleBonusText);
				SetStyleBonusText(val.value);
			}
			void SetStyleBonusText(string text)
			{
				DictionaryExtensions.TrySetValue<string, string>(MonoSingleton<StyleHUD>.Instance.idNameDict, id, text, true);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BetterWeaponHUDs";

		public const string PLUGIN_NAME = "BetterWeaponHUDs";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}