Decompiled source of FloweryMod v1.0.1

plugins/FloweryMod/FloweryMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using FloweryMod.Components;
using FloweryMod.Content;
using FloweryMod.Modules;
using FloweryMod.SkillStates;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ConVar;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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("FloweryMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+51691b05e398af36b7f84782d084203e1be8e455")]
[assembly: AssemblyProduct("Flowery (DELTARUNE) Survivor")]
[assembly: AssemblyTitle("FloweryMod")]
[assembly: AssemblyVersion("1.0.1.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 FloweryMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.deltarune.FloweryMod", "FloweryMod", "1.0.1")]
	public class FloweryPlugin : BaseUnityPlugin
	{
		public const string Author = "deltarune";

		public const string ModName = "FloweryMod";

		public const string Guid = "com.deltarune.FloweryMod";

		public const string Version = "1.0.1";

		public static FloweryPlugin Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Log.Info("Howdy! Flowery is waking up.");
			FloweryConfig.Init(((BaseUnityPlugin)this).Config);
			FloweryAssets.Init();
			Sounds.Init();
			Tokens.Init();
			Buffs.Init();
			FlowerySkills.RegisterEntityStates();
			FloweryBody.Init();
			FloweryDiagnostics.Init();
			FloweryMenuSounds.Spawn();
			Log.Info("Flowery is ready. Six petals, one very large plan.");
		}
	}
}
namespace FloweryMod.SkillStates
{
	public abstract class BaseFloweryDash : BaseFloweryState, IFloweryMotorState
	{
		public static float hitRadius = 2.8f;

		public static float procCoefficient = 0.8f;

		public static float exitSpeedFraction = 0.25f;

		private readonly HashSet<HealthComponent> alreadyHit = new HashSet<HealthComponent>();

		private bool gravityDisabled;

		protected Vector3 dashDirection;

		protected abstract float DashSpeed { get; }

		protected abstract float DashDuration { get; }

		protected abstract float DamageCoefficient { get; }

		protected abstract float TensionPerEnemy { get; }

		protected abstract string VoiceCategory { get; }

		protected virtual string DashPose => "Jarona";

		public override void OnEnter()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001d: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			dashDirection = ((Vector3)(ref direction)).normalized;
			if (((Vector3)(ref dashDirection)).sqrMagnitude < 0.001f)
			{
				dashDirection = ((EntityState)this).transform.forward;
			}
			Sounds.PlayAt(VoiceCategory, ((EntityState)this).gameObject);
			PlayPose(DashPose, 0.08f, "Jarona");
			LockFacing(dashDirection);
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				gravityDisabled = true;
				Gravity.Suspend(((EntityState)this).characterMotor);
				((EntityState)this).characterMotor.disableAirControlUntilCollision = false;
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			SpawnDashEffect();
		}

		public override void FixedUpdate()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.velocity = dashDirection * DashSpeed;
			}
			LockFacing(dashDirection);
			DamagePassedThrough();
			if (((EntityState)this).fixedAge >= DashDuration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			ReleasePose();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				if (gravityDisabled)
				{
					Gravity.Restore(((EntityState)this).characterMotor);
					gravityDisabled = false;
				}
				((EntityState)this).characterMotor.velocity = dashDirection * (DashSpeed * exitSpeedFraction);
			}
			base.OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		protected virtual void SpawnDashEffect()
		{
			//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_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_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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			if (!((Object)(object)FloweryAssets.JaronaChargeEffect == (Object)null))
			{
				FloweryEffects.Spawn(FloweryAssets.JaronaChargeEffect, new EffectData
				{
					origin = ((EntityState)this).transform.position + Vector3.up,
					scale = 2.5f,
					rotation = Quaternion.LookRotation(dashDirection),
					color = Color32.op_Implicit(FloweryAssets.SoulBlue)
				}, transmit: false);
			}
		}

		private void DamagePassedThrough()
		{
			//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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_00f5: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_01db: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			if ((Object)(object)((EntityState)this).characterBody == (Object)null)
			{
				return;
			}
			TeamIndex val = (TeamIndex)((!((Object)(object)((EntityState)this).characterBody.teamComponent != (Object)null)) ? 1 : ((int)((EntityState)this).characterBody.teamComponent.teamIndex));
			Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
			float num = hitRadius;
			LayerIndex entityPrecise = LayerIndex.entityPrecise;
			Collider[] array = Physics.OverlapSphere(corePosition, num, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2);
			for (int i = 0; i < array.Length; i++)
			{
				HurtBox component = ((Component)array[i]).GetComponent<HurtBox>();
				if ((Object)(object)component == (Object)null || (Object)(object)component.healthComponent == (Object)null || component.teamIndex == val || !component.healthComponent.alive || !alreadyHit.Add(component.healthComponent))
				{
					continue;
				}
				if (((EntityState)this).isAuthority && (Object)(object)tension != (Object)null)
				{
					tension.Add(TensionPerEnemy);
				}
				if (NetworkServer.active)
				{
					DamageInfo val2 = new DamageInfo
					{
						attacker = ((EntityState)this).gameObject,
						inflictor = ((EntityState)this).gameObject,
						damage = ((BaseState)this).damageStat * DamageCoefficient,
						crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master),
						force = dashDirection * 900f,
						position = ((Component)component).transform.position,
						procCoefficient = procCoefficient,
						damageType = FloweryDamage.Of((DamageType)32, (DamageSource)4),
						damageColorIndex = (DamageColorIndex)0
					};
					component.healthComponent.TakeDamage(val2);
					GlobalEventManager.instance.OnHitEnemy(val2, ((Component)component.healthComponent).gameObject);
					GlobalEventManager.instance.OnHitAll(val2, ((Component)component.healthComponent).gameObject);
					if ((Object)(object)FloweryAssets.PelletHitEffect != (Object)null)
					{
						FloweryEffects.Spawn(FloweryAssets.PelletHitEffect, new EffectData
						{
							origin = ((Component)component).transform.position,
							scale = 1.5f,
							rotation = Quaternion.LookRotation(dashDirection)
						}, transmit: true);
					}
				}
			}
		}
	}
	public interface IFloweryMotorState
	{
	}
	public abstract class BaseFloweryState : BaseSkillState
	{
		protected TensionController tension;

		private bool facingLocked;

		private bool directionWasEnabled;

		private string ownedPose;

		private Animator cachedAnimator;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			tension = ((EntityState)this).GetComponent<TensionController>();
		}

		public override void OnExit()
		{
			ReleaseFacing();
			((EntityState)this).OnExit();
		}

		private Transform TakeFacing(Vector3 direction, out Vector3 flat)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			flat = Vector3.zero;
			if ((Object)(object)((EntityState)this).characterDirection == (Object)null)
			{
				return null;
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(direction.x, 0f, direction.z);
			if (((Vector3)(ref val)).sqrMagnitude < 0.001f)
			{
				return null;
			}
			flat = ((Vector3)(ref val)).normalized;
			if (!facingLocked)
			{
				facingLocked = true;
				directionWasEnabled = ((Behaviour)((EntityState)this).characterDirection).enabled;
				((Behaviour)((EntityState)this).characterDirection).enabled = false;
			}
			Transform val2 = ((EntityState)this).characterDirection.targetTransform;
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = ((EntityState)this).GetModelBaseTransform();
			}
			return val2;
		}

		protected void LockFacing(Vector3 direction)
		{
			//IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Vector3 flat;
			Transform val = TakeFacing(direction, out flat);
			if (!((Object)(object)val == (Object)null))
			{
				val.rotation = Quaternion.LookRotation(flat);
				((EntityState)this).characterDirection.forward = flat;
			}
		}

		protected void TrackFacing(Vector3 direction, float degreesPerSecond = 720f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0028: 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)
			Vector3 flat;
			Transform val = TakeFacing(direction, out flat);
			if (!((Object)(object)val == (Object)null))
			{
				val.rotation = Quaternion.RotateTowards(val.rotation, Quaternion.LookRotation(flat), degreesPerSecond * Time.fixedDeltaTime);
				((EntityState)this).characterDirection.forward = flat;
			}
		}

		protected void ReleaseFacing()
		{
			if (facingLocked)
			{
				if ((Object)(object)((EntityState)this).characterDirection != (Object)null)
				{
					((Behaviour)((EntityState)this).characterDirection).enabled = directionWasEnabled;
				}
				facingLocked = false;
			}
		}

		protected void PlayPose(string state, float crossfade = 0.08f, string fallback = null)
		{
			Animator floweryAnimator = GetFloweryAnimator();
			if ((Object)(object)floweryAnimator == (Object)null || string.IsNullOrEmpty(state))
			{
				return;
			}
			int num = floweryAnimator.GetLayerIndex("Base Layer");
			if (num < 0)
			{
				num = 0;
			}
			if (!floweryAnimator.HasState(num, Animator.StringToHash(state)))
			{
				FloweryAnimations.ReportOnce(state, "animator has no pose '" + state + "'" + (string.IsNullOrEmpty(fallback) ? "" : (" - wearing '" + fallback + "' instead")));
				if (!string.IsNullOrEmpty(fallback) && !(fallback == state))
				{
					PlayPose(fallback, crossfade);
				}
			}
			else
			{
				ownedPose = state;
				floweryAnimator.CrossFadeInFixedTime(state, crossfade, num);
				ApplyCapeFor(state);
			}
		}

		private void ApplyCapeFor(string pose)
		{
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (!((Object)(object)modelTransform == (Object)null))
			{
				FloweryModelEnforcer component = ((Component)modelTransform).GetComponent<FloweryModelEnforcer>();
				if ((Object)(object)component != (Object)null)
				{
					component.WantCape(FloweryAnimations.WearsCape(pose));
				}
			}
		}

		protected void ReleasePose()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(ownedPose))
			{
				return;
			}
			Animator floweryAnimator = GetFloweryAnimator();
			if (!((Object)(object)floweryAnimator == (Object)null))
			{
				int num = floweryAnimator.GetLayerIndex("Base Layer");
				if (num < 0)
				{
					num = 0;
				}
				AnimatorStateInfo val = (floweryAnimator.IsInTransition(num) ? floweryAnimator.GetNextAnimatorStateInfo(num) : floweryAnimator.GetCurrentAnimatorStateInfo(num));
				if (((AnimatorStateInfo)(ref val)).shortNameHash == Animator.StringToHash(ownedPose))
				{
					PlayFly();
				}
			}
		}

		protected void SetPoseSpeed(float speed)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			Animator floweryAnimator = GetFloweryAnimator();
			if ((Object)(object)floweryAnimator == (Object)null || (Object)(object)floweryAnimator.runtimeAnimatorController == (Object)null)
			{
				return;
			}
			for (int i = 0; i < floweryAnimator.parameterCount; i++)
			{
				AnimatorControllerParameter parameter = floweryAnimator.GetParameter(i);
				if ((int)parameter.type == 1 && !(parameter.name != "PunchSpeed"))
				{
					floweryAnimator.SetFloat("PunchSpeed", speed);
					return;
				}
			}
			FloweryAnimations.ReportOnce("PunchSpeed", "controller has no 'PunchSpeed' parameter - punch clips will not follow attack speed");
		}

		protected Animator GetFloweryAnimator()
		{
			if ((Object)(object)cachedAnimator != (Object)null)
			{
				return cachedAnimator;
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if ((Object)(object)modelTransform == (Object)null)
			{
				return null;
			}
			Transform val = FloweryModelEnforcer.FindCustom(modelTransform);
			cachedAnimator = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInChildren<Animator>(true) : ((EntityState)this).GetModelAnimator());
			return cachedAnimator;
		}

		protected void PlayFly(float crossfade = 0.12f)
		{
			PlayPose("Fly", crossfade);
		}
	}
	internal static class FloweryAnimations
	{
		internal const string BaseLayer = "Base Layer";

		internal const string OmegaTransform = "OmegaTransform";

		internal const string ModelObject = "FloweryCustomModel";

		internal const string Select = "Select";

		internal const string SelectIntro = "SelectIntro";

		internal const string Fly = "Fly";

		internal const string Jarona = "Jarona";

		internal const string Jarona2 = "Jarona2";

		internal const string Jarona3 = "Jarona3";

		internal const string SanFrandisco = "SanFrandisco";

		internal const string ChargeLastJarona = "ChargeLastJarona";

		internal const string LastJarona = "LastJarona";

		internal const string PunchRight = "PunchR";

		internal const string PunchLeft = "PunchL";

		internal const string SpeedParameter = "PunchSpeed";

		internal const string RunParameter = "Run";

		internal const string CapeMesh = "mesh_coat";

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

		internal static bool WearsCape(string pose)
		{
			switch (pose)
			{
			default:
				return pose == "SelectIntro";
			case "Fly":
			case "SanFrandisco":
			case "Select":
				return true;
			}
		}

		internal static void ReportOnce(string key, string message)
		{
			if (reported.Add(key))
			{
				Log.Warning("Flowery animator: " + message);
			}
		}
	}
	public class FlowerPunches : BaseFloweryState, IStepSetter
	{
		public const string HitBoxGroupName = "FloweryPunch";

		public static float attackStartFraction = 0.22f;

		public static float attackEndFraction = 0.55f;

		public static float procCoefficient = 1f;

		public static float pushAwayForce = 900f;

		private readonly List<HurtBox> hits = new List<HurtBox>();

		private OverlapAttack attack;

		private float duration;

		private bool attackStarted;

		private bool attackFinished;

		private int swingIndex;

		private bool healedThisSwing;

		private bool warnedAboutHitbox;

		public void SetStep(int i)
		{
			swingIndex = i;
		}

		public override void OnEnter()
		{
			//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_00bc: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			duration = FloweryConfig.PunchDuration.Value / ((BaseState)this).attackSpeedStat;
			((BaseState)this).StartAimMode(2f, false);
			if ((Object)(object)((EntityState)this).characterBody != (Object)null)
			{
				((EntityState)this).characterBody.SetAimTimer(1.5f);
			}
			PlaySwingAnimation();
			Sounds.PlayAt("Primary", ((EntityState)this).gameObject);
			attack = ((BaseState)this).InitMeleeOverlap(FloweryConfig.PunchDamage.Value, FloweryAssets.LashHitEffect, ((EntityState)this).GetModelTransform(), "FloweryPunch");
			attack.procCoefficient = procCoefficient;
			attack.pushAwayForce = pushAwayForce;
			attack.damageType = FloweryDamage.Of((DamageType)0, (DamageSource)1);
			attack.damageColorIndex = (DamageColorIndex)0;
			if (((EntityState)this).isAuthority && (Object)(object)attack.hitBoxGroup == (Object)null && !warnedAboutHitbox)
			{
				warnedAboutHitbox = true;
				Log.Error("Flower Punches found no HitBoxGroup named 'FloweryPunch' on the model - the swing will not damage anything.");
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			float num = ((duration > 0f) ? (((EntityState)this).fixedAge / duration) : 1f);
			if (!attackStarted && num >= attackStartFraction)
			{
				attackStarted = true;
				SpawnSwingEffect();
			}
			if (attackStarted && !attackFinished)
			{
				if (num >= attackEndFraction)
				{
					attackFinished = true;
				}
				else if (((EntityState)this).isAuthority && attack != null)
				{
					hits.Clear();
					if (attack.Fire(hits))
					{
						if ((Object)(object)tension != (Object)null)
						{
							tension.AddForHits(hits.Count);
						}
						HealOnConnect();
					}
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		private void HealOnConnect()
		{
			//IL_005a: 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)
			if (healedThisSwing || (Object)(object)((EntityState)this).characterBody == (Object)null)
			{
				return;
			}
			healedThisSwing = true;
			float value = FloweryConfig.PunchHealFraction.Value;
			if (!(value <= 0f) && NetworkServer.active)
			{
				HealthComponent healthComponent = ((EntityState)this).characterBody.healthComponent;
				if ((Object)(object)healthComponent != (Object)null && healthComponent.alive)
				{
					healthComponent.HealFraction(value, default(ProcChainMask));
				}
			}
		}

		private void PlaySwingAnimation()
		{
			string state = ((swingIndex % 2 == 0) ? "PunchL" : "PunchR");
			PlayPose(state, 0.05f / Mathf.Max(((BaseState)this).attackSpeedStat, 0.1f));
			SetPoseSpeed(((BaseState)this).attackSpeedStat);
		}

		private void SpawnSwingEffect()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)FloweryAssets.LashSwingEffect == (Object)null) && !((Object)(object)((EntityState)this).characterBody == (Object)null))
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				Quaternion val = Quaternion.LookRotation(((Ray)(ref aimRay)).direction);
				if (swingIndex % 2 != 0)
				{
					val *= Quaternion.Euler(0f, 0f, 180f);
				}
				GameObject lashSwingEffect = FloweryAssets.LashSwingEffect;
				EffectData val2 = new EffectData();
				Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
				Vector3 direction = ((Ray)(ref aimRay)).direction;
				val2.origin = corePosition + ((Vector3)(ref direction)).normalized * 1.5f;
				val2.rotation = val;
				val2.scale = FloweryConfig.PunchRange.Value * 0.5f;
				FloweryEffects.Spawn(lashSwingEffect, val2, transmit: false);
			}
		}

		public override void OnExit()
		{
			ReleasePose();
			base.OnExit();
		}
	}
	public class FlowerySpawnState : BaseState
	{
		private CharacterModel characterModel;

		private AimRequest aimRequest;

		private bool hasTeleported;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if ((Object)(object)modelTransform != (Object)null)
			{
				characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
			}
			if ((Object)(object)characterModel != (Object)null)
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount + 1;
			}
			if ((Object)(object)((EntityState)this).cameraTargetParams != (Object)null)
			{
				aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)2);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.HiddenInvincibility);
			}
		}

		public override void FixedUpdate()
		{
			//IL_00a2: 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)
			((EntityState)this).FixedUpdate();
			if (!hasTeleported && ((EntityState)this).fixedAge >= SpawnTeleporterState.initialDelay)
			{
				hasTeleported = true;
				if ((Object)(object)characterModel != (Object)null)
				{
					CharacterModel obj = characterModel;
					int invisibilityCount = obj.invisibilityCount;
					obj.invisibilityCount = invisibilityCount - 1;
					TeleportOutController.AddTPOutEffect(characterModel, 1f, 0f, SpawnTeleporterState.initialDelay);
				}
				GameObject val = (((Object)(object)Run.instance != (Object)null) ? Run.instance.GetTeleportEffectPrefab(((EntityState)this).gameObject) : null);
				if ((Object)(object)val != (Object)null && !Run.instance.spawnWithPod)
				{
					EffectManager.SimpleEffect(val, ((EntityState)this).transform.position, Quaternion.identity, false);
					Util.PlaySound(SpawnTeleporterState.soundString, ((EntityState)this).gameObject);
				}
			}
			if (hasTeleported && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (!hasTeleported && (Object)(object)characterModel != (Object)null)
			{
				CharacterModel obj = characterModel;
				int invisibilityCount = obj.invisibilityCount;
				obj.invisibilityCount = invisibilityCount - 1;
			}
			if (aimRequest != null)
			{
				aimRequest.Dispose();
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.HiddenInvincibility);
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 3f);
			}
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)9;
		}
	}
	public class JaronaDash : BaseFloweryDash
	{
		public static float speed = 34f;

		public static float duration = 0.44f;

		public static float tensionPerEnemy = 5f;

		private static readonly string[] Poses = new string[3] { "Jarona", "Jarona2", "Jarona3" };

		private byte pose;

		protected override float DashSpeed => speed;

		protected override float DashDuration => duration;

		protected override float DamageCoefficient => FloweryConfig.JaronaDamage.Value;

		protected override float TensionPerEnemy => tensionPerEnemy;

		protected override string VoiceCategory => "Secondary";

		protected override string DashPose => Poses[Mathf.Min((int)pose, Poses.Length - 1)];

		public override void OnEnter()
		{
			if (((EntityState)this).isAuthority)
			{
				pose = (byte)Random.Range(0, Poses.Length);
			}
			base.OnEnter();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(pose);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			pose = reader.ReadByte();
		}
	}
	public class LastJarona : BaseFloweryState, IFloweryMotorState
	{
		public static float speed = 78f;

		public static float duration = 0.55f;

		public static float hitRadius = 3f;

		public static float blastRadius = 14f;

		public static float impactProcCoefficient = 1f;

		public static float blastProcCoefficient = 1f;

		private Vector3 dashDirection;

		private bool detonated;

		private bool gravityDisabled;

		private bool dashStarted;

		private float chargeDuration;

		public override void OnEnter()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			base.OnEnter();
			chargeDuration = Mathf.Max(0f, FloweryConfig.LastJaronaChargeDuration.Value);
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			dashDirection = ((Vector3)(ref direction)).normalized;
			if (((Vector3)(ref dashDirection)).sqrMagnitude < 0.001f)
			{
				dashDirection = ((EntityState)this).transform.forward;
			}
			((BaseState)this).StartAimMode(2f + chargeDuration, false);
			PlayPose("ChargeLastJarona");
			Sounds.PlayAt("Special/LastJarona", ((EntityState)this).gameObject);
			LockFacing(dashDirection);
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				gravityDisabled = true;
				Gravity.Suspend(((EntityState)this).characterMotor);
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
		}

		public override void FixedUpdate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_0076: 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)
			((EntityState)this).FixedUpdate();
			if (detonated)
			{
				return;
			}
			if (((EntityState)this).fixedAge < chargeDuration)
			{
				if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				AimAtCrosshair();
				return;
			}
			if (!dashStarted)
			{
				dashStarted = true;
				BeginDash();
			}
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.velocity = dashDirection * speed;
			}
			LockFacing(dashDirection);
			HurtBox val = FindFirstVictim();
			if ((Object)(object)val != (Object)null)
			{
				Detonate(val);
			}
			else if (((EntityState)this).fixedAge >= chargeDuration + duration)
			{
				Detonate(null);
			}
		}

		private void BeginDash()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00c0: Expected O, but got Unknown
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			dashDirection = ((Vector3)(ref direction)).normalized;
			if (((Vector3)(ref dashDirection)).sqrMagnitude < 0.001f)
			{
				dashDirection = ((EntityState)this).transform.forward;
			}
			PlayPose("LastJarona");
			LockFacing(dashDirection);
			if ((Object)(object)FloweryAssets.JaronaChargeEffect != (Object)null)
			{
				FloweryEffects.Spawn(FloweryAssets.JaronaChargeEffect, new EffectData
				{
					origin = ((EntityState)this).transform.position + Vector3.up,
					scale = 3.5f,
					rotation = Quaternion.LookRotation(dashDirection),
					color = Color32.op_Implicit(FloweryAssets.Gold)
				}, transmit: false);
			}
		}

		private void AimAtCrosshair()
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			Ray aimRay = ((BaseState)this).GetAimRay();
			TrackFacing(((Ray)(ref aimRay)).direction);
		}

		public override void OnExit()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			ReleasePose();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				if (gravityDisabled)
				{
					Gravity.Restore(((EntityState)this).characterMotor);
					gravityDisabled = false;
				}
				((EntityState)this).characterMotor.velocity = dashDirection * (speed * 0.15f);
			}
			base.OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		private HurtBox FindFirstVictim()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((EntityState)this).characterBody == (Object)null)
			{
				return null;
			}
			TeamIndex val = (TeamIndex)((!((Object)(object)((EntityState)this).characterBody.teamComponent != (Object)null)) ? 1 : ((int)((EntityState)this).characterBody.teamComponent.teamIndex));
			Vector3 corePosition = ((EntityState)this).characterBody.corePosition;
			float num = hitRadius;
			LayerIndex entityPrecise = LayerIndex.entityPrecise;
			Collider[] array = Physics.OverlapSphere(corePosition, num, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2);
			for (int i = 0; i < array.Length; i++)
			{
				HurtBox component = ((Component)array[i]).GetComponent<HurtBox>();
				if (!((Object)(object)component == (Object)null) && !((Object)(object)component.healthComponent == (Object)null) && component.teamIndex != val && component.healthComponent.alive)
				{
					return component;
				}
			}
			return null;
		}

		private void Detonate(HurtBox victim)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0182: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00fb: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0124: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			detonated = true;
			Vector3 val = (((Object)(object)((EntityState)this).characterBody != (Object)null) ? ((EntityState)this).characterBody.corePosition : ((EntityState)this).transform.position);
			if ((Object)(object)FloweryAssets.JaronaExplosionEffect != (Object)null)
			{
				FloweryEffects.Spawn(FloweryAssets.JaronaExplosionEffect, new EffectData
				{
					origin = val,
					scale = blastRadius,
					rotation = Quaternion.identity
				}, transmit: false);
			}
			if (NetworkServer.active && (Object)(object)((EntityState)this).characterBody != (Object)null)
			{
				bool crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master);
				if ((Object)(object)victim != (Object)null && (Object)(object)victim.healthComponent != (Object)null && victim.healthComponent.alive)
				{
					DamageInfo val2 = new DamageInfo
					{
						attacker = ((EntityState)this).gameObject,
						inflictor = ((EntityState)this).gameObject,
						damage = ((BaseState)this).damageStat * FloweryConfig.LastJaronaImpactDamage.Value,
						crit = crit,
						force = dashDirection * 2000f,
						position = ((Component)victim).transform.position,
						procCoefficient = impactProcCoefficient,
						damageType = FloweryDamage.Of((DamageType)32, (DamageSource)8),
						damageColorIndex = (DamageColorIndex)0
					};
					victim.healthComponent.TakeDamage(val2);
					GlobalEventManager.instance.OnHitEnemy(val2, ((Component)victim.healthComponent).gameObject);
					GlobalEventManager.instance.OnHitAll(val2, ((Component)victim.healthComponent).gameObject);
				}
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = (TeamIndex)((!((Object)(object)((EntityState)this).characterBody.teamComponent != (Object)null)) ? 1 : ((int)((EntityState)this).characterBody.teamComponent.teamIndex)),
					attackerFiltering = (AttackerFiltering)2,
					position = val,
					radius = blastRadius,
					baseDamage = ((BaseState)this).damageStat * FloweryConfig.LastJaronaBlastDamage.Value,
					baseForce = 3000f,
					bonusForce = Vector3.up * 1200f,
					crit = crit,
					procCoefficient = blastProcCoefficient,
					falloffModel = (FalloffModel)2,
					damageColorIndex = (DamageColorIndex)0,
					damageType = FloweryDamage.Of((DamageType)32, (DamageSource)8)
				}.Fire();
			}
			if (((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public class OmegaFloweryState : BaseFloweryState, IFloweryMotorState
	{
		public static float recoveryDuration = 0.4f;

		public static float baseRadius = 9f;

		public static float radiusPerTension = 0.07f;

		public static float damagePerTension = 0.08f;

		public static float procCoefficient = 1f;

		public float storedTension;

		private bool hasErupted;

		private bool gravityDisabled;

		private float chargeDuration;

		public override void OnEnter()
		{
			if (((EntityState)this).isAuthority)
			{
				TensionController component = ((EntityState)this).GetComponent<TensionController>();
				if ((Object)(object)component != (Object)null)
				{
					storedTension = component.Tension;
				}
			}
			base.OnEnter();
			chargeDuration = Mathf.Max(0f, FloweryConfig.OmegaChargeDuration.Value);
			((BaseState)this).StartAimMode(2f, false);
			PlayPose("OmegaTransform", 0.1f);
			Sounds.PlayAt("Special/Transform", ((EntityState)this).gameObject);
			if ((Object)(object)((EntityState)this).characterBody != (Object)null)
			{
				((EntityState)this).characterBody.SetAimTimer(2.5f);
			}
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				gravityDisabled = true;
				Gravity.Suspend(((EntityState)this).characterMotor);
				if ((Object)(object)((BaseCharacterController)((EntityState)this).characterMotor).Motor != (Object)null)
				{
					((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f);
				}
			}
			if (NetworkServer.active && (Object)(object)((EntityState)this).characterBody != (Object)null)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, chargeDuration + 0.1f);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!hasErupted)
			{
				if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
				{
					((EntityState)this).characterMotor.velocity = Vector3.up * FloweryConfig.OmegaRiseSpeed.Value;
				}
				if (((EntityState)this).fixedAge >= chargeDuration)
				{
					hasErupted = true;
					ReleasePose();
					Erupt();
				}
			}
			else
			{
				if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (((EntityState)this).fixedAge >= chargeDuration + recoveryDuration && ((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void OnExit()
		{
			ReleasePose();
			if (gravityDisabled)
			{
				Gravity.Restore(((EntityState)this).characterMotor);
				gravityDisabled = false;
			}
			base.OnExit();
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(storedTension);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			storedTension = reader.ReadSingle();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		private void Erupt()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_00fb: 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_0108: 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_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_0122: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((EntityState)this).characterBody == (Object)null)
			{
				return;
			}
			float radius = baseRadius + storedTension * radiusPerTension;
			float num = FloweryConfig.OmegaBlastDamage.Value + storedTension * damagePerTension;
			SpawnEruptionVisual(radius);
			if (NetworkServer.active)
			{
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = (TeamIndex)((!((Object)(object)((EntityState)this).characterBody.teamComponent != (Object)null)) ? 1 : ((int)((EntityState)this).characterBody.teamComponent.teamIndex)),
					attackerFiltering = (AttackerFiltering)2,
					position = ((EntityState)this).characterBody.corePosition,
					radius = radius,
					baseDamage = ((BaseState)this).damageStat * num,
					baseForce = 1600f,
					bonusForce = Vector3.up * 900f,
					crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master),
					procCoefficient = procCoefficient,
					falloffModel = (FalloffModel)2,
					damageColorIndex = (DamageColorIndex)4,
					damageType = FloweryDamage.Of((DamageType)32, (DamageSource)8)
				}.Fire();
				float num2 = Mathf.Max(0.1f, FloweryConfig.OmegaDrainPerSecond.Value);
				float num3 = storedTension / num2;
				if ((Object)(object)Buffs.Omega != (Object)null && num3 > 0f)
				{
					((EntityState)this).characterBody.AddTimedBuff(Buffs.Omega, num3);
				}
			}
		}

		private void SpawnEruptionVisual(float radius)
		{
			//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_001f: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			if (!((Object)(object)FloweryAssets.OmegaEruptionEffect == (Object)null))
			{
				FloweryEffects.Spawn(FloweryAssets.OmegaEruptionEffect, new EffectData
				{
					origin = ((EntityState)this).characterBody.corePosition,
					scale = radius,
					rotation = Quaternion.identity
				}, transmit: false);
			}
		}
	}
	public class SanFranciscoChannel : BaseFloweryState, IFloweryMotorState
	{
		private bool gravityDisabled;

		public override void OnEnter()
		{
			//IL_0059: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b6: Expected O, but got Unknown
			base.OnEnter();
			((BaseState)this).StartAimMode(4f, false);
			PlayPose("SanFrandisco");
			Sounds.PlayAt("Utility", ((EntityState)this).gameObject);
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				gravityDisabled = true;
				Gravity.Suspend(((EntityState)this).characterMotor);
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			if ((Object)(object)FloweryAssets.JaronaChargeEffect != (Object)null)
			{
				FloweryEffects.Spawn(FloweryAssets.JaronaChargeEffect, new EffectData
				{
					origin = ((EntityState)this).transform.position + Vector3.up,
					scale = 1.5f,
					color = Color32.op_Implicit(FloweryAssets.SoulBlue)
				}, transmit: false);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_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)
			((EntityState)this).FixedUpdate();
			if ((Object)(object)((EntityState)this).characterMotor != (Object)null)
			{
				((EntityState)this).characterMotor.velocity = Vector3.zero;
			}
			Ray aimRay = ((BaseState)this).GetAimRay();
			TrackFacing(((Ray)(ref aimRay)).direction);
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= FloweryConfig.SanFranciscoChannelDuration.Value)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new SanFranciscoDash());
			}
		}

		public override void OnExit()
		{
			RestoreGravity();
			base.OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		private void RestoreGravity()
		{
			if (gravityDisabled)
			{
				Gravity.Restore(((EntityState)this).characterMotor);
				gravityDisabled = false;
			}
		}
	}
	public class SanFranciscoDash : BaseFloweryDash
	{
		public static float speed = 52f;

		public static float duration = 0.5f;

		public static float tensionPerEnemy = 7f;

		protected override float DashSpeed => speed;

		protected override float DashDuration => duration;

		protected override float DamageCoefficient => FloweryConfig.SanFranciscoDamage.Value;

		protected override float TensionPerEnemy => tensionPerEnemy;

		protected override string VoiceCategory => null;

		protected override void SpawnDashEffect()
		{
			//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_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_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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			if (!((Object)(object)FloweryAssets.JaronaChargeEffect == (Object)null))
			{
				FloweryEffects.Spawn(FloweryAssets.JaronaChargeEffect, new EffectData
				{
					origin = ((EntityState)this).transform.position + Vector3.up,
					scale = 3.5f,
					rotation = Quaternion.LookRotation(dashDirection),
					color = Color32.op_Implicit(FloweryAssets.SoulBlue)
				}, transmit: false);
			}
		}
	}
}
namespace FloweryMod.Modules
{
	internal static class Buffs
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__ApplyOmegaStats;
		}

		internal static BuffDef Omega;

		internal const float OmegaDamageMultiplier = 0.25f;

		internal static void Init()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_007e: Expected O, but got Unknown
			Omega = ScriptableObject.CreateInstance<BuffDef>();
			((Object)Omega).name = "bdFloweryOmega";
			Omega.buffColor = FloweryAssets.Gold;
			Omega.canStack = false;
			Omega.isDebuff = false;
			Omega.isHidden = false;
			Omega.iconSprite = FloweryAssets.IconOmegaBuff;
			ContentAddition.AddBuffDef(Omega);
			object obj = <>O.<0>__ApplyOmegaStats;
			if (obj == null)
			{
				StatHookEventHandler val = ApplyOmegaStats;
				<>O.<0>__ApplyOmegaStats = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
		}

		private static void ApplyOmegaStats(CharacterBody body, StatHookEventArgs args)
		{
			if (!((Object)(object)body == (Object)null) && !((Object)(object)Omega == (Object)null) && body.HasBuff(Omega))
			{
				args.damageMultAdd += 0.25f;
			}
		}
	}
	internal static class FloweryAssets
	{
		internal const string BundleName = "flowery";

		internal static AssetBundle Bundle;

		internal static readonly Color Gold = new Color(1f, 0.84f, 0.24f);

		internal static readonly Color SoulBlue = new Color(0.25f, 0.62f, 1f);

		internal static readonly Color32 TpFillColor = new Color32(byte.MaxValue, (byte)160, (byte)64, byte.MaxValue);

		internal static GameObject LashSwingEffect;

		internal static GameObject LashHitEffect;

		internal static GameObject PelletHitEffect;

		internal static GameObject JaronaChargeEffect;

		internal static GameObject JaronaExplosionEffect;

		internal static GameObject OmegaEruptionEffect;

		internal static GameObject Crosshair;

		internal static Texture PortraitTexture;

		internal static Sprite TpBarFrame;

		internal static Sprite TpBarFill;

		internal static Sprite TpPercent;

		internal static Sprite TpMax;

		internal static Sprite IconFlowery;

		internal static Sprite IconPassive;

		internal static Sprite IconFlowerPunches;

		internal static Sprite IconJarona;

		internal static Sprite IconSanFrancisco;

		internal static Sprite IconOmega;

		internal static Sprite IconLastJarona;

		internal static Sprite IconOmegaBuff;

		private static readonly Dictionary<string, Sprite> FileSprites = new Dictionary<string, Sprite>(StringComparer.OrdinalIgnoreCase);

		private const int GlyphWidth = 5;

		private const int GlyphHeight = 7;

		private const int GlyphSpacing = 1;

		private const int GlyphScale = 8;

		private const int NumberCanvasGlyphs = 2;

		private static readonly Dictionary<char, byte[]> Glyphs = new Dictionary<char, byte[]>
		{
			{
				'0',
				new byte[7] { 14, 17, 19, 21, 25, 17, 14 }
			},
			{
				'1',
				new byte[7] { 4, 12, 4, 4, 4, 4, 14 }
			},
			{
				'2',
				new byte[7] { 14, 17, 1, 2, 4, 8, 31 }
			},
			{
				'3',
				new byte[7] { 31, 2, 4, 2, 1, 17, 14 }
			},
			{
				'4',
				new byte[7] { 2, 6, 10, 18, 31, 2, 2 }
			},
			{
				'5',
				new byte[7] { 31, 16, 30, 1, 1, 17, 14 }
			},
			{
				'6',
				new byte[7] { 6, 8, 16, 30, 17, 17, 14 }
			},
			{
				'7',
				new byte[7] { 31, 1, 2, 4, 8, 8, 8 }
			},
			{
				'8',
				new byte[7] { 14, 17, 17, 14, 17, 17, 14 }
			},
			{
				'9',
				new byte[7] { 14, 17, 17, 15, 1, 2, 12 }
			}
		};

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

		internal static void Init()
		{
			LoadBundle();
			LoadVanillaAssets();
			BuildIcons();
		}

		private static void LoadBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				if (string.IsNullOrEmpty(directoryName))
				{
					return;
				}
				string[] array = new string[2]
				{
					Path.Combine(Path.Combine(directoryName, "Assets"), "flowery"),
					Path.Combine(directoryName, "flowery")
				};
				foreach (string text in array)
				{
					if (File.Exists(text))
					{
						Bundle = AssetBundle.LoadFromFile(text);
						if ((Object)(object)Bundle != (Object)null)
						{
							Log.Info("Loaded asset bundle from " + text);
							return;
						}
					}
				}
				Log.Warning("No Flowery asset bundle found - he will wear Loader's model. Expected it at [plugin folder]/Assets/flowery.");
			}
			catch (Exception ex)
			{
				Log.Error("Failed to load the Flowery asset bundle: " + ex);
			}
		}

		internal static T FromBundle<T>(string name) where T : Object
		{
			if ((Object)(object)Bundle == (Object)null || string.IsNullOrEmpty(name))
			{
				return default(T);
			}
			try
			{
				return Bundle.LoadAsset<T>(name);
			}
			catch (Exception ex)
			{
				Log.Warning("Bundle asset '" + name + "' failed to load: " + ex.Message);
				return default(T);
			}
		}

		internal static T Load<T>(string key) where T : Object
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
			}
			catch (Exception ex)
			{
				Log.Warning("Could not load addressable '" + key + "': " + ex.Message);
				return default(T);
			}
		}

		private static void LoadVanillaAssets()
		{
			LashSwingEffect = FloweryAssets.Load<GameObject>("RoR2/Base/Croco/CrocoSlash.prefab");
			LashHitEffect = FloweryAssets.Load<GameObject>("RoR2/Base/Merc/OmniImpactVFXSlashMerc.prefab");
			PelletHitEffect = FloweryAssets.Load<GameObject>("RoR2/Base/Huntress/OmniImpactVFXHuntress.prefab");
			JaronaChargeEffect = FloweryAssets.Load<GameObject>("RoR2/Base/Common/VFX/MuzzleflashSmokeRing.prefab");
			JaronaExplosionEffect = FloweryAssets.Load<GameObject>("RoR2/Base/Croco/CrocoLeapExplosion.prefab");
			OmegaEruptionEffect = FloweryAssets.Load<GameObject>("RoR2/Base/Treebot/OmniExplosionVFXTreebot.prefab");
			Crosshair = FloweryAssets.Load<GameObject>("RoR2/Base/UI/SimpleDotCrosshair.prefab");
		}

		private static void BuildIcons()
		{
			LoadImageFolders();
			IconFlowery = RequiredFile("CharSelection");
			IconPassive = RequiredFile("Passive");
			IconFlowerPunches = RequiredFile("Primary");
			IconJarona = RequiredFile("Jarona");
			IconSanFrancisco = RequiredFile("HereICome");
			IconOmega = RequiredFile("OmegaFlowery");
			IconLastJarona = RequiredFile("LastJarona");
			IconOmegaBuff = IconOmega;
			PortraitTexture = (Texture)(object)(((Object)(object)IconFlowery != (Object)null) ? IconFlowery.texture : null);
			TpPercent = FromFile("Percentage");
			if ((Object)(object)TpPercent == (Object)null)
			{
				Log.Warning("No Hud/Percentage image found - the TP bar will show no percent sign.");
			}
			TpMax = FromFile("MAX");
			if ((Object)(object)TpMax == (Object)null)
			{
				Log.Warning("No Hud/MAX image found - a full TP bar will show nothing in its place.");
			}
			BuildTpBar();
		}

		private static Sprite FromFile(string name)
		{
			if (!FileSprites.TryGetValue(name, out var value))
			{
				return null;
			}
			return value;
		}

		private static Sprite RequiredFile(string name)
		{
			Sprite obj = FromFile(name);
			if ((Object)(object)obj == (Object)null)
			{
				Log.Warning("No Icons/" + name + " image found - that icon will be blank.");
			}
			return obj;
		}

		private static void LoadImageFolders()
		{
			string text = PluginFolder();
			if (text == null)
			{
				return;
			}
			string[] array = new string[2] { "Icons", "Hud" };
			foreach (string path in array)
			{
				string path2 = Path.Combine(Path.Combine(text, "Assets"), path);
				if (!Directory.Exists(path2))
				{
					continue;
				}
				string[] files = Directory.GetFiles(path2);
				foreach (string text2 in files)
				{
					string text3 = Path.GetExtension(text2).ToLowerInvariant();
					if (!(text3 != ".png") || !(text3 != ".jpg") || !(text3 != ".jpeg"))
					{
						Sprite val = LoadSpriteFromFile(text2);
						if ((Object)(object)val != (Object)null)
						{
							FileSprites[Path.GetFileNameWithoutExtension(text2)] = val;
						}
					}
				}
			}
			if (FileSprites.Count > 0)
			{
				List<string> list = new List<string>(FileSprites.Keys);
				list.Sort();
				Log.Info("Loaded " + FileSprites.Count + " image(s): " + string.Join(", ", list.ToArray()));
			}
		}

		private static string PluginFolder()
		{
			try
			{
				return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			}
			catch (Exception ex)
			{
				Log.Error("Could not resolve the plugin folder: " + ex.Message);
				return null;
			}
		}

		private static Sprite LoadSpriteFromFile(string file)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0058: 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)
			try
			{
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
				{
					filterMode = (FilterMode)1,
					wrapMode = (TextureWrapMode)1
				};
				if (!ImageConversion.LoadImage(val, File.ReadAllBytes(file)))
				{
					Log.Warning("Could not decode image " + Path.GetFileName(file));
					return null;
				}
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}
			catch (Exception ex)
			{
				Log.Warning("Failed to load image " + Path.GetFileName(file) + ": " + ex.Message);
				return null;
			}
		}

		private static void BuildTpBar()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00fc: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			TpBarFrame = FromFile("TP_Bar_Empty");
			if ((Object)(object)TpBarFrame == (Object)null)
			{
				Log.Warning("No Hud/TP_Bar_Empty image found - there will be no TP bar.");
				return;
			}
			try
			{
				Texture2D texture = TpBarFrame.texture;
				Color32[] pixels = texture.GetPixels32();
				Color32 tpFillColor = TpFillColor;
				Color32 val = default(Color32);
				((Color32)(ref val))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
				for (int i = 0; i < pixels.Length; i++)
				{
					Color32 val2 = pixels[i];
					bool flag = val2.a > 8 && val2.r > val2.g + 40 && val2.r > val2.b + 40;
					pixels[i] = (flag ? tpFillColor : val);
				}
				Texture2D val3 = new Texture2D(((Texture)texture).width, ((Texture)texture).height, (TextureFormat)4, false)
				{
					filterMode = (FilterMode)1,
					wrapMode = (TextureWrapMode)1
				};
				val3.SetPixels32(pixels);
				val3.Apply(false, false);
				TpBarFill = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f));
			}
			catch (Exception ex)
			{
				Log.Warning("Could not build the TP bar fill overlay: " + ex.Message);
			}
		}

		internal static Sprite NumberSprite(int value)
		{
			return TextSprite(Mathf.Clamp(value, 0, 99).ToString(), 2);
		}

		private static Sprite TextSprite(string text, int canvasGlyphs)
		{
			string key = canvasGlyphs + ":" + text;
			if (TextSprites.TryGetValue(key, out var value))
			{
				return value;
			}
			Sprite val = DrawText(text, canvasGlyphs);
			TextSprites[key] = val;
			return val;
		}

		private static Sprite DrawText(string text, int canvasGlyphs)
		{
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_00be: 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)
			int num = canvasGlyphs * 5 + (canvasGlyphs - 1);
			int num2 = num * 8;
			int num3 = 56;
			Color32[] array = (Color32[])(object)new Color32[num2 * num3];
			Color32 val = default(Color32);
			((Color32)(ref val))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			int num4 = text.Length * 5 + (text.Length - 1);
			int num5 = (num - num4) / 2;
			for (int i = 0; i < text.Length; i++)
			{
				if (!Glyphs.TryGetValue(text[i], out var value))
				{
					continue;
				}
				int num6 = num5 + i * 6;
				for (int j = 0; j < 7; j++)
				{
					for (int k = 0; k < 5; k++)
					{
						if ((value[j] & (1 << 4 - k)) == 0)
						{
							continue;
						}
						int num7 = (num6 + k) * 8;
						int num8 = (6 - j) * 8;
						for (int l = 0; l < 8; l++)
						{
							int num9 = (num8 + l) * num2 + num7;
							for (int m = 0; m < 8; m++)
							{
								array[num9 + m] = val;
							}
						}
					}
				}
			}
			Texture2D val2 = new Texture2D(num2, num3, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)1
			};
			val2.SetPixels32(array);
			val2.Apply(false, false);
			return Sprite.Create(val2, new Rect(0f, 0f, (float)num2, (float)num3), new Vector2(0.5f, 0.5f));
		}
	}
	internal static class FloweryConfig
	{
		internal static ConfigEntry<float> DisplayModelScale;

		internal static ConfigEntry<bool> ModelRagdoll;

		internal static ConfigEntry<bool> ShowItemDisplays;

		internal static ConfigEntry<float> BaseHealth;

		internal static ConfigEntry<float> BaseDamage;

		internal static ConfigEntry<float> BaseMoveSpeed;

		internal static ConfigEntry<float> BaseArmor;

		internal static ConfigEntry<float> TensionMax;

		internal static ConfigEntry<float> TensionGrazeRadius;

		internal static ConfigEntry<float> TensionGrazePerSecond;

		internal static ConfigEntry<float> TensionPerHit;

		internal static ConfigEntry<float> PunchDamage;

		internal static ConfigEntry<float> PunchDuration;

		internal static ConfigEntry<float> PunchRange;

		internal static ConfigEntry<float> PunchHealFraction;

		internal static ConfigEntry<float> TpBarLeftMargin;

		internal static ConfigEntry<float> TpBarHeight;

		internal static ConfigEntry<float> JaronaDamage;

		internal static ConfigEntry<float> JaronaCooldown;

		internal static ConfigEntry<int> JaronaCharges;

		internal static ConfigEntry<float> SanFranciscoDamage;

		internal static ConfigEntry<float> SanFranciscoCooldown;

		internal static ConfigEntry<float> SanFranciscoChannelDuration;

		internal static ConfigEntry<float> SoundVolume;

		internal static ConfigEntry<float> OmegaMinTension;

		internal static ConfigEntry<float> OmegaDrainPerSecond;

		internal static ConfigEntry<float> OmegaBlastDamage;

		internal static ConfigEntry<float> OmegaCooldown;

		internal static ConfigEntry<float> OmegaFlySpeedMultiplier;

		internal static ConfigEntry<float> OmegaRiseSpeed;

		internal static ConfigEntry<float> OmegaChargeDuration;

		internal static ConfigEntry<float> LastJaronaImpactDamage;

		internal static ConfigEntry<float> LastJaronaBlastDamage;

		internal static ConfigEntry<float> LastJaronaCooldown;

		internal static ConfigEntry<float> LastJaronaChargeDuration;

		internal static void Init(ConfigFile config)
		{
			DisplayModelScale = config.Bind<float>("00 - General", "Character Select Model Scale", 0.8f, "Extra scale for the character-select mannequin only, multiplied on top of his in-game size. The select panel is framed for Loader's proportions, so Flowery needs to come down a little to sit in it properly. In-game size is unaffected.");
			ModelRagdoll = config.Bind<bool>("00 - General", "Model Ragdoll", true, "Build a real ragdoll on Flowery's own skeleton, so his corpse goes limp. Set false and his corpse simply holds its last pose - there is no borrowed corpse to fall back on any more.");
			ShowItemDisplays = config.Bind<bool>("00 - General", "Show Item Displays", false, "Draw picked-up items on Flowery's body. Off by default: the only placements available are Loader's, positioned against Loader's skeleton and animated by Loader's clips, so items sit wrong on Flowery and drift against his pose. Turn this back on once he has item display rules of his own. Cosmetic only - items always work either way.");
			BaseHealth = config.Bind<float>("01 - Stats", "Base Health", 110f, "Health at level 1.");
			BaseDamage = config.Bind<float>("01 - Stats", "Base Damage", 12f, "Damage at level 1.");
			BaseMoveSpeed = config.Bind<float>("01 - Stats", "Base Move Speed", 7f, "Movement speed in m/s.");
			BaseArmor = config.Bind<float>("01 - Stats", "Base Armor", 0f, "Armor at level 1.");
			SoundVolume = config.Bind<float>("00 - General", "Voice Clip Volume", 0.5f, "Volume of Flowery's voice clips, 0 to 1. Set to 0 to mute them. Applied on top of the game's Master and SFX volume sliders.");
			TpBarLeftMargin = config.Bind<float>("00 - General", "TP Bar Left Margin", 60f, "Distance from the left edge of the screen to the TP bar, in HUD units.");
			TpBarHeight = config.Bind<float>("00 - General", "TP Bar Height", 338f, "On-screen height of the TP bar, in HUD units. The width follows the artwork's aspect ratio, and the bar stays centred vertically, so shrinking it pulls the top and bottom in equally.");
			TensionMax = config.Bind<float>("02 - Tension (TP)", "Max TP", 100f, "Maximum stored Tension Points.");
			TensionGrazeRadius = config.Bind<float>("02 - Tension (TP)", "Graze Radius", 14f, "Enemies within this radius feed TP, mirroring DELTARUNE's grazing.");
			TensionGrazePerSecond = config.Bind<float>("02 - Tension (TP)", "Graze TP per Second", 4f, "TP per second while at least one enemy is inside the graze radius.");
			TensionPerHit = config.Bind<float>("02 - Tension (TP)", "TP per Hit", 1.2f, "TP granted per enemy hit.");
			PunchDamage = config.Bind<float>("03 - Primary: Flower Punches", "Damage", 2.3f, "Damage coefficient per punch. 2.3 means 230% of base damage.");
			PunchDuration = config.Bind<float>("03 - Primary: Flower Punches", "Punch Duration", 0.6f, "Seconds per punch before attack speed is applied. Higher is slower and weightier.");
			PunchRange = config.Bind<float>("03 - Primary: Flower Punches", "Reach", 4.5f, "How far in front of Flowery the punch reaches, in meters.");
			PunchHealFraction = config.Bind<float>("03 - Primary: Flower Punches", "Heal per Punch", 0.01f, "Fraction of maximum health restored by a punch that connects. 0.01 is 1%. Once per swing, not once per enemy hit. Set to 0 to disable.");
			JaronaDamage = config.Bind<float>("04 - Secondary: Jarona", "Damage", 2f, "Damage coefficient dealt to each enemy passed through.");
			JaronaCooldown = config.Bind<float>("04 - Secondary: Jarona", "Cooldown", 2f, "Seconds to recharge one use.");
			JaronaCharges = config.Bind<int>("04 - Secondary: Jarona", "Charges", 2, "How many dashes can be banked at once.");
			SanFranciscoDamage = config.Bind<float>("05 - Utility: Here I Come San Frandisco", "Damage", 3f, "Damage coefficient dealt to each enemy passed through.");
			SanFranciscoCooldown = config.Bind<float>("05 - Utility: Here I Come San Frandisco", "Cooldown", 6f, "Cooldown in seconds.");
			SanFranciscoChannelDuration = config.Bind<float>("05 - Utility: Here I Come San Frandisco", "Channel Duration", 0.8f, "Seconds Flowery hangs in place before launching. Fixed, not hold-to-charge.");
			OmegaMinTension = config.Bind<float>("06 - Special: OMEGA FLOWERY", "Minimum TP", 75f, "TP required to go OMEGA.");
			OmegaDrainPerSecond = config.Bind<float>("06 - Special: OMEGA FLOWERY", "TP Drain per Second", 5f, "How fast the TP meter empties while OMEGA is active. OMEGA ends when it hits zero, so 75 TP at 5/s lasts 15 seconds and a full bar lasts 20.");
			OmegaBlastDamage = config.Bind<float>("06 - Special: OMEGA FLOWERY", "Eruption Damage", 4f, "Base damage coefficient of the vine eruption, before the TP bonus.");
			OmegaCooldown = config.Bind<float>("06 - Special: OMEGA FLOWERY", "Cooldown", 10f, "Cooldown in seconds.");
			OmegaFlySpeedMultiplier = config.Bind<float>("06 - Special: OMEGA FLOWERY", "Flight Speed Multiplier", 1.6f, "Flight speed as a multiple of ground move speed.");
			OmegaRiseSpeed = config.Bind<float>("06 - Special: OMEGA FLOWERY", "Transform Rise Speed", 13f, "How fast Flowery lifts off the ground while transforming.");
			OmegaChargeDuration = config.Bind<float>("06 - Special: OMEGA FLOWERY", "Transform Charge", 0.5f, "Seconds spent rising and invulnerable before the eruption goes off.");
			LastJaronaImpactDamage = config.Bind<float>("07 - OMEGA Special: LAST JARONA", "Impact Damage", 6f, "Damage coefficient dealt on contact, before the explosion.");
			LastJaronaBlastDamage = config.Bind<float>("07 - OMEGA Special: LAST JARONA", "Explosion Damage", 12f, "Damage coefficient of the explosion.");
			LastJaronaCooldown = config.Bind<float>("07 - OMEGA Special: LAST JARONA", "Cooldown", 3f, "Cooldown in seconds. Only usable while OMEGA.");
			LastJaronaChargeDuration = config.Bind<float>("07 - OMEGA Special: LAST JARONA", "Charge", 0.8f, "Seconds spent winding up before the punch, so it lands on \"...Jarona!\".");
		}
	}
	internal static class FloweryDamage
	{
		internal static DamageTypeCombo Of(DamageType type, DamageSource source)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			return new DamageTypeCombo
			{
				damageType = type,
				damageSource = source
			};
		}
	}
	internal static class FloweryDiagnostics
	{
		internal static void Init()
		{
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Report));
		}

		private static void Report()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected I4, but got Unknown
			//IL_027f: 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_00cf: Expected I4, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected I4, but got Unknown
			if ((Object)(object)FloweryBody.BodyPrefab == (Object)null)
			{
				Log.Error("Flowery body prefab was never created - the survivor is not registered.");
				return;
			}
			BodyIndex val = BodyCatalog.FindBodyIndex("FloweryBody");
			if ((int)val == -1)
			{
				Log.Error("BodyCatalog has no 'FloweryBody' - the body failed to register.");
			}
			else
			{
				Log.Info("Body registered as index " + (int)val + ".");
			}
			SurvivorDef val2 = SurvivorCatalog.FindSurvivorDefFromBody(FloweryBody.BodyPrefab);
			if ((Object)(object)val2 == (Object)null)
			{
				Log.Error("SurvivorCatalog has no entry for Flowery - he will not appear in character select.");
			}
			else
			{
				int num = 0;
				bool flag = false;
				foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs)
				{
					if ((Object)(object)orderedSurvivorDef == (Object)(object)val2)
					{
						flag = true;
						break;
					}
					num++;
				}
				Log.Info("Survivor registered: index " + (int)val2.survivorIndex + ", cachedName '" + val2.cachedName + "', " + (flag ? ("slot " + num + " of " + SurvivorCatalog.survivorCount + " in character select.") : "MISSING from the ordered list - he will not show in character select."));
				Log.Info("Display name resolves to: \"" + Language.GetString(val2.displayNameToken) + "\".");
				SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(val2.survivorIndex);
				if ((Object)(object)survivorDef != (Object)(object)val2)
				{
					Log.Error("Survivor index " + (int)val2.survivorIndex + " resolves to '" + (((Object)(object)survivorDef != (Object)null) ? survivorDef.cachedName : "null") + "' instead of Flowery - the catalog entry is inconsistent.");
				}
			}
			SkillLocator component = FloweryBody.BodyPrefab.GetComponent<SkillLocator>();
			if ((Object)(object)component != (Object)null)
			{
				Log.Info("Skills: " + Describe(component.primary) + ", " + Describe(component.secondary) + ", " + Describe(component.utility) + ", " + Describe(component.special) + ".");
			}
			if ((Object)(object)FlowerySkills.LastJaronaSkill == (Object)null)
			{
				Log.Error("LAST JARONA was never built - the OMEGA special override will do nothing.");
			}
			CheckMeleeHitbox();
			CheckBorrowedEffects();
			CheckStateMachines();
			ReportModelComponents();
			ReportSkins(val);
			Sounds.ReportAudioState();
		}

		private static void CheckBorrowedEffects()
		{
			List<string> list = new List<string>();
			DescribeEffect(list, "swing", FloweryAssets.LashSwingEffect);
			DescribeEffect(list, "punch impact", FloweryAssets.LashHitEffect);
			DescribeEffect(list, "dash charge", FloweryAssets.JaronaChargeEffect);
			DescribeEffect(list, "dash impact", FloweryAssets.PelletHitEffect);
			DescribeEffect(list, "LAST JARONA blast", FloweryAssets.JaronaExplosionEffect);
			DescribeEffect(list, "OMEGA eruption", FloweryAssets.OmegaEruptionEffect);
			Log.Info("Borrowed VFX: " + string.Join(", ", list.ToArray()) + ".");
		}

		private static void DescribeEffect(List<string> into, string role, GameObject prefab)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			if ((Object)(object)prefab == (Object)null)
			{
				into.Add(role + " never loaded");
				return;
			}
			bool flag = (int)EffectCatalog.FindEffectIndexFromPrefab(prefab) != -1;
			into.Add(role + " '" + ((Object)prefab).name + "' " + (flag ? "networked" : "local-only (not an EffectCatalog entry)"));
		}

		private static void CheckStateMachines()
		{
			EntityStateMachine[] components = FloweryBody.BodyPrefab.GetComponents<EntityStateMachine>();
			List<string> list = new List<string>();
			EntityStateMachine[] array = components;
			foreach (EntityStateMachine val in array)
			{
				list.Add(val.customName);
			}
			Log.Info("State machines: " + string.Join(", ", list.ToArray()) + ".");
			string[] array2 = new string[2] { "Body", "Weapon" };
			foreach (string text in array2)
			{
				if (!list.Contains(text))
				{
					Log.Error("No EntityStateMachine named '" + text + "' - skills bound to it will not fire.");
				}
			}
		}

		private static void CheckMeleeHitbox()
		{
			ModelLocator component = FloweryBody.BodyPrefab.GetComponent<ModelLocator>();
			Transform val = (((Object)(object)component != (Object)null) ? component.modelTransform : null);
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("Flowery has no model transform - Flower Punches cannot find its hitboxes.");
				return;
			}
			HitBoxGroup val2 = HitBoxGroup.FindByGroupName(((Component)val).gameObject, "FloweryPunch");
			if ((Object)(object)val2 == (Object)null || val2.hitBoxes == null || val2.hitBoxes.Length == 0)
			{
				Log.Error("HitBoxGroup 'FloweryPunch' is missing - Flower Punches will not hit anything.");
				return;
			}
			Log.Info("Flower Punches hitbox ready (" + val2.hitBoxes.Length + " box, reach " + FloweryConfig.PunchRange.Value + "m).");
		}

		private static void ReportModelComponents()
		{
			ModelLocator component = FloweryBody.BodyPrefab.GetComponent<ModelLocator>();
			Transform val = (((Object)(object)component != (Object)null) ? component.modelTransform : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			List<string> list = new List<string>();
			Component[] components = ((Component)val).GetComponents<Component>();
			foreach (Component val2 in components)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					list.Add(((object)val2).GetType().Name);
				}
			}
			Log.Info("Model components: " + string.Join(", ", list.ToArray()) + ".");
			Log.Info("Model children of '" + ((Object)val).name + "': " + ChildNames(val) + ".");
			ReportRig(val);
			HurtBoxGroup componentInChildren = ((Component)val).GetComponentInChildren<HurtBoxGroup>(true);
			Log.Info("Hurtboxes under the model: " + (((Object)(object)componentInChildren != (Object)null) ? (((componentInChildren.hurtBoxes != null) ? componentInChildren.hurtBoxes.Length : 0) + " box(es), bullseyes " + componentInChildren.bullseyeCount + ", on '" + ((Object)((Component)componentInChildren).gameObject).name + "'") : "none - they live outside the model"));
		}

		private static void ReportSkins(BodyIndex bodyIndex)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if ((int)bodyIndex == -1)
			{
				return;
			}
			SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(bodyIndex);
			if (bodySkinDefs == null || bodySkinDefs.Length == 0)
			{
				Log.Warning("SkinCatalog has no skins for Flowery - the loadout will show no skin row.");
				return;
			}
			List<string> list = new List<string>();
			SkinDef[] array = bodySkinDefs;
			foreach (SkinDef val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					list.Add("null");
					continue;
				}
				list.Add("'" + ((Object)val).name + "' (" + ((val.runtimeSkin != null) ? (val.runtimeSkin.rendererInfoTemplates.Length + " renderers baked") : "NOT baked") + ")");
			}
			Log.Info("Skins: " + string.Join(", ", list.ToArray()) + ".");
		}

		private static string ChildNames(Transform t)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			List<string> list = new List<string>();
			foreach (Transform item in t)
			{
				Transform val = item;
				list.Add(((Object)val).name);
			}
			return string.Join(", ", list.ToArray());
		}

		private static void ReportRig(Transform model)
		{
			Transform val = FloweryModelEnforcer.FindCustom(model);
			if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)model)
			{
				Log.Warning("Rig: no Flowery model on the body - he is wearing Loader's.");
				return;
			}
			ModelSkinController component = ((Component)model).GetComponent<ModelSkinController>();
			Animator componentInChildren = ((Component)val).GetComponentInChildren<Animator>(true);
			Log.Info("Rig: model object '" + ((Object)model).name + "' has " + (((Object)(object)((Component)model).GetComponent<Animator>() != (Object)null) ? "an Animator (Loader's survived!)" : "no Animator") + "; Flowery's animator " + (((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.runtimeAnimatorController != (Object)null) ? ("'" + ((Object)componentInChildren.runtimeAnimatorController).name + "'") : "MISSING") + "; skins: " + (((Object)(object)component != (Object)null && component.skins != null) ? string.Join(", ", Array.ConvertAll(component.skins, (SkinDef s) => (!((Object)(object)s != (Object)null)) ? "null" : ((Object)s).name)) : "none") + ".");
		}

		private static string Describe(GenericSkill slot)
		{
			if ((Object)(object)slot == (Object)null)
			{
				return "<missing slot>";
			}
			if ((Object)(object)slot.skillFamily == (Object)null)
			{
				return slot.skillName + " <no family>";
			}
			return slot.skillName;
		}
	}
	internal static class FloweryEffects
	{
		private const float MinLifetime = 1f;

		private const float MaxLifetime = 8f;

		private static readonly Dictionary<GameObject, bool> Catalogued = new Dictionary<GameObject, bool>();

		internal static void Spawn(GameObject prefab, EffectData data, bool transmit)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)prefab == (Object)null) && data != null)
			{
				if (IsCatalogued(prefab))
				{
					EffectManager.SpawnEffect(prefab, data, transmit);
				}
				else
				{
					SpawnDetached(prefab, data.origin, data.rotation, data.scale);
				}
			}
		}

		internal static GameObject SpawnDetached(GameObject prefab, Vector3 position, Quaternion rotation, float scale)
		{
			//IL_000b: 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_0048: 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_0063: 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_0025: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)prefab == (Object)null)
			{
				return null;
			}
			if (rotation.x == 0f && rotation.y == 0f && rotation.z == 0f && rotation.w == 0f)
			{
				rotation = Quaternion.identity;
			}
			GameObject val = Object.Instantiate<GameObject>(prefab, position, rotation);
			if (scale > 0f)
			{
				val.transform.localScale = prefab.transform.localScale * scale;
			}
			Object.Destroy((Object)(object)val, Lifetime(val));
			return val;
		}

		private static float Lifetime(GameObject instance)
		{
			//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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			ParticleSystem[] componentsInChildren = instance.GetComponentsInChildren<ParticleSystem>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				float num2 = num;
				float duration = ((MainModule)(ref main)).duration;
				MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
				num = Mathf.Max(num2, duration + ((MinMaxCurve)(ref startLifetime)).constantMax);
			}
			return Mathf.Clamp(num, 1f, 8f);
		}

		private static bool IsCatalogued(GameObject prefab)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if (Catalogued.TryGetValue(prefab, out var value))
			{
				return value;
			}
			bool flag = (int)EffectCatalog.FindEffectIndexFromPrefab(prefab) != -1;
			if (EffectCatalog.effectCount <= 0)
			{
				return flag;
			}
			Catalogued[prefab] = flag;
			if (!flag)
			{
				Log.Info("'" + ((Object)prefab).name + "' is not an EffectCatalog entry, so it cannot go through EffectManager. Instantiating it locally instead.");
			}
			return flag;
		}
	}
	internal static class FloweryRagdoll
	{
		private struct BoneSpec
		{
			public string Name;

			public string Tip;

			public string Parent;

			public float Mass;

			public float RadiusFactor;

			public float Twist;

			public float Swing1;

			public float Swing2;

			public BoneSpec(string name, string tip, string parent, float mass, float radiusFactor, float twist, float swing1, float swing2)
			{
				Name = name;
				Tip = tip;
				Parent = parent;
				Mass = m