Decompiled source of LethalBoykisser v1.0.5

BepInEx/plugins/LethalBoykisserMod.dll

Decompiled 7 months ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance;
using GameNetcodeStuff;
using HarmonyLib;
using ModelReplacement;
using ModelReplacement.Monobehaviors.Enemies;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LethalBoykisserMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalBoykisserMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1f1f2793-57ef-49c6-bca3-2205a4cd81a8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[AddComponentMenu("Dynamic Bone/Dynamic Bone")]
public class DynamicBone : MonoBehaviour
{
	public enum FreezeAxis
	{
		None,
		X,
		Y,
		Z
	}

	private class Particle
	{
		public Transform m_Transform = null;

		public int m_ParentIndex = -1;

		public float m_Damping = 0f;

		public float m_Elasticity = 0f;

		public float m_Stiffness = 0f;

		public float m_Inert = 0f;

		public float m_Radius = 0f;

		public float m_BoneLength = 0f;

		public Vector3 m_Position = Vector3.zero;

		public Vector3 m_PrevPosition = Vector3.zero;

		public Vector3 m_EndOffset = Vector3.zero;

		public Vector3 m_InitLocalPosition = Vector3.zero;

		public Quaternion m_InitLocalRotation = Quaternion.identity;
	}

	public Transform m_Root = null;

	public float m_UpdateRate = 60f;

	[Range(0f, 1f)]
	public float m_Damping = 0.1f;

	public AnimationCurve m_DampingDistrib = null;

	[Range(0f, 1f)]
	public float m_Elasticity = 0.1f;

	public AnimationCurve m_ElasticityDistrib = null;

	[Range(0f, 1f)]
	public float m_Stiffness = 0.1f;

	public AnimationCurve m_StiffnessDistrib = null;

	[Range(0f, 1f)]
	public float m_Inert = 0f;

	public AnimationCurve m_InertDistrib = null;

	public float m_Radius = 0f;

	public AnimationCurve m_RadiusDistrib = null;

	public float m_EndLength = 0f;

	public Vector3 m_EndOffset = Vector3.zero;

	public Vector3 m_Gravity = Vector3.zero;

	public Vector3 m_Force = Vector3.zero;

	public List<DynamicBoneCollider> m_Colliders = null;

	public List<Transform> m_Exclusions = null;

	public FreezeAxis m_FreezeAxis = FreezeAxis.None;

	public bool m_DistantDisable = false;

	public Transform m_ReferenceObject = null;

	public float m_DistanceToObject = 20f;

	private Vector3 m_LocalGravity = Vector3.zero;

	private Vector3 m_ObjectMove = Vector3.zero;

	private Vector3 m_ObjectPrevPosition = Vector3.zero;

	private float m_BoneTotalLength = 0f;

	private float m_ObjectScale = 1f;

	private float m_Time = 0f;

	private float m_Weight = 1f;

	private bool m_DistantDisabled = false;

	private List<Particle> m_Particles = new List<Particle>();

	private void Start()
	{
		SetupParticles();
	}

