Decompiled source of PlayerTweaks v0.1.1

RepoHUDTweaks.dll

Decompiled 10 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Omni.WalkieTalkie;
using RepoHUDTweaks.compatibilityPatches;
using RepoHUDTweaks.patches;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RepoHUDTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RepoHUDTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("537e4ad8-2470-446c-9fa9-0ebfd7b9dd00")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RepoHUDTweaks
{
	public class Helpers
	{
		public static string ToHex(Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return ColorUtility.ToHtmlStringRGB(color);
		}

		public static string ToHexAlpha(Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return ColorUtility.ToHtmlStringRGBA(color);
		}

		public static Color ToColor(string hex, Color fallback)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(hex, ref result))
			{
				return result;
			}
			return fallback;
		}

		public static Color ToColor(string hex, string fallback)
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(hex, ref result))
			{
				return result;
			}
			return ToColor(fallback, Color.white);
		}
	}
	[BepInPlugin("Swaggies.PlayerTweaks", "PlayerTweaks", "0.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string _guid = "Swaggies.PlayerTweaks";

		private const string _name = "PlayerTweaks";

		public const string _ver = "0.1.1";

		private readonly Harmony harmony = new Harmony("Swaggies.PlayerTweaks");

		public static ManualLogSource loggy;

		public static ConfigEntry<string> HealthPlusSignColor;

		public static ConfigEntry<string> HealthColor;

		public static ConfigEntry<string> HealthMaxColor;

		public static ConfigEntry<bool> HealthMaxMatchSlash;

		public static ConfigEntry<bool> HealthPlusSignAsHealthBar;

		public static ConfigEntry<string> StaminaZapSignColor;

		public static ConfigEntry<string> StaminaColor;

		public static ConfigEntry<string> StaminaMaxColor;

		public static ConfigEntry<bool> StaminaMaxMatchSlash;

		public static ConfigEntry<bool> StaminaZapSignAsStaminaBar;

		public static ConfigEntry<int> TumbleUIFrameRate;

		public static ConfigEntry<int> TumbleUIInSpeed;

		public static ConfigEntry<int> TumbleUIOutSpeed;

		public static ConfigEntry<string> TumbleUIColorExitLight;

		public static ConfigEntry<string> TumbleUIColorExitDark;

		public static ConfigEntry<string> TumbleUIColorStunnedLight;

		public static ConfigEntry<string> TumbleUIColorStunnedDark;

		public static ConfigEntry<string> HaulUIColor;

		public static ConfigEntry<string> HaulUIDollarSignColor;

		public static ConfigEntry<string> HaulUISlashColor;

		public static ConfigEntry<string> GoalUIColor;

		public static ConfigEntry<string> GoalUISlashColor;

		public static ConfigEntry<bool> WASDCancelsTumbleImmediately;

		public static ConfigEntry<bool> SpaceToExitCrouch;

		public static ConfigEntry<bool> SprintToExitCrouch;

		public static ConfigEntry<string> AimColorDefault;

		public static ConfigEntry<string> AimColorGrabbable;

		public static ConfigEntry<string> AimColorGrab;

		public static ConfigEntry<string> AimColorRotate;

		public static ConfigEntry<string> AimColorClimbable;

		public static ConfigEntry<string> AimColorClimb;

		public static ConfigEntry<string> HurtVignetteColor;

		public static ConfigEntry<bool> HurtVignetteHealthBased;

		public static ConfigEntry<float> HurtVignetteHealthBasedScaleMax;

		public static ConfigEntry<float> HurtVignetteHealthBasedScaleMin;

		public static ConfigEntry<bool> HurtVignetteWhileDead;

		private void Awake()
		{
			loggy = Logger.CreateLogSource("Swaggies.PlayerTweaks");
			loggy.LogMessage((object)"PlayerTweaks's up and runnin' (0.1.1)");
			harmony.PatchAll(typeof(AimPatch));
			harmony.PatchAll(typeof(EnergyUIPatch));
			harmony.PatchAll(typeof(GoalUIPatch));
			harmony.PatchAll(typeof(HaulUIPatch));
			harmony.PatchAll(typeof(HealthUIPatch));
			harmony.PatchAll(typeof(HurtVignettePatch));
			harmony.PatchAll(typeof(PlayerControllerPatch));
			harmony.PatchAll(typeof(PlayerTumblePatch));
			harmony.PatchAll(typeof(TumbleUIPatch));
			if (Chainloader.PluginInfos.Keys.Contains("omni.repo.walkietalkie"))
			{
				harmony.PatchAll(typeof(WalkieTalkieCompatibilityPatch));
			}
			ConfigHealth();
			ConfigStamina();
			ConfigTumble();
			ConfigHaul();
			ConfigGoal();
			ConfigControls();
			ConfigAim();
			ConfigHurtVignette();
		}

		private void ConfigHealth()
		{
			HealthPlusSignColor = ((BaseUnityPlugin)this).Config.Bind<string>("Health UI", "Plus Sign Color", "#56ff6d", "The color of the plus sign");
			HealthColor = ((BaseUnityPlugin)this).Config.Bind<string>("Health UI", "Health Color", "#56ff6d", "The color of the current health number");
			HealthMaxColor = ((BaseUnityPlugin)this).Config.Bind<string>("Health UI", "Max Health Color", "#008b20", "The color of the max health number");
			HealthMaxMatchSlash = ((BaseUnityPlugin)this).Config.Bind<bool>("Health UI", "Use Same Color for Max and Current HP", false, "If the max health number and current health number use the same color (true in vanilla)");
			HealthPlusSignAsHealthBar = ((BaseUnityPlugin)this).Config.Bind<bool>("Health UI", "Use Plus Sign as Health Bar", true, "If the plus sign should be used as a health bar");
		}

		private void ConfigStamina()
		{
			StaminaZapSignColor = ((BaseUnityPlugin)this).Config.Bind<string>("Stamina UI", "Zap Sign Color", "#fcff00", "The color of the energy sign");
			StaminaColor = ((BaseUnityPlugin)this).Config.Bind<string>("Stamina UI", "Stamina Color", "#fcff00", "The color of the current stamina number");
			StaminaMaxColor = ((BaseUnityPlugin)this).Config.Bind<string>("Stamina UI", "Max Stamina Color", "#ffa500", "The color of the max stamina number");
			StaminaMaxMatchSlash = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina UI", "Use Same Color for Max and Current Stam", false, "If the max stamina number and current stamina number use the same color (true in vanilla)");
			StaminaZapSignAsStaminaBar = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina UI", "Use Zap Sign as Stamina Bar", true, "If the zap sign should be used as a stamina bar");
		}

		private void ConfigTumble()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			TumbleUIFrameRate = ((BaseUnityPlugin)this).Config.Bind<int>("Tumble UI", "Border Animation Frame Rate", 60, new ConfigDescription("The frame rate of the Tumble UI appearing and disappearing (vanilla default is 12.5)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 120), Array.Empty<object>()));
			TumbleUIInSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Tumble UI", "Border Fade-In Speed", 8, new ConfigDescription("How quickly the Tumble UI appears when beginning a tumble (affected by frame rate, vanilla default is 30)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 100), Array.Empty<object>()));
			TumbleUIOutSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Tumble UI", "Border Fade-Out Speed", 10, new ConfigDescription("How quickly the Tumble UI disappears when getting up from a tumble (affected by frame rate, vanilla default is 80)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 100), Array.Empty<object>()));
			TumbleUIColorExitLight = ((BaseUnityPlugin)this).Config.Bind<string>("Tumble UI", "Border Color Light", "#ffb20050", "The lighter color of the border when you're able to exit a tumble.");
			TumbleUIColorExitDark = ((BaseUnityPlugin)this).Config.Bind<string>("Tumble UI", "Border Color Dark", "#ffb20032", "The darker color of the border when you're able to exit a tumble.");
			TumbleUIColorStunnedLight = ((BaseUnityPlugin)this).Config.Bind<string>("Tumble UI", "Border Color Light (Stunned)", "#ff000050", "The lighter color of the border when you're stunned.");
			TumbleUIColorStunnedDark = ((BaseUnityPlugin)this).Config.Bind<string>("Tumble UI", "Border Color Dark (Stunned)", "#ff000032", "The darker color of the border when you're stunned.");
		}

		private void ConfigHaul()
		{
			HaulUIColor = ((BaseUnityPlugin)this).Config.Bind<string>("Haul UI", "Color", "#c9e9e6", "Color for haul UI");
			HaulUIDollarSignColor = ((BaseUnityPlugin)this).Config.Bind<string>("Haul UI", "Dollar Sign Color", "#558b2f", "Color of the dollar sign in the haul UI");
			HaulUISlashColor = ((BaseUnityPlugin)this).Config.Bind<string>("Haul UI", "Slash Color", "#616161", "Color for the slash in the haul UI");
		}

		private void ConfigGoal()
		{
			GoalUIColor = ((BaseUnityPlugin)this).Config.Bind<string>("Goal UI", "Color", "#ff5f00", "Color for goal UI");
			GoalUISlashColor = ((BaseUnityPlugin)this).Config.Bind<string>("Goal UI", "Slash Color", "#7d250b", "Color for the slash in the goal UI");
		}

		private void ConfigControls()
		{
			WASDCancelsTumbleImmediately = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "WASD Cancels Tumble Immediately", false, "If using WASD does NOT wait for you to stop moving before making you get up from a tumble");
			SpaceToExitCrouch = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "Jumping Exits Crouch", false, "If jumping automatically uncrouches you");
			SprintToExitCrouch = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "Sprinting Exits Crouch", false, "If trying to sprint while crouched will automatically uncrouch you");
		}

		private void ConfigAim()
		{
			AimColorDefault = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Default Color", "#ffffff32", "Color for default crosshair");
			AimColorGrabbable = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Object Hover Color", "#fff700ff", "Color for hovering over a grabbable object");
			AimColorGrab = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Object Grab Color", "#ffffff1e", "Color for holding an object");
			AimColorRotate = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Object Rotate Color", "#ffffff1e", "Color for rotating an object");
			AimColorClimbable = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Climb Hover Color", "#005fffff", "Color for hovering over a climbable surface");
			AimColorClimb = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Climb Grab Color", "#005fff49", "Color for climbing");
			AimColorDefault.SettingChanged += delegate
			{
				AimPatch.Update();
			};
			AimColorGrabbable.SettingChanged += delegate
			{
				AimPatch.Update();
			};
			AimColorGrab.SettingChanged += delegate
			{
				AimPatch.Update();
			};
			AimColorRotate.SettingChanged += delegate
			{
				AimPatch.Update();
			};
			AimColorClimbable.SettingChanged += delegate
			{
				AimPatch.Update();
			};
			AimColorClimb.SettingChanged += delegate
			{
				AimPatch.Update();
			};
		}

		private void ConfigHurtVignette()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			HurtVignetteColor = ((BaseUnityPlugin)this).Config.Bind<string>("Hurt Vignette", "Color", "#b20000af", "Color of vignette");
			HurtVignetteHealthBased = ((BaseUnityPlugin)this).Config.Bind<bool>("Hurt Vignette", "Health Based", false, "If the vignette should fade in the more your health goes down");
			HurtVignetteHealthBasedScaleMax = ((BaseUnityPlugin)this).Config.Bind<float>("Hurt Vignette", "Max Scale", 2f, new ConfigDescription("(IF Health Based IS ENABLED ONLY) The scale of the vignette image when at max health.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2.5f), Array.Empty<object>()));
			HurtVignetteHealthBasedScaleMin = ((BaseUnityPlugin)this).Config.Bind<float>("Hurt Vignette", "Min Scale", 1f, new ConfigDescription("(IF Health Based IS ENABLED ONLY) The scale of the vignette image when at 0 health. Lowering this too far might make the vignette cover the screen a lot!", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			HurtVignetteWhileDead = ((BaseUnityPlugin)this).Config.Bind<bool>("Hurt Vignette", "Display While Dead", false, "(IF Health Based IS ENABLED ONLY) If the vignette should remain on screen while you're dead");
			HurtVignetteColor.SettingChanged += delegate
			{
				HurtVignettePatch.SpoofLerp();
			};
		}
	}
	public class UITweak_Health : MonoBehaviour
	{
		public static UITweak_Health instance;

		public const string hexColorPlusSign = "#56ff6d";

		public const string hexColorHealth = "#56ff6d";

		public const string hexColorMaxHealth = "#008b20";

		private const float VISUAL_PLUSSIGN_MIN = 0.03f;

		private const float VISUAL_PLUSSIGN_MAX = 0.98f;

		private HealthUI healthUI;

		private Image plusSign;

		private Image plusSignBackground;

		private TextMeshProUGUI healthText;

		private TextMeshProUGUI healthTextMax;

		private bool initialized;

		private void Start()
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance != (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			instance = this;
			healthUI = ((Component)this).GetComponent<HealthUI>();
			healthText = ((Component)this).GetComponent<TextMeshProUGUI>();
			healthTextMax = ((Component)((Component)this).transform.Find("HealthMax")).GetComponent<TextMeshProUGUI>();
			plusSign = ((Component)((Component)this).transform.Find("Plus")).GetComponent<Image>();
			plusSign.fillAmount = 1f;
			plusSign.fillMethod = (FillMethod)1;
			plusSign.type = (Type)3;
			plusSignBackground = Object.Instantiate<GameObject>(((Component)plusSign).gameObject, ((Component)plusSign).gameObject.transform.parent).GetComponent<Image>();
			((Object)((Component)plusSignBackground).gameObject).name = "Plus Sign Background";
			((Component)plusSignBackground).gameObject.transform.SetSiblingIndex(0);
			((Graphic)plusSignBackground).color = Color.clear;
			initialized = true;
		}

		private void Update()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			if (initialized)
			{
				((TMP_Text)healthText).faceColor = Color32.op_Implicit(Color.white);
				((Graphic)plusSign).color = Helpers.ToColor(Plugin.HealthPlusSignColor.Value, "#56ff6d");
				((Graphic)plusSignBackground).color = ((Graphic)plusSign).color * new Color(1f, 1f, 1f, 0.1f);
				((Graphic)healthTextMax).color = (Plugin.HealthMaxMatchSlash.Value ? Helpers.ToColor(Plugin.HealthColor.Value, "#56ff6d") : Helpers.ToColor(Plugin.HealthMaxColor.Value, "#008b20"));
				((TMP_Text)healthTextMax).text = ((TMP_Text)healthTextMax).text.Replace("#008b20", Plugin.HealthMaxColor.Value);
				if (((SemiUI)healthUI).flashColorTime > 0f)
				{
					((SemiUI)healthUI).originalTextColor = Helpers.ToColor(Plugin.HealthColor.Value, "#56ff6d");
				}
				else
				{
					((Graphic)healthText).color = Helpers.ToColor(Plugin.HealthColor.Value, "#56ff6d");
				}
				if (Plugin.HealthPlusSignAsHealthBar.Value && Object.op_Implicit((Object)(object)PlayerAvatar.instance) && Object.op_Implicit((Object)(object)PlayerAvatar.instance.playerHealth) && !PlayerAvatar.instance.isDisabled)
				{
					int health = PlayerAvatar.instance.playerHealth.health;
					int maxHealth = PlayerAvatar.instance.playerHealth.maxHealth;
					plusSign.fillAmount = NormalizeFillAmount((float)health / (float)maxHealth);
				}
			}
		}

		private float NormalizeFillAmount(float amount)
		{
			if (amount <= 0f)
			{
				return 0f;
			}
			if (amount >= 1f)
			{
				return 1f;
			}
			return Mathf.Lerp(0.03f, 0.98f, amount);
		}
	}
	public class UITweak_Stamina : MonoBehaviour
	{
		public static UITweak_Stamina instance;

		public const string hexColorZapSign = "#fcff00";

		public const string hexColorStamina = "#fcff00";

		public const string hexColorMaxStamina = "#ffa500";

		private const float VISUAL_ZAPSIGN_MIN = 0.04f;

		private const float VISUAL_ZAPSIGN_MAX = 0.97f;

		private EnergyUI energyUI;

		private Image zapSign;

		private Image zapSignBackground;

		private TextMeshProUGUI staminaText;

		private TextMeshProUGUI staminaTextMax;

		private bool initialized;

		private void Start()
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance != (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return;
			}
			instance = this;
			energyUI = ((Component)this).GetComponent<EnergyUI>();
			staminaText = ((Component)this).GetComponent<TextMeshProUGUI>();
			staminaTextMax = ((Component)((Component)this).transform.Find("EnergyMax")).GetComponent<TextMeshProUGUI>();
			zapSign = ((Component)((Component)this).transform.Find("Zap")).GetComponent<Image>();
			zapSign.fillAmount = 1f;
			zapSign.fillMethod = (FillMethod)1;
			zapSign.type = (Type)3;
			zapSignBackground = Object.Instantiate<GameObject>(((Component)zapSign).gameObject, ((Component)zapSign).gameObject.transform.parent).GetComponent<Image>();
			((Object)((Component)zapSignBackground).gameObject).name = "Zap Sign Background";
			((Component)zapSignBackground).gameObject.transform.SetSiblingIndex(0);
			((Graphic)zapSignBackground).color = Color.clear;
			initialized = true;
		}

		private void Update()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if (initialized)
			{
				((Graphic)zapSign).color = Helpers.ToColor(Plugin.StaminaZapSignColor.Value, "#fcff00");
				((Graphic)zapSignBackground).color = ((Graphic)zapSign).color * new Color(1f, 1f, 1f, 0.1f);
				((Graphic)staminaText).color = Helpers.ToColor(Plugin.StaminaZapSignColor.Value, "#fcff00");
				((Graphic)staminaTextMax).color = (Plugin.StaminaMaxMatchSlash.Value ? Helpers.ToColor(Plugin.StaminaColor.Value, "#fcff00") : Helpers.ToColor(Plugin.StaminaMaxColor.Value, "#ffa500"));
				((TMP_Text)staminaTextMax).text = ((TMP_Text)staminaTextMax).text.Replace("orange", Plugin.StaminaMaxColor.Value);
				if (((SemiUI)energyUI).flashColorTime > 0f)
				{
					((SemiUI)energyUI).originalTextColor = Helpers.ToColor(Plugin.StaminaColor.Value, "#fcff00");
				}
				else
				{
					((Graphic)staminaText).color = Helpers.ToColor(Plugin.StaminaColor.Value, "#fcff00");
				}
				if (Plugin.StaminaZapSignAsStaminaBar.Value && Object.op_Implicit((Object)(object)PlayerController.instance) && !PlayerAvatar.instance.isDisabled)
				{
					zapSign.fillAmount = Mathf.Clamp01(PlayerController.instance.EnergyCurrent / PlayerController.instance.EnergyStart);
				}
			}
		}

		private float NormalizeFillAmount(float amount)
		{
			if (amount <= 0f)
			{
				return 0f;
			}
			if (amount >= 1f)
			{
				return 1f;
			}
			return Mathf.Lerp(0.04f, 0.97f, amount);
		}
	}
	public class UITweak_Tumble : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Start>d__7 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public UITweak_Tumble <>4__this;

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

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

			[DebuggerHidden]
			public <Start>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Expected O, but got Unknown
				int num = <>1__state;
				UITweak_Tumble uITweak_Tumble = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => LevelGenerator.Instance.Generated));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)instance != (Object)null)
					{
						Object.Destroy((Object)(object)uITweak_Tumble);
						return false;
					}
					instance = uITweak_Tumble;
					uITweak_Tumble.tumbleUI = ((Component)uITweak_Tumble).GetComponent<TumbleUI>();
					if ((Object)(object)uITweak_Tumble.tumbleUI == (Object)null)
					{
						Object.Destroy((Object)(object)((Component)uITweak_Tumble).gameObject);
						return false;
					}
					uITweak_Tumble.init = true;
					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();
			}
		}

		public const string hexColorExitLight = "#ffb20050";

		public const string hexColorExitDark = "#ffb20032";

		public const string hexColorStunnedLight = "#ff000050";

		public const string hexColorStunnedDark = "#ff000032";

		public static UITweak_Tumble instance;

		private TumbleUI tumbleUI;

		private bool init;

		[IteratorStateMachine(typeof(<Start>d__7))]
		private IEnumerator Start()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Start>d__7(0)
			{
				<>4__this = this
			};
		}

		private void Update()
		{
			//IL_001e: 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)
			//IL_003d: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (init)
			{
				tumbleUI.canExitColor1 = Helpers.ToColor(Plugin.TumbleUIColorExitLight.Value, "#ffb20050");
				tumbleUI.canExitColor2 = Helpers.ToColor(Plugin.TumbleUIColorExitDark.Value, "#ffb20032");
				tumbleUI.canNotExitColor1 = Helpers.ToColor(Plugin.TumbleUIColorStunnedLight.Value, "#ff000050");
				tumbleUI.canNotExitColor2 = Helpers.ToColor(Plugin.TumbleUIColorStunnedLight.Value, "#ff000032");
				tumbleUI.updateTime = 1f / (float)Plugin.TumbleUIFrameRate.Value;
				tumbleUI.introSpeed = Plugin.TumbleUIInSpeed.Value;
				tumbleUI.outroSpeed = Plugin.TumbleUIOutSpeed.Value;
			}
		}

		public void SetTimerMax(float timerMax)
		{
		}

		private void UpdateTumbleTimer()
		{
		}
	}
}
namespace RepoHUDTweaks.patches
{
	[HarmonyPatch(typeof(Aim))]
	internal class AimPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakeP()
		{
			Update();
		}

