Decompiled source of Extra Statuses v1.0.0

plugins/ExtraStatuses.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ExtraStatuses")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExtraStatuses")]
[assembly: AssemblyTitle("ExtraStatuses")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExtraStatuses
{
	internal static class BlindFX
	{
		internal const string STATUS = "Blinded";

		private const string SMOKE = "SmokePuff";

		private const string DISTO = "DistoPuff";

		private static readonly float SPEED = 0.3f;

		private static readonly float OPACITY = 0.3f;

		private const int MAX_ATTEMPTS = 15;

		private static int _attempts;

		private static bool _finished;

		internal static void TryOnce()
		{
			if (_finished)
			{
				return;
			}
			_attempts++;
			try
			{
				StatusEffect val = ((ResourcesPrefabManager.Instance != null) ? ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Blinded") : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					if (Object.op_Implicit((Object)(object)val.FXPrefab))
					{
						Shape(val.FXPrefab);
					}
					else
					{
						ExtraStatusesPlugin.Log.LogWarning((object)"[BlindFX] status 'Blinded': FXPrefab is NULL - the XML's VFXPrefab did not resolve.");
					}
					_finished = true;
				}
			}
			catch (Exception ex)
			{
				ExtraStatusesPlugin.Log.LogError((object)("[BlindFX] vfx threw: " + ex));
				_finished = true;
				return;
			}
			if (!_finished && _attempts >= 15)
			{
				_finished = true;
				ExtraStatusesPlugin.Log.LogWarning((object)("[BlindFX] vfx gave up after " + _attempts + " attempts - Blinded never loaded."));
			}
		}

		private static void Shape(Transform root)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: 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_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: 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_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: 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_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Invalid comparison between Unknown and I4
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: 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_04e3: 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_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			string text = "[BlindFX] vfx, status 'Blinded': root '" + ((Object)root).name + "' (Teleport's smoke)";
			Transform val = root.Find("SmokePuff");
			ParticleSystem val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<ParticleSystem>() : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				ExtraStatusesPlugin.Log.LogMessage((object)(text + "\n    NO SmokePuff - the XML's VFXPrefab is not VFXTeleport, or the prefab is not what the 2026-10-28 dump showed; left as it is."));
				return;
			}
			Transform val3 = val.Find("DistoPuff");
			if (Object.op_Implicit((Object)(object)val3))
			{
				Object.DestroyImmediate((Object)(object)((Component)val3).gameObject);
				text += "\n    DistoPuff removed";
			}
			Animation component = ((Component)root).GetComponent<Animation>();
			if (Object.op_Implicit((Object)(object)component))
			{
				text = text + "\n    Animation '" + (Object.op_Implicit((Object)(object)component.clip) ? ((Object)component.clip).name : "no clip") + "' stopped (was playAutomatically " + component.playAutomatically + ")";
				component.playAutomatically = false;
				((Behaviour)component).enabled = false;
			}
			MainModule main = val2.main;
			string[] obj = new string[10]
			{
				"space ",
				((object)((MainModule)(ref main)).simulationSpace/*cast due to .constrained prefix*/).ToString(),
				", scaling ",
				((object)((MainModule)(ref main)).scalingMode/*cast due to .constrained prefix*/).ToString(),
				", speed ",
				Range(((MainModule)(ref main)).startSpeed),
				", gravity ",
				Range(((MainModule)(ref main)).gravityModifier),
				", velocity over life ",
				null
			};
			VelocityOverLifetimeModule velocityOverLifetime = val2.velocityOverLifetime;
			obj[9] = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled ? "on" : "off");
			string text2 = string.Concat(obj);
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startDelay = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)0;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0;
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(SPEED);
			MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
			string text3;
			if ((int)((MinMaxGradient)(ref startColor)).mode != 0)
			{
				startColor = ((MainModule)(ref main)).startColor;
				text3 = ((object)((MinMaxGradient)(ref startColor)).mode/*cast due to .constrained prefix*/).ToString();
			}
			else
			{
				startColor = ((MainModule)(ref main)).startColor;
				text3 = ((MinMaxGradient)(ref startColor)).color.a.ToString("F2");
			}
			string text4 = text3;
			startColor = ((MainModule)(ref main)).startColor;
			if ((int)((MinMaxGradient)(ref startColor)).mode == 0)
			{
				startColor = ((MainModule)(ref main)).startColor;
				Color color = ((MinMaxGradient)(ref startColor)).color;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(color.r, color.g, color.b, color.a * OPACITY));
			}
			text2 = text2 + ", opacity " + text4;
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f);
			VelocityOverLifetimeModule velocityOverLifetime2 = val2.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime2)).enabled = false;
			EmissionModule emission = val2.emission;
			float num = 0f;
			string text5 = "";
			for (int i = 0; i < ((EmissionModule)(ref emission)).burstCount; i++)
			{
				Burst burst = ((EmissionModule)(ref emission)).GetBurst(i);
				MinMaxCurve count = ((Burst)(ref burst)).count;
				float num2;
				if ((int)((MinMaxCurve)(ref count)).mode != 3)
				{
					count = ((Burst)(ref burst)).count;
					num2 = ((MinMaxCurve)(ref count)).constant;
				}
				else
				{
					count = ((Burst)(ref burst)).count;
					float constantMin = ((MinMaxCurve)(ref count)).constantMin;
					count = ((Burst)(ref burst)).count;
					num2 = (constantMin + ((MinMaxCurve)(ref count)).constantMax) * 0.5f;
				}
				float num3 = num2;
				int num4 = ((((Burst)(ref burst)).cycleCount <= 0) ? 1 : ((Burst)(ref burst)).cycleCount);
				num += num3 * (float)num4;
				text5 = text5 + ((text5.Length > 0) ? ", " : "") + num3.ToString("F0") + ((num4 > 1) ? (" x" + num4) : "") + " at " + ((Burst)(ref burst)).time.ToString("F2") + " s";
			}
			((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[0]);
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(num / Mathf.Max(((MainModule)(ref main)).duration, 0.1f));
			((EmissionModule)(ref emission)).enabled = true;
			if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent<TeleportCloud>()))
			{
				((Component)val).gameObject.AddComponent<TeleportCloud>();
			}
			string[] obj2 = new string[26]
			{
				text,
				"\n    SmokePuff: ",
				text2,
				"\n          -> space ",
				((object)((MainModule)(ref main)).simulationSpace/*cast due to .constrained prefix*/).ToString(),
				", scaling ",
				((object)((MainModule)(ref main)).scalingMode/*cast due to .constrained prefix*/).ToString(),
				", loop, speed ",
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null,
				null
			};
			float sPEED = SPEED;
			obj2[8] = sPEED.ToString("F2");
			obj2[9] = ", gravity 0, velocity over life off, opacity ";
			startColor = ((MainModule)(ref main)).startColor;
			string text6;
			if ((int)((MinMaxGradient)(ref startColor)).mode != 0)
			{
				startColor = ((MainModule)(ref main)).startColor;
				text6 = ((object)((MinMaxGradient)(ref startColor)).mode/*cast due to .constrained prefix*/).ToString() + " (left as it is)";
			}
			else
			{
				startColor = ((MainModule)(ref main)).startColor;
				text6 = ((MinMaxGradient)(ref startColor)).color.a.ToString("F2");
			}
			obj2[10] = text6;
			obj2[11] = "\n    emission: bursts ";
			obj2[12] = ((text5.Length > 0) ? text5 : "none");
			obj2[13] = " in ";
			obj2[14] = ((MainModule)(ref main)).duration.ToString("F2");
			obj2[15] = " s -> steady ";
			obj2[16] = ((EmissionModule)(ref emission)).rateOverTimeMultiplier.ToString("F1");
			obj2[17] = "/s; life ";
			obj2[18] = Range(((MainModule)(ref main)).startLifetime);
			obj2[19] = " s, size ";
			obj2[20] = Range(((MainModule)(ref main)).startSize);
			obj2[21] = " m, max ";
			obj2[22] = ((MainModule)(ref main)).maxParticles.ToString();
			obj2[23] = "\n    shaped to the idle body, an ovoid turning clockwise at ";
			sPEED = TeleportCloud.SPIN;
			obj2[24] = sPEED.ToString("F0");
			obj2[25] = " deg/s round its long axis (TeleportCloud), logged per character";
			text = string.Concat(obj2);
			ExtraStatusesPlugin.Log.LogMessage((object)text);
		}

		private static string Range(MinMaxCurve curve)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if ((int)((MinMaxCurve)(ref curve)).mode != 3)
			{
				if ((int)((MinMaxCurve)(ref curve)).mode != 0)
				{
					return ((object)((MinMaxCurve)(ref curve)).mode/*cast due to .constrained prefix*/).ToString();
				}
				return ((MinMaxCurve)(ref curve)).constant.ToString("F2");
			}
			return ((MinMaxCurve)(ref curve)).constantMin.ToString("F2") + ".." + ((MinMaxCurve)(ref curve)).constantMax.ToString("F2");
		}
	}
	internal class TeleportCloud : MonoBehaviour
	{
		internal static readonly float SPIN = 0f;

		private static readonly float LONG_MARGIN = 0.2f;

		private static readonly float MAX_STRETCH = 2f;

		private static readonly float HUMAN_LONG = 1.7f;

		private static readonly float SIZE_MIN = 0.5f;

		private static readonly float SIZE_MAX = 2f;

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

		private ParticleSystem _ps;

		private Character _character;

		private readonly List<Renderer> _meshes = new List<Renderer>();

		private Vector3 _centre;

		private bool _long;

		private float _spin;

		private float _rate = 30f;

		private bool _fading;

		private float _fadeUntil;

		private Particle[] _buffer;

		private const float FADE_MAX = 3f;

		private static readonly float SPENT_MARGIN = 0.5f;

		private static bool s_askedCE;

		private static Func<Character, string, bool> s_spentByMiss;

		private static readonly float BURST_SPEED = 5f;

		private static readonly float BURST_DRAG = 4f;

		private static readonly float BURST_LIFE_MIN = 0.6f;

		private StatusEffect _status;

		private readonly ParticleSnapshot _snap = new ParticleSnapshot();

		private PoseFollow _follow = new PoseFollow();

		private float _stretch = 1f;

		private float _yaw;

		private static bool? SpentByMiss(Character character, string identifier)
		{
			if (!s_askedCE)
			{
				s_askedCE = true;
				try
				{
					Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
					for (int i = 0; i < assemblies.Length; i++)
					{
						Type type = assemblies[i].GetType("CustomEffects.SL_Blind", throwOnError: false);
						MethodInfo methodInfo = ((type != null) ? type.GetMethod("SpentByMiss", BindingFlags.Static | BindingFlags.Public, null, new Type[2]
						{
							typeof(Character),
							typeof(string)
						}, null) : null);
						if (!(methodInfo == null) && !(methodInfo.ReturnType != typeof(bool)))
						{
							s_spentByMiss = (Func<Character, string, bool>)Delegate.CreateDelegate(typeof(Func<Character, string, bool>), methodInfo);
							break;
						}
					}
				}
				catch (Exception ex)
				{
					ExtraStatusesPlugin.Log.LogWarning((object)("[BlindFX] looking up CE's SL_Blind.SpentByMiss threw: " + ex.Message));
				}
				ManualLogSource log = ExtraStatusesPlugin.Log;
				object obj;
				if (s_spentByMiss == null)
				{
					float sPENT_MARGIN = SPENT_MARGIN;
					obj = "not found (CE older than 1.5.0) - the cloud bursts when Blinded ends with over " + sPENT_MARGIN.ToString("F1") + " s left";
				}
				else
				{
					obj = "found - a miss bursts the cloud, a cleanse or expiry fades it";
				}
				log.LogMessage((object)("[BlindFX] CE's SL_Blind.SpentByMiss " + (string?)obj));
			}
			if (s_spentByMiss == null)
			{
				return null;
			}
			return s_spentByMiss(character, identifier);
		}

		private void Awake()
		{
			_ps = ((Component)this).GetComponent<ParticleSystem>();
		}

		private void VFXPlayed(VFXSystem _system)
		{
			_character = (Object.op_Implicit((Object)(object)_system) ? _system.Character : ((Component)this).GetComponentInParent<Character>());
			_status = ((Component)this).GetComponentInParent<StatusEffect>();
			Measure();
			Place();
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)_character))
			{
				if (_fading)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			_spin = Mathf.Repeat(_spin + _rate * Time.deltaTime, 360f);
			Place();
			if (_fading && (Time.time >= _fadeUntil || (Object.op_Implicit((Object)(object)_ps) && _ps.particleCount == 0)))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void LateUpdate()
		{
			if (!_fading && Object.op_Implicit((Object)(object)_character))
			{
				_snap.Take(_ps);
			}
		}

		private void OnDisable()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (_fading || !Object.op_Implicit((Object)(object)_ps) || !FadeCopy.CanFade(_character, ((Component)this).gameObject))
			{
				return;
			}
			try
			{
				GameObject val = FadeCopy.Copy(((Component)this).gameObject, _character, "BlindedFade");
				TeleportCloud component = val.GetComponent<TeleportCloud>();
				component._ps = val.GetComponent<ParticleSystem>();
				component._character = _character;
				component._centre = _centre;
				component._long = _long;
				component._yaw = _yaw;
				component._spin = _spin;
				component._rate = _rate;
				component._fading = true;
				component._fadeUntil = Time.time + 3f;
				int num = _snap.GiveTo(component._ps);
				float num2 = (Object.op_Implicit((Object)(object)_status) ? _status.RemainingLifespan : 0f);
				bool? flag = SpentByMiss(_character, Object.op_Implicit((Object)(object)_status) ? _status.IdentifierName : "Blinded");
				bool flag2 = (flag.HasValue ? flag.Value : (num2 > SPENT_MARGIN));
				string text = ((!flag.HasValue) ? "time left" : (flag2 ? "CE: spent by a miss" : "CE: not a miss"));
				if (flag2)
				{
					int num3 = component.Burst();
					ExtraStatusesPlugin.Log.LogMessage((object)("[BlindFX] " + _character.Name + ": Blinded ended with " + num2.ToString("F1") + " s left (" + text + ") - the cloud bursts (" + num + " puffs handed over, " + num3 + " thrown)"));
				}
				else
				{
					ExtraStatusesPlugin.Log.LogMessage((object)("[BlindFX] " + _character.Name + ": Blinded ended with " + num2.ToString("F1") + " s left (" + text + ") - the cloud fades (" + num + " puffs handed over)"));
				}
			}
			catch (Exception e)
			{
				FadeCopy.Warn("BlindFX", e);
			}
		}

		private void Measure()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_character) && Object.op_Implicit((Object)(object)_ps))
			{
				BodyBox.Meshes(_character, _meshes);
				BodyBox.MeasureIdle(_character, _meshes, out _centre, out var size, out var clip, out var middle);
				_follow.Begin(_character, middle);
				_long = size.z > size.y * (1f + LONG_MARGIN);
				float num = (_long ? size.z : size.y);
				float num2 = (_long ? ((size.x + size.y) * 0.5f) : ((size.x + size.z) * 0.5f));
				float num3 = Mathf.Clamp(num / Mathf.Max(num2, 0.01f), 1f, MAX_STRETCH);
				float num4 = Mathf.Clamp(BodyBox.VolumeGrow(size), SIZE_MIN, SIZE_MAX);
				_stretch = num3;
				_yaw = ((Component)_character).transform.eulerAngles.y;
				((Component)this).transform.localScale = Vector3.one * num4;
				float num5 = num / HUMAN_LONG;
				_rate = ((num5 > SIZE_MAX) ? (SPIN * SIZE_MAX / num5) : SPIN);
				ShapeModule shape = _ps.shape;
				((ShapeModule)(ref shape)).scale = (_long ? new Vector3(1f / num3, 1f / num3, 1f) : new Vector3(1f / num3, 1f, 1f / num3));
				if (s_logged.Add(_character.Name))
				{
					ExtraStatusesPlugin.Log.LogMessage((object)("[BlindFX] " + _character.Name + ": idle body (" + clip + ") " + ((Vector3)(ref size)).ToString("F2") + ", centre " + ((Vector3)(ref _centre)).ToString("F2") + ", length/height " + (size.z / Mathf.Max(size.y, 0.01f)).ToString("F2") + " -> " + (_long ? "long: rolls lengthwise, clockwise from behind" : "upright: turns clockwise from above") + ", ovoid " + num3.ToString("F2") + ":1, cloud scale " + num4.ToString("F2") + ", turning " + _rate.ToString("F0") + " deg/s"));
				}
			}
		}

		private int Burst()
		{
			//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_0069: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_ps))
			{
				return 0;
			}
			MainModule main = _ps.main;
			int maxParticles = ((MainModule)(ref main)).maxParticles;
			if (_buffer == null || _buffer.Length < maxParticles)
			{
				_buffer = (Particle[])(object)new Particle[maxParticles];
			}
			int particles = _ps.GetParticles(_buffer);
			for (int i = 0; i < particles; i++)
			{
				Vector3 position = ((Particle)(ref _buffer[i])).position;
				Vector3 val;
				if (!(((Vector3)(ref position)).sqrMagnitude > 0.0001f))
				{
					val = Random.onUnitSphere;
				}
				else
				{
					position = ((Particle)(ref _buffer[i])).position;
					val = ((Vector3)(ref position)).normalized;
				}
				Vector3 val2 = val;
				((Particle)(ref _buffer[i])).velocity = val2 * BURST_SPEED;
				if (((Particle)(ref _buffer[i])).remainingLifetime < BURST_LIFE_MIN)
				{
					((Particle)(ref _buffer[i])).remainingLifetime = BURST_LIFE_MIN;
				}
			}
			_ps.SetParticles(_buffer, particles);
			LimitVelocityOverLifetimeModule limitVelocityOverLifetime = _ps.limitVelocityOverLifetime;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(1000f);
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).drag = MinMaxCurve.op_Implicit(BURST_DRAG);
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).multiplyDragByParticleSize = false;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).multiplyDragByParticleVelocity = false;
			_fadeUntil = Mathf.Max(_fadeUntil, Time.time + 3f);
			return particles;
		}

		private void Place()
		{
			//IL_002a: 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_0030: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_character))
			{
				return;
			}
			Transform transform = ((Component)_character).transform;
			Quaternion val = Quaternion.Euler(0f, _yaw, 0f);
			Vector3 val2 = val * Vector3.Scale(_centre, transform.lossyScale);
			((Component)this).transform.SetPositionAndRotation(transform.position + val2, val * (_long ? Quaternion.Euler(0f, 0f, 0f - _spin) : Quaternion.Euler(0f, _spin, 0f)));
			if (!_fading && Object.op_Implicit((Object)(object)_ps))
			{
				_follow.Step(_character, Time.deltaTime);
				ShapeModule shape = _ps.shape;
				Vector3 val3 = transform.rotation * Vector3.Scale(_centre, transform.lossyScale) - val2 + transform.up * _follow.Shift;
				((ShapeModule)(ref shape)).position = Quaternion.Inverse(((Component)this).transform.rotation) * val3 / Mathf.Max(((Component)this).transform.lossyScale.y, 0.0001f);
				((ShapeModule)(ref shape)).rotation = new Vector3(0f, Mathf.DeltaAngle(_yaw, transform.eulerAngles.y), 0f);
				if (!_long)
				{
					((ShapeModule)(ref shape)).scale = new Vector3(1f / _stretch, _follow.Squash, 1f / _stretch);
				}
			}
		}
	}
	internal static class BodyBox
	{
		private class IdleBox
		{
			internal Vector3 Centre;

			internal Vector3 Size;

			internal string Clip;

			internal float Middle;
		}

		internal static readonly float HUMAN_HEIGHT = 1.9f;

		private static Mesh s_baked;

		private const float HUMAN_VOLUME = 0.9f;

		private static readonly FieldInfo s_pelvis = typeof(Character).GetField("m_pelvis", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly FieldInfo s_head = typeof(Character).GetField("m_head", BindingFlags.Instance | BindingFlags.NonPublic);

		private const string HUMAN_PREFIX = "Human";

		private const string HUMAN_IDLE = "HumanIdleNeutral_a";

		private const string IDLE_SUFFIX = "Idle_a";

		private static readonly Dictionary<string, IdleBox> s_idleBoxes = new Dictionary<string, IdleBox>();

		private static readonly Dictionary<RuntimeAnimatorController, AnimationClip> s_idleClips = new Dictionary<RuntimeAnimatorController, AnimationClip>();

		internal static void Meshes(Character character, List<Renderer> meshes)
		{
			meshes.Clear();
			CharacterVisuals val = (Object.op_Implicit((Object)(object)character) ? character.Visuals : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)val.ActiveVisualsBody))
			{
				Add(meshes, (Renderer)(object)val.ActiveVisualsBody.Renderer);
				if (Object.op_Implicit((Object)(object)val.ActiveVisualsHelmOrHead))
				{
					Add(meshes, (Renderer)(object)val.ActiveVisualsHelmOrHead.Renderer);
				}
				if (Object.op_Implicit((Object)(object)val.ActiveVisualsFoot))
				{
					Add(meshes, (Renderer)(object)val.ActiveVisualsFoot.Renderer);
				}
			}
			else if (Object.op_Implicit((Object)(object)val.Head))
			{
				Add(meshes, (Renderer)(object)((Component)val.Head).GetComponent<SkinnedMeshRenderer>());
			}
		}

		private static void Add(List<Renderer> meshes, Renderer mesh)
		{
			if (Object.op_Implicit((Object)(object)mesh) && mesh.enabled && ((Component)mesh).gameObject.activeInHierarchy)
			{
				meshes.Add(mesh);
			}
		}

		internal static void Measure(Transform root, List<Renderer> meshes, out Vector3 centre, out Vector3 size)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0048: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			Vector3 val = Vector3.zero;
			Vector3 val2 = Vector3.zero;
			foreach (Renderer mesh in meshes)
			{
				if (!Object.op_Implicit((Object)(object)mesh))
				{
					continue;
				}
				SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((mesh is SkinnedMeshRenderer) ? mesh : null);
				Bounds val4;
				Transform val5;
				if (Object.op_Implicit((Object)(object)val3))
				{
					val4 = val3.localBounds;
					val5 = (Object.op_Implicit((Object)(object)val3.rootBone) ? val3.rootBone : ((Component)val3).transform);
				}
				else
				{
					val4 = mesh.bounds;
					val5 = null;
				}
				for (int i = 0; i < 8; i++)
				{
					Vector3 val6 = ((Bounds)(ref val4)).center + Vector3.Scale(((Bounds)(ref val4)).extents, new Vector3(((i & 1) == 0) ? (-1f) : 1f, ((i & 2) == 0) ? (-1f) : 1f, ((i & 4) == 0) ? (-1f) : 1f));
					Vector3 val7 = (Object.op_Implicit((Object)(object)val5) ? val5.TransformPoint(val6) : val6);
					Vector3 val8 = root.InverseTransformPoint(val7);
					if (!flag)
					{
						val = (val2 = val8);
						flag = true;
					}
					else
					{
						val = Vector3.Min(val, val8);
						val2 = Vector3.Max(val2, val8);
					}
				}
			}
			if (!flag)
			{
				((Vector3)(ref val))..ctor(-0.4f, 0f, -0.3f);
				((Vector3)(ref val2))..ctor(0.4f, HUMAN_HEIGHT, 0.3f);
			}
			centre = (val + val2) * 0.5f;
			size = val2 - val;
		}

		internal static void MeasurePosed(Transform root, List<Renderer> meshes, out Vector3 centre, out Vector3 size)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			Vector3 val = Vector3.zero;
			Vector3 val2 = Vector3.zero;
			foreach (Renderer mesh in meshes)
			{
				SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((mesh is SkinnedMeshRenderer) ? mesh : null);
				if (!Object.op_Implicit((Object)(object)val3))
				{
					continue;
				}
				if (!Object.op_Implicit((Object)(object)s_baked))
				{
					s_baked = new Mesh();
				}
				val3.BakeMesh(s_baked, true);
				Vector3 position = ((Component)val3).transform.position;
				Quaternion rotation = ((Component)val3).transform.rotation;
				Vector3 lossyScale = ((Component)val3).transform.lossyScale;
				Vector3[] vertices = s_baked.vertices;
				foreach (Vector3 val4 in vertices)
				{
					Vector3 val5 = root.InverseTransformPoint(position + rotation * Vector3.Scale(val4, lossyScale));
					if (!flag)
					{
						val = (val2 = val5);
						flag = true;
					}
					else
					{
						val = Vector3.Min(val, val5);
						val2 = Vector3.Max(val2, val5);
					}
				}
			}
			if (!flag)
			{
				Measure(root, meshes, out centre, out size);
				return;
			}
			centre = (val + val2) * 0.5f;
			size = val2 - val;
		}

		internal static float VolumeGrow(Vector3 size)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Pow(Mathf.Max(size.x * size.y * size.z, 0f) / 0.9f, 1f / 3f);
		}

		internal static float MiddleUp(Character character)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)character).transform;
			return transform.InverseTransformDirection(character.MiddlePos - transform.position).y;
		}

		private static float SampledMiddleUp(Character character)
		{
			//IL_0062: 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)
			//IL_0077: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (Transform)((s_pelvis != null) ? /*isinst with value type is only supported in some contexts*/: null);
			Transform val2 = (Transform)((s_head != null) ? /*isinst with value type is only supported in some contexts*/: null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
			{
				return MiddleUp(character);
			}
			Transform transform = ((Component)character).transform;
			return transform.InverseTransformDirection((val.position + val2.position) * 0.5f - transform.position).y;
		}

		internal static bool MeasureIdle(Character character, List<Renderer> meshes, out Vector3 centre, out Vector3 size, out string clip, out float middle)
		{
			//IL_01e9: 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_020f: 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_0100: 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_0108: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)character).transform;
			Animator animator = character.Animator;
			RuntimeAnimatorController val = (Object.op_Implicit((Object)(object)animator) ? animator.runtimeAnimatorController : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				MeasurePosed(transform, meshes, out centre, out size);
				clip = "none, no animator";
				middle = MiddleUp(character);
				return false;
			}
			string name = ((Object)val).name;
			Vector3 val2 = transform.lossyScale;
			string text = name + "|" + val2.y.ToString("F2");
			foreach (Renderer mesh in meshes)
			{
				text = text + "|" + ((Object)mesh).name;
			}
			if (s_idleBoxes.TryGetValue(text, out var value))
			{
				centre = value.Centre;
				size = value.Size;
				clip = value.Clip;
				middle = value.Middle;
				return true;
			}
			AnimationClip val3 = IdleClip(val);
			MeasurePosed(transform, meshes, out var centre2, out var size2);
			centre = centre2;
			size = size2;
			clip = (Object.op_Implicit((Object)(object)val3) ? ((Object)val3).name : "none, no idle clip");
			middle = MiddleUp(character);
			if (Object.op_Implicit((Object)(object)val3))
			{
				Transform[] componentsInChildren = ((Component)animator).GetComponentsInChildren<Transform>(true);
				Vector3[] array = (Vector3[])(object)new Vector3[componentsInChildren.Length];
				Quaternion[] array2 = (Quaternion[])(object)new Quaternion[componentsInChildren.Length];
				Vector3[] array3 = (Vector3[])(object)new Vector3[componentsInChildren.Length];
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					array[i] = componentsInChildren[i].localPosition;
					array2[i] = componentsInChildren[i].localRotation;
					array3[i] = componentsInChildren[i].localScale;
				}
				try
				{
					val3.SampleAnimation(((Component)animator).gameObject, 0f);
					MeasurePosed(transform, meshes, out centre, out size);
					middle = SampledMiddleUp(character);
				}
				finally
				{
					for (int j = 0; j < componentsInChildren.Length; j++)
					{
						componentsInChildren[j].localPosition = array[j];
						componentsInChildren[j].localRotation = array2[j];
						componentsInChildren[j].localScale = array3[j];
					}
				}
				val2 = size - size2;
				if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f)
				{
					val2 = centre - centre2;
					if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f)
					{
						clip += ", which moved nothing";
					}
				}
			}
			s_idleBoxes[text] = new IdleBox
			{
				Centre = centre,
				Size = size,
				Clip = clip,
				Middle = middle
			};
			return false;
		}

		private static AnimationClip IdleClip(RuntimeAnimatorController controller)
		{
			if (s_idleClips.TryGetValue(controller, out var value))
			{
				return value;
			}
			Dictionary<string, AnimationClip> dictionary = new Dictionary<string, AnimationClip>();
			AnimationClip[] animationClips = controller.animationClips;
			foreach (AnimationClip val in animationClips)
			{
				if (Object.op_Implicit((Object)(object)val) && !dictionary.ContainsKey(((Object)val).name))
				{
					dictionary[((Object)val).name] = val;
				}
			}
			int num = 0;
			string text = "";
			foreach (KeyValuePair<string, AnimationClip> item in dictionary)
			{
				if (!item.Key.EndsWith("Idle_a", StringComparison.Ordinal) || item.Key.Length == "Idle_a".Length)
				{
					continue;
				}
				string text2 = item.Key.Substring(0, item.Key.Length - "Idle_a".Length);
				int num2 = 0;
				foreach (string key in dictionary.Keys)
				{
					if (key.StartsWith(text2, StringComparison.Ordinal))
					{
						num2++;
					}
				}
				if (num2 > num)
				{
					num = num2;
					text = text2;
					value = item.Value;
				}
			}
			if (text == "Human" && dictionary.TryGetValue("HumanIdleNeutral_a", out var value2))
			{
				value = value2;
			}
			s_idleClips[controller] = value;
			return value;
		}
	}
	internal class PoseFollow
	{
		private const float SMOOTH = 0.6f;

		private const float SQUASH_MIN = 0.5f;

		private float _idle;

		private float _shiftSpeed;

		private float _squashSpeed;

		internal float Shift;

		internal float Squash = 1f;

		internal void Begin(Character character, float idleMiddle)
		{
			_idle = idleMiddle;
			float num = BodyBox.MiddleUp(character);
			Shift = num - _idle;
			Squash = SquashFor(num);
			_shiftSpeed = 0f;
			_squashSpeed = 0f;
		}

		internal void Target(Character character, out float shift, out float squash)
		{
			float num = BodyBox.MiddleUp(character);
			shift = num - _idle;
			squash = SquashFor(num);
		}

		internal void Step(Character character, float dt)
		{
			float num = BodyBox.MiddleUp(character);
			if (!(dt <= 0f))
			{
				Shift = Mathf.SmoothDamp(Shift, num - _idle, ref _shiftSpeed, 0.6f, float.PositiveInfinity, dt);
				Squash = Mathf.SmoothDamp(Squash, SquashFor(num), ref _squashSpeed, 0.6f, float.PositiveInfinity, dt);
			}
		}

		private float SquashFor(float now)
		{
			if (!(_idle > 0.01f))
			{
				return 1f;
			}
			return Mathf.Clamp(now / _idle, 0.5f, 1f);
		}
	}
	internal static class CourageFX
	{
		internal const string STATUS = "Courage";

		private const string LANTERN = "Runic Lantern";

		private const string LANTERN_EMBERS = "Embers";

		private const int FLAME_ITEM = 9400151;

		private const string FLAME_PART = "_FX_fire (1)";

		private const int MAX_ATTEMPTS = 15;

		private static int _attempts;

		private static bool _finished;

		internal static void TryOnce()
		{
			if (_finished)
			{
				return;
			}
			_attempts++;
			try
			{
				ResourcesPrefabManager instance = ResourcesPrefabManager.Instance;
				StatusEffect val = ((instance != null) ? instance.GetStatusEffectPrefab("Courage") : null);
				StatusEffect val2 = ((instance != null) ? instance.GetStatusEffectPrefab("Runic Lantern") : null);
				Transform val3 = ((instance != null) ? FindFlame(instance) : null);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val3))
				{
					if (Object.op_Implicit((Object)(object)val.FXPrefab))
					{
						Shape(val.FXPrefab, val3, val2.FXPrefab);
					}
					else
					{
						ExtraStatusesPlugin.Log.LogWarning((object)"[CourageFX] status 'Courage': FXPrefab is NULL - the XML's VFXPrefab did not resolve.");
					}
					_finished = true;
				}
			}
			catch (Exception ex)
			{
				ExtraStatusesPlugin.Log.LogError((object)("[CourageFX] vfx threw: " + ex));
				_finished = true;
				return;
			}
			if (!_finished && _attempts >= 15)
			{
				_finished = true;
				ExtraStatusesPlugin.Log.LogWarning((object)("[CourageFX] vfx gave up after " + _attempts + " attempts - Courage, Runic Lantern or item " + 9400151 + " never loaded."));
			}
		}

		private static Transform FindFlame(ResourcesPrefabManager rpm)
		{
			Item itemPrefab = rpm.GetItemPrefab(9400151);
			if (!Object.op_Implicit((Object)(object)itemPrefab))
			{
				return null;
			}
			string[] array = new string[2] { itemPrefab.VisualPrefabPath, itemPrefab.SpecialVisualPrefabDefaultPath };
			foreach (string text in array)
			{
				if (!string.IsNullOrEmpty(text))
				{
					Transform itemVisualPrefab = rpm.GetItemVisualPrefab(text);
					Transform val = (Object.op_Implicit((Object)(object)itemVisualPrefab) ? Find(itemVisualPrefab, "_FX_fire (1)") : null);
					if (Object.op_Implicit((Object)(object)val))
					{
						return val;
					}
				}
			}
			return Find(((Component)itemPrefab).transform, "_FX_fire (1)");
		}

		private static Transform Find(Transform root, string name)
		{
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == name)
				{
					return val;
				}
			}
			return null;
		}

		private static void Shape(Transform root, Transform flameSource, Transform lantern)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0240: 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_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Invalid comparison between Unknown and I4
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: 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_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Expected O, but got Unknown
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: 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_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: 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_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Expected O, but got Unknown
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Expected O, but got Unknown
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			string text = "[CourageFX] vfx, status 'Courage': root '" + ((Object)root).name + "' (the holder's parent)";
			GameObject val = Object.Instantiate<GameObject>(((Component)root).gameObject);
			((Object)val).name = "Waves";
			MonoBehaviour[] componentsInChildren = val.GetComponentsInChildren<MonoBehaviour>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
			}
			VFXFollowCharBone component = ((Component)root).GetComponent<VFXFollowCharBone>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			ParticleSystem component2 = ((Component)root).GetComponent<ParticleSystem>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				EmissionModule emission = component2.emission;
				((EmissionModule)(ref emission)).enabled = false;
			}
			GameObject val2 = new GameObject("CourageWisp");
			val2.transform.SetParent(root, false);
			CourageWisp courageWisp = val2.AddComponent<CourageWisp>();
			val.transform.SetParent(val2.transform, false);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			val.SetActive(true);
			courageWisp.Waves = val.GetComponent<ParticleSystem>();
			MainModule main = courageWisp.Waves.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			MinMaxGradient val3 = ((MainModule)(ref main)).startColor;
			courageWisp.WavesAlpha = ((MinMaxGradient)(ref val3)).color.a;
			ColorOverLifetimeModule colorOverLifetime = courageWisp.Waves.colorOverLifetime;
			if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
			{
				val3 = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
				if (((MinMaxGradient)(ref val3)).gradient != null)
				{
					val3 = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
					GradientColorKey[] colorKeys = ((MinMaxGradient)(ref val3)).gradient.colorKeys;
					for (int j = 0; j < colorKeys.Length; j++)
					{
						colorKeys[j].color = Color.white;
					}
					Gradient val4 = new Gradient();
					val3 = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color;
					val4.SetKeys(colorKeys, ((MinMaxGradient)(ref val3)).gradient.alphaKeys);
					((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4);
				}
			}
			EmissionModule emission2 = courageWisp.Waves.emission;
			courageWisp.WavesRate = ((EmissionModule)(ref emission2)).rateOverTimeMultiplier;
			GameObject val5 = Object.Instantiate<GameObject>(((Component)flameSource).gameObject, val2.transform, false);
			((Object)val5).name = "Flame";
			for (int num = val5.transform.childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)val5.transform.GetChild(num)).gameObject);
			}
			val5.transform.localPosition = Vector3.zero;
			val5.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
			val5.transform.localScale = Vector3.one;
			val5.SetActive(true);
			courageWisp.Flame = val5.GetComponent<ParticleSystem>();
			MainModule main2 = courageWisp.Flame.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main2)).startLifetime;
			float num2;
			if ((int)((MinMaxCurve)(ref startLifetime)).mode != 3)
			{
				startLifetime = ((MainModule)(ref main2)).startLifetime;
				num2 = ((MinMaxCurve)(ref startLifetime)).constant;
			}
			else
			{
				startLifetime = ((MainModule)(ref main2)).startLifetime;
				float constantMin = ((MinMaxCurve)(ref startLifetime)).constantMin;
				startLifetime = ((MainModule)(ref main2)).startLifetime;
				num2 = (constantMin + ((MinMaxCurve)(ref startLifetime)).constantMax) / 2f;
			}
			float num3 = num2;
			if (num3 <= 0f)
			{
				num3 = 0.7f;
			}
			courageWisp.FlamePace = 0.7f / num3;
			courageWisp.FlameRate = 12f / num3;
			((MainModule)(ref main2)).loop = true;
			((MainModule)(ref main2)).playOnAwake = false;
			((MainModule)(ref main2)).simulationSpace = (ParticleSystemSimulationSpace)0;
			((MainModule)(ref main2)).scalingMode = (ParticleSystemScalingMode)2;
			EmissionModule emission3 = courageWisp.Flame.emission;
			((EmissionModule)(ref emission3)).enabled = true;
			ShapeModule shape = courageWisp.Flame.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).radius = 0.01f;
			((ShapeModule)(ref shape)).angle = 11f;
			((ShapeModule)(ref shape)).scale = Vector3.one;
			ColorOverLifetimeModule colorOverLifetime2 = courageWisp.Flame.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime2)).enabled = true;
			Gradient val6 = new Gradient();
			val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(CourageWisp.FLAME_COLOUR, 0f),
				new GradientColorKey(CourageWisp.FLAME_COLOUR, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(1f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime2)).color = MinMaxGradient.op_Implicit(val6);
			Transform val7 = Find(lantern, "Embers");
			if (Object.op_Implicit((Object)(object)val7))
			{
				GameObject val8 = Object.Instantiate<GameObject>(((Component)val7).gameObject, val2.transform, false);
				((Object)val8).name = "Embers";
				val8.transform.localPosition = Vector3.zero;
				val8.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
				val8.transform.localScale = Vector3.one;
				val8.SetActive(true);
				courageWisp.Embers = val8.GetComponent<ParticleSystem>();
				MainModule main3 = courageWisp.Embers.main;
				((MainModule)(ref main3)).loop = true;
				((MainModule)(ref main3)).playOnAwake = false;
				ColorOverLifetimeModule colorOverLifetime3 = courageWisp.Embers.colorOverLifetime;
				Color val9 = default(Color);
				((Color)(ref val9))..ctor(0.08f, 0.08f, 0.08f, 1f);
				Gradient val10 = new Gradient();
				val10.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(val9, 0f),
					new GradientColorKey(val9, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
				{
					new GradientAlphaKey(0f, 0f),
					new GradientAlphaKey(1f, 0.22f),
					new GradientAlphaKey(0f, 1f)
				});
				((ColorOverLifetimeModule)(ref colorOverLifetime3)).color = MinMaxGradient.op_Implicit(val10);
				emission2 = courageWisp.Embers.emission;
				courageWisp.EmberRate = ((EmissionModule)(ref emission2)).rateOverTimeMultiplier;
			}
			else
			{
				text += "\n    embers NOT built: no 'Embers' on Runic Lantern";
			}
			GameObject val11 = new GameObject("Light");
			val11.transform.SetParent(val2.transform, false);
			courageWisp.Lamp = val11.AddComponent<Light>();
			courageWisp.Lamp.type = (LightType)2;
			courageWisp.Lamp.color = CourageWisp.AMBER;
			courageWisp.Lamp.intensity = 0f;
			courageWisp.Lamp.range = 3f;
			courageWisp.Lamp.shadows = (LightShadows)0;
			text = text + "\n    wisp: flame (item " + 9400151 + "), embers, waves and a plain light, on a " + 8.5f.ToString("F1") + " s cycle from MiddlePos";
			ExtraStatusesPlugin.Log.LogMessage((object)text);
		}
	}
	internal class CourageWisp : MonoBehaviour
	{
		internal static readonly Color AMBER = new Color(1f, 0.549f, 0f);

		internal static readonly Color FLAME_COLOUR = new Color(0.878f, 0.565f, 0f);

		internal const float FADE_IN = 1f;

		internal const float FLOAT_TIME = 5f;

		internal const float FADE_OUT = 1.5f;

		internal const float SILENCE = 1f;

		private const float VISIBLE_MIN = 7.5f;

		private const float AFTER_OUT = 4.5f;

		private const float OUT_TIME_MIN = 3f;

		private const float OUT_SPEED_MAX = 0.36f;

		private const float RISE_SPEED_MAX = 0.16f;

		private const float PLAYER_OUT = 0.55f;

		private const float OUT_MARGIN = 0.22f;

		private const float RISE = 0.6f;

		private const float HUMAN_HEIGHT = 1.9f;

		private const float DRIFT = 0.25f;

		private const float DRIFT_UP = 0.1f;

		private const float DRIFT_PACE = 0.35f;

		private const float GROW_MAX = 2f;

		private const float LONG_RATIO = 1.2f;

		private const float EXIT_SPREAD = 45f;

		internal const float FLAMES_ALIVE = 12f;

		private const float FLAME_SIZE = 0.225f;

		private const float FLAME_SIZE_MIN = 0.2f;

		private const float FLAME_SIZE_MAX = 0.3f;

		private const float EMBER_SCALE = 0.5f;

		internal const float EMBER_GREY = 0.08f;

		private const float WAVES_SCALE = 0.2f;

		internal const float LIGHT_RANGE = 3f;

		private const float LIGHT_INTENSITY = 0.6f;

		private const float FADE_MAX = 3f;

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

		public ParticleSystem Flame;

		public ParticleSystem Embers;

		public ParticleSystem Waves;

		public Light Lamp;

		public float FlameRate;

		public float FlamePace = 1f;

		public float EmberRate;

		public float WavesRate;

		public float WavesAlpha = 1f;

		private Character _character;

		private bool _isPlayer;

		private readonly List<Renderer> _meshes = new List<Renderer>();

		private Vector3 _boxCentre;

		private Vector3 _boxSize;

		private float _scale = 1f;

		private float _seed;

		private int _wisp;

		private float _started;

		private Vector3 _start;

		private Quaternion _facing = Quaternion.identity;

		private float _sin;

		private float _cos = 1f;

		private float _out;

		private float _outTime = 3f;

		private float _visible = 7.5f;

		private float _rise;

		private bool _fading;

		private float _fadeBegan;

		private float _fadeLight;

		private readonly ParticleSnapshot _snapFlame = new ParticleSnapshot();

		private readonly ParticleSnapshot _snapEmbers = new ParticleSnapshot();

		private readonly ParticleSnapshot _snapWaves = new ParticleSnapshot();

		private void VFXPlayed(VFXSystem _system)
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			_character = (Object.op_Implicit((Object)(object)_system) ? _system.Character : ((Component)this).GetComponentInParent<Character>());
			if (Object.op_Implicit((Object)(object)_character))
			{
				_isPlayer = !_character.IsAI;
				Stopwatch stopwatch = Stopwatch.StartNew();
				string clip = "none";
				bool flag = false;
				_scale = 1f;
				if (_isPlayer)
				{
					_boxCentre = Vector3.zero;
					_boxSize = new Vector3(0.71f, 1.9f, 0.67f);
				}
				else
				{
					BodyBox.Meshes(_character, _meshes);
					flag = BodyBox.MeasureIdle(_character, _meshes, out var centre, out var size, out clip, out var _);
					Vector3 lossyScale = ((Component)_character).transform.lossyScale;
					_boxCentre = Vector3.Scale(centre, lossyScale);
					_boxSize = Vector3.Scale(size, lossyScale);
					_scale = Mathf.Clamp(BodyBox.VolumeGrow(_boxSize), 1f, 2f);
				}
				stopwatch.Stop();
				Size();
				Vector3 val = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? ((Component)this).transform.parent.lossyScale : Vector3.one);
				((Component)this).transform.localScale = new Vector3(1f / Mathf.Max(val.x, 0.0001f), 1f / Mathf.Max(val.y, 0.0001f), 1f / Mathf.Max(val.z, 0.0001f));
				_seed = Random.value * 1000f;
				_wisp = 0;
				_started = Time.time;
				Pick();
				Place(0f);
				Shine(0f);
				if (Object.op_Implicit((Object)(object)Flame))
				{
					Flame.Clear();
					Flame.Play();
				}
				if (Object.op_Implicit((Object)(object)Embers))
				{
					Embers.Clear();
					Embers.Play();
				}
				if (Object.op_Implicit((Object)(object)Waves))
				{
					Waves.Clear();
					Waves.Play();
				}
				string name = _character.Name;
				if (s_logged.Add(name + "|" + flag))
				{
					ExtraStatusesPlugin.Log.LogMessage((object)("[CourageFX] " + name + ": " + (_isPlayer ? "player, fixed path" : ("idle clip " + clip + (flag ? " (remembered)" : "") + ", body " + ((Vector3)(ref _boxSize)).ToString("F2") + " m")) + ", wisp x" + _scale.ToString("F2") + ", light " + (3f * _scale).ToString("F1") + " m, first out " + _out.ToString("F2") + " m in " + _outTime.ToString("F1") + " s, measured in " + stopwatch.Elapsed.TotalMilliseconds.ToString("F1") + " ms"));
				}
			}
		}

		private void Size()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Flame))
			{
				float num = 0.225f * _scale;
				MainModule main = Flame.main;
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.2f * num, 0.3f * num);
				((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.1f * FlamePace * num / 0.6f);
				((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.1f * FlamePace * FlamePace * num / 0.6f);
			}
			if (Object.op_Implicit((Object)(object)Embers))
			{
				float num2 = 0.5f * _scale;
				MainModule main2 = Embers.main;
				((MainModule)(ref main2)).startSize = new MinMaxCurve(0.03f * num2, 0.04f * num2);
				((MainModule)(ref main2)).startSpeed = new MinMaxCurve(0.8f * num2, 1.5f * num2);
				ShapeModule shape = Embers.shape;
				((ShapeModule)(ref shape)).radius = 0.2f * num2;
			}
			if (Object.op_Implicit((Object)(object)Waves))
			{
				((Component)Waves).transform.localScale = Vector3.one * 0.2f * _scale;
			}
			if (Object.op_Implicit((Object)(object)Lamp))
			{
				Lamp.range = 3f * _scale;
			}
		}

		private void Pick()
		{
			//IL_0014: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)_character).transform;
			_start = transform.InverseTransformDirection(_character.MiddlePos - transform.position);
			_facing = transform.rotation;
			float num = ((!_isPlayer && Mathf.Max(_boxSize.x, _boxSize.z) > 1.2f * Mathf.Min(_boxSize.x, _boxSize.z)) ? (((_boxSize.z <= _boxSize.x) ? 0f : 90f) + ((Random.value < 0.5f) ? 180f : 0f) + Random.Range(-45f, 45f)) : Random.Range(0f, 360f));
			_sin = Mathf.Sin(num * ((float)Math.PI / 180f));
			_cos = Mathf.Cos(num * ((float)Math.PI / 180f));
			if (_isPlayer)
			{
				_out = 0.55f;
				_rise = 0.6f;
			}
			else
			{
				Vector3 val = _boxCentre - _start;
				float num2 = ((Mathf.Abs(_sin) > 0.001f) ? Mathf.Max(0f, (val.x + Mathf.Sign(_sin) * _boxSize.x / 2f) / _sin) : float.MaxValue);
				float num3 = ((Mathf.Abs(_cos) > 0.001f) ? Mathf.Max(0f, (val.z + Mathf.Sign(_cos) * _boxSize.z / 2f) / _cos) : float.MaxValue);
				_out = Mathf.Min(num2, num3) + 0.22f * _scale;
			}
			_outTime = Mathf.Max(3f, _out / 0.36f);
			_visible = Mathf.Max(7.5f, _outTime + 4.5f);
			if (!_isPlayer)
			{
				_rise = Mathf.Min(0.6f * _boxSize.y / 1.9f, 0.16f * _visible);
			}
		}

		private void Place(float at)
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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)
			float num = Mathf.Min(at, _visible);
			float num2 = Mathf.Clamp01((num - _outTime * 0.5f) / _outTime);
			float num3 = Mathf.SmoothStep(0f, 1f, num / _outTime);
			float num4 = Drift(0f, num) * 0.25f * _scale * num2;
			float num5 = Drift(50f, num) * 0.25f * _scale * num2;
			float num6 = Drift(100f, num) * 0.1f * _scale * num2;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(num4 + _sin * _out * num3, num6 + _rise * num / _visible, num5 + _cos * _out * num3);
			Transform transform = ((Component)_character).transform;
			((Component)this).transform.SetPositionAndRotation(transform.position + _facing * (_start + val), _facing);
		}

		private float Drift(float channel, float go)
		{
			return (Mathf.PerlinNoise(_seed + channel + (float)_wisp * 17.3f, go * 0.35f) - 0.5f) * 2.5f;
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)_character))
			{
				if (_fading)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			float num = Time.time - _started;
			if (_fading)
			{
				Place(num);
				float num2 = Time.time - _fadeBegan;
				if (Object.op_Implicit((Object)(object)Lamp))
				{
					Lamp.intensity = _fadeLight * Mathf.Clamp01(1f - num2 / 1.5f);
				}
				if (num2 >= 3f || Alive() == 0)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			if (num >= _visible + 1f)
			{
				_wisp++;
				_started = Time.time;
				num = 0f;
				if (Object.op_Implicit((Object)(object)Flame))
				{
					Flame.Clear(false);
				}
				if (Object.op_Implicit((Object)(object)Waves))
				{
					Waves.Clear(false);
				}
				Pick();
			}
			float num3 = ((num < 1f) ? (num / 1f) : ((num < _visible - 1.5f) ? 1f : ((num < _visible) ? ((_visible - num) / 1.5f) : 0f)));
			num3 = num3 * num3 * (3f - 2f * num3);
			Place(num);
			Shine(num3);
		}

		private void Shine(float a)
		{
			//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_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_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_0060: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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)
			if (Object.op_Implicit((Object)(object)Flame))
			{
				EmissionModule emission = Flame.emission;
				((EmissionModule)(ref emission)).rateOverTimeMultiplier = FlameRate * a;
				MainModule main = Flame.main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(a, a, a, 1f));
			}
			if (Object.op_Implicit((Object)(object)Embers))
			{
				EmissionModule emission2 = Embers.emission;
				((EmissionModule)(ref emission2)).rateOverTimeMultiplier = EmberRate * a;
				MainModule main2 = Embers.main;
				((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(new Color(AMBER.r * a, AMBER.g * a, AMBER.b * a, 1f));
			}
			if (Object.op_Implicit((Object)(object)Waves))
			{
				EmissionModule emission3 = Waves.emission;
				((EmissionModule)(ref emission3)).rateOverTimeMultiplier = WavesRate * a;
				MainModule main3 = Waves.main;
				((MainModule)(ref main3)).startColor = MinMaxGradient.op_Implicit(new Color(AMBER.r * a, AMBER.g * a, AMBER.b * a, WavesAlpha));
			}
			if (Object.op_Implicit((Object)(object)Lamp))
			{
				Lamp.intensity = 0.6f * a;
			}
		}

		private void LateUpdate()
		{
			if (!_fading)
			{
				_snapFlame.Take(Flame);
				_snapEmbers.Take(Embers);
				_snapWaves.Take(Waves);
			}
		}

		private int Alive()
		{
			return (Object.op_Implicit((Object)(object)Flame) ? Flame.particleCount : 0) + (Object.op_Implicit((Object)(object)Embers) ? Embers.particleCount : 0) + (Object.op_Implicit((Object)(object)Waves) ? Waves.particleCount : 0);
		}

		private void OnDisable()
		{
			//IL_0083: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if (_fading || !FadeCopy.CanFade(_character, ((Component)this).gameObject))
			{
				return;
			}
			try
			{
				CourageWisp component = FadeCopy.Copy(((Component)this).gameObject, _character, "CourageFade").GetComponent<CourageWisp>();
				component._character = _character;
				component._isPlayer = _isPlayer;
				component._scale = _scale;
				component._seed = _seed;
				component._wisp = _wisp;
				component._started = _started;
				component._start = _start;
				component._facing = _facing;
				component._sin = _sin;
				component._cos = _cos;
				component._out = _out;
				component._outTime = _outTime;
				component._visible = _visible;
				component._rise = _rise;
				component._fading = true;
				component._fadeBegan = Time.time;
				component._fadeLight = (Object.op_Implicit((Object)(object)Lamp) ? Lamp.intensity : 0f);
				_snapFlame.GiveTo(component.Flame);
				_snapEmbers.GiveTo(component.Embers);
				_snapWaves.GiveTo(component.Waves);
			}
			catch (Exception e)
			{
				FadeCopy.Warn("CourageFX", e);
			}
		}
	}
	internal static class DisorientedFX
	{
		internal const string STATUS = "Disoriented";

		private const string LANTERN = "Runic Lantern";

		private const string LANTERN_GLOW = "center";

		private const string LANTERN_EMBERS = "Embers";

		private const string LANTERN_SHIMMER = "disto";

		private static readonly Color GOLD = new Color(1f, 0.75f, 0.2f);

		private static readonly float STAR_SIZE = 0.25f;

		private const int MAX_ATTEMPTS = 15;

		private static int _attempts;

		private static bool _finished;

		internal static void TryOnce()
		{
			if (_finished)
			{
				return;
			}
			_attempts++;
			try
			{
				StatusEffect val = ((ResourcesPrefabManager.Instance != null) ? ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Disoriented") : null);
				StatusEffect val2 = ((ResourcesPrefabManager.Instance != null) ? ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Runic Lantern") : null);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
				{
					if (Object.op_Implicit((Object)(object)val.FXPrefab))
					{
						Shape(val.FXPrefab, val2.FXPrefab);
					}
					else
					{
						ExtraStatusesPlugin.Log.LogWarning((object)"[DisorientedFX] status 'Disoriented': FXPrefab is NULL - the XML's VFXPrefab did not resolve.");
					}
					_finished = true;
				}
			}
			catch (Exception ex)
			{
				ExtraStatusesPlugin.Log.LogError((object)("[DisorientedFX] vfx threw: " + ex));
				_finished = true;
				return;
			}
			if (!_finished && _attempts >= 15)
			{
				_finished = true;
				ExtraStatusesPlugin.Log.LogWarning((object)("[DisorientedFX] vfx gave up after " + _attempts + " attempts - Disoriented or Runic Lantern never loaded."));
			}
		}

		private static void Shape(Transform root, Transform lantern)
		{
			//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)
			string text = "[DisorientedFX] vfx, status 'Disoriented': root '" + ((Object)root).name + "' (the holder)";
			VFXParticlesOnChar component = ((Component)root).GetComponent<VFXParticlesOnChar>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			ParticleSystem component2 = ((Component)root).GetComponent<ParticleSystem>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				EmissionModule emission = component2.emission;
				((EmissionModule)(ref emission)).enabled = false;
			}
			text = text + "\n    Pain's streaks off" + (Object.op_Implicit((Object)(object)component) ? ", VFXParticlesOnChar removed" : "");
			Orbits(root, lantern, ref text);
			ExtraStatusesPlugin.Log.LogMessage((object)text);
		}

		private static MinMaxCurve Scaled(MinMaxCurve value, float factor)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if ((int)((MinMaxCurve)(ref value)).mode == 3)
			{
				return new MinMaxCurve(((MinMaxCurve)(ref value)).constantMin * factor, ((MinMaxCurve)(ref value)).constantMax * factor);
			}
			if ((int)((MinMaxCurve)(ref value)).mode == 0)
			{
				return new MinMaxCurve(((MinMaxCurve)(ref value)).constant * factor);
			}
			((MinMaxCurve)(ref value)).curveMultiplier = ((MinMaxCurve)(ref value)).curveMultiplier * factor;
			return value;
		}

		private static string Range(MinMaxCurve value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if ((int)((MinMaxCurve)(ref value)).mode == 3)
			{
				return ((MinMaxCurve)(ref value)).constantMin.ToString("F2") + ".." + ((MinMaxCurve)(ref value)).constantMax.ToString("F2");
			}
			if ((int)((MinMaxCurve)(ref value)).mode == 0)
			{
				return ((MinMaxCurve)(ref value)).constant.ToString("F2");
			}
			return ((object)((MinMaxCurve)(ref value)).mode/*cast due to .constrained prefix*/).ToString() + " x" + ((MinMaxCurve)(ref value)).curveMultiplier.ToString("F2");
		}

		private static void Orbits(Transform root, Transform lantern, ref string report)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = CopyPart(lantern, "center", "Stars", ref report);
			if (!Object.op_Implicit((Object)(object)val))
			{
				report += "\n    orbits NOT built";
				return;
			}
			GameObject val2 = new GameObject("DisorientedOrbits");
			val2.transform.SetParent(root, false);
			((Component)val).transform.SetParent(val2.transform, false);
			MainModule main = val.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(GOLD);
			string text = Range(((MainModule)(ref main)).startSize);
			((MainModule)(ref main)).startSize = Scaled(((MainModule)(ref main)).startSize, STAR_SIZE);
			TextureSheetAnimationModule textureSheetAnimation = val.textureSheetAnimation;
			Swarm(val);
			ParticleSystem val3 = CopyPart(lantern, "disto", "Shimmer", ref report);
			string text2 = "\n    shimmer NOT built";
			float sHIMMER_PER_SECOND;
			if (Object.op_Implicit((Object)(object)val3))
			{
				((Component)val3).transform.SetParent(val2.transform, false);
				MainModule main2 = val3.main;
				string text3 = Range(((MainModule)(ref main2)).startSize);
				((MainModule)(ref main2)).startSize = Scaled(((MainModule)(ref main2)).startSize, STAR_SIZE);
				Swarm(val3);
				ParticleSystemRenderer component = ((Component)val3).GetComponent<ParticleSystemRenderer>();
				string[] obj = new string[10] { "\n    shimmer (lantern heat): ", null, null, null, null, null, null, null, null, null };
				sHIMMER_PER_SECOND = DisorientedOrbits.SHIMMER_PER_SECOND;
				obj[1] = sHIMMER_PER_SECOND.ToString("F0");
				obj[2] = " blobs/s per star, size ";
				obj[3] = text3;
				obj[4] = " -> ";
				obj[5] = Range(((MainModule)(ref main2)).startSize);
				obj[6] = ", life ";
				obj[7] = Range(((MainModule)(ref main2)).startLifetime);
				obj[8] = " s, material ";
				obj[9] = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((Renderer)component).sharedMaterial)) ? ((Object)((Renderer)component).sharedMaterial).name : "none");
				text2 = string.Concat(obj);
			}
			ParticleSystem val4 = CopyPart(lantern, "Embers", "Embers", ref report);
			string text4 = "\n    embers NOT built";
			if (Object.op_Implicit((Object)(object)val4))
			{
				Quaternion localRotation = ((Component)val4).transform.localRotation;
				((Component)val4).transform.SetParent(val2.transform, false);
				((Component)val4).transform.localPosition = Vector3.zero;
				((Component)val4).transform.localRotation = localRotation;
				MainModule main3 = val4.main;
				((MainModule)(ref main3)).loop = true;
				((MainModule)(ref main3)).playOnAwake = false;
				((MainModule)(ref main3)).prewarm = false;
				((MainModule)(ref main3)).startDelay = MinMaxCurve.op_Implicit(0f);
				((MainModule)(ref main3)).startColor = MinMaxGradient.op_Implicit(GOLD);
				((MainModule)(ref main3)).maxParticles = Mathf.Max(((MainModule)(ref main3)).maxParticles, 300);
				EmissionModule emission = val4.emission;
				((EmissionModule)(ref emission)).enabled = false;
				ShapeModule shape = val4.shape;
				string[] obj2 = new string[14]
				{
					"\n    embers (lantern): gold, ", null, null, null, null, null, null, null, null, null,
					null, null, null, null
				};
				sHIMMER_PER_SECOND = DisorientedOrbits.EMBERS_PER_SECOND;
				obj2[1] = sHIMMER_PER_SECOND.ToString("F0");
				obj2[2] = "/s on a human by the body box's area, from the stars, ";
				obj2[3] = ((object)((MainModule)(ref main3)).simulationSpace/*cast due to .constrained prefix*/).ToString();
				obj2[4] = ", life ";
				obj2[5] = Range(((MainModule)(ref main3)).startLifetime);
				obj2[6] = " s, speed ";
				obj2[7] = Range(((MainModule)(ref main3)).startSpeed);
				obj2[8] = " up a ";
				obj2[9] = ((ShapeModule)(ref shape)).angle.ToString("F0");
				obj2[10] = " deg cone, size ";
				obj2[11] = Range(((MainModule)(ref main3)).startSize);
				obj2[12] = ", noise ";
				NoiseModule nois