	private void Update()
	{
		if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled))
		{
			InitTransforms();
		}
	}

	private void LateUpdate()
	{
		if (m_DistantDisable)
		{
			CheckDistance();
		}
		if (m_Weight > 0f && (!m_DistantDisable || !m_DistantDisabled))
		{
			UpdateDynamicBones(Time.deltaTime);
		}
	}

	private void CheckDistance()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		Transform val = m_ReferenceObject;
		if ((Object)(object)val == (Object)null && (Object)(object)Camera.main != (Object)null)
		{
			val = ((Component)Camera.main).transform;
		}
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		Vector3 val2 = val.position - ((Component)this).transform.position;
		float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
		bool flag = sqrMagnitude > m_DistanceToObject * m_DistanceToObject;
		if (flag != m_DistantDisabled)
		{
			if (!flag)
			{
				ResetParticlesPosition();
			}
			m_DistantDisabled = flag;
		}
	}

	private void OnEnable()
	{
		ResetParticlesPosition();
	}

	private void OnDisable()
	{
		InitTransforms();
	}

	private void OnValidate()
	{
		m_UpdateRate = Mathf.Max(m_UpdateRate, 0f);
		m_Damping = Mathf.Clamp01(m_Damping);
		m_Elasticity = Mathf.Clamp01(m_Elasticity);
		m_Stiffness = Mathf.Clamp01(m_Stiffness);
		m_Inert = Mathf.Clamp01(m_Inert);
		m_Radius = Mathf.Max(m_Radius, 0f);
		if (Application.isEditor && Application.isPlaying)
		{
			InitTransforms();
			SetupParticles();
		}
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0052: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		if (!((Behaviour)this).enabled || (Object)(object)m_Root == (Object)null)
		{
			return;
		}
		if (Application.isEditor && !Application.isPlaying && ((Component)this).transform.hasChanged)
		{
			InitTransforms();
			SetupParticles();
		}
		Gizmos.color = Color.white;
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if (particle.m_ParentIndex >= 0)
			{
				Particle particle2 = m_Particles[particle.m_ParentIndex];
				Gizmos.DrawLine(particle.m_Position, particle2.m_Position);
			}
			if (particle.m_Radius > 0f)
			{
				Gizmos.DrawWireSphere(particle.m_Position, particle.m_Radius * m_ObjectScale);
			}
		}
	}

	public void SetWeight(float w)
	{
		if (m_Weight != w)
		{
			if (w == 0f)
			{
				InitTransforms();
			}
			else if (m_Weight == 0f)
			{
				ResetParticlesPosition();
			}
			m_Weight = w;
		}
	}

	public float GetWeight()
	{
		return m_Weight;
	}

	private void UpdateDynamicBones(float t)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)m_Root == (Object)null)
		{
			return;
		}
		m_ObjectScale = Mathf.Abs(((Component)this).transform.lossyScale.x);
		m_ObjectMove = ((Component)this).transform.position - m_ObjectPrevPosition;
		m_ObjectPrevPosition = ((Component)this).transform.position;
		int num = 1;
		if (m_UpdateRate > 0f)
		{
			float num2 = 1f / m_UpdateRate;
			m_Time += t;
			num = 0;
			while (m_Time >= num2)
			{
				m_Time -= num2;
				if (++num >= 3)
				{
					m_Time = 0f;
					break;
				}
			}
		}
		if (num > 0)
		{
			for (int i = 0; i < num; i++)
			{
				UpdateParticles1();
				UpdateParticles2();
				m_ObjectMove = Vector3.zero;
			}
		}
		else
		{
			SkipUpdateParticles();
		}
		ApplyParticlesToTransforms();
	}

	private void SetupParticles()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		m_Particles.Clear();
		if ((Object)(object)m_Root == (Object)null)
		{
			return;
		}
		m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity);
		m_ObjectScale = ((Component)this).transform.lossyScale.x;
		m_ObjectPrevPosition = ((Component)this).transform.position;
		m_ObjectMove = Vector3.zero;
		m_BoneTotalLength = 0f;
		AppendParticles(m_Root, -1, 0f);
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			particle.m_Damping = m_Damping;
			particle.m_Elasticity = m_Elasticity;
			particle.m_Stiffness = m_Stiffness;
			particle.m_Inert = m_Inert;
			particle.m_Radius = m_Radius;
			if (m_BoneTotalLength > 0f)
			{
				float num = particle.m_BoneLength / m_BoneTotalLength;
				if (m_DampingDistrib != null && m_DampingDistrib.keys.Length != 0)
				{
					particle.m_Damping *= m_DampingDistrib.Evaluate(num);
				}
				if (m_ElasticityDistrib != null && m_ElasticityDistrib.keys.Length != 0)
				{
					particle.m_Elasticity *= m_ElasticityDistrib.Evaluate(num);
				}
				if (m_StiffnessDistrib != null && m_StiffnessDistrib.keys.Length != 0)
				{
					particle.m_Stiffness *= m_StiffnessDistrib.Evaluate(num);
				}
				if (m_InertDistrib != null && m_InertDistrib.keys.Length != 0)
				{
					particle.m_Inert *= m_InertDistrib.Evaluate(num);
				}
				if (m_RadiusDistrib != null && m_RadiusDistrib.keys.Length != 0)
				{
					particle.m_Radius *= m_RadiusDistrib.Evaluate(num);
				}
			}
			particle.m_Damping = Mathf.Clamp01(particle.m_Damping);
			particle.m_Elasticity = Mathf.Clamp01(particle.m_Elasticity);
			particle.m_Stiffness = Mathf.Clamp01(particle.m_Stiffness);
			particle.m_Inert = Mathf.Clamp01(particle.m_Inert);
			particle.m_Radius = Mathf.Max(particle.m_Radius, 0f);
		}
	}

	private void AppendParticles(Transform b, int parentIndex, float boneLength)
	{
		//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_002a: 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_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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: 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_0112: 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)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		Particle particle = new Particle();
		particle.m_Transform = b;
		particle.m_ParentIndex = parentIndex;
		Vector3 val;
		if ((Object)(object)b != (Object)null)
		{
			val = (particle.m_Position = (particle.m_PrevPosition = b.position));
			particle.m_InitLocalPosition = b.localPosition;
			particle.m_InitLocalRotation = b.localRotation;
		}
		else
		{
			Transform transform = m_Particles[parentIndex].m_Transform;
			if (m_EndLength > 0f)
			{
				Transform parent = transform.parent;
				if ((Object)(object)parent != (Object)null)
				{
					particle.m_EndOffset = transform.InverseTransformPoint(transform.position * 2f - parent.position) * m_EndLength;
				}
				else
				{
					particle.m_EndOffset = new Vector3(m_EndLength, 0f, 0f);
				}
			}
			else
			{
				particle.m_EndOffset = transform.InverseTransformPoint(((Component)this).transform.TransformDirection(m_EndOffset) + transform.position);
			}
			val = (particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset)));
		}
		if (parentIndex >= 0)
		{
			float num = boneLength;
			val = m_Particles[parentIndex].m_Transform.position - particle.m_Position;
			boneLength = num + ((Vector3)(ref val)).magnitude;
			particle.m_BoneLength = boneLength;
			m_BoneTotalLength = Mathf.Max(m_BoneTotalLength, boneLength);
		}
		int count = m_Particles.Count;
		m_Particles.Add(particle);
		if (!((Object)(object)b != (Object)null))
		{
			return;
		}
		for (int i = 0; i < b.childCount; i++)
		{
			bool flag = false;
			if (m_Exclusions != null)
			{
				for (int j = 0; j < m_Exclusions.Count; j++)
				{
					Transform val2 = m_Exclusions[j];
					if ((Object)(object)val2 == (Object)(object)b.GetChild(i))
					{
						flag = true;
						break;
					}
				}
			}
			if (!flag)
			{
				AppendParticles(b.GetChild(i), count, boneLength);
			}
		}
		if (b.childCount == 0 && (m_EndLength > 0f || m_EndOffset != Vector3.zero))
		{
			AppendParticles(null, count, boneLength);
		}
	}

	private void InitTransforms()
	{
		//IL_002b: 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)
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				particle.m_Transform.localPosition = particle.m_InitLocalPosition;
				particle.m_Transform.localRotation = particle.m_InitLocalRotation;
			}
		}
	}

	private void ResetParticlesPosition()
	{
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				particle.m_Position = (particle.m_PrevPosition = particle.m_Transform.position);
				continue;
			}
			Transform transform = m_Particles[particle.m_ParentIndex].m_Transform;
			particle.m_Position = (particle.m_PrevPosition = transform.TransformPoint(particle.m_EndOffset));
		}
		m_ObjectPrevPosition = ((Component)this).transform.position;
	}

	private void UpdateParticles1()
	{
		//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_000e: 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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: 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_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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_0103: 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_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		Vector3 gravity = m_Gravity;
		Vector3 normalized = ((Vector3)(ref m_Gravity)).normalized;
		Vector3 val = m_Root.TransformDirection(m_LocalGravity);
		Vector3 val2 = normalized * Mathf.Max(Vector3.Dot(val, normalized), 0f);
		gravity -= val2;
		gravity = (gravity + m_Force) * m_ObjectScale;
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if (particle.m_ParentIndex >= 0)
			{
				Vector3 val3 = particle.m_Position - particle.m_PrevPosition;
				Vector3 val4 = m_ObjectMove * particle.m_Inert;
				particle.m_PrevPosition = particle.m_Position + val4;
				particle.m_Position += val3 * (1f - particle.m_Damping) + gravity + val4;
			}
			else
			{
				particle.m_PrevPosition = particle.m_Position;
				particle.m_Position = particle.m_Transform.position;
			}
		}
	}

	private void UpdateParticles2()
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_00cf: 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_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: 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_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		Plane val = default(Plane);
		for (int i = 1; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			Particle particle2 = m_Particles[particle.m_ParentIndex];
			Vector3 val2;
			float magnitude;
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				val2 = particle2.m_Transform.position - particle.m_Transform.position;
				magnitude = ((Vector3)(ref val2)).magnitude;
			}
			else
			{
				Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix;
				val2 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyVector(particle.m_EndOffset);
				magnitude = ((Vector3)(ref val2)).magnitude;
			}
			float num = magnitude;
			float num2 = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight);
			if (num2 > 0f || particle.m_Elasticity > 0f)
			{
				Matrix4x4 localToWorldMatrix2 = particle2.m_Transform.localToWorldMatrix;
				((Matrix4x4)(ref localToWorldMatrix2)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position));
				Vector3 val3 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition));
				Vector3 val4 = val3 - particle.m_Position;
				particle.m_Position += val4 * particle.m_Elasticity;
				if (num2 > 0f)
				{
					val4 = val3 - particle.m_Position;
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					float num3 = num * (1f - num2) * 2f;
					if (magnitude2 > num3)
					{
						particle.m_Position += val4 * ((magnitude2 - num3) / magnitude2);
					}
				}
			}
			if (m_Colliders != null)
			{
				float particleRadius = particle.m_Radius * m_ObjectScale;
				for (int j = 0; j < m_Colliders.Count; j++)
				{
					DynamicBoneCollider dynamicBoneCollider = m_Colliders[j];
					if ((Object)(object)dynamicBoneCollider != (Object)null && ((Behaviour)dynamicBoneCollider).enabled)
					{
						dynamicBoneCollider.Collide(ref particle.m_Position, particleRadius);
					}
				}
			}
			if (m_FreezeAxis != 0)
			{
				switch (m_FreezeAxis)
				{
				case FreezeAxis.X:
					((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.right, particle2.m_Position);
					break;
				case FreezeAxis.Y:
					((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.up, particle2.m_Position);
					break;
				case FreezeAxis.Z:
					((Plane)(ref val)).SetNormalAndPosition(particle2.m_Transform.forward, particle2.m_Position);
					break;
				}
				particle.m_Position -= ((Plane)(ref val)).normal * ((Plane)(ref val)).GetDistanceToPoint(particle.m_Position);
			}
			Vector3 val5 = particle2.m_Position - particle.m_Position;
			float magnitude3 = ((Vector3)(ref val5)).magnitude;
			if (magnitude3 > 0f)
			{
				particle.m_Position += val5 * ((magnitude3 - num) / magnitude3);
			}
		}
	}

	private void SkipUpdateParticles()
	{
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: 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_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: 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_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			if (particle.m_ParentIndex >= 0)
			{
				Vector3 val = m_ObjectMove * particle.m_Inert;
				particle.m_PrevPosition += val;
				particle.m_Position += val;
				Particle particle2 = m_Particles[particle.m_ParentIndex];
				Vector3 val2;
				float magnitude;
				if ((Object)(object)particle.m_Transform != (Object)null)
				{
					val2 = particle2.m_Transform.position - particle.m_Transform.position;
					magnitude = ((Vector3)(ref val2)).magnitude;
				}
				else
				{
					Matrix4x4 localToWorldMatrix = particle2.m_Transform.localToWorldMatrix;
					val2 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyVector(particle.m_EndOffset);
					magnitude = ((Vector3)(ref val2)).magnitude;
				}
				float num = magnitude;
				float num2 = Mathf.Lerp(1f, particle.m_Stiffness, m_Weight);
				if (num2 > 0f)
				{
					Matrix4x4 localToWorldMatrix2 = particle2.m_Transform.localToWorldMatrix;
					((Matrix4x4)(ref localToWorldMatrix2)).SetColumn(3, Vector4.op_Implicit(particle2.m_Position));
					Vector3 val3 = ((!((Object)(object)particle.m_Transform != (Object)null)) ? ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_EndOffset) : ((Matrix4x4)(ref localToWorldMatrix2)).MultiplyPoint3x4(particle.m_Transform.localPosition));
					Vector3 val4 = val3 - particle.m_Position;
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					float num3 = num * (1f - num2) * 2f;
					if (magnitude2 > num3)
					{
						particle.m_Position += val4 * ((magnitude2 - num3) / magnitude2);
					}
				}
				Vector3 val5 = particle2.m_Position - particle.m_Position;
				float magnitude3 = ((Vector3)(ref val5)).magnitude;
				if (magnitude3 > 0f)
				{
					particle.m_Position += val5 * ((magnitude3 - num) / magnitude3);
				}
			}
			else
			{
				particle.m_PrevPosition = particle.m_Position;
				particle.m_Position = particle.m_Transform.position;
			}
		}
	}

	private void ApplyParticlesToTransforms()
	{
		//IL_00bf: 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_0052: 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_0067: 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_006f: 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_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_008c: 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)
		for (int i = 1; i < m_Particles.Count; i++)
		{
			Particle particle = m_Particles[i];
			Particle particle2 = m_Particles[particle.m_ParentIndex];
			if (particle2.m_Transform.childCount <= 1)
			{
				Vector3 val = ((!((Object)(object)particle.m_Transform != (Object)null)) ? particle.m_EndOffset : particle.m_Transform.localPosition);
				Quaternion val2 = Quaternion.FromToRotation(particle2.m_Transform.TransformDirection(val), particle.m_Position - particle2.m_Position);
				particle2.m_Transform.rotation = val2 * particle2.m_Transform.rotation;
			}
			if ((Object)(object)particle.m_Transform != (Object)null)
			{
				particle.m_Transform.position = particle.m_Position;
			}
		}
	}
}
[AddComponentMenu("Dynamic Bone/Dynamic Bone Collider")]
public class DynamicBoneCollider : MonoBehaviour
{
	public enum Direction
	{
		X,
		Y,
		Z
	}

