Decompiled source of SeedHunter v1.0.2

SeedHunter.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SSSGame;
using SSSGame.Controllers;
using SeedHunter.UI;
using SeedHunter.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SeedHunter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("ASKA world seed exploration mod - reveals map, POIs, and enables fast movement")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3af03fda42f7304593ff535ce62cd427173e488b")]
[assembly: AssemblyProduct("SeedHunter")]
[assembly: AssemblyTitle("SeedHunter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SeedHunter
{
	[BepInPlugin("com.jrich523.askaseedhunter", "SeedHunter", "1.0.0")]
	public class SeedHunterPlugin : BasePlugin
	{
		internal static ManualLogSource Log;

		internal static SeedHunterPlugin Instance;

		private Harmony _harmony;

		private static ConfigEntry<bool> configMapRevealed;

		private static ConfigEntry<bool> configFastMovement;

		private static ConfigEntry<bool> configNoclip;

		private static ConfigEntry<float> configSpeed;

		public override void Load()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			Instance = this;
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("com.jrich523.askaseedhunter");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loading...");
			}
			log.LogInfo(val);
			InitializeConfig();
			_harmony = new Harmony("com.jrich523.askaseedhunter");
			try
			{
				_harmony.PatchAll();
				IEnumerable<MethodBase> patchedMethods = _harmony.GetPatchedMethods();
				int num = 0;
				foreach (MethodBase item in patchedMethods)
				{
					ManualLogSource log2 = Log;
					val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Patched: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.DeclaringType?.Name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Name);
					}
					log2.LogInfo(val);
					num++;
				}
				ManualLogSource log3 = Log;
				val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Applied ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Harmony patches");
				}
				log3.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log4 = Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to apply Harmony patches: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log4.LogError(val2);
				ManualLogSource log5 = Log;
				val2 = new BepInExErrorLogInterpolatedStringHandler(13, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Stack trace: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace);
				}
				log5.LogError(val2);
			}
			ManualLogSource log6 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("com.jrich523.askaseedhunter");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log6.LogInfo(val);
			Log.LogInfo((object)"Hotkeys:");
			Log.LogInfo((object)"  F8  - Toggle continuous map reveal (caves, objectives, locations)");
			Log.LogInfo((object)"  F9  - Toggle fast movement + infinite stamina + god mode");
			Log.LogInfo((object)"  F10 - Toggle noclip/fly mode (Space=up, Ctrl=down) + god mode");
			Log.LogInfo((object)"  F7  - Disable all cheats");
			Log.LogInfo((object)"  +/- - Increase/decrease movement speed (range: 5-100, default: 50)");
			Log.LogInfo((object)"NOTE: God mode (invincibility) is auto-enabled with F9 or F10");
			((BasePlugin)this).AddComponent<HotkeyManager>();
		}

		public override bool Unload()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}

		private void InitializeConfig()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			configMapRevealed = ((BasePlugin)this).Config.Bind<bool>("Features", "MapRevealed", false, "Enable continuous map reveal (caves, objectives, locations)");
			configFastMovement = ((BasePlugin)this).Config.Bind<bool>("Features", "FastMovement", false, "Enable fast movement + infinite stamina + god mode");
			configNoclip = ((BasePlugin)this).Config.Bind<bool>("Features", "Noclip", false, "Enable noclip/fly mode + god mode");
			configSpeed = ((BasePlugin)this).Config.Bind<float>("Movement", "Speed", 50f, new ConfigDescription("Movement speed multiplier", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 100f), Array.Empty<object>()));
			StateManager.MapRevealed = configMapRevealed.Value;
			StateManager.FastMovementEnabled = configFastMovement.Value;
			StateManager.NoclipEnabled = configNoclip.Value;
			StateManager.CurrentSpeed = configSpeed.Value;
			Log.LogInfo((object)"Configuration loaded:");
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  Map Reveal: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(StateManager.MapRevealed);
			}
			log.LogInfo(val);
			ManualLogSource log2 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(17, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  Fast Movement: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(StateManager.FastMovementEnabled);
			}
			log2.LogInfo(val);
			ManualLogSource log3 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  Noclip: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(StateManager.NoclipEnabled);
			}
			log3.LogInfo(val);
			ManualLogSource log4 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("  Speed: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(StateManager.CurrentSpeed);
			}
			log4.LogInfo(val);
		}

		internal static void SaveConfig()
		{
			if (Instance != null)
			{
				configMapRevealed.Value = StateManager.MapRevealed;
				configFastMovement.Value = StateManager.FastMovementEnabled;
				configNoclip.Value = StateManager.NoclipEnabled;
				configSpeed.Value = StateManager.CurrentSpeed;
				((BasePlugin)Instance).Config.Save();
			}
		}

		internal static void RevealAllCaves()
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				CavesManager val = Object.FindObjectOfType<CavesManager>();
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				Dictionary<int, CaveExplorationHandler> explorationHandlers = val._explorationHandlers;
				if (explorationHandlers == null || explorationHandlers.Count == 0)
				{
					return;
				}
				int num = 0;
				Enumerator<int, CaveExplorationHandler> enumerator = explorationHandlers.GetEnumerator();
				while (enumerator.MoveNext())
				{
					CaveExplorationHandler value = enumerator.Current.Value;
					if (value != null && value.data != null && !value.data.explored)
					{
						value.data.SetExploredState(true);
						value._OnCaveExplorationChanged(true);
						value._RefreshMarkerState();
						num++;
					}
				}
				if (num > 0)
				{
					ManualLogSource log = Log;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("✓ Revealed ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" new caves!");
					}
					log.LogInfo(val2);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Log;
				BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Error revealing caves: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				log2.LogError(val3);
			}
		}

		internal static void RevealAllObjectives()
		{
		}
	}
	public class HotkeyManager : MonoBehaviour
	{
		private float lastRevealAttempt;

		private static bool overlayCreated;

		private static float lastOverlayCheck;

		private void Update()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Expected O, but got Unknown
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Expected O, but got Unknown
			bool flag = default(bool);
			if (!overlayCreated && Time.time - lastOverlayCheck > 2f)
			{
				lastOverlayCheck = Time.time;
				if ((Object)(object)Object.FindObjectOfType<PlayerCharacter>() != (Object)null && SeedHunterPlugin.Instance != null)
				{
					try
					{
						((BasePlugin)SeedHunterPlugin.Instance).AddComponent<StatusOverlay>();
						SeedHunterPlugin.Log.LogInfo((object)"Status overlay created (player in-game)");
						overlayCreated = true;
					}
					catch (Exception ex)
					{
						ManualLogSource log = SeedHunterPlugin.Log;
						BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to create overlay: ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
						}
						log.LogError(val);
						overlayCreated = true;
					}
				}
			}
			if (StateManager.MapRevealed && Time.time - lastRevealAttempt >= 2f)
			{
				lastRevealAttempt = Time.time;
				SeedHunterPlugin.RevealAllCaves();
				SeedHunterPlugin.RevealAllObjectives();
			}
			if (Input.GetKeyDown((KeyCode)289))
			{
				StateManager.MapRevealed = !StateManager.MapRevealed;
				SeedHunterPlugin.SaveConfig();
				if (StateManager.MapRevealed)
				{
					SeedHunterPlugin.Log.LogInfo((object)"Map Reveal: ENABLED - Continuously revealing map objects");
					lastRevealAttempt = 0f;
				}
				else
				{
					SeedHunterPlugin.Log.LogInfo((object)"Map Reveal: DISABLED");
				}
			}
			if (Input.GetKeyDown((KeyCode)290))
			{
				StateManager.FastMovementEnabled = !StateManager.FastMovementEnabled;
				SeedHunterPlugin.SaveConfig();
				if (StateManager.FastMovementEnabled)
				{
					ManualLogSource log2 = SeedHunterPlugin.Log;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Fast Movement: ENABLED (Speed: ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(StateManager.CurrentSpeed, "F0");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", use +/- to adjust)");
					}
					log2.LogInfo(val2);
				}
				else
				{
					SeedHunterPlugin.Log.LogInfo((object)"Fast Movement: DISABLED");
				}
			}
			if (Input.GetKeyDown((KeyCode)291))
			{
				StateManager.NoclipEnabled = !StateManager.NoclipEnabled;
				SeedHunterPlugin.SaveConfig();
				if (StateManager.NoclipEnabled)
				{
					SeedHunterPlugin.Log.LogInfo((object)"Noclip/Fly: ENABLED (SPACE=up, CTRL=down)");
				}
				else
				{
					SeedHunterPlugin.Log.LogInfo((object)"Noclip/Fly: DISABLED");
				}
			}
			if (Input.GetKeyDown((KeyCode)288))
			{
				StateManager.ResetAll();
				SeedHunterPlugin.SaveConfig();
				SeedHunterPlugin.Log.LogInfo((object)"All cheats DISABLED");
			}
			if (Input.GetKeyDown((KeyCode)61) || Input.GetKeyDown((KeyCode)270))
			{
				StateManager.IncreaseSpeed();
				SeedHunterPlugin.SaveConfig();
				ManualLogSource log3 = SeedHunterPlugin.Log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Movement Speed: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(StateManager.CurrentSpeed, "F0");
				}
				log3.LogInfo(val2);
			}
			if (Input.GetKeyDown((KeyCode)45) || Input.GetKeyDown((KeyCode)269))
			{
				StateManager.DecreaseSpeed();
				SeedHunterPlugin.SaveConfig();
				ManualLogSource log4 = SeedHunterPlugin.Log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Movement Speed: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(StateManager.CurrentSpeed, "F0");
				}
				log4.LogInfo(val2);
			}
		}
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.jrich523.askaseedhunter";

		public const string PLUGIN_NAME = "SeedHunter";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SeedHunter.Utils
{
	public static class PerformanceTracker
	{
		private static Dictionary<string, int> _callCounts = new Dictionary<string, int>();

		private static Dictionary<string, long> _totalTime = new Dictionary<string, long>();

		private static Stopwatch _sessionTimer = Stopwatch.StartNew();

		private static bool _enabled = true;

		public static void Track(string patchName, Action action)
		{
			if (!_enabled || _sessionTimer.ElapsedMilliseconds > 60000)
			{
				_enabled = false;
				action();
				return;
			}
			if (!_callCounts.ContainsKey(patchName))
			{
				_callCounts[patchName] = 0;
				_totalTime[patchName] = 0L;
			}
			Stopwatch stopwatch = Stopwatch.StartNew();
			action();
			stopwatch.Stop();
			_callCounts[patchName]++;
			_totalTime[patchName] += stopwatch.ElapsedMilliseconds;
		}

		public static void LogStats()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			if (_callCounts.Count == 0)
			{
				return;
			}
			SeedHunterPlugin.Log.LogWarning((object)"=== PERFORMANCE TRACKER (First 60 seconds) ===");
			bool flag = default(bool);
			foreach (KeyValuePair<string, int> callCount in _callCounts)
			{
				double num = (double)_totalTime[callCount.Key] / (double)callCount.Value;
				ManualLogSource log = SeedHunterPlugin.Log;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 4, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(callCount.Key);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(callCount.Value);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" calls, ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<long>(_totalTime[callCount.Key]);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ms total, ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<double>(num, "F2");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ms avg");
				}
				log.LogWarning(val);
			}
			SeedHunterPlugin.Log.LogWarning((object)"==============================================");
		}

		public static void Reset()
		{
			_callCounts.Clear();
			_totalTime.Clear();
			_sessionTimer.Restart();
			_enabled = true;
		}
	}
	public static class StateManager
	{
		public const float MIN_SPEED = 5f;

		public const float MAX_SPEED = 100f;

		public const float SPEED_INCREMENT = 5f;

		private static float _currentSpeed = 50f;

		public const float JUMP_MULTIPLIER = 2f;

		public const float NOCLIP_VERTICAL_SPEED = 25f;

		public const float SPEED_MULTIPLIER = 10f;

		public static bool MapRevealed { get; set; } = false;


		public static bool FastMovementEnabled { get; set; } = false;


		public static bool NoclipEnabled { get; set; } = false;


		public static float CurrentSpeed
		{
			get
			{
				return _currentSpeed;
			}
			set
			{
				_currentSpeed = Mathf.Clamp(value, 5f, 100f);
			}
		}

		public static float OriginalMoveSpeed { get; set; } = -1f;


		public static float OriginalJumpForce { get; set; } = -1f;


		public static float OriginalGravity { get; set; } = -9.81f;


		public static float OriginalColliderRadius { get; set; } = -1f;


		public static float OriginalColliderHeight { get; set; } = -1f;


		public static void IncreaseSpeed()
		{
			CurrentSpeed += 5f;
		}

		public static void DecreaseSpeed()
		{
			CurrentSpeed -= 5f;
		}

		public static void ResetAll()
		{
			MapRevealed = false;
			FastMovementEnabled = false;
			NoclipEnabled = false;
		}

		public static bool AnyFeatureActive()
		{
			if (!FastMovementEnabled)
			{
				return NoclipEnabled;
			}
			return true;
		}
	}
}
namespace SeedHunter.UI
{
	public class StatusOverlay : MonoBehaviour
	{
		private GUIStyle _boxStyle;