		public static void Update()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0064: Expected I4, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Aim.instance) || Aim.instance.aimStates.Count == 0)
			{
				return;
			}
			foreach (AimState aimState in Aim.instance.aimStates)
			{
				State state = aimState.State;
				switch ((int)state)
				{
				case 0:
					aimState.Color = Helpers.ToColor(Plugin.AimColorDefault.Value, aimState.Color);
					break;
				case 1:
					aimState.Color = Helpers.ToColor(Plugin.AimColorGrabbable.Value, aimState.Color);
					break;
				case 2:
					aimState.Color = Helpers.ToColor(Plugin.AimColorGrab.Value, aimState.Color);
					break;
				case 3:
					aimState.Color = Helpers.ToColor(Plugin.AimColorRotate.Value, aimState.Color);
					break;
				case 5:
					aimState.Color = Helpers.ToColor(Plugin.AimColorClimbable.Value, aimState.Color);
					break;
				case 6:
					aimState.Color = Helpers.ToColor(Plugin.AimColorClimb.Value, aimState.Color);
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnergyUI))]
	internal class EnergyUIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartP(ref EnergyUI __instance)
		{
			((Component)__instance).gameObject.AddComponent<UITweak_Stamina>();
		}
	}
	[HarmonyPatch(typeof(GoalUI))]
	internal class GoalUIPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdateP(ref GoalUI __instance)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)__instance.Text).text = ((TMP_Text)__instance.Text).text.Replace("#7D250B", Plugin.GoalUISlashColor.Value);
			if (((SemiUI)__instance).flashColorTime > 0f)
			{
				((SemiUI)__instance).originalTextColor = Helpers.ToColor(Plugin.GoalUIColor.Value, "#ff5f00");
			}
			else
			{
				((Graphic)__instance.Text).color = Helpers.ToColor(Plugin.GoalUIColor.Value, "#ff5f00");
			}
		}
	}
	[HarmonyPatch(typeof(HaulUI))]
	internal class HaulUIPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdateP(ref HaulUI __instance)
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)__instance.Text).text = ((TMP_Text)__instance.Text).text.Replace("#558B2F", Plugin.HaulUIDollarSignColor.Value);
			((TMP_Text)__instance.Text).text = ((TMP_Text)__instance.Text).text.Replace("#558b2f", Plugin.HaulUIDollarSignColor.Value);
			((TMP_Text)__instance.Text).text = ((TMP_Text)__instance.Text).text.Replace("#616161", Plugin.HaulUISlashColor.Value);
			if (((SemiUI)__instance).flashColorTime > 0f)
			{
				((SemiUI)__instance).originalTextColor = Helpers.ToColor(Plugin.HaulUIColor.Value, "#c9e9e6");
			}
			else
			{
				((Graphic)__instance.Text).color = Helpers.ToColor(Plugin.HaulUIColor.Value, "#c9e9e6");
			}
		}
	}
	[HarmonyPatch(typeof(HealthUI))]
	internal class HealthUIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartP(ref HealthUI __instance)
		{
			((Component)__instance).gameObject.AddComponent<UITweak_Health>();
		}
	}
	[HarmonyPatch(typeof(HurtVignette))]
	internal class HurtVignettePatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static bool UpdateP(ref HurtVignette __instance)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if (!LevelGenerator.Instance.Generated || SemiFunc.MenuLevel())
			{
				return false;
			}
			if ((Object)(object)PlayerAvatar.instance == (Object)null)
			{
				return false;
			}
			__instance.activeColor = Helpers.ToColor(Plugin.HurtVignetteColor.Value, __instance.activeColor);
			if (!Plugin.HurtVignetteHealthBased.Value || !Object.op_Implicit((Object)(object)PlayerAvatar.instance.playerHealth))
			{
				return true;
			}
			float num = (float)PlayerAvatar.instance.playerHealth.health / (float)PlayerAvatar.instance.playerHealth.maxHealth;
			float num2 = Mathf.Max(Plugin.HurtVignetteHealthBasedScaleMax.Value, Plugin.HurtVignetteHealthBasedScaleMin.Value);
			float num3 = Mathf.Min(Plugin.HurtVignetteHealthBasedScaleMax.Value, Plugin.HurtVignetteHealthBasedScaleMin.Value);
			if (num >= 1f || (PlayerAvatar.instance.isDisabled && !Plugin.HurtVignetteWhileDead.Value))
			{
				Image image = __instance.image;
				((Graphic)image).color = ((Graphic)image).color * new Color(0f, 0f, 0f, 0f);
			}
			else
			{
				((Graphic)__instance.image).color = __instance.activeColor;
			}
			((Transform)__instance.rectTransform).localScale = Vector3.one * Mathf.Lerp(num3, num2, num);
			return false;
		}

		public static void SpoofLerp()
		{
			if (Object.op_Implicit((Object)(object)HurtVignette.instance))
			{
				HurtVignette.instance.lerp = 0.5f;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerController))]
	internal class PlayerControllerPatch
	{
		private static PlayerAvatar Self => PlayerAvatar.instance;

		private static PlayerTumble Tumble => PlayerAvatar.instance.tumble;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdateP(ref PlayerController __instance)
		{
			if (!LevelGenerator.Instance.Generated || SemiFunc.MenuLevel())
			{
				return;
			}
			bool flag = Mathf.Abs(SemiFunc.InputMovementX()) > 0f || Mathf.Abs(SemiFunc.InputMovementY()) > 0f;
			if (Self.isTumbling)
			{
				if (Plugin.WASDCancelsTumbleImmediately.Value)
				{
					bool flag2 = __instance.tumbleInputDisableTimer <= 0f && !Tumble.tumbleOverride && __instance.InputDisableTimer <= 0f;
					if (flag && flag2)
					{
						Tumble.TumbleRequest(false, true);
					}
				}
			}
			else
			{
				if (Plugin.SpaceToExitCrouch.Value && __instance.toggleCrouch && __instance.JumpImpulse)
				{
					__instance.toggleCrouch = false;
				}
				if (Plugin.SprintToExitCrouch.Value && __instance.toggleCrouch && flag && SemiFunc.InputDown((InputKey)15) && __instance.InputDisableTimer <= 0f)
				{
					__instance.toggleCrouch = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerTumble))]
	internal class PlayerTumblePatch
	{
		[HarmonyPatch("TumbleOverrideTimeRPC")]
		[HarmonyPostfix]
		private static void TumbleOverrideTimeRPCP(ref float _time)
		{
			UITweak_Tumble.instance?.SetTimerMax(_time);
		}
	}
	[HarmonyPatch(typeof(TumbleUI))]
	internal class TumbleUIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartP(ref TumbleUI __instance)
		{
			((Component)__instance).gameObject.AddComponent<UITweak_Tumble>();
		}
	}
}
namespace RepoHUDTweaks.compatibilityPatches
{
	internal class WalkieTalkieCompatibilityPatch
	{
		[HarmonyPatch(typeof(WalkieController), "TryCreateBatteryUi")]
		[HarmonyPostfix]
		private static void TryCreateBatteryUiP(ref WalkieBatteryUI ____batteryUi)
		{
			Image[] componentsInChildren = ((Component)____batteryUi).gameObject.GetComponentsInChildren<Image>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Behaviour)componentsInChildren[i]).enabled = false;
			}
		}
	}
}