	public enum Bound
	{
		Outside,
		Inside
	}

	public Vector3 m_Center = Vector3.zero;

	public float m_Radius = 0.5f;

	public float m_Height = 0f;

	public Direction m_Direction = Direction.X;

	public Bound m_Bound = Bound.Outside;

	private void OnValidate()
	{
		m_Radius = Mathf.Max(m_Radius, 0f);
		m_Height = Mathf.Max(m_Height, 0f);
	}

	public void Collide(ref Vector3 particlePosition, float particleRadius)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		float num = m_Radius * Mathf.Abs(((Component)this).transform.lossyScale.x);
		float num2 = m_Height * 0.5f - num;
		if (num2 <= 0f)
		{
			if (m_Bound == Bound.Outside)
			{
				OutsideSphere(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(m_Center), num);
			}
			else
			{
				InsideSphere(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(m_Center), num);
			}
			return;
		}
		Vector3 center = m_Center;
		Vector3 center2 = m_Center;
		switch (m_Direction)
		{
		case Direction.X:
			center.x -= num2;
			center2.x += num2;
			break;
		case Direction.Y:
			center.y -= num2;
			center2.y += num2;
			break;
		case Direction.Z:
			center.z -= num2;
			center2.z += num2;
			break;
		}
		if (m_Bound == Bound.Outside)
		{
			OutsideCapsule(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(center), ((Component)this).transform.TransformPoint(center2), num);
		}
		else
		{
			InsideCapsule(ref particlePosition, particleRadius, ((Component)this).transform.TransformPoint(center), ((Component)this).transform.TransformPoint(center2), num);
		}
	}

	private static void OutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
	{
		//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_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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		float num = sphereRadius + particleRadius;
		float num2 = num * num;
		Vector3 val = particlePosition - sphereCenter;
		float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
		if (sqrMagnitude > 0f && sqrMagnitude < num2)
		{
			float num3 = Mathf.Sqrt(sqrMagnitude);
			particlePosition = sphereCenter + val * (num / num3);
		}
	}

	private static void InsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
	{
		//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_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_0032: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		float num = sphereRadius + particleRadius;
		float num2 = num * num;
		Vector3 val = particlePosition - sphereCenter;
		float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
		if (sqrMagnitude > num2)
		{
			float num3 = Mathf.Sqrt(sqrMagnitude);
			particlePosition = sphereCenter + val * (num / num3);
		}
	}

	private static void OutsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius)
	{
		//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_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: 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_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_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		float num = capsuleRadius + particleRadius;
		float num2 = num * num;
		Vector3 val = capsuleP1 - capsuleP0;
		Vector3 val2 = particlePosition - capsuleP0;
		float num3 = Vector3.Dot(val2, val);
		if (num3 <= 0f)
		{
			float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
			if (sqrMagnitude > 0f && sqrMagnitude < num2)
			{
				float num4 = Mathf.Sqrt(sqrMagnitude);
				particlePosition = capsuleP0 + val2 * (num / num4);
			}
			return;
		}
		float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude;
		if (num3 >= sqrMagnitude2)
		{
			val2 = particlePosition - capsuleP1;
			float sqrMagnitude3 = ((Vector3)(ref val2)).sqrMagnitude;
			if (sqrMagnitude3 > 0f && sqrMagnitude3 < num2)
			{
				float num5 = Mathf.Sqrt(sqrMagnitude3);
				particlePosition = capsuleP1 + val2 * (num / num5);
			}
		}
		else if (sqrMagnitude2 > 0f)
		{
			num3 /= sqrMagnitude2;
			val2 -= val * num3;
			float sqrMagnitude4 = ((Vector3)(ref val2)).sqrMagnitude;
			if (sqrMagnitude4 > 0f && sqrMagnitude4 < num2)
			{
				float num6 = Mathf.Sqrt(sqrMagnitude4);
				particlePosition += val2 * ((num - num6) / num6);
			}
		}
	}

	private static void InsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius)
	{
		//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_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		float num = capsuleRadius + particleRadius;
		float num2 = num * num;
		Vector3 val = capsuleP1 - capsuleP0;
		Vector3 val2 = particlePosition - capsuleP0;
		float num3 = Vector3.Dot(val2, val);
		if (num3 <= 0f)
		{
			float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
			if (sqrMagnitude > num2)
			{
				float num4 = Mathf.Sqrt(sqrMagnitude);
				particlePosition = capsuleP0 + val2 * (num / num4);
			}
			return;
		}
		float sqrMagnitude2 = ((Vector3)(ref val)).sqrMagnitude;
		if (num3 >= sqrMagnitude2)
		{
			val2 = particlePosition - capsuleP1;
			float sqrMagnitude3 = ((Vector3)(ref val2)).sqrMagnitude;
			if (sqrMagnitude3 > num2)
			{
				float num5 = Mathf.Sqrt(sqrMagnitude3);
				particlePosition = capsuleP1 + val2 * (num / num5);
			}
		}
		else if (sqrMagnitude2 > 0f)
		{
			num3 /= sqrMagnitude2;
			val2 -= val * num3;
			float sqrMagnitude4 = ((Vector3)(ref val2)).sqrMagnitude;
			if (sqrMagnitude4 > num2)
			{
				float num6 = Mathf.Sqrt(sqrMagnitude4);
				particlePosition += val2 * ((num - num6) / num6);
			}
		}
	}

	private void OnDrawGizmosSelected()
	{
		//IL_0035: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: 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_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		if (!((Behaviour)this).enabled)
		{
			return;
		}
		if (m_Bound == Bound.Outside)
		{
			Gizmos.color = Color.yellow;
		}
		else
		{
			Gizmos.color = Color.magenta;
		}
		float num = m_Radius * Mathf.Abs(((Component)this).transform.lossyScale.x);
		float num2 = m_Height * 0.5f - num;
		if (num2 <= 0f)
		{
			Gizmos.DrawWireSphere(((Component)this).transform.TransformPoint(m_Center), num);
			return;
		}
		Vector3 center = m_Center;
		Vector3 center2 = m_Center;
		switch (m_Direction)
		{
		case Direction.X:
			center.x -= num2;
			center2.x += num2;
			break;
		case Direction.Y:
			center.y -= num2;
			center2.y += num2;
			break;
		case Direction.Z:
			center.z -= num2;
			center2.z += num2;
			break;
		}
		Gizmos.DrawWireSphere(((Component)this).transform.TransformPoint(center), num);
		Gizmos.DrawWireSphere(((Component)this).transform.TransformPoint(center2), num);
	}
}
namespace LethalBoykisserMod;

public static class Assets
{
	public static string mainAssetBundleName = "boykisserbundle";

	public static AssetBundle MainAssetBundle = null;

	public static AssetBundle TextureAssetBundle = null;

	public static Sprite replacementSELFTPOSE_Out;

	public static Sprite replacementSELFTPOSE_Fill;

	private static string GetAssemblyName()
	{
		return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0];
	}

	public static void PopulateAssets()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		if ((Object)MainAssetBundle == (Object)null)
		{
			Debug.Log((object)Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName));
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
			MainAssetBundle = AssetBundle.LoadFromStream(stream);
		}
	}

	public static void tryGetTextureAssets()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		string text = "MainModbundle";
		if ((Object)TextureAssetBundle == (Object)null)
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + text))
			{
				TextureAssetBundle = AssetBundle.LoadFromStream(stream);
				replacementSELFTPOSE_Fill = TextureAssetBundle.LoadAsset<Sprite>("assets/ab/selftposefilled.png");
				replacementSELFTPOSE_Out = TextureAssetBundle.LoadAsset<Sprite>("assets/ab/selftposeoutline.png");
			}
		}
	}
}
public class BodyReplacementBoy : BodyReplacementBase
{
	private ExpressionManager EM;

	protected override GameObject LoadAssetsAndReturnModel()
	{
		List<string> list = new List<string> { "body", "tail", "facial Features", "eyes" };
		string text = ((!LethalBoykisserBase.playerSize.Value) ? "BoykisserLargeAsset" : "BoykisserAsset");
		GameObject val = Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		GameObject gameObject = ((Component)val.transform.GetChild(1)).gameObject;
		GameObject gameObject2 = ((Component)val.transform.GetChild(2)).gameObject;
		SkinnedMeshRenderer component = gameObject.GetComponent<SkinnedMeshRenderer>();
		SkinnedMeshRenderer component2 = gameObject2.GetComponent<SkinnedMeshRenderer>();
		List<Material> list2 = new List<Material>();
		foreach (string item in list)
		{
			Material val2 = Assets.MainAssetBundle.LoadAsset<Material>("assets/material/" + item + ".mat");
			if (LethalBoykisserBase.useDefaultShaders.Value)
			{
				val2.shader = Shader.Find("HDRP/Lit");
			}
			list2.Add(val2);
		}
		((Renderer)component).SetMaterials(list2);
		List<Material> list3 = new List<Material> { Assets.MainAssetBundle.LoadAsset<Material>("assets/material/socks.mat") };
		if (LethalBoykisserBase.useDefaultShaders.Value)
		{
			list3[0].shader = Shader.Find("HDRP/Lit");
		}
		((Renderer)component2).SetMaterials(list3);
		return val;
	}

	protected override void AddModelScripts()
	{
		base.UseNoPostProcessing = true;
		PlayerControllerB component = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
		Transform val = (from x in base.replacementModel.GetComponentsInChildren<Transform>()
			where ((Object)x).name.Contains("Body")
			select x).FirstOrDefault();
		if (!((Object)(object)((Component)val).gameObject.GetComponent<ExpressionManager>() != (Object)null))
		{
			ExpressionManager expressionManager = ((Component)val).gameObject.AddComponent<ExpressionManager>();
			expressionManager.SetBodyReplacementB(((Component)this).gameObject.transform);
			EM = expressionManager;
		}
		if ((Object)(object)component == (Object)(object)StartOfRound.Instance.localPlayerController && LethalBoykisserBase.enableReplacementUI.Value && (Object)(object)((Component)val.parent).GetComponent<UIReplacementManager>() == (Object)null && ((NetworkBehaviour)component).IsOwner)
		{
			UIReplacementManager uIReplacementManager = ((Component)val.parent).gameObject.AddComponent<UIReplacementManager>();
		}
		Transform where = (from x in base.replacementModel.GetComponentsInChildren<Transform>()
			where ((Object)x).name.Contains("Tail_001")
			select x).FirstOrDefault();
		Transform where2 = (from x in base.replacementModel.GetComponentsInChildren<Transform>()
			where ((Object)x).name.Contains("Ear_L")
			select x).FirstOrDefault();
		Transform where3 = (from x in base.replacementModel.GetComponentsInChildren<Transform>()
			where ((Object)x).name.Contains("Ear_R")
			select x).FirstOrDefault();
		CreateBone(where, colldier: false, ear: true);
		CreateBone(where2, colldier: false, ear: true);
		CreateBone(where3, colldier: false, ear: true);
	}

	protected override void OnDeath()
	{
		EM.OnDeath();
	}

	private void CreateBone(Transform where, bool colldier = false, bool ear = false)
	{
		if (!Object.op_Implicit((Object)(object)((Component)where).gameObject.GetComponent<DynamicBone>()))
		{
			DynamicBone dynamicBone = ((Component)where).gameObject.AddComponent<DynamicBone>();
			dynamicBone.m_Root = where;
			if (colldier)
			{
				DynamicBoneCollider dynamicBoneCollider = ((Component)where).gameObject.AddComponent<DynamicBoneCollider>();
			}
			if (ear)
			{
				EarSettings(dynamicBone);
			}
		}
	}

	private void EarSettings(DynamicBone ear)
	{
		ear.m_UpdateRate = 70f;
		ear.m_Damping = 0.2f;
		ear.m_Elasticity = 0.1f;
		ear.m_Stiffness = 0.035f;
		ear.m_Inert = 0.555f;
	}

	public PlayerControllerB TryGetPlayerController()
	{
		return ((BodyReplacementBase)this).controller;
	}

	public GameObject getDeadBody()
	{
		return base.replacementDeadBody;
	}
}
public class ExpressionManager : MonoBehaviour
{
	private enum BlinkShapes
	{
		Blink = 52,
		Scream
	}

	private enum SpeakShapes
	{
		Mouth = 57
	}

	private enum voicestate
	{
		Closed,
		Talking,
		Screaming
	}

	private SkinnedMeshRenderer body;

	private IEnumerator blinkingInstance;

	private IEnumerator speakingInstance;

	private bool isblinking;

	private GameObject parent;

	private PlayerControllerB plrCntrB;

	public BodyReplacementBoy bodyReplacementB;

	private bool isScreaming;

	private voicestate currentVoiceState;

	private bool eyeOpen = true;

	public bool died = false;

	private VoicePlayerState vps;

	private bool isMasked = false;

	private float requiredVolume;

	private Vector3 CameraPosition = Vector3.zero;

	private UpdateItemRoot ItemRootUpdater;

	private IEnumerator currentBlinkState;

	private IEnumerator currentSpeakState;

	public void SetBodyReplacementB(Transform tofind)
	{
		BodyReplacementBoy component = ((Component)tofind).GetComponent<BodyReplacementBoy>();
		bodyReplacementB = component;
		Awake();
	}

	private void Awake()
	{
		if (!((Object)(object)bodyReplacementB == (Object)null))
		{
			plrCntrB = bodyReplacementB.TryGetPlayerController();
			body = ((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>();
			parent = ((Component)((Component)this).gameObject.transform.parent).gameObject;
			if (!plrCntrB.isPlayerDead && died)
			{
				died = false;
				OnRespawn();
			}
			requiredVolume = LethalBoykisserBase.playerScreamsReqAmpLvl.Value;
			if (LethalBoykisserBase.playerSize.Value && LethalBoykisserBase.changeViewModelHeight.Value && (Object)(object)ItemRootUpdater == (Object)null)
			{
				ItemRootUpdater = ((Component)this).gameObject.AddComponent<UpdateItemRoot>();
				ItemRootUpdater.plrCntrB = plrCntrB;
			}
		}
	}

	private void OnEnable()
	{
		if ((Object)(object)bodyReplacementB == (Object)null)
		{
			return;
		}
		requiredVolume = LethalBoykisserBase.playerScreamsReqAmpLvl.Value;
		plrCntrB = bodyReplacementB.TryGetPlayerController();
		if (!plrCntrB.isPlayerDead)
		{
			if (died)
			{
				died = false;
				OnRespawn();
			}
			if (blinkingInstance != null)
			{
				((MonoBehaviour)this).StopCoroutine(blinkingInstance);
			}
			if (speakingInstance != null)
			{
				((MonoBehaviour)this).StopCoroutine(speakingInstance);
			}
			body.SetBlendShapeWeight(52, 0f);
			body.SetBlendShapeWeight(53, 0f);
			body.SetBlendShapeWeight(57, 0f);
			eyeOpen = true;
			isblinking = false;
			isScreaming = false;
		}
		else if (died)
		{
			OnDeath();
		}
	}

	private void Update()
	{
		if ((Object)(object)plrCntrB == (Object)null)
		{
			plrCntrB = bodyReplacementB.TryGetPlayerController();
		}
		if (!isblinking && (Object)(object)body != (Object)null && !died && !isScreaming)
		{
			isblinking = true;
			if (blinkingInstance != null)
			{
				((MonoBehaviour)this).StopCoroutine(blinkingInstance);
			}
			eyeOpen = !eyeOpen;
			blinkingInstance = changeBlinkState(BlinkShapes.Blink, EyeStateVal(eyeOpen), blinkingInstance);
			((MonoBehaviour)this).StartCoroutine(blinkingInstance);
		}
		if (plrCntrB.voicePlayerState != null)
		{
			vps = plrCntrB.voicePlayerState;
			if (vps.IsSpeaking)
			{
				if (LethalBoykisserBase.playerScreams.Value)
				{
					if (voiceAmp() > requiredVolume && !isScreaming)
					{
						((MonoBehaviour)this).StartCoroutine(ChangeScreamState(screaming: true));
					}
					if (voiceAmp() < requiredVolume && isScreaming)
					{
						((MonoBehaviour)this).StartCoroutine(ChangeScreamState(screaming: false));
					}
				}
				if (voiceAmp() > 5f && currentVoiceState != voicestate.Talking)
				{
					currentVoiceState = voicestate.Talking;
					if (speakingInstance != null)
					{
						((MonoBehaviour)this).StopCoroutine(speakingInstance);
					}
					speakingInstance = changeSpeakState(SpeakShapes.Mouth, 50, speakingInstance);
					((MonoBehaviour)this).StartCoroutine(speakingInstance);
				}
				if (voiceAmp() < 5f && currentVoiceState != 0)
				{
					currentVoiceState = voicestate.Closed;
					if (speakingInstance != null)
					{
						((MonoBehaviour)this).StopCoroutine(speakingInstance);
					}
					speakingInstance = changeSpeakState(SpeakShapes.Mouth, 0, speakingInstance);
					((MonoBehaviour)this).StartCoroutine(speakingInstance);
				}
			}
		}
		if (plrCntrB.isPlayerDead && !died)
		{
			died = true;
		}
		else if (!plrCntrB.isPlayerDead && died)
		{
			died = false;
			OnRespawn();
			if (blinkingInstance != null)
			{
				((MonoBehaviour)this).StopCoroutine(blinkingInstance);
			}
			if (speakingInstance != null)
			{
				((MonoBehaviour)this).StopCoroutine(speakingInstance);
			}
			body.SetBlendShapeWeight(52, 0f);
			body.SetBlendShapeWeight(53, 0f);
			body.SetBlendShapeWeight(57, 0f);
			eyeOpen = true;
			isblinking = false;
			isScreaming = false;
		}
		if (LethalBoykisserBase.playerSize.Value && LethalBoykisserBase.changeViewModelHeight.Value)
		{
			UpdateCameraPos();
		}
	}

	public void MaskPlayer()
	{
		isMasked = true;
		((MonoBehaviour)this).StopAllCoroutines();
		body.SetBlendShapeWeight(52, 0f);
		body.SetBlendShapeWeight(53, 0f);
		body.SetBlendShapeWeight(57, 0f);
		body.SetBlendShapeWeight(63, 100f);
	}

	public void OnDeath()
	{
		((MonoBehaviour)this).StopAllCoroutines();
		GameObject deadBody = bodyReplacementB.getDeadBody();
		Debug.Log((object)deadBody);
		SkinnedMeshRenderer val = (from x in deadBody.GetComponentsInChildren<SkinnedMeshRenderer>()
			where ((Object)x).name.Contains("Body")
			select x).FirstOrDefault();
		((Behaviour)((Component)val).gameObject.GetComponent<ExpressionManager>()).enabled = false;
		val.SetBlendShapeWeight(52, 0f);
		val.SetBlendShapeWeight(72, 100f);
		val.SetBlendShapeWeight(30, 0f);
	}

	private void OnRespawn()
	{
		isMasked = false;
		isblinking = false;
		body.SetBlendShapeWeight(63, 0f);
		body.SetBlendShapeWeight(72, 0f);
		body.SetBlendShapeWeight(30, 100f);
	}

	private IEnumerator ChangeScreamState(bool screaming)
	{
		isblinking = true;
		isScreaming = screaming;
		body.SetBlendShapeWeight(52, 0f);
		if (blinkingInstance != null)
		{
			((MonoBehaviour)this).StopCoroutine(blinkingInstance);
		}
		blinkingInstance = changeBlinkState(BlinkShapes.Scream, EyeStateVal(!isScreaming), blinkingInstance, 0.03f);
		yield return ((MonoBehaviour)this).StartCoroutine(blinkingInstance);
		if (!isScreaming)
		{
			isblinking = false;
		}
	}

	private IEnumerator changeBlinkState(BlinkShapes state, int value, IEnumerator instance, float speed = 0.15f)
	{
		if (died)
		{
			yield break;
		}
		if (currentBlinkState != null)
		{
			((MonoBehaviour)this).StopCoroutine(currentBlinkState);
		}
		currentBlinkState = instance;
		float elapsedTime = 0f;
		while (body.GetBlendShapeWeight((int)state) != (float)value)
		{
			elapsedTime += Time.deltaTime;
			float percComplete = elapsedTime / speed;
			float blendKey = Mathf.Lerp(body.GetBlendShapeWeight((int)state), (float)value, percComplete);
			body.SetBlendShapeWeight((int)state, blendKey);
			yield return (object)new WaitForSeconds(0.01f);
		}
		body.SetBlendShapeWeight((int)state, (float)value);
		yield return (object)new WaitForSeconds(0.25f);
		currentBlinkState = null;
		if (state == BlinkShapes.Blink)
		{
			if ((float)value == 0f)
			{
				yield return (object)new WaitForSeconds(Random.Range(1f, 4f));
				isblinking = false;
			}
			else
			{
				isblinking = false;
			}
		}
	}

	private IEnumerator changeSpeakState(SpeakShapes state, int value, IEnumerator instance, float speed = 0.035f)
	{
		if (!died)
		{
			if (currentSpeakState != null)
			{
				((MonoBehaviour)this).StopCoroutine(currentSpeakState);
			}
			currentSpeakState = instance;
			float elapsedTime = 0f;
			while (body.GetBlendShapeWeight((int)state) != (float)value)
			{
				elapsedTime += Time.deltaTime;
				float percComplete = elapsedTime / speed;
				float blendKey = Mathf.Lerp(body.GetBlendShapeWeight((int)state), (float)value, percComplete);
				body.SetBlendShapeWeight((int)state, blendKey);
				yield return (object)new WaitForSeconds(0.01f);
			}
			body.SetBlendShapeWeight((int)state, (float)value);
			currentSpeakState = null;
		}
	}

	private int EyeStateVal(bool state)
	{
		if (state)
		{
			return 0;
		}
		return 100;
	}

	private float voiceAmp()
	{
		return vps.Amplitude * 6.5f * 100f;
	}

	private void UpdateCameraPos()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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)
		if (!died)
		{
			Vector3 val = CameraPosition;
			if (!plrCntrB.inTerminalMenu && !plrCntrB.inSpecialInteractAnimation)
			{
				val -= new Vector3(0f, 0.35f, 0f);
			}
			((Component)plrCntrB.gameplayCamera).transform.localPosition = val;
		}
	}