		private GUIStyle _textStyle;

		private bool _stylesInitialized;

		private Rect _windowRect = new Rect(10f, 10f, 180f, 160f);

		private static PlayerCharacter _cachedPlayer;

		private static float _lastPlayerCheck;

		private const float PLAYER_CHECK_INTERVAL = 2f;

		private static bool _hasCheckedOnce;

		private void OnGUI()
		{
			//IL_0018: 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)
			if (IsPlayerInGame())
			{
				if (!_stylesInitialized)
				{
					InitializeStyles();
				}
				GUI.Box(_windowRect, "", _boxStyle);
				GUILayout.BeginArea(new Rect(((Rect)(ref _windowRect)).x + 10f, ((Rect)(ref _windowRect)).y + 10f, ((Rect)(ref _windowRect)).width - 20f, ((Rect)(ref _windowRect)).height - 20f));
				GUILayout.Label("═══ SEEDHUNTER ═══", _textStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(5f);
				GUILayout.Label(StateManager.MapRevealed ? "Map Reveal (F8): ON" : "Map Reveal (F8): OFF", _textStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label(StateManager.FastMovementEnabled ? "Fast Move (F9): ON" : "Fast Move (F9): OFF", _textStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label(StateManager.NoclipEnabled ? "Noclip (F10): ON" : "Noclip (F10): OFF", _textStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(5f);
				float value = (StateManager.FastMovementEnabled ? StateManager.CurrentSpeed : 5f);
				GUILayout.Label($"Speed: {value:F0} (+/- to adjust)", _textStyle, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.EndArea();
			}
		}

		private void InitializeStyles()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0037: 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_005b: Expected O, but got Unknown
			//IL_0075: 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_00b5: Expected O, but got Unknown
			try
			{
				_boxStyle = new GUIStyle(GUI.skin.box);
				_boxStyle.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0f, 0.75f));
				_textStyle = new GUIStyle(GUI.skin.label);
				_textStyle.normal.textColor = new Color(0.4f, 1f, 0.4f);
				_textStyle.fontSize = 13;
				_stylesInitialized = true;
				SeedHunterPlugin.Log.LogInfo((object)"Status overlay styles initialized");
			}
			catch (Exception ex)
			{
				ManualLogSource log = SeedHunterPlugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(35, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error initializing overlay styles: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val);
			}
		}

		private Texture2D MakeTex(int width, int height, Color color)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = color;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private bool IsPlayerInGame()
		{
			if (!_hasCheckedOnce && Time.time < 5f)
			{
				return false;
			}
			if (Time.time - _lastPlayerCheck > 2f || ((Object)(object)_cachedPlayer == (Object)null && _hasCheckedOnce))
			{
				_cachedPlayer = Object.FindObjectOfType<PlayerCharacter>();
				_lastPlayerCheck = Time.time;
				_hasCheckedOnce = true;
			}
			return (Object)(object)_cachedPlayer != (Object)null;
		}
	}
}
namespace SeedHunter.Patches
{
	public class DebugPatches
	{
		private static StreamWriter logWriter;

