Decompiled source of Thorn v0.5.1

plugins/Thorn/ThornClientModules.dll

Decompiled 15 hours 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Notiffy.API;
using NukeLib.Game;
using NukeLib.UI;
using NukeLib.Utils;
using TMPro;
using ThornClient;
using ThornClient.Core;
using ThornClient.Core.ConfigurableElements;
using ThornClient.Core.DataTypes;
using ThornClient.HUD;
using ThornClient.HUD.HUDComponents;
using ThornClient.Managers;
using ThornClient.System;
using ThornClientModules.Utility;
using ULTRAKILL.Portal;
using UnityEngine;
using UnityEngine.InputSystem;
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("ThornClientModules")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1a101fb30c637f775dd0986afe4d275e7d2734a3")]
[assembly: AssemblyProduct("ThornClientModules")]
[assembly: AssemblyTitle("ThornClientModules")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 ThornClientModules
{
	public static class ModulesBundleInfo
	{
		public static string workingPath = Assembly.GetExecutingAssembly().Location;

		public static string workingDir = Path.GetDirectoryName(workingPath);
	}
}
namespace ThornClientModules.Utility
{
	public class BossBars : Module
	{
		public static BossBars? Instance;

		public Setting<EnemyList> TargetEnemyTypes;

		public Setting<float> TargetHealthAmount;

		public Setting<EnemyList> ExcludedEnemyTypes;

		internal const string HealthBarObjectName = "HealthBarEnemyIcon";

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "health_bar");

		public override string[] Tags => new string[5] { "blood", "hp", "health", "enemy", "damage" };

		public BossBars()
			: base("thorn.bossBars", "Boss Bars", "Forces boss bar to show for selected enemies. (Configuration needed!)", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			if (Instance == null)
			{
				Instance = this;
				((Configurable)this).CreateHeader("conditions", "Conditions [OR-combined]", "Enemies satisfying one or more conditions below get a boss bar", (HeaderType)0, (SettingGroup)null);
				TargetHealthAmount = ((Configurable)this).CreateSetting<float>("targetHealthAmount", "Has health >=", "Enemies having at least this much health will get a boss bar on them", 9999f, (SettingGroup)null);
				TargetEnemyTypes = ((Configurable)this).CreateSetting<EnemyList>("targetEnemyTypes", "Enemy type whitelist", "Enemies of this type will have boss bars shown", new EnemyList(), (SettingGroup)null);
				((Configurable)this).CreateHeader("exclusions", "Exclusions", "Enemies satisfying one or more conditions below don't get a boss bar", (HeaderType)0, (SettingGroup)null);
				ExcludedEnemyTypes = ((Configurable)this).CreateSetting<EnemyList>("excludedEnemyTypes", "Enemy type blacklist", "Tip: Idols are instakilled, so having a health bar might not help much", new EnemyList(), (SettingGroup)null);
			}
		}

		protected override void OnEnable()
		{
			UpdateAll(enabled: true);
			EnemyEvents.OnSpawn += UpdateEnemy;
			((Setting)TargetEnemyTypes).OnChanged += UpdateAll;
			((Setting)TargetHealthAmount).OnChanged += UpdateAll;
		}

		protected override void OnDisable()
		{
			EnemyEvents.OnSpawn -= UpdateEnemy;
			((Setting)TargetEnemyTypes).OnChanged -= UpdateAll;
			((Setting)TargetHealthAmount).OnChanged -= UpdateAll;
			UpdateAll(enabled: false);
		}

		private void UpdateAll()
		{
			UpdateAll(((Configurable)this).IsEnabled);
		}

		private void UpdateAll(bool enabled)
		{
			EnemyIdentifier[] array = Object.FindObjectsOfType<EnemyIdentifier>();
			foreach (EnemyIdentifier eid in array)
			{
				UpdateEnemy(eid, enabled);
			}
		}

		private void UpdateEnemy(EnemyIdentifier eid)
		{
			UpdateEnemy(eid, ((Configurable)this).IsEnabled);
		}

		private void UpdateEnemy(EnemyIdentifier eid, bool enabled)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			bool flag = enabled && (TargetEnemyTypes.Value.Includes(eid.enemyType) || eid.health >= TargetHealthAmount.Value) && !ExcludedEnemyTypes.Value.Includes(eid.enemyType);
			eid.BossBar(flag);
		}
	}
	public class EnemyTracers : Module
	{
		public Setting<EnhancedColor> TracerColor;

		public Setting<float> LineThickness;

		public Setting<bool> AlwaysOnTop;

		public Setting<int> EnemyCountThreshold;

		public Setting<EnemyList> ForceTraceEnemies;

		public Setting<EnemyList> ForceNotTraceEnemies;

		private readonly Dictionary<int, Collider> _colliderCache = new Dictionary<int, Collider>();

		private readonly Queue<int> _cacheHistory = new Queue<int>();

		private const int MaxCacheSize = 1000;

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "connect");

		public override string[] Tags => new string[4] { "lines", "position", "indicator", "path" };

		public EnemyTracers()
			: base("thorn.enemyTracers", "Enemy Tracers", "Draws lines from you to enemies", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			TracerColor = ((Configurable)this).CreateSetting<EnhancedColor>("tracerColor", "Tracer color", "Color used for the trace lines", EnhancedColorExtensions.ToEnhancedColor(2800935863u, (EnhancedColorMode)0), (SettingGroup)null);
			LineThickness = ((Configurable)this).CreateSetting<float>("lineThickness", "Line thickness", "The pixel width of the tracer lines", 2f, (SettingGroup)null);
			AlwaysOnTop = ((Configurable)this).CreateSetting<bool>("alwaysOnTop", "Always on top", "Render tracer lines through walls and world geometry", true, (SettingGroup)null);
			EnemyCountThreshold = ((Configurable)this).CreateSetting<int>("enemyCountThreshold", "Enemy count threshold", "Display tracers when there are this many enemies left", 5, (SettingGroup)null);
			ForceTraceEnemies = ((Configurable)this).CreateSetting<EnemyList>("forceTraceEnemies", "Force trace enemies", "Always trace these enemy types regardless of the total count/threshold. Useful for e.g. Mindflayers", new EnemyList(), (SettingGroup)null);
			ForceNotTraceEnemies = ((Configurable)this).CreateSetting<EnemyList>("forceNotTraceEnemies", "Force NOT trace enemies", "Blacklist. Enemies in here won't be traced", new EnemyList(), (SettingGroup)null);
		}

		private Vector3 GetEnemyPosition(EnemyIdentifier enemy)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00a7: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemy == (Object)null || (Object)(object)((Component)enemy).transform == (Object)null)
			{
				return Vector3.zero;
			}
			int instanceID = ((Object)enemy).GetInstanceID();
			if (!_colliderCache.TryGetValue(instanceID, out Collider value))
			{
				value = ((Component)enemy).GetComponent<Collider>();
				if ((Object)(object)value != (Object)null)
				{
					_colliderCache[instanceID] = value;
					_cacheHistory.Enqueue(instanceID);
					if (_cacheHistory.Count > 1000)
					{
						int key = _cacheHistory.Dequeue();
						_colliderCache.Remove(key);
					}
				}
			}
			if ((Object)(object)value == (Object)null)
			{
				return ((Component)enemy).transform.position;
			}
			Bounds bounds = value.bounds;
			float y = (((Bounds)(ref bounds)).center - ((Component)enemy).transform.position).y;
			bounds = value.bounds;
			float num = y + ((Bounds)(ref bounds)).extents.y;
			return ((Component)enemy).transform.position + num / 2f * Vector3.up;
		}

		private bool IsEnemyMeaningful(EnemyIdentifier enemy)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemy != (Object)null && !enemy.dead && (Object)(object)((Component)enemy).gameObject != (Object)null && ((Component)enemy).gameObject.activeInHierarchy)
			{
				return !ForceNotTraceEnemies.Value.Includes(enemy.enemyType);
			}
			return false;
		}

		public override void OnRender()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: 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)
			EnemyTracker instance = MonoSingleton<EnemyTracker>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				return;
			}
			Material val = (AlwaysOnTop.Value ? RenderManager.LineTop : RenderManager.Line);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			val.SetPass(0);
			GL.PushMatrix();
			GL.MultMatrix(main.worldToCameraMatrix);
			GL.LoadProjectionMatrix(main.projectionMatrix);
			GL.Begin(7);
			GL.Color(TracerColor.Value.GetCurrentColor());
			float num = LineThickness.Value * 0.01f;
			Vector3 position = ((Component)main).transform.position;
			Vector3 forward = ((Component)main).transform.forward;
			Vector3 val2 = position + forward * 1.5f;
			int count = instance.enemies.Count;
			int num2 = instance.enemies.Where(IsEnemyMeaningful).Count();
			for (int i = 0; i < count; i++)
			{
				EnemyIdentifier val3 = instance.enemies[i];
				if (IsEnemyMeaningful(val3) && (num2 <= EnemyCountThreshold.Value || ForceTraceEnemies.Value.Includes(val3.enemyType)))
				{
					Vector3 enemyPosition = GetEnemyPosition(val3);
					Vector3 val4 = enemyPosition - val2;
					Vector3 val5 = val2 - position;
					Vector3 normalized = ((Vector3)(ref val5)).normalized;
					val5 = Vector3.Cross(val4, normalized);
					Vector3 val6 = ((Vector3)(ref val5)).normalized * (num / 2f);
					GL.Vertex(val2 - val6);
					GL.Vertex(val2 + val6);
					GL.Vertex(enemyPosition + val6);
					GL.Vertex(enemyPosition - val6);
				}
			}
			GL.End();
			GL.PopMatrix();
		}
	}
	public class ExtraBinds : Module
	{
		public Setting<Keybind> RestartKeybind { get; }

		public Setting<Keybind> CheckpointKeybind { get; }

		public Setting<Keybind> AltPauseKeybind { get; }

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "keyboard");

		public override string[] Tags => new string[5] { "utility", "speedrun", "restart", "checkpoint", "pause" };

		private OptionsManager? opts => MonoSingleton<OptionsManager>.Instance;

		public ExtraBinds()
			: base("thorn.extraBinds", "Extra Binds", "Some useful keybinds for (almost) everything", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			RestartKeybind = ((Configurable)this).CreateSetting<Keybind>("restartMission", "Restart mission", "Keybind to restart mission", new Keybind((KeyCode)0, (KeyCode)0), (SettingGroup)null);
			CheckpointKeybind = ((Configurable)this).CreateSetting<Keybind>("restartToCheckpoint", "Checkpoint Keybind", "Goes to the latest checkpoint", new Keybind((KeyCode)0, (KeyCode)0), (SettingGroup)null);
			AltPauseKeybind = ((Configurable)this).CreateSetting<Keybind>("pauseKey", "Alternative pause key", "Pauses the game", new Keybind((KeyCode)0, (KeyCode)0), (SettingGroup)null);
		}

		protected override void OnEnable()
		{
			RestartKeybind.OnPress += Restart;
			CheckpointKeybind.OnPress += Checkpoint;
			AltPauseKeybind.OnPress += TogglePause;
		}

		protected override void OnDisable()
		{
			RestartKeybind.OnPress -= Restart;
			CheckpointKeybind.OnPress -= Checkpoint;
			AltPauseKeybind.OnPress -= TogglePause;
		}

		private void Restart()
		{
			OptionsManager? obj = opts;
			if (obj != null)
			{
				obj.RestartMission();
			}
		}

		private void Checkpoint()
		{
			OptionsManager? obj = opts;
			if (obj != null)
			{
				obj.RestartCheckpoint();
			}
		}

		private void TogglePause()
		{
			if (!((Object)(object)opts == (Object)null))
			{
				if (opts.paused)
				{
					opts.UnPause();
				}
				else
				{
					opts.Pause();
				}
			}
		}
	}
	public class FreezeframeRocketRideHint : Module
	{
		public enum RocketHintShowWhen
		{
			Freezeframe,
			RocketLauncher,
			Always
		}

		public Setting<RocketHintShowWhen> ShowWhen { get; }

		public Setting<EnhancedColor> LineColor { get; }

		public Setting<float> LineThickness { get; }

		public Setting<float> LineWidth { get; }

		public Setting<float> Distance { get; }

		public Setting<float> UpperAngle { get; }

		public Setting<float> LowerAngle { get; }

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "rocket_ride");

		public override string[] Tags => new string[2] { "movement", "freezeframe" };

		private GunControl? gc => MonoSingleton<GunControl>.Instance;

		public FreezeframeRocketRideHint()
			: base("thorn.freezeframeRocketRideHint", "Rocket Ride Hint", "Draws assist lines to help with Freezeframe rocket ride aiming", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			ShowWhen = ((Configurable)this).CreateSetting<RocketHintShowWhen>("showWhen", "Show when holding", "When to show the hint lines", RocketHintShowWhen.Freezeframe, (SettingGroup)null);
			((Setting)ShowWhen).Hints = InterfaceHints.SentenceCaseEnumSubstitutions<RocketHintShowWhen>();
			LineColor = ((Configurable)this).CreateSetting<EnhancedColor>("lineColor", "Line color", "Color used for the hint line.", new EnhancedColor(new Color(0.2509804f, 0.9098039f, 1f), (EnhancedColorMode)0), (SettingGroup)null);
			LineThickness = ((Configurable)this).CreateSetting<float>("lineThickness", "Line thickness", "How thicc the line is", 2f, (SettingGroup)null);
			LineWidth = ((Configurable)this).CreateSetting<float>("lineWidth", "Line width", "How long the line is", 1f, (SettingGroup)null);
			Distance = ((Configurable)this).CreateSetting<float>("distance", "Distance", "How far away from the camera to show the lines", 3f, (SettingGroup)null);
			UpperAngle = ((Configurable)this).CreateSetting<float>("upperAngle", "Upper angle", "The vertical angle of the upper line, in degrees.", 7f, (SettingGroup)null);
			((Setting)UpperAngle).Hints = new InterfaceHints
			{
				Range = Tuple.Create(-90f, 90f)
			};
			LowerAngle = ((Configurable)this).CreateSetting<float>("lowerAngle", "Lower angle", "The vertical angle of the lower line, in degrees.", 34f, (SettingGroup)null);
			((Setting)LowerAngle).Hints = new InterfaceHints
			{
				Range = Tuple.Create(-90f, 90f)
			};
		}

		public override void OnRender()
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			switch (ShowWhen.Value)
			{
			case RocketHintShowWhen.RocketLauncher:
				if ((Object)(object)gc == (Object)null || (Object)(object)gc.currentWeapon == (Object)null || (Object)(object)gc.currentWeapon.GetComponent<RocketLauncher>() == (Object)null)
				{
					return;
				}
				break;
			case RocketHintShowWhen.Freezeframe:
				if ((Object)(object)gc == (Object)null || (Object)(object)gc.currentWeapon == (Object)null || (Object)(object)gc.currentWeapon.GetComponent<RocketLauncher>() == (Object)null || gc.currentWeapon.GetComponent<RocketLauncher>().variation != 0)
				{
					return;
				}
				break;
			}
			Camera main = Camera.main;
			if (!((Object)(object)main == (Object)null) && !((Object)(object)RenderManager.LineTop == (Object)null))
			{
				RenderManager.LineTop.SetPass(0);
				GL.PushMatrix();
				GL.MultMatrix(main.worldToCameraMatrix);
				GL.LoadProjectionMatrix(main.projectionMatrix);
				GL.Begin(7);
				GL.Color(LineColor.Value.GetCurrentColor());
				float thickness = LineThickness.Value * 0.01f;
				Vector3 position = ((Component)main).transform.position;
				Vector3 forward = ((Component)main).transform.forward;
				Vector3 val = new Vector3(forward.x, 0f, forward.z);
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				NewMovement instance = MonoSingleton<NewMovement>.Instance;
				Vector3 gravity = ((instance != null) ? PhysicsExtensions.GetGravityDirection(instance.rb) : Vector3.down);
				DrawHintLine(UpperAngle.Value, position, normalized, gravity, thickness);
				DrawHintLine(LowerAngle.Value, position, normalized, gravity, thickness);
				GL.End();
				GL.PopMatrix();
			}
		}

		private void DrawHintLine(float angleDegrees, Vector3 cameraPos, Vector3 flatForward, Vector3 gravity, float thickness)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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)
			//IL_0058: 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)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00a0: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00d1: 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_00dc: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			float num = angleDegrees * -1f * (MathF.PI / 180f);
			Vector3 val = flatForward * Mathf.Cos(num) - gravity * Mathf.Sin(num);
			Vector3 val2 = cameraPos + val * Distance.Value;
			Vector3 val3 = Vector3.Cross(Vector3.up, flatForward);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			Vector3 val4 = val2 - normalized * (LineWidth.Value / 2f);
			Vector3 val5 = val2 + normalized * (LineWidth.Value / 2f);
			val3 = val2 - cameraPos;
			Vector3 normalized2 = ((Vector3)(ref val3)).normalized;
			val3 = Vector3.Cross(val5 - val4, normalized2);
			Vector3 val6 = ((Vector3)(ref val3)).normalized * (thickness / 2f);
			GL.Vertex(val4 - val6);
			GL.Vertex(val4 + val6);
			GL.Vertex(val5 + val6);
			GL.Vertex(val5 - val6);
		}
	}
	public class FullBright : Module
	{
		private bool _lastFogEnabled;

		private Color _lastAmbientColor = Color.black;

		private bool _isStateSaved;

		public Setting<float> Brightness { get; }

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "light_bulb");

		public override string[] Tags => new string[6] { "light", "vision", "sight", "clear", "see", "illuminate" };

		public override string? CheatReason
		{
			get
			{
				List<string> list = new List<string>(2) { "Level 0-S", "Level 4-3" };
				if (!((Configurable)this).IsEnabled || !list.Contains(SceneHelper.CurrentScene))
				{
					return "";
				}
				return "Darkness is a core challenge of this level";
			}
		}

		public FullBright()
			: base("thorn.fullBright", "FullBright", "Adjust brightness for accessibility", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Brightness = ((Configurable)this).CreateSetting<float>("brightness", "Brightness", "How bright the world should be", 0.2f, (SettingGroup)null);
		}

		protected override void OnEnable()
		{
			//IL_0038: 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)
			SceneUtils.SafeSceneLoaded += OnSceneLoaded;
			Setting<float> brightness = Brightness;
			brightness.OnValueChanged = (Action<float>)Delegate.Combine(brightness.OnValueChanged, new Action<float>(UpdateAmbientLightColor));
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).isLoaded)
			{
				ApplyFullBright();
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			_isStateSaved = false;
			ApplyFullBright();
		}

		private void ApplyFullBright()
		{
			try
			{
				if (!_isStateSaved)
				{
					_lastFogEnabled = RenderSettings.fog;
					_isStateSaved = true;
				}
				RenderSettings.fog = false;
				UpdateAmbientLightColor(Brightness.Value);
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"[FullBright] RenderSettings not ready yet: {arg}");
			}
		}

		private void UpdateAmbientLightColor(float brightness)
		{
			//IL_0009: 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)
			if (_isStateSaved)
			{
				RenderSettings.ambientLight = Color.white * brightness;
				CheatManager.UpdateCheatiness();
			}
		}

		protected override void OnDisable()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			SceneUtils.SafeSceneLoaded -= OnSceneLoaded;
			Setting<float> brightness = Brightness;
			brightness.OnValueChanged = (Action<float>)Delegate.Remove(brightness.OnValueChanged, new Action<float>(UpdateAmbientLightColor));
			if (_isStateSaved)
			{
				RenderSettings.fog = _lastFogEnabled;
				RenderSettings.ambientLight = _lastAmbientColor;
				_isStateSaved = false;
			}
		}
	}
	public class WeaponVariantBinds : Module
	{
		public static WeaponVariantBinds? Instance;

		public const int NumWeapons = 6;

		public const int NumVariants = 3;

		public static readonly string[,] GunIds = new string[6, 3]
		{
			{ "revolver_piercer", "revolver_marksman", "revolver_sharpshooter" },
			{ "shotgun_core_eject", "shotgun_pump_charge", "shotgun_sawed_on" },
			{ "nailgun_attractor", "nailgun_overheat", "nailgun_jumpstart" },
			{ "railcannon_electric", "railcannon_screwdriver", "railcannon_malicious" },
			{ "rocket_freezeframe", "rocket_srs", "rocket_firestarter" },
			{ "spawner_arm_move", "spawner_arm_alter", "spawner_arm_delete" }
		};

		private static readonly string[,] GunNamesRaw = new string[6, 3]
		{
			{ "Piercer Revolver", "Marksman Revolver", "Sharpshooter Revolver" },
			{ "Core Eject Shotgun (or Hammer)", "Pump Charge Shotgun (or Hammer)", "Sawed-on Shotgun (or Hammer)" },
			{ "Attractor Nailgun (or Sawblade Launcher)", "Overheat Nailgun (or Sawblade Launcher)", "Jumpstart Nailgun (or Sawblade Launcher)" },
			{ "Electric Railcannon", "Screwdriver Railcannon", "Malicious Railcannon" },
			{ "Freezeframe Rocket Launcher", "S.R.S. Cannon Rocket Launcher", "Firestarter Rocket Launcher" },
			{ "Move Arm", "Alter Arm", "Delete Arm" }
		};

		private static readonly string[,] GunNames = new string[6, 3]
		{
			{ "<color=#9c9c9c>Revolver    :</color> <color=#40e7ff>Piercer</color>", "<color=#9c9c9c>Revolver    :</color> <color=#44ff45>Marksman</color>", "<color=#9c9c9c>Revolver    :</color> <color=#f00>Sharpshooter</color>" },
			{ "<color=#ffffff>Shotgun     :</color> <color=#40e7ff>Core</color>", "<color=#ffffff>Shotgun     :</color> <color=#44ff45>Pump</color>", "<color=#ffffff>Shotgun     :</color> <color=#f00>Sawed-on</color>" },
			{ "<color=#9c9c9c>Nailgun     :</color> <color=#40e7ff>Attractor</color>", "<color=#9c9c9c>Nailgun     :</color> <color=#44ff45>Overheat</color>", "<color=#9c9c9c>Nailgun     :</color> <color=#f00>Jumpstart</color>" },
			{ "<color=#ffffff>Railcannon  :</color> <color=#40e7ff>Electric</color>", "<color=#ffffff>Railcannon  :</color> <color=#44ff45>Screwdriver</color>", "<color=#ffffff>Railcannon  :</color> <color=#f00>Malicious</color>" },
			{ "<color=#9c9c9c>Rocket      :</color> <color=#40e7ff>Freezeframe</color>", "<color=#9c9c9c>Rocket      :</color> <color=#44ff45>S.R.S.</color>", "<color=#9c9c9c>Rocket      :</color> <color=#f00>Firestarter</color>" },
			{ "<color=#ffffff>Spawner Arm :</color> <color=#40e7ff>Move</color>", "<color=#ffffff>Spawner Arm :</color> <color=#44ff45>Alter</color>", "<color=#ffffff>Spawner Arm :</color> <color=#f00>Delete</color>" }
		};

		public Setting<Keybind>[,] Binds = new Setting<Keybind>[6, 3];

		public Setting<Keybind> GoldSpawnerArmBind;

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "ab_key");

		private GunControl? gcon => MonoSingleton<GunControl>.Instance;

		public WeaponVariantBinds()
			: base("thorn.weaponVariantBinds", "Weapon Variant Binds", "Allows you to bind keys to specific weapons", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			if (Instance != null)
			{
				return;
			}
			Instance = this;
			for (int i = 0; i < 6; i++)
			{
				for (int j = 0; j < 3; j++)
				{
					Binds[i, j] = ((Configurable)this).CreateSetting<Keybind>(GunIds[i, j], GunNames[i, j], "Keybind to switch to " + GunNamesRaw[i, j], new Keybind((KeyCode)0, (KeyCode)0), (SettingGroup)null);
					int i2 = i;
					int j2 = j;
					Binds[i, j].OnPress += delegate
					{
						Switch(i2, j2);
					};
				}
			}
			GoldSpawnerArmBind = ((Configurable)this).CreateSetting<Keybind>("spawner_arm_default", "<color=#ffffff>Spawner Arm :</color> <color=#ffdf3c>Default</color>", "Keybind to switch to Gold Spawner Arm", new Keybind((KeyCode)0, (KeyCode)0), (SettingGroup)null);
			GoldSpawnerArmBind.OnPress += delegate
			{
				Switch(5, 3);
			};
		}

		private void Switch(int weaponIndex, int variantIndex)
		{
			if (!((Configurable)this).IsEnabled)
			{
				return;
			}
			ClickGUI instance = ClickGUI.Instance;
			if (instance != null && ((Configurable)instance).IsEnabled)
			{
				return;
			}
			bool flag = ((weaponIndex >= 6 || weaponIndex < 0) ? true : false);
			if (flag || variantIndex < 0 || (Object)(object)gcon == (Object)null || gcon.slots.Count <= weaponIndex)
			{
				return;
			}
			List<GameObject> list = gcon.slots[weaponIndex];
			if (list == null)
			{
				return;
			}
			for (int i = 0; i < list.Count; i++)
			{
				GameObject val = list[i];
				if (GunHelper.GetVariation(val) == variantIndex)
				{
					gcon.ForceWeapon(val, true);
					break;
				}
			}
		}
	}
	public class Zoom : Module
	{
		public Setting<float> ZoomFov { get; }

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "loupe");

		public override string[] Tags => new string[3] { "magnifier", "close", "see" };

		public Zoom()
			: base("thorn.zoom", "Zoom", "Look more closely. Note: zooming only happens when the game is running, so use a keybind to toggle it", (ModuleCategory)0, (KeyCode)0, (KeyCode)0, true, true)
		{
			ZoomFov = ((Configurable)this).CreateSetting<float>("zoomFov", "Zoom FOV", "Zoom amount. Lower = more zoomed in", 30f, (SettingGroup)null);
		}

		protected override void OnEnable()
		{
			UpdateZoom(ZoomFov.Value);
			Setting<float> zoomFov = ZoomFov;
			zoomFov.OnValueChanged = (Action<float>)Delegate.Combine(zoomFov.OnValueChanged, new Action<float>(UpdateZoom));
		}

		private void UpdateZoom(float value)
		{
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				instance.Zoom(ZoomFov.Value);
			}
		}

		protected override void OnDisable()
		{
			Setting<float> zoomFov = ZoomFov;
			zoomFov.OnValueChanged = (Action<float>)Delegate.Remove(zoomFov.OnValueChanged, new Action<float>(UpdateZoom));
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				instance.StopZoom();
			}
		}
	}
}
namespace ThornClientModules.Render
{
	public class CustomStyleRanks : Module
	{
		public static readonly string DefaultStyleDir = Path.Combine(ModulesBundleInfo.workingDir, "assets", "skins", "style_ranks", "glow");