	private void OnDisable()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		((Component)plrCntrB.gameplayCamera).transform.localPosition = CameraPosition;
	}
}
[BepInPlugin("LethallyGay.Boykisser", "Boy Kisser Model", "0.0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class LethalBoykisserBase : BaseUnityPlugin
{
	public static ConfigFile config;

	private const string modGUID = "LethallyGay.Boykisser";

	private const string modNAME = "Boy Kisser Model";

	private const string modVER = "0.0.0.1";

	private readonly Harmony harmony = new Harmony("LethallyGay.Boykisser");

	private static LethalBoykisserBase instance;

	internal ManualLogSource mls;

	public static string[] replacementsuitnames;

	public static ConfigEntry<bool> enabledForAllSuits { get; private set; }

	public static ConfigEntry<bool> playerScreams { get; private set; }

	public static ConfigEntry<float> playerScreamsReqAmpLvl { get; private set; }

	public static ConfigEntry<bool> enableReplacementUI { get; private set; }

	public static ConfigEntry<string> suitsToEnable { get; private set; }

	public static ConfigEntry<bool> playerSize { get; private set; }

	public static ConfigEntry<bool> changeViewModelHeight { get; private set; }

	public static ConfigEntry<bool> useDefaultShaders { get; private set; }

	private static string GetAssemblyName()
	{
		return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0];
	}

	private static void InitConfig()
	{
		enabledForAllSuits = config.Bind<bool>("Model Visability per Suit", "Enable for all", true, "Enable this to show the model for all suits");
		playerScreams = config.Bind<bool>("Screaming Expression", "Enable screaming", false, "Enable this to show another expression when your friends are screaming");
		playerScreamsReqAmpLvl = config.Bind<float>("Screaming Expression", "Decibel Level", 80f, "The required volume for the screaming expression to start");
		suitsToEnable = config.Bind<string>("Suits to Replace Settings", "Suits to enable model replacement for", "Default,Orange suit", "Enter a comma separated list of suit names.(Stuff like: [Green suit,Pajama suit,Hazard suit])");
		enableReplacementUI = config.Bind<bool>("UI settings stuff", "Replacement UI ON:", true, "Currently replaces the health indicator in the top left corner");
		playerSize = config.Bind<bool>("Player Size", "Account for Ears:", false, "This might not make sense, but this determines how model height is scaled to the base model. If you account for the ears, the player would be shorter. ");
		changeViewModelHeight = config.Bind<bool>("Player Size", "Change viewmodel height:", true, "If the player is shorter make the viewmodel shorter ");
		useDefaultShaders = config.Bind<bool>("Rendering", "Use default shaders:", false, "As of right now, this model is being forced to use lilToon because of my 3 iq. You can set this to true if you liked the old shaders better");
	}

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		if ((Object)instance == (Object)null)
		{
			instance = this;
		}
		config = ((BaseUnityPlugin)this).Config;
		InitConfig();
		if (enabledForAllSuits.Value)
		{
			ModelReplacementAPI.RegisterModelReplacementOverride(typeof(BodyReplacementBoy));
		}
		string[] array = suitsToEnable.Value.Split(new char[1] { ',' });
		string[] array2 = array;
		foreach (string text in array2)
		{
			CollectionExtensions.AddItem<string>((IEnumerable<string>)replacementsuitnames, text);
			ModelReplacementAPI.RegisterSuitModelReplacement(text, typeof(BodyReplacementBoy));
		}
		mls = Logger.CreateLogSource("LethallyGay.Boykisser");
		mls.LogInfo((object)"Loading the boykisser mod");
		Assets.PopulateAssets();
		Assets.tryGetTextureAssets();
		harmony.PatchAll(typeof(LethalBoykisserBase));
		harmony.PatchAll(typeof(ExpressionManager));
		harmony.PatchAll(typeof(MaskedReplacementBoy));
		mls.LogInfo((object)"Boykisser mod loaded... (If you're reading this i just spent like 8+ hours rewriting this gg) pls pls pls check out the config");
	}
}
public class MaskAnimationBoykisser : MonoBehaviour
{
	private MaskedReplacementBase MaskedReplacement;