		private static int frameCounter;

		private static bool isLogging;

		private static float loggingStartTime;

		private static string logFilePath;

		static DebugPatches()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				string text = Path.Combine(Path.GetTempPath(), "SeedHunter_Debug");
				Directory.CreateDirectory(text);
				logFilePath = Path.Combine(text, $"movement_debug_{DateTime.Now:yyyyMMdd_HHmmss}.txt");
				logWriter = new StreamWriter(logFilePath, append: false);
				logWriter.AutoFlush = true;
				ManualLogSource log = SeedHunterPlugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Debug log created at: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(logFilePath);
				}
				log.LogInfo(val);
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = SeedHunterPlugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to create debug log: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogError(val2);
			}
		}

		private static void Log(string message)
		{
			if (!isLogging)
			{
				return;
			}
			try
			{
				logWriter?.WriteLine($"[Frame {frameCounter}] {message}");
			}
			catch
			{
			}
		}

		[HarmonyPatch(typeof(PlayerCharacter), "Update")]
		[HarmonyPrefix]
		public static void PlayerCharacter_Update_Prefix(PlayerCharacter __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			if (!StateManager.NoclipEnabled)
			{
				return;
			}
			bool flag = default(bool);
			if (Input.GetKeyDown((KeyCode)32) && !isLogging)
			{
				isLogging = true;
				loggingStartTime = Time.time;
				frameCounter = 0;
				ManualLogSource log = SeedHunterPlugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== STARTING DEBUG LOGGING ===");
				}
				log.LogInfo(val);
				ManualLogSource log2 = SeedHunterPlugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Log file: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(logFilePath);
				}
				log2.LogInfo(val);
				Log("=== DEBUG SESSION START ===");
				Log($"Noclip enabled, Space pressed at {Time.time}");
			}
			if (isLogging && Time.time - loggingStartTime > 5f)
			{
				isLogging = false;
				ManualLogSource log3 = SeedHunterPlugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("=== DEBUG LOGGING STOPPED ===");
				}
				log3.LogInfo(val);
				ManualLogSource log4 = SeedHunterPlugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Analyze log at: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(logFilePath);
				}
				log4.LogInfo(val);
				Log("=== DEBUG SESSION END ===");
				logWriter?.Flush();
			}
			if (!isLogging)
			{
				return;
			}
			frameCounter++;
			try
			{
				CharacterMovement characterMovement = __instance.GetCharacterMovement();
				CharacterController component = ((Component)__instance).GetComponent<CharacterController>();
				Transform transform = ((Component)__instance).transform;
				Log("--- PlayerCharacter.Update PREFIX ---");
				Log($"  Position.y: {transform.position.y:F3}");
				if ((Object)(object)characterMovement != (Object)null)
				{
					Log($"  CharacterMovement._velocityY: {characterMovement._velocityY:F3}");
				}
				if ((Object)(object)component != (Object)null)
				{
					Log($"  CharacterController.detectCollisions: {component.detectCollisions}");
					Log($"  CharacterController.isGrounded: {component.isGrounded}");
				}
				Log($"  Input.Space: {Input.GetKey((KeyCode)32)}");
			}
			catch (Exception ex)
			{
				Log("ERROR in PlayerCharacter_Update_Prefix: " + ex.Message);
			}
		}

		[HarmonyPatch(typeof(PlayerCharacter), "Update")]
		[HarmonyPostfix]
		public static void PlayerCharacter_Update_Postfix(PlayerCharacter __instance)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!isLogging)
			{
				return;
			}
			try
			{
				CharacterMovement characterMovement = __instance.GetCharacterMovement();
				Transform transform = ((Component)__instance).transform;
				Log("--- PlayerCharacter.Update POSTFIX ---");
				Log($"  Position.y: {transform.position.y:F3}");
				if ((Object)(object)characterMovement != (Object)null)
				{
					Log($"  CharacterMovement._velocityY: {characterMovement._velocityY:F3}");
				}
			}
			catch (Exception ex)
			{
				Log("ERROR in PlayerCharacter_Update_Postfix: " + ex.Message);
			}
		}

		[HarmonyPatch(typeof(CharacterMovement), "Update")]
		[HarmonyPrefix]
		public static void CharacterMovement_Update_Prefix(CharacterMovement __instance)
		{
			if (!isLogging)
			{
				return;
			}
			try
			{
				Log("--- CharacterMovement.Update PREFIX ---");
				Log($"  _velocityY: {__instance._velocityY:F3}");
			}
			catch (Exception ex)
			{
				Log("ERROR in CharacterMovement_Update_Prefix: " + ex.Message);
			}
		}

		[HarmonyPatch(typeof(CharacterMovement), "Update")]
		[HarmonyPostfix]
		public static void CharacterMovement_Update_Postfix(CharacterMovement __instance)
		{
			if (!isLogging)
			{
				return;
			}
			try
			{
				Log("--- CharacterMovement.Update POSTFIX ---");
				Log($"  _velocityY: {__instance._velocityY:F3}");
			}
			catch (Exception ex)
			{
				Log("ERROR in CharacterMovement_Update_Postfix: " + ex.Message);
			}
		}

		[HarmonyPatch(typeof(CharacterController), "Move")]
		[HarmonyPrefix]
		public static void CharacterController_Move_Prefix(CharacterController __instance, Vector3 motion)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (!isLogging)
			{
				return;
			}
			try
			{
				if (!((Object)(object)((Component)__instance).GetComponent<PlayerCharacter>() == (Object)null))
				{
					Log("--- CharacterController.Move PREFIX ---");
					Log($"  motion: {motion}");
					Log($"  motion.y: {motion.y:F3}");
					Log($"  isGrounded: {__instance.isGrounded}");
				}
			}
			catch (Exception ex)
			{
				Log("ERROR in CharacterController_Move_Prefix: " + ex.Message);
			}
		}

		[HarmonyPatch(typeof(CharacterController), "Move")]
		[HarmonyPostfix]
		public static void CharacterController_Move_Postfix(CharacterController __instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (!isLogging)
			{
				return;
			}
			try
			{
				if (!((Object)(object)((Component)__instance).GetComponent<PlayerCharacter>() == (Object)null))
				{
					Log("--- CharacterController.Move POSTFIX ---");
					Log($"  transform.position.y: {((Component)__instance).transform.position.y:F3}");
				}
			}
			catch (Exception ex)
			{
				Log("ERROR in CharacterController_Move_Postfix: " + ex.Message);
			}
		}

		public static void Cleanup()
		{
			try
			{
				logWriter?.Close();
				logWriter?.Dispose();
			}
			catch
			{
			}
		}
	}
	public class MapRevealPatches
	{
	}
	public class NoclipPatches
	{
		private static int logCounter;

		[HarmonyPatch(typeof(PlayerCharacter), "Update")]
		[HarmonyPostfix]
		public static void HandleNoclip(PlayerCharacter __instance)
		{
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				if (!StateManager.NoclipEnabled)
				{
					CharacterController component = ((Component)__instance).GetComponent<CharacterController>();
					if ((Object)(object)component != (Object)null && !component.detectCollisions)
					{
						component.detectCollisions = true;
						SeedHunterPlugin.Log.LogInfo((object)"Noclip disabled - collisions restored");
					}
					return;
				}
				logCounter++;
				if (logCounter % 60 == 0)
				{
					SeedHunterPlugin.Log.LogInfo((object)"Noclip patch running...");
				}
				CharacterController component2 = ((Component)__instance).GetComponent<CharacterController>();
				if ((Object)(object)component2 != (Object)null && component2.detectCollisions)
				{
					component2.detectCollisions = false;
					SeedHunterPlugin.Log.LogInfo((object)"Disabled collisions");
				}
				CharacterMovement characterMovement = __instance.GetCharacterMovement();
				if ((Object)(object)characterMovement == (Object)null)
				{
					SeedHunterPlugin.Log.LogWarning((object)"CharacterMovement is null!");
				}
				else if (Input.GetKey((KeyCode)32))
				{
					characterMovement._velocityY = 25f;
					if (logCounter % 60 == 0)
					{
						ManualLogSource log = SeedHunterPlugin.Log;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Space pressed - setting velocityY to ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(25f);
						}
						log.LogInfo(val);
					}
				}
				else if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
				{
					characterMovement._velocityY = -25f;
					if (logCounter % 60 == 0)
					{
						ManualLogSource log2 = SeedHunterPlugin.Log;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ctrl pressed - setting velocityY to -");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(25f);
						}
						log2.LogInfo(val);
					}
				}
				else
				{
					characterMovement._velocityY = 10f;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log3 = SeedHunterPlugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error in HandleNoclip: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log3.LogError(val2);
			}
		}
	}
	public class NoclipPatches_Alternative
	{
		private static bool collisionsDisabled;

		[HarmonyPatch(typeof(CharacterMovement), "Update")]
		[HarmonyPostfix]
		public static void CharacterMovement_Update_Postfix(CharacterMovement __instance)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			try
			{
				PlayerCharacter val = default(PlayerCharacter);
				if (!((Component)__instance).TryGetComponent<PlayerCharacter>(ref val))
				{
					return;
				}
				if (!StateManager.NoclipEnabled)
				{
					if (collisionsDisabled)
					{
						CharacterController component = ((Component)val).GetComponent<CharacterController>();
						if ((Object)(object)component != (Object)null)
						{
							component.detectCollisions = true;
							collisionsDisabled = false;
							SeedHunterPlugin.Log.LogInfo((object)"Noclip disabled - collisions restored");
						}
					}
					return;
				}
				if (!collisionsDisabled)
				{
					CharacterController component2 = ((Component)val).GetComponent<CharacterController>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.detectCollisions = false;
						collisionsDisabled = true;
						SeedHunterPlugin.Log.LogInfo((object)"Noclip enabled - collisions disabled");
					}
				}
				if (Input.GetKey((KeyCode)32))
				{
					__instance._velocityY = 25f;
				}
				else if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
				{
					__instance._velocityY = -25f;
				}
				else
				{
					__instance._velocityY = 0f;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = SeedHunterPlugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error in CharacterMovement_Update_Postfix: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val2);
			}
		}
	}
	[HarmonyPatch]
	public class GodModePatches
	{
		[HarmonyPatch(typeof(Character), "TakeDamage")]
		[HarmonyPrefix]
		public static bool BlockAllDamage(Character __instance)
		{
			if ((StateManager.FastMovementEnabled || StateManager.NoclipEnabled) && __instance.IsPlayer())
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static bool PreventHealthDecrease(Character __instance, ref float value)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			if (!StateManager.FastMovementEnabled && !StateManager.NoclipEnabled)
			{
				return true;
			}
			if (!__instance.IsPlayer())
			{
				return true;
			}
			try
			{
				float currentHealth = __instance.CurrentHealth;
				if (value < currentHealth)
				{
					value = currentHealth;
					return true;
				}
				return true;
			}
			catch (Exception ex)
			{
				ManualLogSource log = SeedHunterPlugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error in PreventHealthDecrease: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val);
				return true;
			}
		}

		[HarmonyPatch(typeof(CharacterMovement), "CheckGrounded")]
		[HarmonyPrefix]
		public static void PreventFallDamage(CharacterMovement __instance)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			try
			{
				PlayerCharacter val = default(PlayerCharacter);
				if ((StateManager.FastMovementEnabled || StateManager.NoclipEnabled) && ((Component)__instance).TryGetComponent<PlayerCharacter>(ref val) && __instance._velocityY < -5f)
				{
					__instance._velocityY = -5f;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = SeedHunterPlugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error in PreventFallDamage: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val2);
			}
		}
	}
	[HarmonyPatch]
	public class MovementPatches
	{
		private static float cachedOriginalSpeed = -1f;

		[HarmonyPatch(typeof(Character), "DrainStamina")]
		[HarmonyPrefix]
		public static bool BlockStaminaDrain(Character __instance)
		{
			if (!StateManager.FastMovementEnabled)
			{
				return true;
			}
			if (__instance.IsPlayer())
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerCharacter), "Update")]
		[HarmonyPostfix]
		public static void ModifyPlayerSpeed(PlayerCharacter __instance)
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				CharacterMovement characterMovement = __instance.GetCharacterMovement();
				if ((Object)(object)characterMovement == (Object)null || (Object)(object)characterMovement.parameters == (Object)null)
				{
					return;
				}
				MovementStats parameters = characterMovement.parameters;
				if (cachedOriginalSpeed < 0f)
				{
					cachedOriginalSpeed = parameters.speed;
					ManualLogSource log = SeedHunterPlugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cached original movement speed: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(cachedOriginalSpeed);
					}
					log.LogInfo(val);
				}
				if (!StateManager.FastMovementEnabled)
				{
					if (Math.Abs(parameters.speed - cachedOriginalSpeed) > 0.1f)
					{
						parameters.speed = cachedOriginalSpeed;
						characterMovement.parameters = parameters;
					}
					return;
				}
				float currentSpeed = StateManager.CurrentSpeed;
				if (Math.Abs(parameters.speed - currentSpeed) > 0.1f)
				{
					parameters.speed = currentSpeed;
					characterMovement.parameters = parameters;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = SeedHunterPlugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(28, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Error in ModifyPlayerSpeed: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
				}
				log2.LogError(val2);
			}
		}
	}
	[HarmonyPatch]
	public class NoclipPatches_DirectPosition
	{
		private static bool collisionsDisabled = false;

		private static float baseVerticalSpeed = 25f;

		[HarmonyPatch(typeof(PlayerCharacter), "Update")]
		[HarmonyPostfix]
		public static void PlayerCharacter_Update_Postfix(PlayerCharacter __instance)
		{
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!StateManager.NoclipEnabled)
				{
					if (collisionsDisabled)
					{
						CharacterController component = ((Component)__instance).GetComponent<CharacterController>();
						if ((Object)(object)component != (Object)null)
						{
							component.detectCollisions = true;
							collisionsDisabled = false;
						}
					}
					return;
				}
				if (!collisionsDisabled)
				{
					CharacterController component2 = ((Component)__instance).GetComponent<CharacterController>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.detectCollisions = false;
						collisionsDisabled = true;
					}
				}
				CharacterMovement characterMovement = __instance.GetCharacterMovement();
				if ((Object)(object)characterMovement != (Object)null)
				{
					characterMovement._velocityY = 0f;
				}
				Transform transform = ((Component)__instance).transform;
				Vector3 position = transform.position;
				float num = 0f;
				float num2 = (StateManager.FastMovementEnabled ? StateManager.CurrentSpeed : baseVerticalSpeed);
				if (Input.GetKey((KeyCode)32))
				{
					num = num2 * Time.deltaTime;
				}
				else if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
				{
					num = (0f - num2) * Time.deltaTime;
				}
				if (Math.Abs(num) > 0.001f)
				{
					Vector3 position2 = default(Vector3);
					((Vector3)(ref position2))..ctor(position.x, position.y + num, position.z);
					transform.position = position2;
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = SeedHunterPlugin.Log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(58, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error in PlayerCharacter_Update_Postfix (DirectPosition): ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogError(val);
			}
		}
	}
}