		public readonly Dictionary<string, Setting<FilePath>> Ranks = new Dictionary<string, Setting<FilePath>>();

		public static readonly string[] RankKeys = new string[8] { "RankD", "RankC", "RankB", "RankA", "RankS", "RankSS", "RankSSS", "RankU" };

		private readonly Dictionary<string, Sprite> DefaultSprites = new Dictionary<string, Sprite>();

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "style_rank");

		public override string[] Tags => new string[10] { "rank title swapper", "tier", "ultrakill", "ssshitstorm", "ssadistic", "supreme", "anarchic", "brutal", "chaotic", "destructive" };

		public CustomStyleRanks()
			: base("thorn.customStyleRank", "Custom Style Ranks", "Changes the style rank image", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			Ranks["RankD"] = ((Configurable)this).CreateSetting<FilePath>("rankDImage", "<color=#0094ff>D</color>ESTRUCTIVE", "Image for the DESTRUCTIVE style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankD.png")), (SettingGroup)null);
			Ranks["RankC"] = ((Configurable)this).CreateSetting<FilePath>("rankCImage", "<color=#4cff00>C</color>HAOTIC", "Image for the CHAOTIC style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankC.png")), (SettingGroup)null);
			Ranks["RankB"] = ((Configurable)this).CreateSetting<FilePath>("rankBImage", "<color=#ffd800>B</color>RUTAL", "Image for the BRUTAL style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankB.png")), (SettingGroup)null);
			Ranks["RankA"] = ((Configurable)this).CreateSetting<FilePath>("rankAImage", "<color=#ff6a00>A</color>NARCHIC", "Image for the ANARCHIC style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankA.png")), (SettingGroup)null);
			Ranks["RankS"] = ((Configurable)this).CreateSetting<FilePath>("rankSImage", "<color=#ff0000>S</color>UPREME", "Image for the SUPREME style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankS.png")), (SettingGroup)null);
			Ranks["RankSS"] = ((Configurable)this).CreateSetting<FilePath>("rankSSImage", "<color=#d10000>S</color><color=#ff0000>S</color>ADISTIC", "Image for the SSADISTIC style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankSS.png")), (SettingGroup)null);
			Ranks["RankSSS"] = ((Configurable)this).CreateSetting<FilePath>("rankSSSImage", "<color=#d10000>SS</color><color=#ff0000>S</color>HITSTORM", "Image for the SSSHITSTORM style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankSSS.png")), (SettingGroup)null);
			Ranks["RankU"] = ((Configurable)this).CreateSetting<FilePath>("rankUImage", "<color=#ffd800>ULTRAKILL</color>", "Image for the ULTRAKILL style rank", FileSystemPathExtensions.ToFilePath(Path.Combine(DefaultStyleDir, "RankU.png")), (SettingGroup)null);
		}

		protected override void OnEnable()
		{
			SaveDefaultRanks();
			foreach (Setting<FilePath> value in Ranks.Values)
			{
				((Setting)value).OnChanged += DoReplacement;
			}
			SceneUtils.SafeSceneLoadedNoParam += OnSceneLoaded;
			DoReplacement();
		}

		protected override void OnDisable()
		{
			foreach (Setting<FilePath> value in Ranks.Values)
			{
				((Setting)value).OnChanged -= DoReplacement;
			}
			SceneUtils.SafeSceneLoadedNoParam -= OnSceneLoaded;
			LoadDefaultRanks();
		}

		private void OnSceneLoaded()
		{
			SaveDefaultRanks();
			DoReplacement();
		}

		private void SaveDefaultRanks()
		{
			StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (StyleRank rank in instance.ranks)
			{
				string name = ((Object)rank.sprite).name;
				if (RankKeys.Contains(name))
				{
					DefaultSprites[name] = rank.sprite;
				}
			}
		}

		private void LoadDefaultRanks()
		{
			StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (StyleRank rank in instance.ranks)
			{
				string name = ((Object)rank.sprite).name;
				if (DefaultSprites.ContainsKey(name))
				{
					rank.sprite = DefaultSprites[name];
				}
			}
		}

		private void DoReplacement()
		{
			StyleHUD instance = MonoSingleton<StyleHUD>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (StyleRank rank in instance.ranks)
			{
				string name = ((Object)rank.sprite).name;
				if (Ranks.TryGetValue(name, out Setting<FilePath> value))
				{
					if (!DefaultSprites.ContainsValue(rank.sprite))
					{
						Object.Destroy((Object)(object)rank.sprite);
					}
					string text = ((object)value.Value).ToString();
					if (File.Exists(text))
					{
						Sprite val = FileAssetUtils.LoadNewSprite(text, 100f, (SpriteMeshType)1);
						((Object)val).name = name;
						rank.sprite = val;
					}
				}
			}
		}
	}
	public class Edges : Module
	{
		private class EnemyWireframizer : MonoBehaviour
		{
			public EnemyIdentifier? TargetEnemyId;

			private Renderer[] _renderers = Array.Empty<Renderer>();

			private void Start()
			{
				if (!((Object)(object)TargetEnemyId == (Object)null))
				{
					ExecutionUtils.RunNextFrame((Action)FindReplacementTargets);
				}
			}

			private void FindReplacementTargets()
			{
				GameObject gameObject = ((Component)this).gameObject;
				_renderers = ((gameObject == null) ? null : gameObject.GetComponentsInChildren<Renderer>(true)?.Where((Renderer r) => (r is MeshRenderer || r is SkinnedMeshRenderer) ? true : false)?.ToArray()) ?? Array.Empty<Renderer>();
			}

			private void Update()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)TargetEnemyId == (Object)null || _renderers.Length == 0)
				{
					return;
				}
				Material enemyMat = GetEnemyMat((EnemyType)(TargetEnemyId.puppet ? 36 : ((int)TargetEnemyId.enemyType)), TargetEnemyId.sandified);
				if ((Object)(object)enemyMat == (Object)null)
				{
					return;
				}
				Renderer[] renderers = _renderers;
				foreach (Renderer val in renderers)
				{
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					List<Material> list = new List<Material>();
					val.GetSharedMaterials(list);
					int count = list.Count;
					if (count == 0)
					{
						continue;
					}
					bool flag = false;
					for (int j = 0; j < count; j++)
					{
						if ((Object)(object)list[j] != (Object)(object)enemyMat)
						{
							flag = true;
							break;
						}
					}
					if (flag)
					{
						Material[] array = (Material[])(object)new Material[count];
						for (int k = 0; k < count; k++)
						{
							array[k] = enemyMat;
						}
						val.sharedMaterials = array;
					}
				}
			}
		}

		public static Edges? Instance;

		public Setting<float> EdgeThickness;

		public Setting<EnhancedColor> FillColor;

		public Setting<EnhancedColor> SandedFillColor;

		public Setting<bool> SwapEdgeAndFill;

		public Dictionary<EnemyType, Setting<EnhancedColor>> EnemyEdgeColors = new Dictionary<EnemyType, Setting<EnhancedColor>>();

		private static readonly Dictionary<EnemyType, EnhancedColor> _defaultEnemyColors = new Dictionary<EnemyType, EnhancedColor>
		{
			{
				(EnemyType)0,
				EnhancedColorExtensions.ToEnhancedColor(16749570, (EnhancedColorMode)0)
			},
			{
				(EnemyType)1,
				EnhancedColorExtensions.ToEnhancedColor(10092799, (EnhancedColorMode)0)
			},
			{
				(EnemyType)2,
				EnhancedColorExtensions.ToEnhancedColor(16739699, (EnhancedColorMode)0)
			},
			{
				(EnemyType)3,
				EnhancedColorExtensions.ToEnhancedColor(11392369, (EnhancedColorMode)0)
			},
			{
				(EnemyType)4,
				EnhancedColorExtensions.ToEnhancedColor(16765339, (EnhancedColorMode)0)
			},
			{
				(EnemyType)5,
				EnhancedColorExtensions.ToEnhancedColor(65483, (EnhancedColorMode)0)
			},
			{
				(EnemyType)6,
				EnhancedColorExtensions.ToEnhancedColor(16544015, (EnhancedColorMode)0)
			},
			{
				(EnemyType)7,
				EnhancedColorExtensions.ToEnhancedColor(16762377, (EnhancedColorMode)0)
			},
			{
				(EnemyType)8,
				EnhancedColorExtensions.ToEnhancedColor(16711680, (EnhancedColorMode)0)
			},
			{
				(EnemyType)9,
				EnhancedColorExtensions.ToEnhancedColor(43263, (EnhancedColorMode)0)
			},
			{
				(EnemyType)10,
				EnhancedColorExtensions.ToEnhancedColor(8224125, (EnhancedColorMode)0)
			},
			{
				(EnemyType)11,
				EnhancedColorExtensions.ToEnhancedColor(15794431, (EnhancedColorMode)0)
			},
			{
				(EnemyType)12,
				EnhancedColorExtensions.ToEnhancedColor(16777002, (EnhancedColorMode)0)
			},
			{
				(EnemyType)13,
				EnhancedColorExtensions.ToEnhancedColor(16733770, (EnhancedColorMode)0)
			},
			{
				(EnemyType)14,
				EnhancedColorExtensions.ToEnhancedColor(12089388, (EnhancedColorMode)0)
			},
			{
				(EnemyType)15,
				EnhancedColorExtensions.ToEnhancedColor(6138367, (EnhancedColorMode)0)
			},
			{
				(EnemyType)16,
				EnhancedColorExtensions.ToEnhancedColor(15968822, (EnhancedColorMode)0)
			},
			{
				(EnemyType)17,
				EnhancedColorExtensions.ToEnhancedColor(10903895, (EnhancedColorMode)0)
			},
			{
				(EnemyType)18,
				EnhancedColorExtensions.ToEnhancedColor(8829439, (EnhancedColorMode)0)
			},
			{
				(EnemyType)19,
				EnhancedColorExtensions.ToEnhancedColor(16740789, (EnhancedColorMode)0)
			},
			{
				(EnemyType)20,
				EnhancedColorExtensions.ToEnhancedColor(13631232, (EnhancedColorMode)0)
			},
			{
				(EnemyType)21,
				EnhancedColorExtensions.ToEnhancedColor(9404671, (EnhancedColorMode)0)
			},
			{
				(EnemyType)22,
				EnhancedColorExtensions.ToEnhancedColor(16711680, (EnhancedColorMode)0)
			},
			{
				(EnemyType)23,
				EnhancedColorExtensions.ToEnhancedColor(4259648, (EnhancedColorMode)0)
			},
			{
				(EnemyType)24,
				EnhancedColorExtensions.ToEnhancedColor(4259648, (EnhancedColorMode)0)
			},
			{
				(EnemyType)25,
				EnhancedColorExtensions.ToEnhancedColor(16755403, (EnhancedColorMode)0)
			},
			{
				(EnemyType)26,
				EnhancedColorExtensions.ToEnhancedColor(50104, (EnhancedColorMode)0)
			},
			{
				(EnemyType)27,
				EnhancedColorExtensions.ToEnhancedColor(50104, (EnhancedColorMode)0)
			},
			{
				(EnemyType)28,
				EnhancedColorExtensions.ToEnhancedColor(16726272, (EnhancedColorMode)0)
			},
			{
				(EnemyType)29,
				EnhancedColorExtensions.ToEnhancedColor(16757538, (EnhancedColorMode)0)
			},
			{
				(EnemyType)30,
				EnhancedColorExtensions.ToEnhancedColor(16749410, (EnhancedColorMode)0)
			},
			{
				(EnemyType)31,
				EnhancedColorExtensions.ToEnhancedColor(15779030, (EnhancedColorMode)0)
			},
			{
				(EnemyType)32,
				EnhancedColorExtensions.ToEnhancedColor(16777215, (EnhancedColorMode)0)
			},
			{
				(EnemyType)33,
				EnhancedColorExtensions.ToEnhancedColor(16747833, (EnhancedColorMode)0)
			},
			{
				(EnemyType)34,
				EnhancedColorExtensions.ToEnhancedColor(16722988, (EnhancedColorMode)0)
			},
			{
				(EnemyType)35,
				EnhancedColorExtensions.ToEnhancedColor(14543091, (EnhancedColorMode)0)
			},
			{
				(EnemyType)36,
				EnhancedColorExtensions.ToEnhancedColor(13303808, (EnhancedColorMode)0)
			},
			{
				(EnemyType)37,
				EnhancedColorExtensions.ToEnhancedColor(16716869, (EnhancedColorMode)0)
			},
			{
				(EnemyType)38,
				EnhancedColorExtensions.ToEnhancedColor(16777178, (EnhancedColorMode)0)
			},
			{
				(EnemyType)39,
				EnhancedColorExtensions.ToEnhancedColor(16714496, (EnhancedColorMode)0)
			},
			{
				(EnemyType)40,
				EnhancedColorExtensions.ToEnhancedColor(16304690, (EnhancedColorMode)0)
			},
			{
				(EnemyType)41,
				EnhancedColorExtensions.ToEnhancedColor(12607913, (EnhancedColorMode)0)
			},
			{
				(EnemyType)42,
				EnhancedColorExtensions.ToEnhancedColor(16733770, (EnhancedColorMode)0)
			}
		};

		private static Dictionary<(EnemyType, bool), Material> _enemyMatCache = new Dictionary<(EnemyType, bool), Material>();

		private readonly Dictionary<EnemyType, Action> _onColorChangedActions = new Dictionary<EnemyType, Action>();

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "icosahedron");

		public override string[] Tags => new string[2] { "wireframe", "world" };

		public unsafe Edges()
			: base("thorn.edges", "Edges (Enemies)", "Applies wireframe shader to enemies", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			if (Instance != null)
			{
				return;
			}
			Instance = this;
			((Configurable)this).CreateHeader("enemies", "Enemies", "Changes applied to newly spawned enemies", (HeaderType)0, (SettingGroup)null);
			EdgeThickness = ((Configurable)this).CreateSetting<float>("edgeThickness", "Edge thickness", "How thick the edge lines are", 2f, (SettingGroup)null);
			SettingGroup val = ((Configurable)this).CreateGroup("enemyColors", "Enemy Colors", "Colors for each enemy type", (SettingGroup)null);
			FillColor = ((Configurable)this).CreateSetting<EnhancedColor>("fillColor", "Fill color", "The color that fills the faces", new EnhancedColor(0f, 0f, 0f, 1f, (EnhancedColorMode)0), (SettingGroup)null);
			SandedFillColor = ((Configurable)this).CreateSetting<EnhancedColor>("fillColorSanded", "Sanded fill color", "The color that fills the faces when enemy is sanded", new EnhancedColor(0.941f, 0.808f, 0.463f, 0.9f, (EnhancedColorMode)0), (SettingGroup)null);
			SwapEdgeAndFill = ((Configurable)this).CreateSetting<bool>("swapEdgeAndFill", "Swap edge and fill colors", "Makes edge colors apply to fill and fill color apply to edges", false, (SettingGroup)null);
			foreach (EnemyType item in from EnemyType e in Enum.GetValues(typeof(EnemyType))
				orderby ((object)(*(EnemyType*)(&e))/*cast due to .constrained prefix*/).ToString()
				select e)
			{
				EnhancedColor value;
				EnhancedColor val2 = (EnhancedColor)(_defaultEnemyColors.TryGetValue(item, out value) ? ((object)value) : ((object)new EnhancedColor(Color.red, (EnhancedColorMode)0)));
				Setting<EnhancedColor> value2 = ((Configurable)this).CreateSetting<EnhancedColor>($"enemyColor_{item}", $"{item}", $"The edge color for {item}", val2, val);
				EnemyEdgeColors[item] = value2;
			}
			((Setting)SwapEdgeAndFill).OnChanged += UpdateAllMats;
		}

		private void UpdateAllMats()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<(EnemyType, bool), Material> item3 in _enemyMatCache)
			{
				(EnemyType, bool) key = item3.Key;
				EnemyType item = key.Item1;
				bool item2 = key.Item2;
				Material value = item3.Value;
				Setting<EnhancedColor> value2;
				Color val = (EnemyEdgeColors.TryGetValue(item, out value2) ? value2.Value.GetCurrentColor() : Color.red);
				Color currentColor = (item2 ? SandedFillColor : FillColor).Value.GetCurrentColor();
				value.SetColor(SwapEdgeAndFill.Value ? "_WireframeColor" : "_FillColor", currentColor);
				value.SetColor(SwapEdgeAndFill.Value ? "_FillColor" : "_WireframeColor", val);
				value.SetFloat("_WireframeThickness", EdgeThickness.Value);
			}
		}

		public static Material? GetEnemyMat(EnemyType enemyType, bool isSanded = false)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0067: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (Instance == null)
			{
				return null;
			}
			(EnemyType, bool) key = (enemyType, isSanded);
			if (_enemyMatCache.TryGetValue(key, out Material value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Material material = EffectManager.GetMaterial("GeometryWireframeMaterial");
			if ((Object)(object)material == (Object)null)
			{
				Plugin.Log.LogError((object)"[Edges] Failed to load GeometryWireframeMaterial asset!");
				return null;
			}
			EnhancedColor val = new EnhancedColor(Color.red, (EnhancedColorMode)0);
			if (Instance.EnemyEdgeColors.TryGetValue(enemyType, out Setting<EnhancedColor> value2))
			{
				val = value2.Value;
			}
			Material val2 = new Material(material)
			{
				color = val.GetCurrentColor()
			};
			Color currentColor = val.GetCurrentColor();
			Color currentColor2 = (isSanded ? Instance.SandedFillColor : Instance.FillColor).Value.GetCurrentColor();
			val2.SetColor("_WireframeColor", Instance.SwapEdgeAndFill.Value ? currentColor2 : currentColor);
			val2.SetColor("_FillColor", Instance.SwapEdgeAndFill.Value ? currentColor : currentColor2);
			val2.SetFloat("_WireframeThickness", Instance.EdgeThickness.Value);
			_enemyMatCache[key] = val2;
			return val2;
		}

		private void OnEnemyColorChanged(EnemyType enemyType, EnhancedColor newColor)
		{
			//IL_001b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			bool[] array = new bool[2] { false, true };
			foreach (bool flag in array)
			{
				if (_enemyMatCache.TryGetValue((enemyType, flag), out Material value) && (Object)(object)value != (Object)null)
				{
					value.color = newColor.GetCurrentColor();
					Color currentColor = newColor.GetCurrentColor();
					Color currentColor2 = (flag ? SandedFillColor : FillColor).Value.GetCurrentColor();
					value.SetColor(SwapEdgeAndFill.Value ? "_WireframeColor" : "_FillColor", currentColor2);
					value.SetColor(SwapEdgeAndFill.Value ? "_FillColor" : "_WireframeColor", currentColor);
					value.SetFloat("_WireframeThickness", EdgeThickness.Value);
				}
			}
		}

		protected override void OnEnable()
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			EnemyEvents.OnSpawn += AddWireframizer;
			((Setting)FillColor).OnChanged += UpdateAllMats;
			FillColor.OnEffectiveValueChanged += UpdateAllMats;
			((Setting)SandedFillColor).OnChanged += UpdateAllMats;
			SandedFillColor.OnEffectiveValueChanged += UpdateAllMats;
			((Setting)EdgeThickness).OnChanged += UpdateAllMats;
			UpdateAllMats();
			foreach (KeyValuePair<EnemyType, Setting<EnhancedColor>> enemyEdgeColor in EnemyEdgeColors)
			{
				EnemyType enemyType = enemyEdgeColor.Key;
				Setting<EnhancedColor> setting = enemyEdgeColor.Value;
				Action action = delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					OnEnemyColorChanged(enemyType, setting.Value);
				};
				_onColorChangedActions[enemyType] = action;
				((Setting)setting).OnChanged += action;
				setting.OnEffectiveValueChanged += action;
				OnEnemyColorChanged(enemyType, setting.Value);
			}
		}

		protected override void OnDisable()
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			EnemyEvents.OnSpawn -= AddWireframizer;
			((Setting)FillColor).OnChanged -= UpdateAllMats;
			FillColor.OnEffectiveValueChanged -= UpdateAllMats;
			((Setting)SandedFillColor).OnChanged -= UpdateAllMats;
			SandedFillColor.OnEffectiveValueChanged -= UpdateAllMats;
			((Setting)EdgeThickness).OnChanged -= UpdateAllMats;
			foreach (KeyValuePair<EnemyType, Setting<EnhancedColor>> enemyEdgeColor in EnemyEdgeColors)
			{
				if (_onColorChangedActions.TryGetValue(enemyEdgeColor.Key, out Action value))
				{
					((Setting)enemyEdgeColor.Value).OnChanged -= value;
					enemyEdgeColor.Value.OnEffectiveValueChanged -= value;
				}
			}
			_onColorChangedActions.Clear();
		}

		private void AddWireframizer(EnemyIdentifier eid)
		{
			((Component)eid).gameObject.AddComponent<EnemyWireframizer>().TargetEnemyId = eid;
		}
	}
	public class EdgesWorld : Module
	{
		public Setting<EnhancedColor> FillColor;

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "icosahedron");

		public override string[] Tags => new string[2] { "wireframe", "world" };

		public EdgesWorld()
			: base("thorn.edgesWorld", "Edges (World)", "Applies wireframe shader to the world", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			FillColor = ((Configurable)this).CreateSetting<EnhancedColor>("fillColor", "Fill color", "The color that fills in the surfaces", EnhancedColorExtensions.ToEnhancedColor(7, (EnhancedColorMode)0), (SettingGroup)null);
		}

		protected override void OnEnable()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			Camera.onPreRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreRender, (Delegate?)new CameraCallback(PreCamHook));
			Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(PostCamHook));
		}

		protected override void OnDisable()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			Camera.onPreRender = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreRender, (Delegate?)new CameraCallback(PreCamHook));
			Camera.onPostRender = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(PostCamHook));
		}

		private void PreCamHook(Camera cam)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)cam != (Object)(object)Camera.main))
			{
				cam.clearFlags = (CameraClearFlags)2;
				cam.backgroundColor = FillColor.Value.GetCurrentColor();
				GL.wireframe = true;
			}
		}

		private void PostCamHook(Camera cam)
		{
			if (!((Object)(object)cam != (Object)(object)Camera.main))
			{
				GL.wireframe = false;
			}
		}
	}
	public class ParryEffect : Module
	{
		public Setting<float> Fov { get; }

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "feedbacker");

		public override string[] Tags => new string[2] { "punch", "fov" };

		public ParryEffect()
			: base("thorn.parryEffect", "Parry Effect", "Adds a slight zoom to make parries feel more impactful", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			Fov = ((Configurable)this).CreateSetting<float>("fov", "FOV adjustment", "The Field of view shift when parrying", -10f, (SettingGroup)null);
		}

		protected override void OnEnable()
		{
			PunchEvents.OnParry += PerformEffects;
		}

		protected override void OnDisable()
		{
			PunchEvents.OnParry -= PerformEffects;
		}

		private IEnumerator StopZoomNextFrame()
		{
			yield return null;
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.StopZoom();
			}
		}

		private void PerformEffects()
		{
			CameraController instance = MonoSingleton<CameraController>.Instance;
			if ((Object)(object)instance != (Object)null && !Mathf.Approximately(Fov.Value, 0f))
			{
				float num = instance.cam.fieldOfView + Fov.Value;
				instance.Zoom(num);
				instance.cam.fieldOfView = num;
				((MonoBehaviour)Plugin.Instance).StartCoroutine(StopZoomNextFrame());
			}
		}
	}
	public class UIScaler : Module
	{
		private float _savedDefaultScale;

		public Setting<float> Scale { get; }

		public Setting<float> HUDScale { get; }

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "screen_scale");

		public override string[] Tags => new string[3] { "interface", "scale", "hud" };

		public UIScaler()
			: base("thorn.uiScaler", "UI Scaler", "Changes the scale of the user interface", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			Scale = ((Configurable)this).CreateSetting<float>("scale", "Scale", "Smaller = smaller UI elements", 1f, (SettingGroup)null);
			HUDScale = ((Configurable)this).CreateSetting<float>("hudScale", "Side HUD Scale", "Changes the size of the 3D HUD", 1f, (SettingGroup)null);
			((Setting)HUDScale).Hints = InterfaceHints.RangeHint(0.1f, 1.5f);
		}

		protected override void OnEnable()
		{
			UpdateScale(Scale.Value);
			UpdateHUDScale(HUDScale.Value);
			SceneUtils.SafeSceneLoaded += UpdateAllScales;
			Setting<float> scale = Scale;
			scale.OnValueChanged = (Action<float>)Delegate.Combine(scale.OnValueChanged, new Action<float>(UpdateScale));
			Setting<float> hUDScale = HUDScale;
			hUDScale.OnValueChanged = (Action<float>)Delegate.Combine(hUDScale.OnValueChanged, new Action<float>(UpdateHUDScale));
		}

		private void UpdateScale(float value)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			CanvasController instance = MonoSingleton<CanvasController>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				CanvasScaler component = ((Component)instance).gameObject.GetComponent<CanvasScaler>();
				if ((int)component.uiScaleMode == 1)
				{
					_savedDefaultScale = component.scaleFactor;
				}
				component.uiScaleMode = (ScaleMode)(Mathf.Approximately(value, 1f) ? 1 : 0);
				PrefsManager instance2 = MonoSingleton<PrefsManager>.Instance;
				float num = (((Object)(object)instance2 == (Object)null) ? 1920f : instance2.GetFloatLocal("resolutionWidth", 0f));
				if ((int)component.uiScaleMode == 0)
				{
					component.scaleFactor = num / (float)Screen.width * 1.5f * value;
				}
			}
		}

		private void UpdateAllScales(Scene scene, LoadSceneMode mode)
		{
			UpdateScale(Scale.Value);
			UpdateHUDScale(HUDScale.Value);
		}

		private void UpdateHUDScale(float value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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)
			if (SceneUtils.IsSafe())
			{
				Scene activeScene = SceneManager.GetActiveScene();
				GameObject? obj = (from val2 in ((Scene)(ref activeScene)).GetRootGameObjects()
					where ((Object)val2).name == "Player"
					select val2).FirstOrDefault();
				GameObject val = ((obj != null) ? UIUtils.FindRecursive(obj, "Main Camera/HUD Camera/HUD") : null);
				if (!((Object)(object)val == (Object)null))
				{
					val.transform.localScale = new Vector3(value, value, 1f);
				}
			}
		}

		protected override void OnDisable()
		{
			Setting<float> scale = Scale;
			scale.OnValueChanged = (Action<float>)Delegate.Remove(scale.OnValueChanged, new Action<float>(UpdateScale));
			Setting<float> hUDScale = HUDScale;
			hUDScale.OnValueChanged = (Action<float>)Delegate.Remove(hUDScale.OnValueChanged, new Action<float>(UpdateHUDScale));
			SceneUtils.SafeSceneLoaded -= UpdateAllScales;
			UpdateScale(1f);
			UpdateHUDScale(1f);
		}
	}
	public class ViewmodelTweaks : Module
	{
		public static ViewmodelTweaks? Instance;

		private static readonly Vector3[,,] BasePositions = new Vector3[2, 5, 2]
		{
			{
				{
					new Vector3(0.42f, -0.6f, 1.49f),
					new Vector3(0.5f, -0.7f, 1.49f)
				},
				{
					new Vector3(0.42f, -0.6f, 1.49f),
					new Vector3(0.42f, -0.6f, 1.49f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				}
			},
			{
				{
					new Vector3(0.09f, -0.9f, 1.49f),
					new Vector3(0.09f, -0.9f, 1.49f)
				},
				{
					new Vector3(0f, -0.85f, 1.65f),
					new Vector3(-0.18f, -0.8f, 1.65f)
				},
				{
					new Vector3(-0.39f, -0.1f, 0.2f),
					new Vector3(-0.5f, -0.1f, 0.2f)
				},
				{
					new Vector3(-0.6f, -0.4f, 0.1f),
					new Vector3(-0.6f, -0.4f, 0.1f)
				},
				{
					new Vector3(-0.37f, -0.15f, 0.2f),
					new Vector3(-0.37f, -0.15f, 0.2f)
				}
			}
		};

		private static readonly Vector3[,,] BaseAngles = new Vector3[2, 5, 2]
		{
			{
				{
					new Vector3(0f, 90f, 20f),
					new Vector3(0f, 92f, 20f)
				},
				{
					new Vector3(0f, 90f, 20f),
					new Vector3(0f, 90f, 20f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				}
			},
			{
				{
					new Vector3(0f, 93f, 30f),
					new Vector3(0f, 93f, 25f)
				},
				{
					new Vector3(0f, 91f, 20f),
					new Vector3(0f, 90f, 25f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				},
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 0f, 0f)
				},
				{
					new Vector3(5f, 5f, 0f),
					new Vector3(5f, 5f, 0f)
				}
			}
		};

		private static readonly Vector3[,,] BaseScales = new Vector3[2, 5, 2]
		{
			{
				{
					new Vector3(0.29f, 0.29f, 0.33f),
					new Vector3(0.3f, 0.3f, 0.4f)
				},
				{
					new Vector3(0.29f, 0.29f, 0.33f),
					new Vector3(1f, 1f, 1f)
				},
				{
					new Vector3(1f, 1f, 1f),
					new Vector3(1f, 1f, 1f)
				},
				{
					new Vector3(1f, 1f, 1f),
					new Vector3(1f, 1f, 1f)
				},
				{
					new Vector3(1f, 1f, 1f),
					new Vector3(1f, 1f, 1f)
				}
			},
			{
				{
					new Vector3(0.29f, 0.29f, 0.33f),
					new Vector3(0.3f, 0.3f, 0.4f)
				},
				{
					new Vector3(0.29f, 0.29f, 0.33f),
					new Vector3(1f, 1f, 1f)
				},
				{
					new Vector3(1f, 1f, 1f),
					new Vector3(1f, 1f, 1f)
				},
				{
					new Vector3(1f, 1f, 1f),
					new Vector3(1f, 1f, 1f)
				},
				{
					new Vector3(1f, 1f, 1.2f),
					new Vector3(1f, 1f, 1.2f)
				}
			}
		};

		public Setting<bool> Bobbing;

		public Setting<bool> WeaponEdges;

		public Setting<float> WeaponEdgeThickness;

		public Setting<EnhancedColor> WeaponFillColor;

		public Setting<bool> AggressiveUpdates;

		public Setting<float> ModelRollOffset;

		public Setting<float> ModelPitchOffset;

		public Setting<float> ModelYawOffset;

		public Setting<float> ModelPosXOffset;

		public Setting<float> ModelPosYOffset;

		public Setting<float> ModelPosZOffset;

		public Setting<float> ModelScaleOffset;

		public Setting<float>[] WeaponModelRollOffsets = new Setting<float>[8];

		public Setting<float>[] WeaponModelPitchOffsets = new Setting<float>[8];

		public Setting<float>[] WeaponModelYawOffsets = new Setting<float>[8];

		public Setting<float>[] WeaponModelPosXOffsets = new Setting<float>[8];

		public Setting<float>[] WeaponModelPosYOffsets = new Setting<float>[8];

		public Setting<float>[] WeaponModelPosZOffsets = new Setting<float>[8];

		public Setting<float>[] WeaponModelScaleOffsets = new Setting<float>[8];

		public static readonly string[] SettingWeaponNameMap = new string[8] { "Revolver", "Slab Revolver", "Shotgun", "Jackhammer", "Nailgun", "Sawblade Launcher", "Railgun", "Rocket Launcher" };

		private static Material?[] _matCache = (Material?[])(object)new Material[4];

		private string[] wireframeBlacklistNames = new string[2] { "ChargeEffect", "Monitor" };

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "gun");

		private static FistControl? fc => MonoSingleton<FistControl>.Instance;

		private static GunControl? gc => MonoSingleton<GunControl>.Instance;

		private static PrefsManager? prefs => MonoSingleton<PrefsManager>.Instance;

		private int GetSpecificWeaponVariantOffsetIndex(int weaponIndex, int altVariantIndex)
		{
			return weaponIndex switch
			{
				0 => altVariantIndex, 
				1 => 2 + altVariantIndex, 
				2 => 4 + altVariantIndex, 
				3 => 6, 
				4 => 7, 
				5 => -1, 
				_ => -1, 
			};
		}

		public static Material? GetVariantMat(int variantIndex)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			if (variantIndex < 0 || variantIndex > 3 || Instance == null)
			{
				return null;
			}
			if ((Object)(object)_matCache[variantIndex] != (Object)null)
			{
				return _matCache[variantIndex];
			}
			Material material = EffectManager.GetMaterial("GeometryWireframeMaterial");
			if ((Object)(object)material == (Object)null)
			{
				Plugin.Log.LogError((object)"[ViewmodelTweaks] Failed to load GeometryWireframeMaterial asset!");
				return null;
			}
			_matCache[variantIndex] = new Material(material);
			Instance.UpdateVariantColors();
			return _matCache[variantIndex];
		}

		private void UpdateVariantColors()
		{
			//IL_001c: 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)
			for (int i = 0; i < 4; i++)
			{
				Material val = _matCache[i];
				if (!((Object)(object)val == (Object)null))
				{
					val.SetColor("_WireframeColor", ColorUtils.GetWeaponVariantColor(i));
					val.SetColor("_FillColor", WeaponFillColor.Value.GetCurrentColor());
					val.SetFloat("_WireframeThickness", WeaponEdgeThickness.Value);
				}
			}
		}

		public ViewmodelTweaks()
			: base("thorn.viewmodelTweaks", "Viewmodel Tweaks", "The viewmodel is your hands, basically.", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			if (Instance != null)
			{
				return;
			}
			Instance = this;
			((Configurable)this).CreateHeader("generalHeader", "General", "", (HeaderType)0, (SettingGroup)null);
			Bobbing = ((Configurable)this).CreateSetting<bool>("bobbing", "Bobbing", "Whether your hands wiggle when walking", true, (SettingGroup)null);
			WeaponEdges = ((Configurable)this).CreateSetting<bool>("weaponEdges", "Edges skin", "Similar to the popular ULTRAEDGES skin. Cleaner but also more detailed. NOTE: to un-apply, you need to restart the mission", false, (SettingGroup)null);
			WeaponEdgeThickness = ((Configurable)this).CreateSetting<float>("weaponEdgeThickness", "Edge thickness", "Thickness of the edges", 2f, (SettingGroup)null);
			WeaponFillColor = ((Configurable)this).CreateSetting<EnhancedColor>("weaponFillColor", "Edges: fill color", "Color to fill surfaces between the lines", new EnhancedColor(0f, 0f, 0f, 0.75f, (EnhancedColorMode)0), (SettingGroup)null);
			AggressiveUpdates = ((Configurable)this).CreateSetting<bool>("aggressiveUpdates", "Aggressive updates", "Makes weapon transforms less likely to desync by updating more aggressively. Impact on performance: should be similar to Daemon's weapon utils (should be acceptable). Technical: Syncs the transforms on Update() instead of on weapon change", false, (SettingGroup)null);
			((Configurable)this).CreateHeader("transformHeader", "Transformations", "", (HeaderType)0, (SettingGroup)null);
			SettingGroup val = ((Configurable)this).CreateGroup("globalTransform", "Global", "Transformations that apply to all weapons", (SettingGroup)null);
			ModelRollOffset = ((Configurable)this).CreateSetting<float>("modelRollOffset", "Roll", "Tilting left/right", 0f, val);
			ModelPitchOffset = ((Configurable)this).CreateSetting<float>("modelPitchOffset", "Pitch", "Pointing up/down", 0f, val);
			ModelYawOffset = ((Configurable)this).CreateSetting<float>("modelYawOffset", "Yaw", "Turning left/right", 0f, val);
			ModelPosXOffset = ((Configurable)this).CreateSetting<float>("modelPosXOffset", "Offset X", "Left/Right position", 0f, val);
			ModelPosYOffset = ((Configurable)this).CreateSetting<float>("modelPosYOffset", "Offset Y", "Up/Down position", 0f, val);
			ModelPosZOffset = ((Configurable)this).CreateSetting<float>("modelPosZOffset", "Offset Z", "Forward/Backward position", 0f, val);
			ModelScaleOffset = ((Configurable)this).CreateSetting<float>("modelScaleOffset", "Scale", "Uniform scale offset", 0f, val);
			for (int i = 0; i < WeaponModelRollOffsets.Length; i++)
			{
				SettingGroup val2 = ((Configurable)this).CreateGroup($"transGroup{i}", SettingWeaponNameMap[i], "Transformations that apply to " + SettingWeaponNameMap[i], (SettingGroup)null);
				WeaponModelRollOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelRollOffset", "Roll", "Tilting left/right", 0f, val2);
				WeaponModelPitchOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelPitchOffset", "Pitch", "Pointing up/down", 0f, val2);
				WeaponModelYawOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelYawOffset", "Yaw", "Turning left/right", 0f, val2);
				WeaponModelPosXOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelPosXOffset", "Offset X", "Left/Right position", 0f, val2);
				WeaponModelPosYOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelPosYOffset", "Offset Y", "Up/Down position", 0f, val2);
				WeaponModelPosZOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelPosZOffset", "Offset Z", "Forward/Backward position", 0f, val2);
				WeaponModelScaleOffsets[i] = ((Configurable)this).CreateSetting<float>($"weapon{i}ModelScaleOffset", "Scale", "Uniform scale offset", 0f, val2);
			}
			SceneUtils.SafeSceneLoadedNoParam += delegate
			{
				if ((Object)(object)gc != (Object)null)
				{
					gc.OnWeaponChange -= UpdateCurrentNextFrame;
				}
				if ((Object)(object)fc != (Object)null)
				{
					fc.FistIconUpdated -= UpdateCurrentNextFrame;
				}
			};
		}

		protected override void OnEnable()
		{
			SceneUtils.SafeSceneLoadedNoParam += OnSceneLoadedWhenEnabled;
			Setting<float> modelRollOffset = ModelRollOffset;
			modelRollOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelRollOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPitchOffset = ModelPitchOffset;
			modelPitchOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelPitchOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelYawOffset = ModelYawOffset;
			modelYawOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelYawOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPosXOffset = ModelPosXOffset;
			modelPosXOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelPosXOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPosYOffset = ModelPosYOffset;
			modelPosYOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelPosYOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPosZOffset = ModelPosZOffset;
			modelPosZOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelPosZOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelScaleOffset = ModelScaleOffset;
			modelScaleOffset.OnValueChanged = (Action<float>)Delegate.Combine(modelScaleOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			for (int i = 0; i < WeaponModelRollOffsets.Length; i++)
			{
				Setting<float> obj = WeaponModelRollOffsets[i];
				obj.OnValueChanged = (Action<float>)Delegate.Combine(obj.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj2 = WeaponModelPitchOffsets[i];
				obj2.OnValueChanged = (Action<float>)Delegate.Combine(obj2.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj3 = WeaponModelYawOffsets[i];
				obj3.OnValueChanged = (Action<float>)Delegate.Combine(obj3.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj4 = WeaponModelPosXOffsets[i];
				obj4.OnValueChanged = (Action<float>)Delegate.Combine(obj4.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj5 = WeaponModelPosYOffsets[i];
				obj5.OnValueChanged = (Action<float>)Delegate.Combine(obj5.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj6 = WeaponModelPosZOffsets[i];
				obj6.OnValueChanged = (Action<float>)Delegate.Combine(obj6.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj7 = WeaponModelScaleOffsets[i];
				obj7.OnValueChanged = (Action<float>)Delegate.Combine(obj7.OnValueChanged, new Action<float>(UpdateCurrent));
			}
			if (!SceneUtils.IsInGame())
			{
				SceneUtils.SafeSceneLoadedNoParam += SubscribeStuffWhenSafe;
			}
			else
			{
				SubscribeStuffWhenSafe();
				UpdateCurrentNextFrame();
			}
			((Setting)Bobbing).OnChanged += UpdateBobbing;
			((Setting)WeaponEdges).OnChanged += UpdateCurrentColor;
			((Setting)WeaponFillColor).OnChanged += UpdateVariantColors;
			WeaponFillColor.OnEffectiveValueChanged += UpdateVariantColors;
			((Setting)WeaponEdgeThickness).OnChanged += UpdateVariantColors;
		}

		public override void OnUpdate()
		{
			if (AggressiveUpdates.Value)
			{
				UpdateCurrent();
			}
		}

		private void SubscribeStuffWhenSafe()
		{
			if (SceneUtils.IsInGame())
			{
				if ((Object)(object)fc != (Object)null)
				{
					fc.FistIconUpdated += UpdateCurrentNextFrame;
				}
				if ((Object)(object)gc != (Object)null)
				{
					gc.OnWeaponChange += UpdateCurrentNextFrame;
					UpdateBobbing();
					SceneUtils.SafeSceneLoadedNoParam -= SubscribeStuffWhenSafe;
				}
			}
		}

		protected override void OnDisable()
		{
			((Setting)WeaponEdges).OnChanged -= UpdateCurrentColor;
			((Setting)WeaponEdgeThickness).OnChanged -= UpdateVariantColors;
			((Setting)WeaponFillColor).OnChanged -= UpdateVariantColors;
			WeaponFillColor.OnEffectiveValueChanged -= UpdateVariantColors;
			((Setting)Bobbing).OnChanged -= UpdateBobbing;
			SceneUtils.SafeSceneLoadedNoParam -= OnSceneLoadedWhenEnabled;
			Setting<float> modelRollOffset = ModelRollOffset;
			modelRollOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelRollOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPitchOffset = ModelPitchOffset;
			modelPitchOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelPitchOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelYawOffset = ModelYawOffset;
			modelYawOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelYawOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPosXOffset = ModelPosXOffset;
			modelPosXOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelPosXOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPosYOffset = ModelPosYOffset;
			modelPosYOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelPosYOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelPosZOffset = ModelPosZOffset;
			modelPosZOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelPosZOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			Setting<float> modelScaleOffset = ModelScaleOffset;
			modelScaleOffset.OnValueChanged = (Action<float>)Delegate.Remove(modelScaleOffset.OnValueChanged, new Action<float>(UpdateCurrent));
			for (int i = 0; i < WeaponModelRollOffsets.Length; i++)
			{
				Setting<float> obj = WeaponModelRollOffsets[i];
				obj.OnValueChanged = (Action<float>)Delegate.Remove(obj.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj2 = WeaponModelPitchOffsets[i];
				obj2.OnValueChanged = (Action<float>)Delegate.Remove(obj2.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj3 = WeaponModelYawOffsets[i];
				obj3.OnValueChanged = (Action<float>)Delegate.Remove(obj3.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj4 = WeaponModelPosXOffsets[i];
				obj4.OnValueChanged = (Action<float>)Delegate.Remove(obj4.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj5 = WeaponModelPosYOffsets[i];
				obj5.OnValueChanged = (Action<float>)Delegate.Remove(obj5.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj6 = WeaponModelPosZOffsets[i];
				obj6.OnValueChanged = (Action<float>)Delegate.Remove(obj6.OnValueChanged, new Action<float>(UpdateCurrent));
				Setting<float> obj7 = WeaponModelScaleOffsets[i];
				obj7.OnValueChanged = (Action<float>)Delegate.Remove(obj7.OnValueChanged, new Action<float>(UpdateCurrent));
			}
			SceneUtils.SafeSceneLoadedNoParam -= SubscribeStuffWhenSafe;
			ResetAllTransforms();
		}

		private int GetMiddleIndex()
		{
			if ((Object)(object)prefs == (Object)null)
			{
				return 0;
			}
			return (prefs.GetInt("weaponHoldPosition", 0) == 1) ? 1 : 0;
		}

		private void OnSceneLoadedWhenEnabled()
		{
			UpdateCurrentNextFrame();
			((Configurable)this).Toggle();
			((Configurable)this).Toggle();
			if ((Object)(object)gc != (Object)null)
			{
				ExecutionUtils.RunNextFrame((Action)delegate
				{
					gc.ForceWeapon(gc.currentWeapon, true);
				});
			}
		}

		private void UpdateCurrentNextFrame(GameObject _)
		{
			UpdateCurrentNextFrame();
		}

		private void UpdateCurrentNextFrame(int _)
		{
			UpdateCurrentNextFrame();
		}

		private void UpdateCurrentNextFrame()
		{
			if (SceneUtils.IsInGame())
			{
				ExecutionUtils.RunNextFrame((Action)UpdateCurrent);
			}
		}

		private void UpdateCurrent(GameObject _)
		{
			UpdateCurrent();
		}

		private void UpdateCurrent(float _)
		{
			UpdateCurrent();
		}

		private void UpdateCurrent()
		{
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			if (!SceneUtils.IsInGame())
			{
				return;
			}
			bool flag = (Object)(object)gc == (Object)null || (Object)(object)prefs == (Object)null;
			if (!flag)
			{
				int currentSlotIndex = gc.currentSlotIndex;
				bool flag2 = ((currentSlotIndex < 1 || currentSlotIndex > 6) ? true : false);
				flag = flag2;
			}
			if (flag || gc.currentVariationIndex >= 4)
			{
				return;
			}
			UpdateCurrentColor();
			if (gc.currentSlotIndex > 5 || gc.currentVariationIndex >= 3)
			{
				return;
			}
			int middleIndex = GetMiddleIndex();
			int num = gc.currentSlotIndex - 1;
			int num2 = 0;
			GameObject currentWeapon = gc.currentWeapon;
			if ((Object)(object)currentWeapon == (Object)null)
			{
				return;
			}
			switch (num)
			{
			case 0:
			{
				Revolver component2 = currentWeapon.GetComponent<Revolver>();
				if (component2 != null && component2.altVersion)
				{
					num2 = 1;
				}
				break;
			}
			case 1:
				if ((Object)(object)currentWeapon.GetComponent<ShotgunHammer>() != (Object)null)
				{
					num2 = 1;
				}
				break;
			case 2:
			{
				Nailgun component = currentWeapon.GetComponent<Nailgun>();
				if (component != null && component.altVersion)
				{
					num2 = 1;
				}
				break;
			}
			}
			int specificWeaponVariantOffsetIndex = GetSpecificWeaponVariantOffsetIndex(num, num2);
			currentWeapon.GetComponent<WeaponPos>();
			Vector3 val = BasePositions[middleIndex, num, num2];
			Vector3 val2 = BaseAngles[middleIndex, num, num2];
			Vector3 val3 = BaseScales[middleIndex, num, num2];
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(ModelPosXOffset.Value, ModelPosYOffset.Value, ModelPosZOffset.Value);
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(ModelPitchOffset.Value, ModelYawOffset.Value, ModelRollOffset.Value);
			float num3 = ModelScaleOffset.Value;
			if (specificWeaponVariantOffsetIndex != -1)
			{
				val4 += new Vector3(WeaponModelPosXOffsets[specificWeaponVariantOffsetIndex].Value, WeaponModelPosYOffsets[specificWeaponVariantOffsetIndex].Value, WeaponModelPosZOffsets[specificWeaponVariantOffsetIndex].Value);
				val5 += new Vector3(WeaponModelPitchOffsets[specificWeaponVariantOffsetIndex].Value, WeaponModelYawOffsets[specificWeaponVariantOffsetIndex].Value, WeaponModelRollOffsets[specificWeaponVariantOffsetIndex].Value);
				num3 += WeaponModelScaleOffsets[specificWeaponVariantOffsetIndex].Value;
			}
			float num4 = (((Configurable)this).IsEnabled ? 1 : 0);
			Vector3 targetPos = val + val4 * num4;
			Vector3 targetAngle = val2 + val5 * num4;
			Vector3 targetScale = val3 + Vector3.one * num3 * num4;
			SetTransform(currentWeapon, targetPos, targetAngle, targetScale);
		}

		private void UpdateCurrentColor()
		{
			if (WeaponEdges.Value && !((Object)(object)gc == (Object)null) && !((Object)(object)fc == (Object)null) && !((Object)(object)MonoSingleton<HookArm>.Instance == (Object)null))
			{
				int variation = GunHelper.GetVariation(gc.currentWeapon);
				ApplyWireframe(gc.currentWeapon, variation);
				int num = PlayerPrefs.GetInt("CurArm", 0);
				ApplyWireframe(fc.currentArmObject, num * 2);
				ApplyWireframe(((Component)MonoSingleton<HookArm>.Instance).gameObject, 1);
				UpdateVariantColors();
			}
		}

		private void ApplyWireframe(GameObject obj, int variantIndex)
		{
			if ((Object)(object)obj == (Object)null)
			{
				return;
			}
			Material variantMat = GetVariantMat(variantIndex);
			Renderer[] array = obj.GetComponentsInChildren<Renderer>(true)?.Where((Renderer r) => (r is MeshRenderer || r is SkinnedMeshRenderer) ? true : false)?.ToArray() ?? Array.Empty<Renderer>();
			foreach (Renderer val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				string compName = ((Object)((Component)val).gameObject).name;
				if (wireframeBlacklistNames.Any((string name) => compName.StartsWith(name)))
				{
					continue;
				}
				List<Material> list = new List<Material>();
				val.GetSharedMaterials(list);
				int count = list.Count;
				if (count == 0)
				{
					continue;
				}
				bool flag = false;
				for (int num2 = 0; num2 < count; num2++)
				{
					if ((Object)(object)list[num2] != (Object)(object)variantMat)
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					Material[] array2 = (Material[])(object)new Material[count];
					for (int num3 = 0; num3 < count; num3++)
					{
						array2[num3] = variantMat;
					}
					val.sharedMaterials = array2;
				}
			}
		}

		private void SetTransform(GameObject weapon, Vector3 targetPos, Vector3 targetAngle, Vector3 targetScale)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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)
			Transform transform = weapon.transform;
			transform.localPosition = targetPos;
			transform.localEulerAngles = targetAngle;
			transform.localScale = targetScale;
		}

		private void ResetAllTransforms()
		{
			int middleIndex = GetMiddleIndex();
			ResetTransforms<Revolver>(middleIndex, 0);
			ResetTransforms<Shotgun>(middleIndex, 1);
			ResetTransforms<ShotgunHammer>(middleIndex, 1);
			ResetTransforms<Nailgun>(middleIndex, 2);
			ResetTransforms<Railcannon>(middleIndex, 3);
			ResetTransforms<RocketLauncher>(middleIndex, 4);
		}

		private void ResetTransforms<T>(int middleIndex, int weaponIndex) where T : MonoBehaviour
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (middleIndex >= 2 || weaponIndex >= 5)
			{
				return;
			}
			T[] array = Object.FindObjectsByType<T>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			T val;
			int num;
			Vector3 targetPos;
			Vector3 targetAngle;
			Vector3 targetScale;
			for (int i = 0; i < array.Length; targetPos = BasePositions[middleIndex, weaponIndex, num], targetAngle = BaseAngles[middleIndex, weaponIndex, num], targetScale = BaseScales[middleIndex, weaponIndex, num], SetTransform(((Component)(object)val).gameObject, targetPos, targetAngle, targetScale), i++)
			{
				val = array[i];
				num = 0;
				if (!(val is ShotgunHammer))
				{
					object obj = val;
					Revolver val2 = (Revolver)((obj is Revolver) ? obj : null);
					if (val2 == null || !val2.altVersion)
					{
						object obj2 = val;
						Nailgun val3 = (Nailgun)((obj2 is Nailgun) ? obj2 : null);
						if (val3 == null || !val3.altVersion)
						{
							continue;
						}
					}
				}
				num = 1;
			}
		}

		private void UpdateBobbing()
		{
			if (SceneUtils.IsSafe() && !((Object)(object)gc == (Object)null))
			{
				WalkingBob component = ((Component)gc).GetComponent<WalkingBob>();
				if (!((Object)(object)component == (Object)null))
				{
					((Behaviour)component).enabled = Bobbing.Value;
				}
			}
		}
	}
	public class VisiblePortals : Module
	{
		public Setting<EnhancedColor> FillColor;

		public Setting<bool> BorderEnabled;

		public Setting<EnhancedColor> BorderColor;

		public Setting<float> Offset;

		public Setting<bool> AlwaysOnTop;

		public override Sprite Icon => AssetManager.Get<Sprite>(ClickGUI.BundleKey, "circle_cross");

		public override string[] Tags => new string[6] { "portal", "accessibility", "overlay", "translucent", "lines", "visual" };

		public VisiblePortals()
			: base("thorn.visiblePortals", "Visible Portals", "Draws translucent overlay on portals for accessibility", (ModuleCategory)1, (KeyCode)0, (KeyCode)0, false, true)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			FillColor = ((Configurable)this).CreateSetting<EnhancedColor>("fillColor", "Fill color", "Fill color of the portal overlays", new EnhancedColor(new Color(0.21f, 0.69f, 1f, 0.1f), (EnhancedColorMode)0), (SettingGroup)null);
			BorderEnabled = ((Configurable)this).CreateSetting<bool>("borderEnabled", "Enable border", "Whether to draw an outline", true, (SettingGroup)null);
			BorderColor = ((Configurable)this).CreateSetting<EnhancedColor>("borderColor", "Border color", "Color of the outline", new EnhancedColor(new Color(0.65f, 0.78f, 1f, 1f), (EnhancedColorMode)0), (SettingGroup)null);
			SettingGroup val = ((Configurable)this).CreateGroup("advanced", "Advanced", "Options that you most likely don't need to touch", (SettingGroup)null);
			Offset = ((Configurable)this).CreateSetting<float>("offset", "Offset", "Distance away from the portal to draw the overlay. Having a value of 0 is most accurate but causes flashing.", 0.03f, val);
			AlwaysOnTop = ((Configurable)this).CreateSetting<bool>("alwaysOnTop", "Always on top", "Portal ESP basically", false, val);
		}

		public override void OnRender()
		{
			//IL_0051: 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_006c: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown