Decompiled source of Monsters v0.1.3

SpellBrigadeMonsters.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using SpellBrigadeMonsters.Core;
using SpellBrigadeMonsters.Game;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SpellBrigadeMonsters")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: AssemblyInformationalVersion("0.1.3+8ad4893a1b915670d8bd80ff7259f64fa8dfa12c")]
[assembly: AssemblyProduct("SpellBrigadeMonsters")]
[assembly: AssemblyTitle("SpellBrigadeMonsters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.3.0")]
[module: UnverifiableCode]
namespace SpellBrigadeMonsters
{
	internal sealed class MonsterConfig
	{
		public ConfigEntry<bool> Enabled;

		public ConfigEntry<float> SpawnShare;

		public ConfigEntry<int> FromWave;

		public ConfigEntry<float> HealthMultiplier;

		public ConfigEntry<float> DamageMultiplier;

		public ConfigEntry<float> SpeedMultiplier;

		public ConfigEntry<float> ExperienceMultiplier;

		public ConfigEntry<float> VisualScale;

		public static MonsterConfig Bind(ConfigFile cfg, string section, string donor, float share, int fromWave, float hp, float dmg, float speed, float xp, float scale = 1f)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			return new MonsterConfig
			{
				Enabled = cfg.Bind<bool>(section, "Enabled", true, "Add the " + section + " to the waves. Every co-op player needs the mod either way."),
				SpawnShare = cfg.Bind<float>(section, "SpawnShare", share, new ConfigDescription("Share of the wave's random enemy picks (0.05 = one pick in twenty). Host only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), Array.Empty<object>())),
				FromWave = cfg.Bind<int>(section, "FromWave", fromWave, new ConfigDescription("First wave (1-20) it can appear in. Host only.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())),
				HealthMultiplier = cfg.Bind<float>(section, "HealthMultiplier", hp, new ConfigDescription("Max health as a multiple of the " + donor + "'s (the game then scales it for difficulty, world and wave as usual).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 20f), Array.Empty<object>())),
				DamageMultiplier = cfg.Bind<float>(section, "DamageMultiplier", dmg, new ConfigDescription("Contact damage as a multiple of the " + donor + "'s.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())),
				SpeedMultiplier = cfg.Bind<float>(section, "SpeedMultiplier", speed, new ConfigDescription("Move speed as a multiple of the " + donor + "'s.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 4f), Array.Empty<object>())),
				ExperienceMultiplier = cfg.Bind<float>(section, "ExperienceMultiplier", xp, new ConfigDescription("Experience dropped as a multiple of the " + donor + "'s (at least one orb).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>())),
				VisualScale = cfg.Bind<float>(section, "VisualScale", scale, new ConfigDescription("Size of the model and its hitbox. Restart the game after changing; every co-op player should use the same value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 3f), Array.Empty<object>()))
			};
		}
	}
	internal static class ModConfig
	{
		public static MonsterConfig Shellsnail;

		public static MonsterConfig Leapling;

		public static MonsterConfig Urchin;

		public static MonsterConfig Sporecap;

		public static ConfigEntry<int> UrchinShards;

		public static ConfigEntry<float> UrchinSplitAfter;

		public static ConfigEntry<int> LeaplingPackSize;

		public static ConfigEntry<bool> DebugHotkey;

		public static ConfigEntry<bool> TrailEnabled;

		public static ConfigEntry<float> TrailSeconds;

		public static ConfigEntry<float> TrailDamageMultiplier;

		public static ConfigEntry<float> TrailSize;

		public static ConfigEntry<bool> LeapEnabled;

		public static ConfigEntry<float> LeapCooldown;

		public static ConfigEntry<float> LeapMinDistance;

		public static ConfigEntry<float> LeapMaxDistance;

		public static ConfigEntry<bool> BurstEnabled;

		public static ConfigEntry<float> BurstTriggerRange;

		public static ConfigEntry<float> BurstDamageMultiplier;

		public static void Init(ConfigFile cfg)
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Expected O, but got Unknown
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Expected O, but got Unknown
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Expected O, but got Unknown
			Shellsnail = MonsterConfig.Bind(cfg, "Shellsnail", "Snipjaw", 0.03f, 4, 3f, 1.5f, 0.6f, 2.5f, 0.75f);
			Leapling = MonsterConfig.Bind(cfg, "Leapling", "Crabling", 0.02f, 2, 0.6f, 1f, 1f, 1f);
			Urchin = MonsterConfig.Bind(cfg, "Urchin", "Spitter", 0.025f, 3, 1.2f, 1f, 1f, 1.5f);
			Sporecap = MonsterConfig.Bind(cfg, "Sporecap", "Stinkbug", 0.03f, 2, 0.5f, 1f, 0.5f, 0.5f);
			UrchinShards = cfg.Bind<int>("Urchin", "ClusterShards", 6, new ConfigDescription("The Spine Urchin's cluster spike splits into this many small spines, in a ring. Every co-op player should use the same value.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 12), Array.Empty<object>()));
			UrchinSplitAfter = cfg.Bind<float>("Urchin", "SplitAfterSeconds", 0.55f, new ConfigDescription("How long the big spine flies before it splits. Every co-op player should use the same value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 2f), Array.Empty<object>()));
			LeaplingPackSize = cfg.Bind<int>("Leapling", "PackSize", 5, new ConfigDescription("Leaplings arrive in packs: when the wave picks one, this many spawn together. Host only.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			TrailEnabled = cfg.Bind<bool>("Shellsnail", "Trail", true, "The Shellsnail leaves a damaging trail behind it (the game's own jellyfish trail). Every co-op player should use the same settings.");
			TrailSeconds = cfg.Bind<float>("Shellsnail", "TrailSeconds", 3f, new ConfigDescription("How long each bit of the trail stays on the ground.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 15f), Array.Empty<object>()));
			TrailDamageMultiplier = cfg.Bind<float>("Shellsnail", "TrailDamageMultiplier", 1f, new ConfigDescription("Trail damage per tick as a multiple of the jellyfish trail's (the game then scales it for difficulty as usual).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			TrailSize = cfg.Bind<float>("Shellsnail", "TrailSize", 0.6f, new ConfigDescription("Size of the trail bits (and their damage area) as a multiple of the jellyfish trail's.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 3f), Array.Empty<object>()));
			LeapEnabled = cfg.Bind<bool>("Leapling", "Leap", true, "Now and then a Leapling charges up (blinks red, swells and trembles), then leaps in one high arc (over other mobs, up to 7 m) to land just short of a player. Host only.");
			LeapCooldown = cfg.Bind<float>("Leapling", "LeapCooldown", 6f, new ConfigDescription("Average seconds between one Leapling's leaps (each waits 75-125 % of this).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			LeapMinDistance = cfg.Bind<float>("Leapling", "LeapMinDistance", 3.5f, new ConfigDescription("Only leaps at a player at least this far away (m).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
			LeapMaxDistance = cfg.Bind<float>("Leapling", "LeapMaxDistance", 10f, new ConfigDescription("... and at most this far away (m).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 40f), Array.Empty<object>()));
			BurstEnabled = cfg.Bind<bool>("Sporecap", "Burst", true, "A Sporecap that gets close to a player swells and flashes for a moment, then bursts (the exploding tick's blast) and leaves its spore cloud. Killed before that, it only leaves the cloud. Every co-op player should use the same settings.");
			BurstTriggerRange = cfg.Bind<float>("Sporecap", "BurstTriggerRange", 2.2f, new ConfigDescription("Starts its wind-up when a player is this close (m). Host only.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 8f), Array.Empty<object>()));
			BurstDamageMultiplier = cfg.Bind<float>("Sporecap", "BurstDamageMultiplier", 1f, new ConfigDescription("Blast damage on players as a multiple of the exploding tick's.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			DebugHotkey = cfg.Bind<bool>("Debug", "Hotkey", false, "For testing: Ctrl+Shift+M spawns one of each monster (a Leapling pack) a few metres from you (host only).");
		}

		public static MonsterConfig For(MonsterDef def)
		{
			if (def != Monsters.Shellsnail)
			{
				if (def != Monsters.Urchin)
				{
					if (def != Monsters.Sporecap)
					{
						return Leapling;
					}
					return Sporecap;
				}
				return Urchin;
			}
			return Shellsnail;
		}
	}
	internal static class ModLog
	{
		private static ManualLogSource? _log;

		private static StreamWriter? _file;

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

		private static readonly Dictionary<string, float> Throttle = new Dictionary<string, float>();

		public const string CleanExit = "clean exit";

		public static string FilePath => Path.Combine(Paths.BepInExRootPath, "SpellBrigadeMonsters.log");

		public static string PreviousFilePath => Path.Combine(Paths.BepInExRootPath, "SpellBrigadeMonsters.prev.log");

		public static string? PreviousCrashStep { get; private set; }

		public static void Init(ManualLogSource log)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			_log = log;
			bool flag = default(bool);
			try
			{
				if (File.Exists(FilePath))
				{
					File.Copy(FilePath, PreviousFilePath, overwrite: true);
					string text = null;
					string[] array = File.ReadAllLines(FilePath);
					foreach (string text2 in array)
					{
						int num = text2.IndexOf(" STEP  ", StringComparison.Ordinal);
						if (num >= 0)
						{
							string text3 = text2;
							int num2 = num + 7;
							text = text3.Substring(num2, text3.Length - num2).Trim();
						}
					}
					if (text != null && text != "clean exit")
					{
						PreviousCrashStep = text;
					}
				}
			}
			catch (Exception ex)
			{
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(30, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not read the previous ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(FilePath);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val);
			}
			try
			{
				_file = new StreamWriter(new FileStream(FilePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
				{
					AutoFlush = true
				};
				_file.WriteLine($"SpellBrigadeMonsters {"0.1.3"} log, started {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
				if (PreviousCrashStep != null)
				{
					_file.WriteLine("Previous session did not exit cleanly; its last step was: " + PreviousCrashStep + " (log kept as SpellBrigadeMonsters.prev.log)");
				}
			}
			catch (Exception ex2)
			{
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(17, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not open ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(FilePath);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex2.Message);
				}
				log.LogWarning(val);
			}
		}

		public static void Info(string msg)
		{
			ManualLogSource? log = _log;
			if (log != null)
			{
				log.LogInfo((object)msg);
			}
			ToFile("INFO ", msg);
		}

		public static void Warn(string msg)
		{
			ManualLogSource? log = _log;
			if (log != null)
			{
				log.LogWarning((object)msg);
			}
			ToFile("WARN ", msg);
		}

		public static void Error(string msg)
		{
			ManualLogSource? log = _log;
			if (log != null)
			{
				log.LogError((object)msg);
			}
			ToFile("ERROR", msg);
		}

		public static void Debug(string msg)
		{
			ManualLogSource? log = _log;
			if (log != null)
			{
				log.LogDebug((object)msg);
			}
			ToFile("DEBUG", msg);
		}

		public static void Step(string msg)
		{
			ToFile("STEP ", msg);
		}

		public static void StepOnce(string key, string msg)
		{
			if (Once.Add("step:" + key))
			{
				Step(msg);
			}
		}

		public static void InfoOnce(string key, string msg)
		{
			if (Once.Add(key))
			{
				Info(msg);
			}
		}

		public static void WarnOnce(string key, string msg)
		{
			if (Once.Add(key))
			{
				Warn(msg);
			}
		}

		public static void ErrorThrottled(string key, Exception ex, float now, float seconds = 10f)
		{
			if (!Throttle.TryGetValue(key, out var value) || !(now - value < seconds))
			{
				Throttle[key] = now;
				Error($"[{key}] {ex.GetType().Name}: {ex.Message}\n{ex.StackTrace}");
			}
		}

		private static void ToFile(string level, string msg)
		{
			if (_file == null)
			{
				return;
			}
			try
			{
				lock (_file)
				{
					_file.WriteLine($"{DateTime.Now:HH:mm:ss.fff} {level} {msg}");
				}
			}
			catch
			{
			}
		}
	}
	[BepInPlugin("com.stefanws0.spellbrigademonsters", "SpellBrigadeMonsters", "0.1.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BasePlugin
	{
		public const string Guid = "com.stefanws0.spellbrigademonsters";

		public const string Name = "SpellBrigadeMonsters";

		public const string Version = "0.1.3";

		public override void Load()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			ModLog.Init(((BasePlugin)this).Log);
			ModLog.Step("Load: config");
			ModConfig.Init(((BasePlugin)this).Config);
			ModLog.Step("Load: registering MonstersRunner");
			ClassInjector.RegisterTypeInIl2Cpp<MonstersRunner>();
			Harmony val = new Harmony("com.stefanws0.spellbrigademonsters");
			Type[] array = new Type[9]
			{
				typeof(SpawnPatches),
				typeof(NetworkPatches),
				typeof(HopDriver),
				typeof(SnailTrail),
				typeof(FrogMotion),
				typeof(Upright),
				typeof(UrchinSpines),
				typeof(SporecapBurst),
				typeof(SporeCloud)
			};
			foreach (Type type in array)
			{
				ModLog.Step("Load: patching " + type.Name);
				try
				{
					val.CreateClassProcessor(type).Patch();
				}
				catch (Exception ex)
				{
					ModLog.Error("Patch group " + type.Name + " failed: " + ex.Message);
				}
			}
			((BasePlugin)this).AddComponent<MonstersRunner>();
			KitSelfTest.Register();
			ModLog.Step("Load: done");
			ModLog.Info($"{"SpellBrigadeMonsters"} {"0.1.3"} loaded: {string.Join(", ", Monsters.All.Select((MonsterDef m) => $"{m.Name} (EnemyType {m.EnemyType})"))}. " + "Every player in a co-op lobby needs this mod: the game refuses joins between players with different prefab lists.");
		}
	}
}
namespace SpellBrigadeMonsters.Game
{
	internal static class DangerCircle
	{
		private static CircleDangerIndicator? _prefab;

		private static bool _searched;

		private static bool _listed;

		private static bool _gaveUp;

		private static int _logged;

		public static int Shown { get; private set; }

		public static string Source { get; private set; } = "not searched";

		private static CircleDangerIndicator? Prefab()
		{
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_prefab != (Object)null && !((Il2CppObjectBase)_prefab).WasCollected)
			{
				return _prefab;
			}
			if (_gaveUp)
			{
				return null;
			}
			if (_searched && Time.frameCount % 600 != 0)
			{
				return null;
			}
			_searched = true;
			try
			{
				NetworkManager singleton = NetworkManager.Singleton;
				object obj;
				if (!((Object)(object)singleton != (Object)null))
				{
					obj = null;
				}
				else
				{
					NetworkConfig networkConfig = singleton.NetworkConfig;
					if (networkConfig == null)
					{
						obj = null;
					}
					else
					{
						NetworkPrefabs prefabs = networkConfig.Prefabs;
						obj = ((prefabs != null) ? prefabs.NetworkPrefabsLists : null);
					}
				}
				List<NetworkPrefabsList> val = (List<NetworkPrefabsList>)obj;
				CircleDangerIndicator val2 = null;
				string source = "";
				if (val == null)
				{
					return null;
				}
				_gaveUp = true;
				if (val != null)
				{
					Enumerator<NetworkPrefabsList> enumerator = val.GetEnumerator();
					while (enumerator.MoveNext())
					{
						NetworkPrefabsList current = enumerator.Current;
						if (((current != null) ? current.List : null) == null)
						{
							continue;
						}
						Enumerator<NetworkPrefab> enumerator2 = current.List.GetEnumerator();
						while (enumerator2.MoveNext())
						{
							NetworkPrefab current2 = enumerator2.Current;
							if (!((Object)(object)((current2 != null) ? current2.Prefab : null) == (Object)null))
							{
								EnemyShootProjectileOnDeath componentInChildren = current2.Prefab.GetComponentInChildren<EnemyShootProjectileOnDeath>(true);
								ArcingProjectile val3 = (((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.projectilePrefab != (Object)null) ? ((Component)componentInChildren.projectilePrefab).GetComponent<ArcingProjectile>() : null);
								if ((Object)(object)val3 != (Object)null && (Object)(object)val3.dangerIndicatorPrefab != (Object)null && (Object)(object)_prefab == (Object)null)
								{
									_prefab = val3.dangerIndicatorPrefab;
									Source = ((Object)current2.Prefab).name + "'s death projectile (" + ((Object)_prefab).name + ")";
								}
								DiveBehaviour componentInChildren2 = current2.Prefab.GetComponentInChildren<DiveBehaviour>(true);
								GameObject val4 = (((Object)(object)componentInChildren2 != (Object)null) ? componentInChildren2.circleDangerIndicatorPrefab : null);
								CircleDangerIndicator val5 = (((Object)(object)val4 != (Object)null) ? val4.GetComponent<CircleDangerIndicator>() : null);
								if ((Object)(object)val5 != (Object)null && (Object)(object)val2 == (Object)null)
								{
									val2 = val5;
									source = ((Object)current2.Prefab).name + "'s dive attack (" + ((Object)val4).name + ")";
								}
							}
						}
					}
				}
				Scene scene;
				if ((Object)(object)_prefab == (Object)null)
				{
					foreach (ArcingProjectile item in Resources.FindObjectsOfTypeAll<ArcingProjectile>())
					{
						if ((Object)(object)item != (Object)null && (Object)(object)item.dangerIndicatorPrefab != (Object)null)
						{
							scene = ((Component)item).gameObject.scene;
							if (!((Scene)(ref scene)).IsValid())
							{
								_prefab = item.dangerIndicatorPrefab;
								Source = $"arcing projectile {((Object)item).name} ({((Object)_prefab).name})";
								break;
							}
						}
					}
				}
				if ((Object)(object)_prefab == (Object)null && (Object)(object)val2 != (Object)null)
				{
					_prefab = val2;
					Source = source;
				}
				if (!_listed)
				{
					_listed = true;
					StringBuilder stringBuilder = new StringBuilder();
					foreach (CircleDangerIndicator item2 in Resources.FindObjectsOfTypeAll<CircleDangerIndicator>())
					{
						if ((Object)(object)item2 == (Object)null)
						{
							continue;
						}
						scene = ((Component)item2).gameObject.scene;
						if (((Scene)(ref scene)).IsValid())
						{
							continue;
						}
						stringBuilder.Append(((Object)item2).name).Append(" [");
						foreach (Renderer componentsInChild in ((Component)item2).GetComponentsInChildren<Renderer>(true))
						{
							Material sharedMaterial = componentsInChild.sharedMaterial;
							stringBuilder.Append(((Object)(object)sharedMaterial != (Object)null) ? ((Object)sharedMaterial).name : "-");
							if ((Object)(object)sharedMaterial != (Object)null && sharedMaterial.HasProperty("_Color"))
							{
								stringBuilder.Append(' ').Append(sharedMaterial.color);
							}
							if ((Object)(object)sharedMaterial != (Object)null && sharedMaterial.HasProperty("_BaseColor"))
							{
								stringBuilder.Append(' ').Append(sharedMaterial.GetColor("_BaseColor"));
							}
							stringBuilder.Append("; ");
						}
						stringBuilder.Append("] ");
					}
					ModLog.Info($"Danger circles in the game: {stringBuilder}");
				}
				if ((Object)(object)_prefab == (Object)null)
				{
					foreach (CircleDangerIndicator item3 in Resources.FindObjectsOfTypeAll<CircleDangerIndicator>())
					{
						if (!((Object)(object)item3 == (Object)null))
						{
							scene = ((Component)item3).gameObject.scene;
							if (!((Scene)(ref scene)).IsValid())
							{
								_prefab = item3;
								Source = "loaded asset " + ((Object)item3).name;
								break;
							}
						}
					}
				}
				if ((Object)(object)_prefab != (Object)null)
				{
					bool flag = (Object)(object)((Component)_prefab).GetComponent<NetworkObject>() != (Object)null;
					Il2CppArrayBase<Renderer> componentsInChildren = ((Component)_prefab).GetComponentsInChildren<Renderer>(true);
					ModLog.Info($"Leapling landing warning: the game's CircleDangerIndicator from {Source}; {componentsInChildren.Length} renderer(s), build-up {CircleDangerIndicator.BuildUpAnimationDuration:0.00} s, prefab scale {((Component)_prefab).transform.localScale}{(flag ? ", NETWORKED (not used)" : "")}.");
					if (flag)
					{
						_prefab = null;
					}
				}
				else
				{
					ModLog.WarnOnce("danger-circle", "Leapling landing warning: the game's CircleDangerIndicator was not found; using our own ring.");
				}
			}
			catch (Exception ex)
			{
				ModLog.ErrorThrottled("danger-circle", ex, Time.realtimeSinceStartup);
			}
			return _prefab;
		}

		public static GameObject? Show(Vector3 at, float radius, float seconds, string name = "Leapling_LandingWarning")
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			CircleDangerIndicator val = Prefab();
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			try
			{
				CircleDangerIndicator val2 = Object.Instantiate<CircleDangerIndicator>(val, at + Vector3.up * 0.02f, ((Component)val).transform.rotation);
				((Object)((Component)val2).gameObject).name = name;
				val2.Trigger(seconds, radius);
				Shown++;
				if (_logged++ < 2)
				{
					Bounds val3 = default(Bounds);
					((Bounds)(ref val3))..ctor(at, Vector3.zero);
					foreach (Renderer componentsInChild in ((Component)val2).GetComponentsInChildren<Renderer>(true))
					{
						((Bounds)(ref val3)).Encapsulate(componentsInChild.bounds);
					}
					ModLog.Info($"Leapling landing warning shown: radius {radius:0.00} m for {seconds:0.00} s; scale after Trigger {((Component)val2).transform.localScale}, drawn bounds {((Bounds)(ref val3)).size}.");
				}
				return ((Component)val2).gameObject;
			}
			catch (Exception ex)
			{
				ModLog.ErrorThrottled("danger-circle-show", ex, Time.realtimeSinceStartup);
				return null;
			}
		}

		public static int Visible()
		{
			return Visible("Leapling_LandingWarning");
		}

		public static int Visible(string name)
		{
			int num = 0;
			foreach (CircleDangerIndicator item in Object.FindObjectsOfType<CircleDangerIndicator>())
			{
				if ((Object)(object)item == (Object)null || ((Object)((Component)item).gameObject).name != name)
				{
					continue;
				}
				foreach (Renderer componentsInChild in ((Component)item).GetComponentsInChildren<Renderer>())
				{
					if (componentsInChild.isVisible)
					{
						num++;
						break;
					}
				}
			}
			return num;
		}
	}
	[HarmonyPatch]
	internal static class FrogMotion
	{
		private sealed class Frog
		{
			public EnemyNavigationController Nav;

			public ulong NetId;

			public Transform Root;

			public Transform VisRoot;

			public Transform Visual;

			public Transform LeapVisual;

			public MeshRenderer MainRenderer;

			public MeshRenderer LeapRenderer;

			public Vector3 BaseLocal;

			public Quaternion BaseLocalRot;

			public Vector3 Offset;

			public Vector3 LastSample;

			public bool HasSample;

			public float LastPhase;

			public readonly RootTrack Track = new RootTrack();

			public bool Pending;

			public bool Playing;

			public double Start;

			public Vector3 From;

			public Vector3 To;

			public bool DustDone;

			public float LeapU;

			public Quaternion Facing;

			public float HoldUntil;

			public float TurnStart = -10f;

			public Quaternion TurnFrom;

			public float CheckAt = -1f;

			public Vector3 Drawn;

			public bool HasDrawn;

			public float LeapEndedAt = -10f;

			public readonly List<GameObject> Warnings = new List<GameObject>();

			public HealthContainer? Health;

			public bool AbortChecked;

			public float AnimOffset;

			public float OffsetReadAt = -10f;

			public float BaseFps = 40f;

			public double Frame;

			public double PrevFrame;

			public bool HasFrame;

			public double Clip;

			public float Fps;

			public float Phase;

			public double LeapClip0;

			public float PendingSince;

			public bool Pin;

			public bool Probing;

			public GameObject RootGo;

			public Vector3 PinAt;

			public float PinUntil;
		}

		private static readonly int OffsetId = Shader.PropertyToID("_AnimationOffset");

		private static readonly int FramesId = Shader.PropertyToID("_Frames");

		private static readonly int FramerateId = Shader.PropertyToID("_Framerate");

		private static MaterialPropertyBlock? _mpb;

		private static int _speedLogs;

		private static int _deathLogs;

		private const float MaxOffset = 1.5f;

		private static readonly float Lead = 0.18f;

		private const float HoldSeconds = 0.4f;

		private const float CatchUpSpeed = 9f;

		private const float TurnSeconds = 0.25f;

		private static readonly Dictionary<IntPtr, Frog> Frogs = new Dictionary<IntPtr, Frog>();

		private static readonly Dictionary<ulong, Frog> ById = new Dictionary<ulong, Frog>();

		private static readonly List<IntPtr> Gone = new List<IntPtr>();

		private static int _seen;

		public static bool FlashOn = true;

		private static readonly int HitFlashId = Shader.PropertyToID("_HitFlash");

		private static readonly int HitColorId = Shader.PropertyToID("_HitColor");

		private static readonly Color ChargeColor = new Color(1f, 0.3f, 0.15f, 1f);

		private static bool _mainSaved;

		private static float _mainFps;

		private static float _mainOff;

		private static Frog? _traceFrog;

		private static readonly StringBuilder Trace = new StringBuilder();

		private static bool _traceNext;

		public static float MovedInAir;

		public static float MovedSitting;

		public static int WarningsCleared { get; private set; }

		public static int Aborted { get; private set; }

		public static int PinsReleased { get; private set; }

		public static int Count => Frogs.Count;

		public static int Slides { get; private set; }

		public static int LeapsBegun { get; private set; }

		public static int ClockJumps { get; private set; }

		private static void ReadClip(Frog f, double t)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			((Renderer)f.MainRenderer).GetPropertyBlock(_mpb);
			float num = (_mpb.HasFloat(FramerateId) ? _mpb.GetFloat(FramerateId) : f.BaseFps);
			float animOffset = (_mpb.HasFloat(OffsetId) ? _mpb.GetFloat(OffsetId) : 0f);
			if (num < 0f)
			{
				num = 0f;
			}
			double num2 = t * (double)num;
			if (f.HasFrame)
			{
				double num3 = num2 - f.Frame;
				if (num3 < 0.0 || num3 > 8.0)
				{
					num3 = Math.Max(0f, Time.deltaTime) * num;
					ClockJumps++;
				}
				f.Clip += num3 / 40.0;
			}
			if (Math.Abs(num - f.Fps) > 0.5f && _speedLogs++ < 6)
			{
				ModLog.Info($"Leapling clip speed {num:0.#} fps (normal {f.BaseFps:0.#}): {((num < 0.5f) ? "frozen" : ((num < f.BaseFps - 0.5f) ? "slowed" : "normal"))}; its hop and leap follow the clip.");
			}
			f.PrevFrame = (f.HasFrame ? f.Frame : num2);
			f.Frame = num2;
			f.HasFrame = true;
			f.Fps = num;
			f.AnimOffset = animOffset;
			double num4 = num2 / 28.0;
			f.Phase = (float)(num4 - Math.Floor(num4));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyNavigationController), "OnNetworkSpawn")]
		private static void OnSpawn(EnemyNavigationController __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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)
			try
			{
				Enemy component = ((Component)__instance).GetComponent<Enemy>();
				if ((Object)(object)component == (Object)null || (int)component.enemyType != Monsters.Leapling.EnemyType || (Object)(object)component.visualsRoot == (Object)null)
				{
					return;
				}
				Transform val = component.visualsRoot.Find(Monsters.Leapling.Name + "_Visual");
				Transform val2 = component.visualsRoot.Find("Leapling_LeapVisual");
				if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
				{
					ModLog.WarnOnce("frog-parts", "Leapling: model parts not found; it hops in place and does not leap.");
					return;
				}
				Frog frog = new Frog
				{
					Nav = __instance,
					NetId = ((NetworkBehaviour)__instance).NetworkObjectId,
					Root = ((Component)__instance).transform,
					RootGo = ((Component)__instance).gameObject,
					VisRoot = component.visualsRoot,
					Visual = val,
					LeapVisual = val2,
					MainRenderer = ((Component)val).GetComponent<MeshRenderer>(),
					LeapRenderer = ((Component)val2).GetComponent<MeshRenderer>(),
					BaseLocal = Vector3.zero,
					BaseLocalRot = val.localRotation
				};
				frog.Health = ((Component)__instance).GetComponent<HealthContainer>();
				Material val3 = (((Object)(object)frog.MainRenderer != (Object)null) ? ((Renderer)frog.MainRenderer).sharedMaterial : null);
				if ((Object)(object)val3 != (Object)null && val3.HasProperty(FramerateId) && val3.GetFloat(FramerateId) > 1f)
				{
					frog.BaseFps = val3.GetFloat(FramerateId);
				}
				Reset(frog);
				Frogs[((Il2CppObjectBase)__instance).Pointer] = frog;
				ById[frog.NetId] = frog;
			}
			catch (Exception ex)
			{
				ModLog.ErrorThrottled("frog-spawn", ex, Time.realtimeSinceStartup);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(EnemyNavigationController), "OnNetworkDespawn")]
		private static void OnDespawn(EnemyNavigationController __instance)
		{
			if (!Frogs.TryGetValue(((Il2CppObjectBase)__instance).Pointer, out Frog value))
			{
				return;
			}
			Frogs.Remove(((Il2CppObjectBase)__instance).Pointer);
			if (ById.TryGetValue(value.NetId, out Frog value2) && value2 == value)
			{
				ById.Remove(value.NetId);
			}
			try
			{
				Reset(value);
			}
			catch (Exception ex)
			{
				ModLog.ErrorThrottled("frog-despawn", ex, Time.realtimeSinceStartup);
			}
		}

		private static void Reset(Frog f)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (f.Warnings.Count > 0)
			{
				WarningsCleared++;
			}
			ClearWarnings(f);
			f.Pending = (f.Playing = false);
			f.Offset = Vector3.zero;
			f.HasSample = false;
			f.HasDrawn = false;
			f.HasFrame = false;
			f.Pin = false;
			f.Track.Clear();
			f.HoldUntil = 0f;
			f.TurnStart = -10f;
			if ((Object)(object)f.Visual != (Object)null && !((Il2CppObjectBase)f.Visual).WasCollected)
			{
				f.Visual.localPosition = f.BaseLocal;
				f.Visual.localRotation = f.BaseLocalRot;
			}
			if ((Object)(object)f.MainRenderer != (Object)null && !((Il2CppObjectBase)f.MainRenderer).WasCollected)
			{
				((Renderer)f.MainRenderer).enabled = true;
			}
			if ((Object)(object)f.LeapRenderer != (Object)null && !((Il2CppObjectBase)f.LeapRenderer).WasCollected)
			{
				((Renderer)f.LeapRenderer).enabled = false;
			}
		}

		public static bool Order(LeapOrder order, bool local)
		{
			double start;
			return Order(order, local, out start);
		}

		public static double PlanStart(ulong networkObjectId)
		{
			if (!ById.TryGetValue(networkObjectId, out Frog value) || value.Playing || value.Pending || !value.HasFrame)
			{
				return -1.0;
			}
			if (value.Fps < 1f)
			{
				return -1.0;
			}
			double num = (1.0 - (double)value.Phase) * 28.0 / (double)value.Fps;
			return ShaderClock.Now + num;
		}

		public static float LeapProgress(ulong networkObjectId)
		{
			if (!ById.TryGetValue(networkObjectId, out Frog value))
			{
				return 2f;
			}
			if (value.Pending)
			{
				return -1f;
			}
			if (!value.Playing)
			{
				return 2f;
			}
			return Mathf.Clamp01(value.LeapU);
		}

		public static float ClipSpeed(ulong networkObjectId)
		{
			if (!ById.TryGetValue(networkObjectId, out Frog value) || !value.HasFrame || !(value.BaseFps > 0f))
			{
				return 1f;
			}
			return value.Fps / value.BaseFps;
		}

		public static void Cancel(ulong networkObjectId)
		{
			if (ById.TryGetValue(networkObjectId, out Frog value) && value.Pending)
			{
				value.Pending = false;
				MainBlink(value, on: false);
			}
		}

		public static bool Order(LeapOrder order, bool local, out double start)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			start = PlanStart(order.NetworkObjectId);
			if (start < 0.0 || !ById.TryGetValue(order.NetworkObjectId, out Frog value))
			{
				return false;
			}
			value.Start = start;
			value.To = new Vector3(order.X, order.Y, order.Z);
			value.Pending = true;
			value.PendingSince = Time.time;
			return true;
		}

		public static void Tick()
		{
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0783: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07af: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_064c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06da: Unknown result type (might be due to invalid IL or missing references)
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Expected O, but got Unknown
			//IL_06df: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Unknown result type (might be due to invalid IL or missing references)
			//IL_088a: Unknown result type (might be due to invalid IL or missing references)
			//IL_088f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_086e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_0902: Unknown result type (might be due to invalid IL or missing references)
			//IL_0915: Unknown result type (might be due to invalid IL or missing references)
			//IL_091c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Unknown result type (might be due to invalid IL or missing references)
			//IL_0926: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0948: Unknown result type (might be due to invalid IL or missing references)
			//IL_094d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0963: Unknown result type (might be due to invalid IL or missing references)
			//IL_0942: Unknown result type (might be due to invalid IL or missing references)
			//IL_0968: Unknown result type (might be due to invalid IL or missing references)
			//IL_0976: Unknown result type (might be due to invalid IL or missing references)
			//IL_097a: Unknown result type (might be due to invalid IL or missing references)
			//IL_097f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0984: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ade: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
			if (Frogs.Count == 0)
			{
				return;
			}
			double now = ShaderClock.Now;
			float time = Time.time;
			foreach (KeyValuePair<IntPtr, Frog> frog in Frogs)
			{
				Frog value = frog.Value;
				if ((Object)(object)value.Root == (Object)null || ((Il2CppObjectBase)value.Root).WasCollected || (Object)(object)value.Visual == (Object)null || ((Il2CppObjectBase)value.Visual).WasCollected || (Object)(object)value.LeapVisual == (Object)null || ((Il2CppObjectBase)value.LeapVisual).WasCollected)
				{
					Gone.Add(frog.Key);
					continue;
				}
				if (!value.RootGo.activeInHierarchy || ((Object)(object)value.Health != (Object)null && !((Il2CppObjectBase)value.Health).WasCollected && value.Health.CurrentHealth <= 0f))
				{
					if (value.Warnings.Count > 0 || value.Pending || value.Playing)
					{
						WarningsCleared++;
						if (_deathLogs++ < 3)
						{
							ModLog.Info("Leapling died " + (value.Playing ? "mid-leap" : (value.Pending ? "before its leap started" : "just after landing")) + ": its landing warning is removed.");
						}
						ClearWarnings(value);
						if (value.Playing)
						{
							EndLeap(value, value.VisRoot.TransformPoint(value.BaseLocal), time);
						}
						value.Pin = false;
						value.Pending = false;
					}
					continue;
				}
				ReadClip(value, now);
				float phase = value.Phase;
				float num = HopMotion.Hop.Progress(phase);
				Vector3 position = value.Root.position;
				value.Track.Add(value.Clip, position);
				Vector3 val = value.VisRoot.TransformPoint(value.BaseLocal);
				Vector3 val2 = val - position;
				if (value.Pending)
				{
					if (Math.Floor(value.Frame / 28.0) > Math.Floor(value.PrevFrame / 28.0))
					{
						MainBlink(value, on: false);
						BeginLeap(value, val2);
					}
					else if (time - value.PendingSince > 3f)
					{
						value.Pending = false;
						MainBlink(value, on: false);
					}
					else
					{
						MainBlink(value, FlashOn && (time - value.PendingSince) * 4f % 1f < 0.35f);
					}
				}
				if (value.Playing)
				{
					float num2 = (float)((value.Clip - value.LeapClip0) * 40.0);
					float num3 = (value.LeapU = num2 / 56f);
					SetLeapFrame(value, Mathf.Min(num2, 55.99f));
					if (!value.DustDone && num3 >= HopMotion.Leap.AirEnd)
					{
						value.DustDone = true;
						ClearWarnings(value);
						Fx.Spawn("Leapling_LandingDust", Fx.Transparent("dust", Fx.RingTex), value.To, new Color(0.96f, 0.88f, 0.74f, 0.9f), 0.45f, 0.5f * value.Visual.localScale.x, 2.4f * value.Visual.localScale.x, 0.02f, 0.3f);
					}
					if (!value.AbortChecked && num3 >= (HopMotion.Leap.AirStart + HopMotion.Leap.AirEnd) * 0.5f)
					{
						value.AbortChecked = true;
						Vector3 val3 = value.Root.position - value.From;
						Vector3 val4 = value.To - value.From;
						val3.y = (val4.y = 0f);
						if (((Vector3)(ref val4)).magnitude > 1.5f && Vector3.Dot(val3, ((Vector3)(ref val4)).normalized) < 0.1f * ((Vector3)(ref val4)).magnitude)
						{
							Aborted++;
							if (Aborted <= 3)
							{
								ModLog.Info($"Leapling leap called off mid-air: its hitbox moved {Vector3.Dot(val3, ((Vector3)(ref val4)).normalized):0.00} of {((Vector3)(ref val4)).magnitude:0.00} m (the game held it: frozen, stunned or knocked back); warning removed.");
							}
							ClearWarnings(value);
							value.To = position + val2;
							EndLeap(value, position + val2, time);
							continue;
						}
					}
					if (num3 < 1f)
					{
						float num4 = HopMotion.Leap.Progress(num3);
						Vector3 val5 = Vector3.Lerp(value.From, value.To, num4);
						if (_traceFrog == value)
						{
							if (_mpb == null)
							{
								_mpb = new MaterialPropertyBlock();
							}
							((Renderer)value.LeapRenderer).GetPropertyBlock(_mpb);
							int value2 = (int)Math.Floor(ShownLeapFrame(value));
							Vector3 val6 = value.Root.position - value.From;
							val6.y = 0f;
							Vector3 val7 = value.To - value.From;
							val7.y = 0f;
							StringBuilder trace = Trace;
							StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(3, 3, trace);
							handler.AppendFormatted(value2);
							handler.AppendLiteral(":");
							handler.AppendFormatted(num4, "0.00");
							handler.AppendLiteral(":");
							handler.AppendFormatted((((Vector3)(ref val7)).magnitude > 0.01f) ? (Vector3.Dot(val6, ((Vector3)(ref val7)).normalized) / ((Vector3)(ref val7)).magnitude) : 0f, "0.00");
							handler.AppendLiteral(" ");
							trace.Append(ref handler);
						}
						value.Pin = true;
						value.PinAt = val5 - val2;
						value.Visual.SetPositionAndRotation(val5, value.Facing);
						value.Drawn = val5;
						value.HasDrawn = true;
						float num5 = Charge(num3);
						Vector3 val8 = ((num5 > 0f) ? (value.Facing * Vector3.right * (0.07f * num5 * value.Visual.localScale.x * Mathf.Sin((float)Math.PI * 22f * num3 * 56f / 40f))) : Vector3.zero);
						value.LeapVisual.SetPositionAndRotation(val5 + val8, value.Facing);
						value.LeapVisual.localScale = Vector3.Scale(value.Visual.localScale, ChargeScale(num3));
						continue;
					}
					EndLeap(value, position + val2, time);
				}
				if (value.Probing)
				{
					continue;
				}
				if (((Renderer)value.LeapRenderer).enabled)
				{
					((Renderer)value.LeapRenderer).enabled = false;
				}
				float num6 = (phase - num + Lead) * 0.7f;
				Vector3 val9 = value.Track.At(value.Clip - (double)num6) + val2;
				if (!value.HasSample)
				{
					value.LastSample = val9;
					value.HasSample = true;
				}
				Vector3 val10 = val9 - value.LastSample;
				val10.y = 0f;
				value.LastSample = val9;
				float num7 = ((phase < value.LastPhase) ? 0f : HopMotion.Hop.Progress(value.LastPhase));
				value.LastPhase = phase;
				float num8 = 1f - num7;
				float num9 = ((num8 > 0.0001f) ? Mathf.Clamp01((num - num7) / num8) : 0f);
				bool flag = value.Pending || time < value.HoldUntil;
				if (flag && (((Vector3)(ref val10)).magnitude > 2f || ((Vector3)(ref value.Offset)).magnitude > 0.5f))
				{
					value.Offset -= val10;
				}
				else
				{
					value.Offset *= 1f - num9;
				}
				value.Offset.y = 0f;
				Vector3 val11 = val9 + value.Offset;
				Vector3 val12 = val11 - val;
				val12.y = 0f;
				float num10 = (flag ? 12f : 1.5f);
				if (((Vector3)(ref val12)).magnitude > num10)
				{
					val11 = val + ((Vector3)(ref val12)).normalized * num10;
				}
				val11.y = val.y;
				Quaternion val13 = value.VisRoot.rotation * value.BaseLocalRot;
				float num11 = (time - value.TurnStart) / 0.25f;
				Quaternion val14 = ((num11 < 1f) ? Quaternion.Slerp(value.TurnFrom, val13, num11 * num11 * (3f - 2f * num11)) : val13);
				if (value.HasDrawn)
				{
					Vector3 val15 = val11 - value.Drawn;
					val15.y = 0f;
					float num12 = 9f * Mathf.Max(Time.deltaTime, 0.0001f);
					if (((Vector3)(ref val15)).magnitude > num12)
					{
						if (((Vector3)(ref val15)).magnitude > 0.3f)
						{
							Slides++;
							if (Slides <= 6)
							{
								DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(103, 3);
								defaultInterpolatedStringHandler.AppendLiteral("Leapling model would have jumped ");
								defaultInterpolatedStringHandler.AppendFormatted(((Vector3)(ref val15)).magnitude, "0.00");
								defaultInterpolatedStringHandler.AppendLiteral(" m in one frame (");
								defaultInterpolatedStringHandler.AppendFormatted((time - value.LeapEndedAt < 2f) ? $"{time - value.LeapEndedAt:0.00} s after a leap" : "while hopping");
								defaultInterpolatedStringHandler.AppendLiteral(", ");
								defaultInterpolatedStringHandler.AppendLiteral("model ");
								Vector3 val16 = val11 - val;
								defaultInterpolatedStringHandler.AppendFormatted(((Vector3)(ref val16)).magnitude, "0.00");
								defaultInterpolatedStringHandler.AppendLiteral(" m from its hitbox); it slides there instead.");
								ModLog.Info(defaultInterpolatedStringHandler.ToStringAndClear());
							}
						}
						Vector3 val17 = value.Drawn + ((Vector3)(ref val15)).normalized * num12;
						((Vector3)(ref val11))..ctor(val17.x, val11.y, val17.z);
						Vector3 val18 = val11 - (val9 + value.Offset);
						val18.y = 0f;
						value.Offset += val18;
					}
				}
				if (value.HasDrawn && !flag)
				{
					Vector3 val19 = val11 - value.Drawn;
					val19.y = 0f;
					if (phase >= 0.18f && phase <= 0.84f)
					{
						MovedInAir += ((Vector3)(ref val19)).magnitude;
					}
					else
					{
						MovedSitting += ((Vector3)(ref val19)).magnitude;
					}
				}
				value.Drawn = val11;
				value.HasDrawn = true;
				value.Visual.SetPositionAndRotation(val11, val14);
				if (value.CheckAt > 0f && time >= value.CheckAt)
				{
					value.CheckAt = -1f;
					Vector3 val20 = value.Root.position - value.To;
					Vector3 val21 = value.Visual.position - value.To;
					val20.y = (val21.y = 0f);
					ModLog.Info($"Leap seen: 0.5 s after landing the Leapling (hitbox) is {((Vector3)(ref val20)).magnitude:0.00} m and its model {((Vector3)(ref val21)).magnitude:0.00} m from the landing spot.");
				}
			}
			foreach (IntPtr item in Gone)
			{
				if (Frogs.TryGetValue(item, out Frog value3) && ById.TryGetValue(value3.NetId, out Frog value4) && value4 == value3)
				{
					ById.Remove(value3.NetId);
				}
				Frogs.Remove(item);
			}
			Gone.Clear();
		}

		private static void SetLeapFrame(Frog f, float frame)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			((Renderer)f.LeapRenderer).GetPropertyBlock(_mpb);
			float num = Mathf.Clamp(frame, 0f, 55.99f);
			double now = ShaderClock.Now;
			float num2 = ((now > 0.05) ? ((float)((double)num / now)) : 0f);
			_mpb.SetFloat(FramerateId, num2);
			_mpb.SetFloat(FramesId, 56f);
			_mpb.SetFloat(OffsetId, 0f);
			float num3 = Charge(num / 56f);
			float num4 = 0f;
			if (num3 > 0.15f)
			{
				float num5 = num / 40f;
				float num6 = 5f * num5 + 4.5f * num5 * num5 / 0.55f;
				num4 = ((num6 - Mathf.Floor(num6) < 0.35f) ? 1f : 0f);
			}
			if (FlashOn)
			{
				_mpb.SetColor(HitColorId, ChargeColor);
				_mpb.SetFloat(HitFlashId, num4);
			}
			((Renderer)f.LeapRenderer).SetPropertyBlock(_mpb);
		}

		private static void MainBlink(Frog f, bool on)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0088: 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)
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			((Renderer)f.MainRenderer).GetPropertyBlock(_mpb);
			if (on || (_mpb.HasFloat(HitFlashId) && _mpb.GetFloat(HitFlashId) != 0f))
			{
				Material sharedMaterial = ((Renderer)f.MainRenderer).sharedMaterial;
				_mpb.SetColor(HitColorId, (on || (Object)(object)sharedMaterial == (Object)null || !sharedMaterial.HasProperty(HitColorId)) ? ChargeColor : sharedMaterial.GetColor(HitColorId));
				_mpb.SetFloat(HitFlashId, on ? 1f : 0f);
				((Renderer)f.MainRenderer).SetPropertyBlock(_mpb);
			}
		}

		public static bool ProbeFlash(Transform? root, Color? color, float flash)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0054: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return false;
			}
			frog.LeapVisual.SetPositionAndRotation(frog.Visual.position, frog.Visual.rotation);
			frog.LeapVisual.localScale = frog.Visual.localScale;
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			_mpb.Clear();
			_mpb.SetFloat(FramerateId, 0f);
			_mpb.SetFloat(FramesId, 56f);
			if (color.HasValue)
			{
				_mpb.SetColor(HitColorId, color.Value);
			}
			if (flash >= 0f)
			{
				_mpb.SetFloat(HitFlashId, flash);
			}
			((Renderer)frog.LeapRenderer).SetPropertyBlock(_mpb);
			((Renderer)frog.LeapRenderer).enabled = true;
			((Renderer)frog.MainRenderer).enabled = false;
			frog.Probing = true;
			return true;
		}

		public static string FlashInfo(Transform? root)
		{
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return "no frog";
			}
			Material m = ((Renderer)frog.LeapRenderer).sharedMaterial;
			return $"leap material _HitFlash {P("_HitFlash")}, _HitColor {P("_HitColor")}, _EmissionColor {P("_EmissionColor")}";
			string P(string n)
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)m != (Object)null) || !m.HasProperty(n))
				{
					return "-";
				}
				if (!n.Contains("Color"))
				{
					return m.GetFloat(n).ToString("0.###");
				}
				return ((object)m.GetColor(n)/*cast due to .constrained prefix*/).ToString();
			}
		}

		private static float Charge(float u)
		{
			return S(0.03f, 0.36f, u) * (1f - S(0.38f, 0.42f, u));
			static float S(float a, float b, float x)
			{
				x = Mathf.Clamp01((x - a) / (b - a));
				return x * x * (3f - 2f * x);
			}
		}

		private static float ShownLeapFrame(Frog f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			((Renderer)f.LeapRenderer).GetPropertyBlock(_mpb);
			double num = (_mpb.HasFloat(FramerateId) ? _mpb.GetFloat(FramerateId) : 40f);
			double num2 = ShaderClock.Now * num;
			return (float)(num2 - Math.Floor(num2 / 56.0) * 56.0);
		}

		private static Vector3 ChargeScale(float u)
		{
			//IL_0063: 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)
			float num = Charge(u);
			if (num <= 0f)
			{
				return Vector3.one;
			}
			float num2 = u * 56f / 40f;
			float num3 = 0.06f * num * Mathf.Sin((float)Math.PI * 26f * num2);
			return new Vector3(1f + 0.3f * num + num3, 1f - 0.25f * num, 1f + 0.3f * num - num3);
		}

		public static bool ProbeLeapFrame(Transform? root, float frame)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return false;
			}
			frog.LeapVisual.SetPositionAndRotation(frog.Visual.position, frog.Visual.rotation);
			frog.LeapVisual.localScale = frog.Visual.localScale;
			SetLeapFrame(frog, frame);
			((Renderer)frog.LeapRenderer).enabled = true;
			((Renderer)frog.MainRenderer).enabled = false;
			frog.Probing = true;
			return true;
		}

		public static string ProbeMain(Transform? root, float framerate, float offset)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return "no frog";
			}
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			((Renderer)frog.MainRenderer).GetPropertyBlock(_mpb);
			if (!_mainSaved)
			{
				_mainSaved = true;
				_mainFps = (_mpb.HasFloat(FramerateId) ? _mpb.GetFloat(FramerateId) : frog.BaseFps);
				_mainOff = (_mpb.HasFloat(OffsetId) ? _mpb.GetFloat(OffsetId) : 0f);
			}
			string result = "game had _Framerate " + (_mpb.HasFloat(FramerateId) ? _mpb.GetFloat(FramerateId).ToString("0.###") : "-") + ", _AnimationOffset " + (_mpb.HasFloat(OffsetId) ? _mpb.GetFloat(OffsetId).ToString("0.###") : "-");
			_mpb.SetFloat(FramerateId, framerate);
			_mpb.SetFloat(OffsetId, offset);
			((Renderer)frog.MainRenderer).SetPropertyBlock(_mpb);
			((Renderer)frog.LeapRenderer).enabled = false;
			((Renderer)frog.MainRenderer).enabled = true;
			frog.Probing = true;
			return result;
		}

		private static void BeginLeap(Frog f, Vector3 lift)
		{
			//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_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_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_0032: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_009e: 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_00a3: 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: 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)
			f.Pending = false;
			f.Playing = true;
			f.From = f.Visual.position;
			f.To += lift;
			Vector3 val = f.To - f.From;
			val.y = 0f;
			Quaternion val2 = Quaternion.Inverse(f.Root.rotation) * f.Visual.rotation;
			f.Facing = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? (Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up) * val2) : f.Visual.rotation);
			f.LeapVisual.SetPositionAndRotation(f.From, f.Facing);
			f.LeapVisual.localScale = f.Visual.localScale;
			double num = f.Frame - Math.Floor(f.Frame / 28.0) * 28.0;
			f.LeapClip0 = f.Clip - num / 40.0;
			f.LeapU = (float)(num / 56.0);
			SetLeapFrame(f, (float)num);
			((Renderer)f.LeapRenderer).enabled = true;
			((Renderer)f.MainRenderer).enabled = false;
			f.AbortChecked = false;
			LeapsBegun++;
			LeapEffects(f);
			if (_traceNext)
			{
				_traceNext = false;
				_traceFrog = f;
			}
			if (++_seen <= 3)
			{
				ModLog.Info($"Leap seen {_seen}: charge-up starts, {((Vector3)(ref val)).magnitude:0.0} m to the landing spot.");
			}
		}

		private static void LeapEffects(Frog f)
		{
			//IL_001e: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			f.DustDone = false;
			f.LeapU = 0f;
			float x = f.Visual.localScale.x;
			float num = ((f.Fps > 1f) ? Mathf.Clamp(f.BaseFps / f.Fps, 1f, 4f) : 1f);
			float untilLand = HopMotion.Leap.AirEnd * 1.4f * num;
			float num2 = Mathf.Max(1.4f, 1.5f * x);
			float leapStart = Time.time;
			ClearWarnings(f);
			GameObject val = DangerCircle.Show(f.To, num2 * 0.5f, untilLand);
			bool num3 = (Object)(object)val != (Object)null;
			if (num3)
			{
				f.Warnings.Add(val);
			}
			if (!num3)
			{
				Keep(f, Fx.Ring("Leapling_LandingWarning", f.To, new Color(1f, 0.32f, 0.05f, 1f), untilLand, num2 * 1.35f, num2, 0.12f, 0.1f, 0.06f, null, 0.01f)?.Go);
			}
			if (!num3)
			{
				Keep(f, Fx.Ring("Leapling_LandingFill", f.To, new Color(1f, 0.22f, 0.04f, 0.3f), untilLand, 0f, num2 - 0.2f, 0f, 0.05f, 0.06f, delegate
				{
					float num4 = Mathf.Clamp01((Time.time - leapStart) / untilLand);
					return num4 * num4;
				})?.Go);
			}
			Frog frog = f;
			Fx.Decal decal = Fx.Spawn("Leapling_BlobShadow", Fx.Transparent("shadow", Fx.DiscTex), f.From, new Color(0f, 0f, 0f, 0.5f), 1.4f * HopMotion.Leap.SlideEnd * num, 0.95f * x, 0.95f * x, 0.1f, 0.1f, 0f, delegate
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: 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)
				Vector3 result = (((Object)(object)frog.LeapVisual != (Object)null && !((Il2CppObjectBase)frog.LeapVisual).WasCollected) ? frog.LeapVisual.position : frog.To);
				float num4 = HopMotion.Leap.Progress(Mathf.Clamp01(frog.LeapU));
				result.y = Mathf.Lerp(frog.From.y, frog.To.y, num4);
				return result;
			}, delegate
			{
				float num4 = Mathf.Clamp01((frog.LeapU - HopMotion.Leap.AirStart) / (HopMotion.Leap.AirEnd - HopMotion.Leap.AirStart));
				return 1f - 2f * num4 * (1f - num4);
			});
			if (decal != null)
			{
				f.Warnings.Add(decal.Go);
			}
		}

		private static void Keep(Frog f, GameObject? go)
		{
			if ((Object)(object)go != (Object)null)
			{
				f.Warnings.Add(go);
			}
		}

		private static void ClearWarnings(Frog f)
		{
			foreach (GameObject warning in f.Warnings)
			{
				if ((Object)(object)warning != (Object)null && !((Il2CppObjectBase)warning).WasCollected)
				{
					Object.Destroy((Object)(object)warning);
				}
			}
			f.Warnings.Clear();
		}

		public static int WarningsOf(Transform? leapVisual)
		{
			if ((Object)(object)leapVisual == (Object)null)
			{
				return -1;
			}
			foreach (Frog value in Frogs.Values)
			{
				if ((Object)(object)value.LeapVisual == (Object)null || ((Il2CppObjectBase)value.LeapVisual).WasCollected || ((Il2CppObjectBase)value.LeapVisual).Pointer != ((Il2CppObjectBase)leapVisual).Pointer)
				{
					continue;
				}
				int num = 0;
				foreach (GameObject warning in value.Warnings)
				{
					if ((Object)(object)warning != (Object)null && !((Il2CppObjectBase)warning).WasCollected)
					{
						num++;
					}
				}
				return num;
			}
			return 0;
		}

		public static int LiveWarnings()
		{
			int num = 0;
			foreach (Frog value in Frogs.Values)
			{
				foreach (GameObject warning in value.Warnings)
				{
					if ((Object)(object)warning != (Object)null && !((Il2CppObjectBase)warning).WasCollected)
					{
						num++;
					}
				}
			}
			return num;
		}

		private static void EndLeap(Frog f, Vector3 home, float now)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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)
			f.Playing = false;
			((Renderer)f.MainRenderer).enabled = true;
			((Renderer)f.LeapRenderer).enabled = false;
			ClearWarnings(f);
			if (f.Pin)
			{
				f.PinAt = f.To - (f.VisRoot.TransformPoint(f.BaseLocal) - f.Root.position);
				f.PinUntil = now + 1f;
			}
			float phase = f.Phase;
			float num = (phase - HopMotion.Hop.Progress(phase) + Lead) * 0.7f;
			Vector3 val = f.Track.At(f.Clip - (double)num) + (home - f.Root.position);
			f.Offset = f.To - val;
			f.Offset.y = 0f;
			f.LastSample = val;
			f.HasSample = true;
			f.LastPhase = phase;
			f.HoldUntil = now + 0.4f;
			f.LeapEndedAt = now;
			f.TurnFrom = f.Facing;
			f.TurnStart = now;
			if (_seen <= 3)
			{
				f.CheckAt = now + 0.5f;
			}
		}

		public static void LateTick()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if (Frogs.Count == 0)
			{
				return;
			}
			float time = Time.time;
			foreach (Frog value in Frogs.Values)
			{
				if (!value.Pin)
				{
					continue;
				}
				if ((Object)(object)value.Root == (Object)null || ((Il2CppObjectBase)value.Root).WasCollected || !value.RootGo.activeInHierarchy)
				{
					value.Pin = false;
					continue;
				}
				Vector3 position = value.Root.position;
				if (!value.Playing)
				{
					Vector3 val = position - value.PinAt;
					val.y = 0f;
					if (time >= value.PinUntil || (time - value.LeapEndedAt > 0.1f && ((Vector3)(ref val)).magnitude < 0.01f))
					{
						value.Pin = false;
						PinsReleased++;
						if (PinsReleased <= 3)
						{
							ModLog.Info($"Leapling hitbox released {time - value.LeapEndedAt:0.00} s after landing (game pull {((Vector3)(ref val)).magnitude:0.000} m/frame).");
						}
						continue;
					}
				}
				value.Root.position = new Vector3(value.PinAt.x, position.y, value.PinAt.z);
			}
		}

		private static Frog? ByRoot(Transform? root)
		{
			if ((Object)(object)root == (Object)null || ((Il2CppObjectBase)root).WasCollected)
			{
				return null;
			}
			foreach (Frog value in Frogs.Values)
			{
				if ((Object)(object)value.Root != (Object)null && !((Il2CppObjectBase)value.Root).WasCollected && ((Il2CppObjectBase)value.Root).Pointer == ((Il2CppObjectBase)root).Pointer)
				{
					return value;
				}
			}
			return null;
		}

		public static bool ProbeLeap(Transform? root, float framerate, float offset)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0054: Expected O, but got Unknown
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return false;
			}
			frog.LeapVisual.SetPositionAndRotation(frog.Visual.position, frog.Visual.rotation);
			frog.LeapVisual.localScale = frog.Visual.localScale;
			if (_mpb == null)
			{
				_mpb = new MaterialPropertyBlock();
			}
			((Renderer)frog.LeapRenderer).GetPropertyBlock(_mpb);
			_mpb.SetFloat(FramerateId, framerate);
			_mpb.SetFloat(FramesId, 56f);
			_mpb.SetFloat(OffsetId, offset);
			((Renderer)frog.LeapRenderer).SetPropertyBlock(_mpb);
			((Renderer)frog.LeapRenderer).enabled = true;
			((Renderer)frog.MainRenderer).enabled = false;
			frog.Probing = true;
			return true;
		}

		public static void ProbeEnd(Transform? root)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return;
			}
			frog.Probing = false;
			if (_mainSaved)
			{
				_mainSaved = false;
				if (_mpb == null)
				{
					_mpb = new MaterialPropertyBlock();
				}
				((Renderer)frog.MainRenderer).GetPropertyBlock(_mpb);
				_mpb.SetFloat(FramerateId, _mainFps);
				_mpb.SetFloat(OffsetId, _mainOff);
				((Renderer)frog.MainRenderer).SetPropertyBlock(_mpb);
			}
			((Renderer)frog.LeapRenderer).enabled = false;
			((Renderer)frog.MainRenderer).enabled = true;
		}

		public static string LeapMaterialInfo(Transform? root)
		{
			Frog frog = ByRoot(root);
			if (frog == null)
			{
				return "frog not found";
			}
			Material m = ((Renderer)frog.LeapRenderer).sharedMaterial;
			if ((Object)(object)m == (Object)null)
			{
				return "no material";
			}
			DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(92, 7);
			defaultInterpolatedStringHandler.AppendLiteral("leap material '");
			defaultInterpolatedStringHandler.AppendFormatted(((Object)m).name);
			defaultInterpolatedStringHandler.AppendLiteral("' shader '");
			Shader shader = m.shader;
			defaultInterpolatedStringHandler.AppendFormatted((shader != null) ? ((Object)shader).name : null);
			defaultInterpolatedStringHandler.AppendLiteral("': _Frames ");
			defaultInterpolatedStringHandler.AppendFormatted(P("_Frames"));
			defaultInterpolatedStringHandler.AppendLiteral(", _Framerate ");
			defaultInterpolatedStringHandler.AppendFormatted(P("_Framerate"));
			defaultInterpolatedStringHandler.AppendLiteral(", _AnimationOffset ");
			defaultInterpolatedStringHandler.AppendFormatted(P("_AnimationOffset"));
			defaultInterpolatedStringHandler.AppendLiteral(", _VertexCount ");
			defaultInterpolatedStringHandler.AppendFormatted(P("_VertexCount"));
			defaultInterpolatedStringHandler.AppendLiteral("; main '");
			Material sharedMaterial = ((Renderer)frog.MainRenderer).sharedMaterial;
			defaultInterpolatedStringHandler.AppendFormatted((sharedMaterial != null) ? ((Object)sharedMaterial).name : null);
			defaultInterpolatedStringHandler.AppendLiteral("'");
			return defaultInterpolatedStringHandler.ToStringAndClear();
			string P(string n)
			{
				if (!m.HasProperty(n))
				{
					return "-";
				}
				return m.GetFloat(n).ToString("0.###");
			}
		}

		public static void TraceNextLeap()
		{
			_traceNext = true;
			_traceFrog = null;
			Trace.Clear();
		}

		public static string TakeTrace()
		{
			return Trace.ToString();
		}

		public static bool Info(Transform? root, out float fps, out float baseFps, out float phase, out float leapU, out float leapFrame, out Vector3 model, out Vector3 hitbox, out Vector3 from, out Vector3 to)
		{
			//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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: 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)
			fps = (baseFps = (phase = (leapFrame = 0f)));
			leapU = -1f;
			model = (hitbox = (from = (to = Vector3.zero)));
			if ((Object)(object)root == (Object)null || ((Il2CppObjectBase)root).WasCollected)
			{
				return false;
			}
			foreach (Frog value in Frogs.Values)
			{
				if (!((Object)(object)value.Root == (Object)null) && !((Il2CppObjectBase)value.Root).WasCollected && !(((Il2CppObjectBase)value.Root).Pointer != ((Il2CppObjectBase)root).Pointer))
				{
					fps = value.Fps;
					baseFps = value.BaseFps;
					phase = value.Phase;
					leapU = (value.Playing ? value.LeapU : (value.Pending ? (-0.5f) : (-1f)));
					if (value.Playing)
					{
						leapFrame = ShownLeapFrame(value);
					}
					model = (value.Playing ? value.LeapVisual.position : value.Visual.position);
					hitbox = value.Root.position;
					from = value.From;
					to = value.To;
					return true;
				}
			}
			return false;
		}

		public static float PlayingPhase()
		{
			foreach (Frog value in Frogs.Values)
			{
				if (value.Playing)
				{
					return value.LeapU;
				}
			}
			return -1f;
		}

		public static float PhaseOf(Transform? leapVisual)
		{
			if ((Object)(object)leapVisual == (Object)null || ((Il2CppObjectBase)leapVisual).WasCollected)
			{
				return -1f;
			}
			foreach (Frog value in Frogs.Values)
			{
				if ((Object)(object)value.LeapVisual != (Object)null && !((Il2CppObjectBase)value.LeapVisual).WasCollected && ((Il2CppObjectBase)value.LeapVisual).Pointer == ((Il2CppObjectBase)leapVisual).Pointer)
				{
					return value.Playing ? value.LeapU : (-1f);
				}
			}
			return -1f;
		}

		public static Transform? PlayingVisual()
		{
			foreach (Frog value in Frogs.Values)
			{
				if (value.Playing && (Object)(object)value.LeapVisual != (Object)null && !((Il2CppObjectBase)value.LeapVisual).WasCollected)
				{
					return value.LeapVisual;
				}
			}
			return null;
		}

		public static Vector3? PlayingTarget()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			foreach (Frog value in Frogs.Values)
			{
				if (value.Playing)
				{
					return value.To;
				}
			}
			return null;
		}