	private MaskedPlayerEnemy MaskedEnemy;

	private SkinnedMeshRenderer BodyRender;

	private void Awake()
	{
		MaskedReplacement = ((Component)this).GetComponent<MaskedReplacementBase>();
		MaskedEnemy = ((Component)this).GetComponent<MaskedPlayerEnemy>();
		BodyRender = ((Component)(from x in MaskedReplacement.replacementModel.GetComponentsInChildren<Transform>()
			where ((Object)x).name.Contains("Body")
			select x).FirstOrDefault()).GetComponent<SkinnedMeshRenderer>();
	}

	private void FixedUpdate()
	{
		if (((EnemyAI)MaskedEnemy).inSpecialAnimation)
		{
			BodyRender.SetBlendShapeWeight(63, 0f);
			BodyRender.SetBlendShapeWeight(74, 100f);
		}
		else
		{
			BodyRender.SetBlendShapeWeight(63, 100f);
			BodyRender.SetBlendShapeWeight(74, 0f);
		}
	}
}
[HarmonyPatch(typeof(MaskedReplacementBase))]
public class MaskedReplacementBoy : MonoBehaviour
{
	[HarmonyPatch("Awake")]
	[HarmonyPostfix]
	private static void Postfix(MaskedReplacementBase __instance)
	{
		((Component)__instance).gameObject.AddComponent<MaskAnimationBoykisser>();
		GameObject gameObject = ((Component)((Component)__instance).transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject;
		GameObject gameObject2 = ((Component)((Component)__instance).transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject;
		Transform val = (from x in __instance.replacementModel.GetComponentsInChildren<Transform>()
			where ((Object)x).name.Contains("Body")
			select x).FirstOrDefault();
		if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<ExpressionManager>()))
		{
			Object.Destroy((Object)(object)((Component)val).gameObject.GetComponent<ExpressionManager>());
			SkinnedMeshRenderer component = ((Component)val).GetComponent<SkinnedMeshRenderer>();
			component.SetBlendShapeWeight(52, 0f);
			component.SetBlendShapeWeight(30, 0f);
			component.SetBlendShapeWeight(53, 0f);
			component.SetBlendShapeWeight(57, 0f);
			component.SetBlendShapeWeight(63, 100f);
			if ((Object)(object)gameObject != (Object)null && (Object)(object)gameObject2 != (Object)null)
			{
				gameObject.SetActive(false);
				gameObject2.SetActive(false);
			}
		}
	}
}
public class UIReplacementManager : MonoBehaviour
{
	public GameObject PlayerHud_Self;

	public Image selfOut;

	public Image selfFill;

	private Sprite cachedImgFill;

	private Sprite cachedImgOut;

	private bool setNew = false;

	private void Awake()
	{
		PlayerHud_Self = GameObject.Find("IngamePlayerHUD/TopLeftCorner");
		selfFill = ((Component)PlayerHud_Self.transform.Find("SelfRed")).GetComponent<Image>();
		selfOut = ((Component)PlayerHud_Self.transform.Find("Self")).GetComponent<Image>();
		setNew = false;
	}

	private void OnEnable()
	{
		if (!setNew)
		{
			cachedImgFill = selfFill.sprite;
			cachedImgOut = selfOut.sprite;
			selfOut.sprite = Assets.replacementSELFTPOSE_Out;
			selfFill.sprite = Assets.replacementSELFTPOSE_Fill;
			setNew = true;
		}
	}

	private void OnDisable()
	{
		setNew = false;
		selfOut.sprite = cachedImgOut;
		selfFill.sprite = cachedImgFill;
	}
}
[DefaultExecutionOrder(-1)]
internal class UpdateItemRoot : MonoBehaviour
{
	internal PlayerControllerB plrCntrB;

	private GameObject offsetBuild;

	private Vector3 org;

	private void LateUpdate()
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)plrCntrB == (Object)null)
		{
			return;
		}
		if ((Object)(object)offsetBuild == (Object)null)
		{
			offsetBuild = new GameObject("LocalOffset");
			offsetBuild.transform.parent = plrCntrB.localArmsTransform.parent;
			org = offsetBuild.transform.parent.localPosition;
			return;
		}
		Vector3 val = org;
		if (!plrCntrB.inTerminalMenu && !plrCntrB.inSpecialInteractAnimation)
		{
			val -= new Vector3(0f, 0.3f, 0f);
		}
		offsetBuild.transform.parent.localPosition = val;
	}
}