		public static bool AnyLeap()
		{
			foreach (Frog value in Frogs.Values)
			{
				if (value.Playing || value.Pending)
				{
					return true;
				}
			}
			return false;
		}

		public static void All(List<(IntPtr key, Vector3 model, Vector3 root)> into)
		{
			//IL_0067: 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)
			into.Clear();
			foreach (KeyValuePair<IntPtr, Frog> frog in Frogs)
			{
				Frog value = frog.Value;
				if ((Object)(object)value.Visual != (Object)null && !((Il2CppObjectBase)value.Visual).WasCollected && (Object)(object)value.Root != (Object)null && !((Il2CppObjectBase)value.Root).WasCollected)
				{
					into.Add((frog.Key, value.Visual.position, value.Root.position));
				}
			}
		}

		public static bool First(out Vector3 model, out Vector3 root)
		{
			//IL_0091: 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_0098: 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_009e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			foreach (Frog value in Frogs.Values)
			{
				if ((Object)(object)value.Visual != (Object)null && !((Il2CppObjectBase)value.Visual).WasCollected && (Object)(object)value.Root != (Object)null && !((Il2CppObjectBase)value.Root).WasCollected)
				{
					model = value.Visual.position;
					root = value.Root.position;
					return true;
				}
			}
			model = (root = Vector3.zero);
			return false;
		}

		public static void Clear()
		{
			Frogs.Clear();
			ById.Clear();
		}
	}
	internal sealed class RootTrack
	{
		private const int Size = 512;

		private readonly double[] _t = new double[512];

		private readonly Vector3[] _p = (Vector3[])(object)new Vector3[512];

		private int _head;

		private int _count;

		public void Clear()
		{
			_count = 0;
		}

		public void Add(double t, Vector3 p)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			if (_count > 0 && t <= _t[_head])
			{
				_p[_head] = p;
				return;
			}
			_head = (_head + 1) % 512;
			_t[_head] = t;
			_p[_head] = p;
			if (_count < 512)
			{
				_count++;
			}
		}

		public Vector3 At(double t)
		{
			//IL_0008: 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_009f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			if (_count == 0)
			{
				return Vector3.zero;
			}
			int num = _head;
			if (t >= _t[num])
			{
				return _p[num];
			}
			for (int i = 1; i < _count; i++)
			{
				int num2 = (num - 1 + 512) % 512;
				if (_t[num2] <= t)
				{
					float num3 = (float)((t - _t[num2]) / (_t[num] - _t[num2]));
					return Vector3.Lerp(_p[num2], _p[num], num3);
				}
				num = num2;
			}
			return _p[num];
		}
	}
	internal static class Fx
	{
		public sealed class Decal
		{
			public GameObject Go;

			public SpriteRenderer Renderer;

			public Color Color;

			public float Born;

			public float Life;

			public float Size0;

			public float Size1;

			public float FadeIn;

			public float FadeOut;

			public float Pulse;

			public Func<Vector3>? Follow;

			public Func<float>? Scale;

			public bool Dead;
		}

		private sealed class PulseFx
		{
			public Transform T;

			public Vector3 Base;

			public float Born;

			public float Life;

			public float Amount;

			public float PeakAt;
		}

		public sealed class Shape
		{
			public GameObject Go;

			public MeshRenderer Renderer;

			public Color Color;

			public float Born;

			public float Life;

			public float Size0;

			public float Size1;

			public float FadeIn;

			public float FadeOut;

			public Func<float>? Grow;
		}

		private static Mesh? _quad;

		private static Texture2D? _ring;

		private static Texture2D? _disc;

		private static Texture2D? _slime;

		private static readonly Dictionary<string, Material> Mats = new Dictionary<string, Material>();

		private static MaterialPropertyBlock? _mpb;

		private static readonly int BaseColorId = Shader.PropertyToID("_BaseColor");

		private static readonly int ColorId = Shader.PropertyToID("_Color");

		private static readonly List<Decal> Decals = new List<Decal>();

		private static readonly List<PulseFx> Pulses = new List<PulseFx>();

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

		private static Material? _particleBase;

		private static readonly Dictionary<string, Material> DecalMats = new Dictionary<string, Material>();

		private static Texture2D? _white;

		private static readonly Dictionary<string, Mesh> ShapeMeshes = new Dictionary<string, Mesh>();

		private static readonly List<Shape> Shapes = new List<Shape>();

		private static Material? _spriteMat;

		private static GameObject? _root;

		public static int Layer = -1;

		private const float Lift = 0.08f;

		public static int LiveDecals => Decals.Count;

		public static int Spawned { get; private set; }

		public static Texture2D RingTex => Keep(ref _ring, () => Radial("SBM_Ring", (float r) => Mathf.Max(Mathf.SmoothStep(0.8f, 0.83f, r) * (1f - Mathf.SmoothStep(0.95f, 0.98f, r)), 0.12f * (1f - Mathf.SmoothStep(0.8f, 0.82f, r)))));

		public static Texture2D DiscTex => Keep(ref _disc, () => Radial("SBM_Disc", (float r) => 1f - Mathf.SmoothStep(0.35f, 1f, r)));

		public static Texture2D SlimeTex => Keep(ref _slime, () => Radial("SBM_Slime", (float r) => 1f - Mathf.SmoothStep(0.82f, 1f, r), (float r) => 0.72f + 0.28f * Mathf.SmoothStep(0.6f, 0.85f, r)));

		private static Texture2D WhiteTex => Keep(ref _white, delegate
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(4, 4, (TextureFormat)4, false)
			{
				name = "SBM_White"
			};
			Color[] array = (Color[])(object)new Color[16];
			for (int i = 0; i < 16; i++)
			{
				array[i] = Color.white;
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply(false, true);
			((Object)val).hideFlags = (HideFlags)32;
			return val;
		});

		public static int ShapesSpawned { get; private set; }

		private static Texture2D Radial(string name, Func<float, float> alpha, Func<float, float>? bright = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false)
			{
				name = name,
				wrapMode = (TextureWrapMode)1
			};
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					float num = ((float)j + 0.5f) / 128f * 2f - 1f;
					float num2 = ((float)i + 0.5f) / 128f * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = ((num3 >= 1f) ? 0f : Mathf.Clamp01(alpha(num3)));
					float num5 = ((bright != null) ? Mathf.Clamp01(bright(num3)) : 1f);
					val.SetPixel(j, i, new Color(num5, num5, num5, num4));
				}
			}
			val.Apply(false, true);
			((Object)val).hideFlags = (HideFlags)32;
			return val;
		}

		private static Texture2D Keep(ref Texture2D? slot, Func<Texture2D> make)
		{
			if ((Object)(object)slot == (Object)null || ((Il2CppObjectBase)slot).WasCollected)
			{
				slot = make();
			}
			return slot;
		}

		public static Material? Transparent(string key, Texture2D tex, bool additive = false, bool vertexColors = false)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (Mats.TryGetValue(key, out Material value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Shader val = (vertexColors ? (Shader.Find("Universal Render Pipeline/Particles/Unlit") ?? Shader.Find("Universal Render Pipeline/Unlit")) : (Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Universal Render Pipeline/Particles/Unlit")));
			if ((Object)(object)val == (Object)null)
			{
				ModLog.WarnOnce("fx-shader", "Effects: no URP Unlit shader found; ground markers are off.");
				return null;
			}
			value = new Material(val)
			{
				name = "SBM_" + key
			};
			value.SetTexture("_BaseMap", (Texture)(object)tex);
			if (value.HasProperty("_MainTex"))
			{
				value.SetTexture("_MainTex", (Texture)(object)tex);
			}
			value.SetColor(BaseColorId, Color.white);
			value.SetFloat("_Surface", 1f);
			value.SetFloat("_Blend", additive ? 2f : 0f);
			value.SetFloat("_SrcBlend", 5f);
			value.SetFloat("_DstBlend", (float)(additive ? 1 : 10));
			value.SetFloat("_ZWrite", 0f);
			value.SetFloat("_Cull", 0f);
			value.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
			value.renderQueue = 3000;
			Object.DontDestroyOnLoad((Object)(object)value);
			Mats[key] = value;
			ModLog.InfoOnce("fx-" + key, $"Effects: material {key} uses {((Object)val).name}.");
			return value;
		}

		private static Mesh Quad()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//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_005f: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_quad != (Object)null)
			{
				return _quad;
			}
			_quad = new Mesh
			{
				name = "SBM_GroundQuad"
			};
			_quad.vertices = Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[4]
			{
				new Vector3(-0.5f, 0f, -0.5f),
				new Vector3(-0.5f, 0f, 0.5f),
				new Vector3(0.5f, 0f, 0.5f),
				new Vector3(0.5f, 0f, -0.5f)
			});
			_quad.uv