Decompiled source of DieHarder v2.0.11

Mods/DieHarder.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using DieHarder;
using DieHarder.DramaticEffects;
using HarmonyLib;
using Il2Cpp;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppLiv.Lck.Smoothing;
using Il2CppRUMBLE.Audio;
using Il2CppRUMBLE.CharacterCreation.Interactable;
using Il2CppRUMBLE.Combat.ShiftStones;
using Il2CppRUMBLE.Environment.Howard;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.MoveSystem;
using Il2CppRUMBLE.Networking.MatchFlow;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Scaling;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Pools;
using Il2CppRUMBLE.Recording.LCK;
using Il2CppRUMBLE.Utilities;
using Il2CppRootMotion;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using RumbleModdingAPI.RMAPI;
using UIFramework;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "DieHarder", "2.0.11", "TacoSlayer36", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 248, 231)]
[assembly: MelonAuthorColor(255, 255, 248, 231)]
[assembly: MelonAdditionalDependencies(new string[] { "UIFramework" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DieHarder")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0f12dc76c516d1e646659e7e1a7c2fca7d82016e")]
[assembly: AssemblyProduct("DieHarder")]
[assembly: AssemblyTitle("DieHarder")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DieHarder
{
	public static class Config
	{
		public enum EffectsInMatches_Type
		{
			[Display(Name = "Disabled")]
			Disabled,
			[Display(Name = "On Match End")]
			OnMatchEnd,
			[Display(Name = "On Round End")]
			OnRoundEnd
		}

		public enum EffectsOutsideMatches_Type
		{
			[Display(Name = "Disabled")]
			Disabled,
			[Display(Name = "On Death")]
			OnDeath
		}

		public enum VariableEffects_Type
		{
			[Display(Name = "Disabled")]
			Disabled,
			[Display(Name = "Normal")]
			Normal,
			[Display(Name = "Overkill is weighted more")]
			OverkillBias
		}

		public enum RagdollsInMatches_Type
		{
			[Display(Name = "Disabled")]
			Disabled,
			[Display(Name = "On Match End")]
			OnMatchEnd,
			[Display(Name = "On Round End")]
			OnRoundEnd,
			[Description("<#F80>On hit (prone to lag)")]
			OnHit,
			[Description("<#F00>Per damage (God help you)")]
			PerDamage
		}

		public enum RagdollsOutsideMatches_Type
		{
			[Display(Name = "Disabled")]
			Disabled,
			[Display(Name = "On Death")]
			OnDeath,
			[Description("<#F80>On hit (prone to lag)")]
			OnHit,
			[Description("<#F00>Per damage (God help you)")]
			PerDamage
		}

		public const string PreferencesFilePath = "UserData/DieHarder/Config.cfg";

		public static MelonPreferences_Category Cat_DramaticEffects;

		public static MelonPreferences_Entry<EffectsInMatches_Type> DramaticEffectsInMatches;

		public static MelonPreferences_Entry<EffectsOutsideMatches_Type> DramaticEffectsOutsideMatches;

		public static MelonPreferences_Entry<bool> IncludeStructureInImpact;

		public static MelonPreferences_Entry<float> DramaticEffectsVolume;

		public static MelonPreferences_Entry<bool> DramaticEffectsHaptics;

		public static MelonPreferences_Entry<string> PrimaryEffectColor;

		public static MelonPreferences_Entry<string> SecondaryEffectColor;

		public static MelonPreferences_Entry<VariableEffects_Type> VariableEffects;

		public static MelonPreferences_Entry<float> ImpactFrameDuration;

		public static MelonPreferences_Category Cat_Ragdolls;

		public static MelonPreferences_Entry<RagdollsInMatches_Type> RagdollsInMatches;

		public static MelonPreferences_Entry<RagdollsOutsideMatches_Type> RagdollsOutsideMatches;

		public static MelonPreferences_Entry<int> CleanupInMatches;

		public static MelonPreferences_Entry<int> CleanupOutsideMatches;

		public static MelonPreferences_Entry<float> RagdollSoundsVolume;

		public static MelonPreferences_Entry<bool> EnableGhostification;

		public static MelonPreferences_Category Cat_Hidden;

		public static MelonPreferences_Entry<bool> DebugEnabled;

		public static MelonPreferences_Entry<bool> LegacyRagdollJank;

		public static MelonPreferences_Entry<bool> SmashBrosLaunch;

		public static void SetUpUI()
		{
			Cat_DramaticEffects = MelonPreferences.CreateCategory("DramaticEffects", "Dramatic Effects");
			Cat_DramaticEffects.SetFilePath("UserData/DieHarder/Config.cfg");
			DramaticEffectsInMatches = Cat_DramaticEffects.CreateEntry<EffectsInMatches_Type>("DramaticEffectsInMatches", EffectsInMatches_Type.OnRoundEnd, "In Matches", "", false, false, (ValueValidator)null, (string)null);
			DramaticEffectsOutsideMatches = Cat_DramaticEffects.CreateEntry<EffectsOutsideMatches_Type>("DramaticEffectsOutsideMatches", EffectsOutsideMatches_Type.Disabled, "Outside Matches", "", false, false, (ValueValidator)null, (string)null);
			IncludeStructureInImpact = Cat_DramaticEffects.CreateEntry<bool>("IncludeStructureInImpact", true, "Include Structure", "Include the structure that delivered the killing blow in the impact frame", false, false, (ValueValidator)null, (string)null);
			DramaticEffectsVolume = Cat_DramaticEffects.CreateEntry<float>("DramaticEffectsVolume", 1f, "Volume", "Volume multiplier for the dramatic sounds\n0-1; default is 1", false, false, (ValueValidator)null, (string)null);
			DramaticEffectsHaptics = Cat_DramaticEffects.CreateEntry<bool>("DramaticEffectsHaptics", true, "Enable Haptics", "Whether to shake the screen and vibrate controllers for dramatic effects\n(Takes into account in-game settings by default)", false, false, (ValueValidator)null, (string)null);
			PrimaryEffectColor = Cat_DramaticEffects.CreateEntry<string>("PrimaryEffectColor", "#000000", "Primary Color", "The color of the player/structure silhouettes during the impact frame\nUse \"Match\" to base it on winning/losing matches and rounds\nUse \"None\" to prevent silhouette-ing", false, false, (ValueValidator)null, (string)null);
			SecondaryEffectColor = Cat_DramaticEffects.CreateEntry<string>("SecondaryEffectColor", "Match", "Secondary Color", "The color of the background during dramatic effects\nUse \"Match\" to base it on winning/losing matches and rounds", false, false, (ValueValidator)null, (string)null);
			VariableEffects = Cat_DramaticEffects.CreateEntry<VariableEffects_Type>("VariableEffects", VariableEffects_Type.OverkillBias, "Variable Effects", "Whether to base the intensity of the effects on the power of the hit", false, false, (ValueValidator)null, (string)null);
			ImpactFrameDuration = Cat_DramaticEffects.CreateEntry<float>("ImpactFrameDuration", 500f, "Impact Frame Duration", "The time in milliseconds the freeze frame will last\nOnly applies when Variable Effects is disabled\n0ms - 1500ms", false, false, (ValueValidator)null, (string)null);
			Cat_Ragdolls = MelonPreferences.CreateCategory("Ragdolls", "Ragdolls");
			Cat_Ragdolls.SetFilePath("UserData/DieHarder/Config.cfg");
			RagdollsInMatches = Cat_Ragdolls.CreateEntry<RagdollsInMatches_Type>("RagdollsInMatches", RagdollsInMatches_Type.OnRoundEnd, "Spawning In Matches", "", false, false, (ValueValidator)null, (string)null);
			RagdollsOutsideMatches = Cat_Ragdolls.CreateEntry<RagdollsOutsideMatches_Type>("RagdollsOutsideMatches", RagdollsOutsideMatches_Type.OnDeath, "Spawning Outside Matches", (string)null, false, false, (ValueValidator)null, (string)null);
			CleanupInMatches = Cat_Ragdolls.CreateEntry<int>("CleanupInMatches", 1, "Cleanup In Matches", "When to remove ragdolls in matches\n0: Between matches\n1: Between rounds\n2 and above: Seconds until vanishing", false, false, (ValueValidator)null, (string)null);
			CleanupOutsideMatches = Cat_Ragdolls.CreateEntry<int>("CleanupOutsideMatches", 7, "Cleanup Outside Matches", "When to remove ragdolls outside matches\n0: On scene change\n1 and above: Seconds until vanishing", false, false, (ValueValidator)null, (string)null);
			RagdollSoundsVolume = Cat_Ragdolls.CreateEntry<float>("RagdollSoundsVolume", 0.5f, "Collision Volume", "Volume of sounds when ragdolls collide with the environment\n0-1; default is 0.5", false, false, (ValueValidator)null, (string)null);
			EnableGhostification = Cat_Ragdolls.CreateEntry<bool>("EnableGhostification", true, "Enable Ghost-ification", "Players that drop ragdolls can take on a ghostly form afterwards", false, false, (ValueValidator)null, (string)null);
			Cat_Hidden = MelonPreferences.CreateCategory("Hidden", "Hidden");
			Cat_Hidden.SetFilePath("UserData/DieHarder/Config.cfg");
			DebugEnabled = Cat_Hidden.CreateEntry<bool>("debug_mode_enabled", false, "debug mode enabled", "For use when TacoSlayer36 tells you to", false, false, (ValueValidator)null, (string)null);
			LegacyRagdollJank = Cat_Hidden.CreateEntry<bool>("LegacyRagdollJank", false, "legacy ragdoll jank", "Brings back the janky ragdolls of older versions", false, false, (ValueValidator)null, (string)null);
			SmashBrosLaunch = Cat_Hidden.CreateEntry<bool>("SmashBrosLaunch", false, "smash bros launch", "Launch ragdolls into the stratosphere", false, false, (ValueValidator)null, (string)null);
			UI.Register((MelonBase)(object)Core.Instance, (MelonPreferences_Category[])(object)new MelonPreferences_Category[2] { Cat_DramaticEffects, Cat_Ragdolls });
			Core.UIInit = true;
		}

		public static void OnMyPrefsSaved(string filePath)
		{
			if (filePath == "UserData/DieHarder/Config.cfg")
			{
				return;
			}
			if (Core.Instance.IsInMatch && CleanupInMatches.Value >= 2)
			{
				foreach (Ragdoll.RagdollPool value in Ragdoll.RagdollPools.Values)
				{
					foreach (Ragdoll poolItem in value.PoolItems)
					{
						poolItem.ClearAfter(CleanupInMatches.Value, ghostify: false);
					}
				}
			}
			else if (!Core.Instance.IsInMatch && CleanupOutsideMatches.Value >= 1)
			{
				foreach (Ragdoll.RagdollPool value2 in Ragdoll.RagdollPools.Values)
				{
					foreach (Ragdoll poolItem2 in value2.PoolItems)
					{
						poolItem2.ClearAfter(CleanupOutsideMatches.Value, ghostify: false);
					}
				}
			}
			if (!EnableGhostification.Value)
			{
				Enumerator<Player> enumerator5 = Singleton<PlayerManager>.Instance.AllPlayers.GetEnumerator();
				while (enumerator5.MoveNext())
				{
					Player current5 = enumerator5.Current;
					Ragdoll.UnGhostify(current5.Controller);
				}
			}
		}
	}
	public static class BuildInfo
	{
		public const string Name = "DieHarder";

		public const string Author = "TacoSlayer36";

		public const string Version = "2.0.11";

		public const string Description = "That death goes hard";
	}
	public class Core : MelonMod
	{
		public enum MatchResult
		{
			Undecided,
			Won,
			Lost,
			Tied
		}

		[CompilerGenerated]
		private sealed class <<OnLateInitializeMelon>g__checkForUI|71_1>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private string <error>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <<OnLateInitializeMelon>g__checkForUI|71_1>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<error>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!UIInit)
					{
						ForceDisabled = true;
						<error>5__1 = "Could not create UIFramework interface. Disabling DieHarder to prevent game-breaking bugs. Make sure you have the dependency installed";
						Debug.Log(<error>5__1, debugOnly: false, 2);
						MelonCoroutines.Start(delayedError(15f, <error>5__1));
						<error>5__1 = null;
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <<OnSceneWasLoaded>g__slight_delay|77_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <<OnSceneWasLoaded>g__slight_delay|77_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					MelonCoroutines.Start(<>4__this.C_ListenForLandButton("FlatLand"));
					MelonCoroutines.Start(<>4__this.C_ListenForLandButton("VoidLand"));
					MelonCoroutines.Start(<>4__this.C_GrabHowardStuff());
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass87_0
		{
			public PlayerController player;
		}

		[CompilerGenerated]
		private sealed class <C_GrabHowardStuff>d__78 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			private SkinnedMeshRenderer <howardSmr>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <C_GrabHowardStuff>d__78(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<howardSmr>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.Howard = GameObject.Find("INTERACTABLES/Howard").GetComponentInChildren<Howard>();
					<howardSmr>5__1 = Instance.HowardSmr;
					if ((Object)(object)<howardSmr>5__1 != (Object)null)
					{
						Instance.HowardMat = ((Renderer)<howardSmr>5__1).material;
						((Object)Instance.HowardMat).hideFlags = (HideFlags)61;
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <C_ListenForLandButton>d__79 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string landType;

			public Core <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <C_ListenForLandButton>d__79(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					GameObject obj = GameObject.Find(landType);
					if (obj != null)
					{
						obj.GetComponentInChildren<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
						{
							MelonCoroutines.Start(<>4__this.C_OnLandEntered());
						}));
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <C_OnLandEntered>d__80 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <C_OnLandEntered>d__80(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.ModObject_Parent.SetActive(true);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <delayedError>d__73 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float waitTime;

			public string msg;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <delayedError>d__73(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(waitTime);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Debug.Log(msg, debugOnly: false, 2);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public float AA_Drama = 3f;

		public bool GlobalInit = false;

		public static Core Instance;

		public static bool UIInit;

		public const string PreferredVersion = "0.5.0.7";

		public static bool ForceDisabled;

		public GameObject ModObject_Parent;

		public GameObject ModObject_Silhouettes;

		public GameObject ModObject_DramaticEffects;

		public GameObject ModObject_Ragdolls;

		public GameObject ModObject_DDOLParent;

		public AssetBundle AssetBundle;

		public static AudioCall PreImpactLight;

		public static AudioCall PreImpactMedium;

		public static AudioCall PreImpactHard;

		public static AudioCall ImpactLight;

		public static AudioCall ImpactMedium;

		public static AudioCall ImpactHard;

		public static AudioCall Buildup;

		private bool warnedAboutImpactAudio = false;

		private bool warnedAboutPreImpactAudio = false;

		private bool warnedAboutBuildupAudio = false;

		private bool warnedAboutRagdollAudioDir = false;

		private bool warnedAboutRagdollAudio = false;

		public bool HasRoundEnded = false;

		public bool WasMatchEnd = false;

		public List<PlayerController> PlayersKilledToGutter = new List<PlayerController>();

		public List<Pool<PooledMonoBehaviour>> StructurePools = new List<Pool<PooledMonoBehaviour>>();

		public List<StructureKillStorage> StructureKillStorages = new List<StructureKillStorage>();

		public static PlayerController LastDamagedPlayer;

		public Impact ActiveImpact;

		public Shockwave ActiveShockwave;

		public Shader ShockwaveShader;

		private Material _shockwaveMat;

		public Shader SilhouetteShader;

		private Material _primarySilhouetteMat;

		private Material _secondarySilhouetteMat;

		public Shader GhostShader;

		private Material _ghostMat;

		public const string UserDataPath = "UserData/DieHarder/";

		public const string RagdollAudioPath = "UserData/DieHarder/ragdoll_sounds/";

		public AudioClip ImpactAudioClip;

		public AudioClip PreImpactAudioClip;

		public List<AudioClip> RagdollAudioClipsSoft = new List<AudioClip>();

		public List<AudioClip> RagdollAudioClipsHard = new List<AudioClip>();

		public Dictionary<PlayerController, PlayerVisualsClone> PlayerSilhouettes = new Dictionary<PlayerController, PlayerVisualsClone>();

		public List<Impact> Impacts = new List<Impact>();

		private List<PlayerController> playersProcessedThisFrame = new List<PlayerController>();

		public Dictionary<PlayerController, Tuple<int, int>> PlayerDamages = new Dictionary<PlayerController, Tuple<int, int>>();

		public Howard Howard;

		private bool howardDied;

		public Material HowardMat = null;

		public List<CameraInfo> StoredCameraInfos = new List<CameraInfo>();

		public LayerMask VisualLayer = LayerMask.op_Implicit(12);

		public int PhysicsLayer = 16;

		public GameObject ModObject_DDOLRagdoll => ((Component)ModObject_DDOLParent.transform.GetChild(0)).gameObject;

		public bool DebugEnabled => Config.DebugEnabled.Value;

		public string CurrentScene
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				return ((Scene)(ref activeScene)).name;
			}
		}

		public bool IsInMatch => CurrentScene.Contains("Map") && Singleton<PlayerManager>.Instance.AllPlayers.Count >= 2;

		public Material ShockwaveMat
		{
			get
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Expected O, but got Unknown
				if ((Object)(object)_shockwaveMat == (Object)null)
				{
					_shockwaveMat = new Material(ShockwaveShader);
					((Object)_shockwaveMat).hideFlags = (HideFlags)61;
				}
				return _shockwaveMat;
			}
		}

		public Material PrimarySilhouetteMat
		{
			get
			{
				//IL_0043: 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_0023: Expected O, but got Unknown
				if ((Object)(object)_primarySilhouetteMat == (Object)null)
				{
					_primarySilhouetteMat = new Material(SilhouetteShader);
					((Object)_primarySilhouetteMat).hideFlags = (HideFlags)61;
				}
				_primarySilhouetteMat.color = Impact.GetColorFromSetting(Config.PrimaryEffectColor.Value, isPrimary: true);
				return _primarySilhouetteMat;
			}
		}

		public Material SecondarySilhouetteMat
		{
			get
			{
				//IL_0043: 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_0023: Expected O, but got Unknown
				if ((Object)(object)_secondarySilhouetteMat == (Object)null)
				{
					_secondarySilhouetteMat = new Material(SilhouetteShader);
					((Object)_secondarySilhouetteMat).hideFlags = (HideFlags)61;
				}
				_secondarySilhouetteMat.color = Impact.GetColorFromSetting(Config.SecondaryEffectColor.Value, isPrimary: false);
				return _secondarySilhouetteMat;
			}
		}

		public Material GhostMat
		{
			get
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Expected O, but got Unknown
				if ((Object)(object)_ghostMat == (Object)null)
				{
					_ghostMat = new Material(GhostShader);
					((Object)_ghostMat).hideFlags = (HideFlags)61;
				}
				return _ghostMat;
			}
		}

		public SkinnedMeshRenderer HowardSmr
		{
			get
			{
				if ((Object)(object)Howard != (Object)null)
				{
					Transform child = ((Component)Howard).transform.GetChild(2);
					if ((Object)(object)child != (Object)null)
					{
						return ((Component)child).GetComponentInChildren<SkinnedMeshRenderer>();
					}
				}
				return null;
			}
		}

		public LayerMask VisualLayerMask => LayerMask.op_Implicit(1 << LayerMask.op_Implicit(VisualLayer));

		public LayerMask PhysicsLayerMask => LayerMask.op_Implicit(1 << PhysicsLayer);

		public override void OnLateInitializeMelon()
		{
			if (Application.version != "0.5.0.7")
			{
				ForceDisabled = true;
				string text = "DieHarder was made for a different version of RUMBLE (0.5.0.7). It has been disabled to prevent game-breaking bugs";
				Debug.Log(text, debugOnly: false, 2);
				MelonCoroutines.Start(delayedError(15f, text));
				return;
			}
			Instance = this;
			((MelonEventBase<LemonAction<string>>)(object)MelonPreferences.OnPreferencesSaved).Subscribe((LemonAction<string>)Config.OnMyPrefsSaved, 0, false);
			if (!Directory.Exists("UserData/DieHarder/"))
			{
				Directory.CreateDirectory("UserData/DieHarder/");
			}
			AssetBundle = AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(HelperFunctions.LoadEmbeddedResource("DieHarder.assets.dieharder")));
			SilhouetteShader = AssetBundle.LoadAsset<Shader>("SolidColorUnlit");
			((Object)SilhouetteShader).hideFlags = (HideFlags)61;
			ShockwaveShader = AssetBundle.LoadAsset<Shader>("Shockwave");
			((Object)ShockwaveShader).hideFlags = (HideFlags)61;
			GhostShader = AssetBundle.LoadAsset<Shader>("Ghost");
			((Object)GhostShader).hideFlags = (HideFlags)61;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			populateUserDataIfNeeded("effect_sounds");
			populateUserDataIfNeeded("ragdoll_sounds");
			if (createAudioCall(ref PreImpactLight, "pre_impact", "-light") && createAudioCall(ref PreImpactMedium, "pre_impact", "-medium") && createAudioCall(ref PreImpactHard, "pre_impact", "-hard"))
			{
				flag = true;
			}
			if (createAudioCall(ref ImpactLight, "impact", "-light") && createAudioCall(ref ImpactMedium, "impact", "-medium") && createAudioCall(ref ImpactHard, "impact", "-hard"))
			{
				flag2 = true;
			}
			if (createAudioCall(ref Buildup, "buildup", ""))
			{
				flag3 = true;
			}
			if (!flag && !warnedAboutPreImpactAudio)
			{
				Debug.Log("Could not find audio files for Pre-Impact sound effect", debugOnly: false, 1);
				warnedAboutPreImpactAudio = true;
			}
			if (!flag2 && !warnedAboutImpactAudio)
			{
				Debug.Log("Could not find audio files for Impact sound effect", debugOnly: false, 1);
				warnedAboutImpactAudio = true;
			}
			if (!flag3 && !warnedAboutBuildupAudio)
			{
				Debug.Log("Could not find audio files for Buildup sound effect", debugOnly: false, 1);
				warnedAboutBuildupAudio = true;
			}
			MelonCoroutines.Start(checkForUI());
			Config.SetUpUI();
			[IteratorStateMachine(typeof(<<OnLateInitializeMelon>g__checkForUI|71_1>d))]
			static IEnumerator checkForUI()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<OnLateInitializeMelon>g__checkForUI|71_1>d(0);
			}
			static bool createAudioCall(ref AudioCall audioCall, string fileName, string suffix)
			{
				string text2 = "UserData/DieHarder//effect_sounds/" + fileName + suffix + ".wav";
				if (File.Exists(text2))
				{
					audioCall = AudioManager.CreateAudioCall(text2, 1f);
					return true;
				}
				text2 = "UserData/DieHarder//effect_sounds/" + fileName + ".wav";
				if (File.Exists(text2))
				{
					audioCall = AudioManager.CreateAudioCall(text2, 1f);
					return true;
				}
				return false;
			}
		}

		private static void populateUserDataIfNeeded(string folderName)
		{
			string text = "UserData/DieHarder//" + folderName + "/";
			if (Directory.Exists(text))
			{
				return;
			}
			Directory.CreateDirectory(text);
			Assembly assembly = typeof(Core).Assembly;
			IEnumerable<string> enumerable = from r in assembly.GetManifestResourceNames()
				where r.StartsWith("DieHarder.assets." + folderName + ".", StringComparison.OrdinalIgnoreCase)
				select r;
			foreach (string item in enumerable)
			{
				string path = item.Substring(("DieHarder.assets." + folderName + ".").Length);
				string path2 = Path.Combine(text, path);
				using Stream stream = assembly.GetManifestResourceStream(item);
				using FileStream destination = File.Create(path2);
				stream.CopyTo(destination);
			}
		}

		[IteratorStateMachine(typeof(<delayedError>d__73))]
		private static IEnumerator delayedError(float waitTime, string msg)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <delayedError>d__73(0)
			{
				waitTime = waitTime,
				msg = msg
			};
		}

		public override void OnUpdate()
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Invalid comparison between Unknown and I4
			if (ForceDisabled || !GlobalInit || !DebugEnabled)
			{
				return;
			}
			if (!Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)116))
			{
				ActiveImpact = CreateImpact(Singleton<PlayerManager>.Instance.localPlayer.Controller, AA_Drama);
			}
			if (Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)116) && (int)Singleton<PlayerManager>.Instance.LocalPlayer.Controller.PlayerSessionStateSystem.CurrentVRState == 0)
			{
				Ragdoll ragdoll = Ragdoll.SpawnRagdoll(Singleton<PlayerManager>.Instance.localPlayer.Controller, FindClosestStructure(Singleton<PlayerManager>.Instance.LocalPlayer.Controller), AA_Drama);
				if (Config.CleanupOutsideMatches.Value > 0)
				{
					ragdoll.UndoGhostOnClear = true;
					ragdoll.ClearAfter(Config.CleanupOutsideMatches.Value);
				}
			}
		}

		public override void OnFixedUpdate()
		{
			if (ForceDisabled || !GlobalInit)
			{
				return;
			}
			if (Time.timeSinceLevelLoad > 10f)
			{
				foreach (Ragdoll.RagdollPool value in Ragdoll.RagdollPools.Values)
				{
					if (value == null || (Object)(object)value.parentController == (Object)null || (Object)(object)((Component)value.parentController).gameObject == (Object)null)
					{
						if (value != null && (Object)(object)value.Transform != (Object)null && (Object)(object)((Component)value.Transform).gameObject != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)value.Transform).gameObject);
						}
						Ragdoll.RagdollPools.Remove(value.parentController);
					}
				}
			}
			if ((Object)(object)Howard != (Object)null && Howard.currentHp == 0f && !howardDied)
			{
				howardDied = true;
				ActiveImpact = CreateImpact(Singleton<PlayerManager>.Instance.LocalPlayer.Controller, 1f, howardInvolved: true);
			}
			if ((Object)(object)Howard != (Object)null && Howard.currentHp > 0f && howardDied)
			{
				howardDied = false;
			}
			if (Time.timeSinceLevelLoad > 10f)
			{
				foreach (PlayerVisualsClone value2 in PlayerSilhouettes.Values)
				{
					if ((Object)(object)value2 == (Object)null || (Object)(object)value2.ParentController == (Object)null || (Object)(object)((Component)value2.ParentController).gameObject == (Object)null)
					{
						try
						{
							Object.Destroy((Object)(object)((value2 != null) ? ((Component)value2).gameObject : null));
						}
						catch
						{
						}
						PlayerSilhouettes.Remove(value2?.ParentController);
					}
				}
			}
			StructureStorage.GameStates.Add(StructureStorage.GenerateStructureStorages());
			if (StructureStorage.GameStates.Count > 3)
			{
				StructureStorage.GameStates.Remove(StructureStorage.GameStates.First());
			}
			playersProcessedThisFrame.Clear();
			PlayerDamages.Clear();
		}

		public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
		{
			if (ForceDisabled)
			{
				return;
			}
			Impact.FogEndDistanceStorage = -1f;
			Ragdoll.PlayerMats.Clear();
			PlayerDamages.Clear();
			LastDamagedPlayer = null;
			foreach (KeyValuePair<Renderer, Material> miscMat in Ragdoll.MiscMats)
			{
				if ((Object)(object)miscMat.Key != (Object)null && (Object)(object)miscMat.Key.material != (Object)null)
				{
					miscMat.Key.material = miscMat.Value;
				}
			}
			Ragdoll.MiscMats.Clear();
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			if (ForceDisabled || sceneName == "Loader")
			{
				return;
			}
			ModObject_Parent = new GameObject("DieHarder");
			ModObject_Silhouettes = new GameObject("Silhouettes");
			ModObject_Silhouettes.transform.SetParent(ModObject_Parent.transform);
			ModObject_DramaticEffects = new GameObject("DramaticEffects");
			ModObject_DramaticEffects.transform.SetParent(ModObject_Parent.transform);
			ModObject_Ragdolls = new GameObject("Ragdolls");
			ModObject_Ragdolls.transform.SetParent(ModObject_Parent.transform);
			ActiveImpact?.CancelAnimation();
			PlayerDamages.Clear();
			PlayerSilhouettes.Clear();
			HasRoundEnded = false;
			PlayersKilledToGutter.Clear();
			Ragdoll.RagdollPools.Clear();
			Ragdoll.LocalHeadClippedMat = null;
			ActiveImpact = null;
			ActiveShockwave = null;
			if (sceneName == "Gym")
			{
				MelonCoroutines.Start(slight_delay());
				if (!GlobalInit)
				{
					RunGlobalInit();
				}
			}
			if (Directory.Exists("UserData/DieHarder/ragdoll_sounds/"))
			{
				if (Directory.GetFiles("UserData/DieHarder/ragdoll_sounds/").Length == 0)
				{
					if (!warnedAboutRagdollAudio)
					{
						Debug.Log("Did not find any ragdoll sounds in ragdoll_sounds folder", debugOnly: false, 1);
						warnedAboutRagdollAudio = true;
					}
					return;
				}
				string[] files = Directory.GetFiles("UserData/DieHarder/ragdoll_sounds/");
				foreach (string text in files)
				{
					AudioClip val = AudioManager.LoadWavFile(text);
					((Object)val).hideFlags = (HideFlags)61;
					if (text.Contains("soft"))
					{
						RagdollAudioClipsSoft.Add(val);
					}
					else
					{
						RagdollAudioClipsHard.Add(val);
					}
				}
			}
			else if (!warnedAboutRagdollAudioDir)
			{
				Debug.Log("Did not find ragdoll_sounds folder", debugOnly: false, 1);
				warnedAboutRagdollAudioDir = true;
			}
			[IteratorStateMachine(typeof(<<OnSceneWasLoaded>g__slight_delay|77_0>d))]
			IEnumerator slight_delay()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<OnSceneWasLoaded>g__slight_delay|77_0>d(0)
				{
					<>4__this = this
				};
			}
		}

		[IteratorStateMachine(typeof(<C_GrabHowardStuff>d__78))]
		private IEnumerator C_GrabHowardStuff()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <C_GrabHowardStuff>d__78(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<C_ListenForLandButton>d__79))]
		private IEnumerator C_ListenForLandButton(string landType)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <C_ListenForLandButton>d__79(0)
			{
				<>4__this = this,
				landType = landType
			};
		}

		[IteratorStateMachine(typeof(<C_OnLandEntered>d__80))]
		private IEnumerator C_OnLandEntered()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <C_OnLandEntered>d__80(0)
			{
				<>4__this = this
			};
		}

		public void RunGlobalInit()
		{
			if (!ForceDisabled)
			{
				fetchStructurePools();
				ModObject_DDOLParent = Object.Instantiate<GameObject>(AssetBundle.LoadAsset<GameObject>("DieHarderDDOL"));
				((Object)ModObject_DDOLParent).name = "DieHarderDDOL";
				Object.DontDestroyOnLoad((Object)(object)ModObject_DDOLParent);
				((Component)ModObject_DDOLParent.transform.GetChild(0)).gameObject.SetActive(false);
				GlobalInit = true;
			}
		}

		public void DetermineIfMatchEnd(PlayerController damagedPlayer = null)
		{
			bool wasMatchEnd = false;
			if ((Object)(object)Singleton<MatchHandler>.instance == (Object)null)
			{
				WasMatchEnd = false;
				return;
			}
			int currentRound = Singleton<MatchHandler>.instance.CurrentRound;
			bool flag = Instance.GetMatchResultEdgeCase(damagedPlayer) == MatchResult.Won;
			List<int> list = ((IEnumerable<int>)Singleton<MatchHandler>.instance.RoundsWonList).ToList();
			switch (currentRound)
			{
			case 0:
				wasMatchEnd = false;
				break;
			case 1:
				wasMatchEnd = (list[0] == 1 && flag) || (list[0] == 0 && !flag);
				break;
			case 2:
				wasMatchEnd = true;
				break;
			}
			WasMatchEnd = wasMatchEnd;
		}

		public MatchResult GetMatchResult()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Invalid comparison between Unknown and I4
			bool flag = true;
			bool flag2 = false;
			if (Singleton<PlayerManager>.Instance.LocalPlayer != null)
			{
				flag = Singleton<PlayerManager>.Instance.LocalPlayer.Data.HealthPoints == 0;
			}
			Enumerator<Player> enumerator = Singleton<PlayerManager>.Instance.AllPlayers.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Player current = enumerator.Current;
				if ((int)current.Controller.controllerType != 1 && current.Data.HealthPoints == 0)
				{
					flag2 = true;
				}
			}
			if (flag && !flag2)
			{
				return MatchResult.Lost;
			}
			if (flag && flag2)
			{
				return MatchResult.Tied;
			}
			if (!flag && flag2)
			{
				return MatchResult.Won;
			}
			return MatchResult.Undecided;
		}

		public MatchResult GetMatchResult(PlayerController damagedPlayer)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			if ((Object)(object)damagedPlayer == (Object)null)
			{
				return MatchResult.Undecided;
			}
			if ((int)damagedPlayer.controllerType == 1)
			{
				return MatchResult.Lost;
			}
			return MatchResult.Won;
		}

		public MatchResult GetMatchResultEdgeCase(PlayerController damagedPlayer = null)
		{
			if (Singleton<PlayerManager>.Instance.AllPlayers.Count < 2)
			{
				return MatchResult.Won;
			}
			MatchResult matchResult = GetMatchResult();
			if (matchResult == MatchResult.Undecided)
			{
				if ((Object)(object)damagedPlayer != (Object)null)
				{
					matchResult = GetMatchResult(damagedPlayer);
				}
				else if ((Object)(object)LastDamagedPlayer != (Object)null)
				{
					matchResult = GetMatchResult(LastDamagedPlayer);
				}
			}
			return matchResult;
		}

		private void fetchStructurePools()
		{
			foreach (Pool<PooledMonoBehaviour> item in (Il2CppArrayBase<Pool<PooledMonoBehaviour>>)(object)Singleton<PoolManager>.instance.availablePools)
			{
				string name = ((Object)item.PoolParent).name;
				if (name.Contains("RUMBLE.MoveSystem.Structure") && !name.Contains("StructureTarget"))
				{
					StructurePools.Add(item);
				}
			}
		}

		public void ProcessNewPlayer(PlayerController player)
		{
			<>c__DisplayClass87_0 CS$<>8__locals0 = new <>c__DisplayClass87_0();
			CS$<>8__locals0.player = player;
			if (!playersProcessedThisFrame.Contains(CS$<>8__locals0.player))
			{
				playersProcessedThisFrame.Add(CS$<>8__locals0.player);
				MelonCoroutines.Start(_());
			}
			[IteratorStateMachine(typeof(<>c__DisplayClass87_0.<<ProcessNewPlayer>g___|0>d))]
			IEnumerator _()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <>c__DisplayClass87_0.<<ProcessNewPlayer>g___|0>d(0)
				{
					<>4__this = CS$<>8__locals0
				};
			}
		}

		public float CalculateDrama(PlayerController player, StructureStorage closestStructure)
		{
			//IL_0059: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			if (Config.VariableEffects.Value == Config.VariableEffects_Type.Disabled)
			{
				return 1f;
			}
			if (PlayersKilledToGutter.Contains(player))
			{
				Vector3 velocity = player.PlayerPhysics.physicsRigidbody.velocity;
				float magnitude = ((Vector3)(ref velocity)).magnitude;
				return magnitude / 10f;
			}
			if (player.GetStandingPosition().y < -40f)
			{
				return 1f;
			}
			float num = GetPlayerDamage(player, closestStructure);
			float num2 = GetPlayerOverkill(player, closestStructure);
			if (Config.VariableEffects.Value == Config.VariableEffects_Type.OverkillBias)
			{
				num2 *= 1.5f;
			}
			num += num2;
			return Mathf.Clamp((num - 1f) / 3f, 0f, float.MaxValue);
		}

		public void PlayBlendedAudio(Vector3 pos, bool preImpact, float drama = 1f)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: 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)
			if (drama < 0f)
			{
				return;
			}
			float num;
			float num2;
			float num3;
			if (drama <= 1f)
			{
				num = 0f;
				num2 = drama;
				num3 = 1f - num2;
			}
			else if (drama <= 2f)
			{
				num = drama - 1f;
				num2 = 1f - num;
				num3 = 0f;
			}
			else
			{
				num = 1f;
				num2 = 0f;
				num3 = 0f;
			}
			num *= Config.DramaticEffectsVolume.Value * 0.8f;
			num2 *= Config.DramaticEffectsVolume.Value;
			num3 *= Config.DramaticEffectsVolume.Value * 0.8f;
			AudioSource audioSource;
			AudioSource audioSource2;
			AudioSource audioSource3;
			try
			{
				GeneralAudioSettings val = new GeneralAudioSettings();
				val.Pitch = 1f;
				val.SetVolume(num3);
				if ((Object)(object)ImpactLight != (Object)null)
				{
					ImpactLight.generalSettings = val;
				}
				if ((Object)(object)PreImpactLight != (Object)null)
				{
					PreImpactLight.generalSettings = new GeneralAudioSettings(((Il2CppObjectBase)val).Pointer);
				}
				GeneralAudioSettings val2 = new GeneralAudioSettings();
				val2.Pitch = 1f;
				val2.SetVolume(num2);
				if ((Object)(object)ImpactMedium != (Object)null)
				{
					ImpactMedium.generalSettings = val2;
				}
				if ((Object)(object)PreImpactMedium != (Object)null)
				{
					PreImpactMedium.generalSettings = val2;
				}
				GeneralAudioSettings val3 = new GeneralAudioSettings();
				val3.Pitch = 1f;
				val3.SetVolume(num);
				if ((Object)(object)ImpactHard != (Object)null)
				{
					ImpactHard.generalSettings = val3;
				}
				if ((Object)(object)ImpactMedium != (Object)null)
				{
					PreImpactHard.generalSettings = val3;
				}
				if (preImpact)
				{
					audioSource = AudioManager.PlaySound(PreImpactLight, pos, false).AudioSource;
					audioSource2 = AudioManager.PlaySound(PreImpactMedium, pos, false).AudioSource;
					audioSource3 = AudioManager.PlaySound(PreImpactHard, pos, false).AudioSource;
				}
				else
				{
					audioSource = AudioManager.PlaySound(ImpactLight, pos, false).AudioSource;
					audioSource2 = AudioManager.PlaySound(ImpactMedium, pos, false).AudioSource;
					audioSource3 = AudioManager.PlaySound(ImpactHard, pos, false).AudioSource;
				}
			}
			catch
			{
				return;
			}
			AnimationCurve val4 = AnimationCurve.Linear(0f, 1f, 1f, 1f);
			RemoveAudioFalloff(audioSource);
			RemoveAudioFalloff(audioSource2);
			RemoveAudioFalloff(audioSource3);
		}

		public static void RemoveAudioFalloff(AudioSource audioSource)
		{
			if (!((Object)(object)audioSource == (Object)null))
			{
				AnimationCurve val = AnimationCurve.Linear(0f, 1f, 1f, 1f);
				audioSource.rolloffMode = (AudioRolloffMode)2;
				audioSource.SetCustomCurve((AudioSourceCurveType)0, val);
			}
		}

		public void OnPlayerDamage(PlayerController player, int newHealth, int previousHealth)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Invalid comparison between Unknown and I4
			if ((Object)(object)player == (Object)null || (int)player.PlayerSessionStateSystem.CurrentVRState > 0)
			{
				return;
			}
			int num = previousHealth - newHealth;
			if (((IsInMatch && Config.RagdollsInMatches.Value >= Config.RagdollsInMatches_Type.OnHit) || (!IsInMatch && Config.RagdollsOutsideMatches.Value >= Config.RagdollsOutsideMatches_Type.OnHit)) && num > 0)
			{
				StructureStorage structureStorage = FindClosestStructure(player);
				float drama = 0.3f;
				if (player.assignedPlayer.Data.HealthPoints == 0)
				{
					drama = CalculateDrama(player, structureStorage);
				}
				if ((IsInMatch && Config.RagdollsInMatches.Value < Config.RagdollsInMatches_Type.PerDamage) || (!IsInMatch && Config.RagdollsOutsideMatches.Value < Config.RagdollsOutsideMatches_Type.PerDamage))
				{
					num = 1;
				}
				for (int i = 0; i < num; i++)
				{
					if ((int)player.PlayerSessionStateSystem.CurrentVRState == 0)
					{
						Ragdoll ragdoll = Ragdoll.SpawnRagdoll(player, structureStorage, drama);
						ragdoll.Hit(structureStorage);
						if (IsInMatch && Config.CleanupInMatches.Value >= 2)
						{
							ragdoll.ClearAfter(Config.CleanupInMatches.Value, ghostify: false);
						}
						else if (!IsInMatch && Config.CleanupOutsideMatches.Value > 0)
						{
							ragdoll.ClearAfter(Config.CleanupOutsideMatches.Value, ghostify: false);
						}
					}
				}
			}
			PlayerDamages[player] = new Tuple<int, int>(num, previousHealth);
		}

		public void OnPlayerHealthDepleted(PlayerHealth playerHealth)
		{
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_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)
			if (IsInMatch && HasRoundEnded)
			{
				return;
			}
			if (IsInMatch)
			{
				HasRoundEnded = true;
			}
			if ((Object)(object)playerHealth == (Object)null)
			{
				return;
			}
			PlayerController val = (LastDamagedPlayer = ((PlayerControllerSubsystem)playerHealth).ParentController);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			bool howardInvolved = false;
			if ((Object)(object)Howard != (Object)null && (Object)(object)Howard.playerControllerInRange != (Object)null)
			{
				howardInvolved = true;
			}
			DetermineIfMatchEnd(val);
			if (CurrentScene == "Map0")
			{
				Vector3 standingPosition = val.GetStandingPosition();
				Vector3 val2 = new Vector3(standingPosition.x, 0f, standingPosition.z);
				float magnitude = ((Vector3)(ref val2)).magnitude;
				if (val.GetStandingPosition().y <= -0.09f || magnitude >= 12f)
				{
					PlayersKilledToGutter.Add(val);
				}
			}
			StructureStorage closestStructure = FindClosestStructure(val);
			float drama = CalculateDrama(val, closestStructure);
			if (IsInMatch)
			{
				if (Config.DramaticEffectsInMatches.Value == Config.EffectsInMatches_Type.OnRoundEnd)
				{
					ActiveImpact = CreateImpact(val, drama, howardInvolved);
				}
				if (Config.DramaticEffectsInMatches.Value == Config.EffectsInMatches_Type.OnMatchEnd && WasMatchEnd)
				{
					ActiveImpact = CreateImpact(val, drama, howardInvolved);
				}
			}
			else if (Config.DramaticEffectsOutsideMatches.Value == Config.EffectsOutsideMatches_Type.OnDeath)
			{
				ActiveImpact = CreateImpact(val, drama, howardInvolved);
			}
			if ((Object)(object)ActiveImpact == (Object)null)
			{
				CreateRagdollIfNecessary(val, closestStructure, drama);
			}
		}

		public void CreateRagdollIfNecessary(PlayerController damagedPlayer, StructureStorage closestStructure = null, float drama = 1f)
		{
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: 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_00d1: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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: Invalid comparison between Unknown and I4
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			if (closestStructure == null)
			{
				closestStructure = FindClosestStructure(damagedPlayer);
			}
			Ragdoll ragdoll = null;
			if (IsInMatch)
			{
				if (((Config.RagdollsInMatches.Value == Config.RagdollsInMatches_Type.OnMatchEnd && WasMatchEnd) || Config.RagdollsInMatches.Value == Config.RagdollsInMatches_Type.OnRoundEnd) && (int)damagedPlayer.PlayerSessionStateSystem.CurrentVRState == 0)
				{
					ragdoll = Ragdoll.SpawnRagdoll(damagedPlayer, closestStructure, drama);
					ragdoll.Hit(closestStructure);
					ragdoll.UndoGhostOnClear = true;
					if (Config.CleanupInMatches.Value >= 2)
					{
						ragdoll.ClearAfter(Config.CleanupInMatches.Value);
					}
					else
					{
						ragdoll.GhostifyOwner();
					}
				}
			}
			else if (Config.RagdollsOutsideMatches.Value == Config.RagdollsOutsideMatches_Type.OnDeath && (int)damagedPlayer.PlayerSessionStateSystem.CurrentVRState == 0)
			{
				ragdoll = Ragdoll.SpawnRagdoll(damagedPlayer, closestStructure, drama);
				ragdoll.Hit(closestStructure);
				if (Config.CleanupOutsideMatches.Value > 0)
				{
					ragdoll.UndoGhostOnClear = true;
					ragdoll.ClearAfter(Config.CleanupOutsideMatches.Value);
				}
			}
			if (!Config.SmashBrosLaunch.Value || !((Object)(object)ragdoll != (Object)null))
			{
				return;
			}
			ragdoll.DoSmashLaunch = true;
			Vector3 val = Vector3.zero;
			Vector3 val2;
			if (closestStructure != null)
			{
				val2 = ragdoll.Chest.position - closestStructure.Pos;
				val = ((Vector3)(ref val2)).normalized;
			}
			else
			{
				try
				{
					PlayerController parentController = GetInvolvedPlayers(damagedPlayer)[0].ParentController;
					PlayerController parentController2 = GetInvolvedPlayers(damagedPlayer)[1].ParentController;
					if ((int)parentController.controllerType == 1)
					{
						val2 = ragdoll.Chest.position - parentController2.GetStandingPosition();
						val = ((Vector3)(ref val2)).normalized;
					}
					else
					{
						val2 = ragdoll.Chest.position - parentController.GetStandingPosition();
						val = ((Vector3)(ref val2)).normalized;
					}
				}
				catch
				{
				}
			}
			ragdoll.SmashLaunchDir = new Vector3(val.x, 1.6f, val.z);
		}

		public int GetPlayerDamage(PlayerController player, StructureStorage closestStructure)
		{
			int num = 0;
			int num2 = 0;
			if (PlayerDamages.ContainsKey(player))
			{
				num = PlayerDamages[player].Item1;
				num2 = PlayerDamages[player].Item2;
			}
			int num3 = ((closestStructure != null) ? closestStructure.StructureComponent.GetTotalTier() : 0);
			return Mathf.Max(num, num3);
		}

		public int GetPlayerOverkill(PlayerController player, StructureStorage closestStructure)
		{
			int num = 0;
			int num2 = 0;
			if (PlayerDamages.ContainsKey(player))
			{
				num = GetPlayerDamage(player, closestStructure);
				num2 = PlayerDamages[player].Item2;
			}
			int num3 = player.assignedPlayer.Data.HealthPoints - num;
			int result = 0;
			if (num3 < 0)
			{
				result = Math.Abs(num3);
			}
			return result;
		}

		public PlayerVisualsClone FindOrCreateSilhouette(PlayerController player)
		{
			if (PlayerSilhouettes.ContainsKey(player))
			{
				return PlayerSilhouettes[player];
			}
			return Impact.CreatePlayerSilhouette(player);
		}

		public List<PlayerVisualsClone> GetInvolvedPlayers(PlayerController damagedPlayer)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Invalid comparison between Unknown and I4
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Invalid comparison between Unknown and I4
			List<PlayerVisualsClone> list = new List<PlayerVisualsClone>();
			if (IsInMatch)
			{
				if (PlayerSilhouettes.Count > 0)
				{
					list.Add(FindOrCreateSilhouette(Singleton<PlayerManager>.Instance.AllPlayers[0].Controller));
				}
				if (PlayerSilhouettes.Count > 1)
				{
					list.Add(FindOrCreateSilhouette(Singleton<PlayerManager>.Instance.AllPlayers[1].Controller));
				}
			}
			else
			{
				if (PlayerSilhouettes.Count > 0)
				{
					list.Add(FindOrCreateSilhouette(damagedPlayer));
				}
				if ((int)damagedPlayer.controllerType != 1)
				{
					list.Add(FindOrCreateSilhouette(Singleton<PlayerManager>.instance.localPlayer.Controller));
				}
			}
			List<PlayerVisualsClone> list2 = new List<PlayerVisualsClone>();
			foreach (PlayerVisualsClone item in list)
			{
				if ((int)item.ParentController.PlayerSessionStateSystem.CurrentVRState > 0)
				{
					list2.Add(item);
				}
			}
			foreach (PlayerVisualsClone item2 in list2)
			{
				list.Remove(item2);
			}
			return list;
		}

		public void CreateShockwave(Vector3 pos, PlayerController damagedPlayer, float drama = 1f, bool howardInvolved = false)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Shockwave");
			val.transform.SetParent(ModObject_DramaticEffects.transform);
			val.transform.position = pos;
			ActiveShockwave = val.AddComponent<Shockwave>();
			ActiveShockwave.DamagedPlayer = damagedPlayer;
			ActiveShockwave.HowardInvolved = howardInvolved;
			ActiveShockwave.Drama = drama;
			ActiveShockwave.SetUp();
		}

		public Impact CreateImpact(PlayerController damagedPlayer, float drama = 1f, bool howardInvolved = false)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)damagedPlayer == (Object)null)
			{
				return null;
			}
			GameObject val = new GameObject("Impact");
			val.transform.SetParent(ModObject_DramaticEffects.transform);
			Impact impact = val.AddComponent<Impact>();
			impact.HowardInvolved = howardInvolved;
			impact.Drama = drama;
			Impacts.Add(impact);
			impact.InvolvedPlayers = GetInvolvedPlayers(damagedPlayer);
			impact.DamagedPlayer = Impact.CreatePlayerSilhouette(damagedPlayer);
			if (!howardInvolved)
			{
				StructureStorage involvedStructure = FindClosestStructure(damagedPlayer);
				impact.InvolvedStructure = involvedStructure;
			}
			if ((Object)(object)ActiveImpact != (Object)null)
			{
				ActiveImpact.CancelAnimation();
				Object.Destroy((Object)(object)ActiveImpact);
			}
			ActiveImpact = impact;
			impact.RunAnimation();
			return impact;
		}

		public StructureStorage FindClosestStructure(PlayerController damagedPlayer)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = damagedPlayer.GetChest().position;
			return FindClosestStructure(position);
		}

		public StructureStorage FindClosestStructure(Vector3 pos)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return (StructureStorage.GameStates.Last()?.Where((StructureStorage obj) => Vector3.Distance(obj.Pos, pos) <= 3f).ToList())?.OrderBy((StructureStorage obj) => Vector3.Distance(obj.Pos, pos))?.FirstOrDefault();
		}

		public static List<CameraInfo> GenerateCamInfos()
		{
			List<CameraInfo> list = new List<CameraInfo>();
			list.Add(new CameraInfo(Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera())
			{
				IsVRCam = true
			});
			list.Add(new CameraInfo(Singleton<RecordingCamera>.Instance.LegacyCamera)
			{
				IsRecordingCam = true
			});
			LCKTabletUtility lckTablet = Singleton<PlayerManager>.Instance.LocalPlayer.Controller.PlayerLIV.LckTablet;
			if ((Object)(object)lckTablet != (Object)null)
			{
				list.Add(new CameraInfo(lckTablet.firstPersonCamera._camera));
				list.Add(new CameraInfo(lckTablet.selfieCamera._camera));
				list.Add(new CameraInfo(lckTablet.thirdPersonCamera._camera));
			}
			return list;
		}
	}
	public static class Debug
	{
		public static bool debugMode => Core.Instance.DebugEnabled;

		public static GameObject DebugUi { get; private set; }

		public static TextMeshPro DebugUiText { get; private set; }

		public static void Log(string message, bool debugOnly = false, int logLevel = 0)
		{
			if (!debugOnly || debugMode)
			{
				switch (logLevel)
				{
				case 1:
					Melon<Core>.Logger.Warning("Warn: " + message);
					break;
				case 2:
					Melon<Core>.Logger.Error("Error: " + message);
					break;
				default:
					Melon<Core>.Logger.Msg(message);
					break;
				}
			}
		}

		public static void PrintInGame(string message)
		{
			if (DebugUi != null)
			{
				((TMP_Text)DebugUiText).enableWordWrapping = false;
				((TMP_Text)DebugUiText).text = message;
			}
			else
			{
				Log("Can't print message: \"" + message + "\" to debug ui. Not created and assigned", debugOnly: true, 2);
			}
		}
	}
	public class CameraInfo
	{
		public int CullingMask;

		public Camera ParentComponent;

		public Vector3 FreezePos;

		public Quaternion FreezeRot;

		public float NearClipPlane;

		public bool IsFirstPerson = true;

		public bool IsVRCam = false;

		public bool IsRecordingCam = false;

		public CameraInfo(Camera camera)
		{
			//IL_0037: 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_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)
			CullingMask = camera.cullingMask;
			ParentComponent = camera;
			FreezePos = ((Component)camera).transform.position;
			FreezeRot = ((Component)camera).transform.rotation;
			NearClipPlane = camera.nearClipPlane;
			if ((Object)(object)ParentComponent != (Object)null)
			{
				IsFirstPerson = ParentComponent.IsFirstPerson();
			}
		}
	}
	[RegisterTypeInIl2Cpp]
	public class Impact : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <C_RunAnimation>d__25 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Impact <>4__this;

			private bool <howardDied>5__1;

			private List<CameraInfo>.Enumerator <>s__2;

			private CameraInfo <cameraInfo>5__3;

			private Camera <parentComponent>5__4;

			private LckStabilizer <stabilizer>5__5;

			private List<PlayerVisualsClone>.Enumerator <>s__6;

			private PlayerVisualsClone <playerSilhouette>5__7;

			private SkinnedMeshRenderer <howardSmr>5__8;

			private Vector3 <howardPos>5__9;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <C_RunAnimation>d__25(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__2 = default(List<CameraInfo>.Enumerator);
				<cameraInfo>5__3 = null;
				<parentComponent>5__4 = null;
				<stabilizer>5__5 = null;
				<>s__6 = default(List<PlayerVisualsClone>.Enumerator);
				<playerSilhouette>5__7 = null;
				<howardSmr>5__8 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0532: Unknown result type (might be due to invalid IL or missing references)
				//IL_0537: Unknown result type (might be due to invalid IL or missing references)
				//IL_0541: Unknown result type (might be due to invalid IL or missing references)
				//IL_0546: Unknown result type (might be due to invalid IL or missing references)
				//IL_054b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0556: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f8: 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_0375: Unknown result type (might be due to invalid IL or missing references)
				//IL_043f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0449: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (<>4__this.IsAnimationRunning)
					{
						<>4__this.CancelAnimation();
					}
					<>4__this.IsAnimationRunning = true;
					Core.Instance.StoredCameraInfos = Core.GenerateCamInfos();
					<>s__2 = Core.Instance.StoredCameraInfos.GetEnumerator();
					try
					{
						while (<>s__2.MoveNext())
						{
							<cameraInfo>5__3 = <>s__2.Current;
							<parentComponent>5__4 = <cameraInfo>5__3.ParentComponent;
							<parentComponent>5__4.cullingMask = LayerMask.op_Implicit(Core.Instance.VisualLayerMask);
							if (<cameraInfo>5__3.IsRecordingCam)
							{
								<parentComponent>5__4.nearClipPlane = 0.05f;
							}
							if (<cameraInfo>5__3.IsRecordingCam)
							{
								((Behaviour)((Component)<cameraInfo>5__3.ParentComponent).GetComponent<RecordingCamera>()).enabled = false;
							}
							<stabilizer>5__5 = ((Component)<cameraInfo>5__3.ParentComponent).GetComponentInParent<LckStabilizer>();
							if ((Object)(object)<stabilizer>5__5 != (Object)null)
							{
								((Behaviour)<stabilizer>5__5).enabled = false;
							}
							<parentComponent>5__4 = null;
							<stabilizer>5__5 = null;
							<cameraInfo>5__3 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__2).Dispose();
					}
					<>s__2 = default(List<CameraInfo>.Enumerator);
					if (FogEndDistanceStorage == -1f)
					{
						FogEndDistanceStorage = RenderSettings.fogEndDistance;
					}
					RenderSettings.fogEndDistance = 10000f;
					((Behaviour)Singleton<PlayerManager>.Instance.localPlayer.Controller.GetCamera()).enabled = false;
					<>s__6 = <>4__this.InvolvedPlayers.GetEnumerator();
					try
					{
						while (<>s__6.MoveNext())
						{
							<playerSilhouette>5__7 = <>s__6.Current;
							<playerSilhouette>5__7.CopyPose();
							<playerSilhouette>5__7.Visuals.SetActive(true);
							if ((Object)(object)<playerSilhouette>5__7.Camera != (Object)null)
							{
								((Behaviour)<playerSilhouette>5__7.Camera).enabled = true;
							}
							if ((Object)(object)<playerSilhouette>5__7.AudioListener != (Object)null)
							{
								((Behaviour)<playerSilhouette>5__7.AudioListener).enabled = true;
							}
							<playerSilhouette>5__7 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__6).Dispose();
					}
					<>s__6 = default(List<PlayerVisualsClone>.Enumerator);
					if (<>4__this.HowardInvolved)
					{
						<howardSmr>5__8 = Core.Instance.HowardSmr;
						if ((Object)(object)<howardSmr>5__8 != (Object)null)
						{
							if (Config.PrimaryEffectColor.Value.ToLower() != "none")
							{
								((Renderer)<howardSmr>5__8).material = Core.Instance.PrimarySilhouetteMat;
							}
							((Component)<howardSmr>5__8).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer);
						}
						<howardSmr>5__8 = null;
					}
					if (Config.IncludeStructureInImpact.Value && <>4__this.InvolvedStructure != null)
					{
						<>4__this.CreateStructureSilhouette(<>4__this.InvolvedStructure);
					}
					<>4__this.CreateSphereBackground();
					Core.Instance.PlayBlendedAudio(<>4__this.DamagePos, preImpact: true, <>4__this.Drama);
					if (Config.VariableEffects.Value <= Config.VariableEffects_Type.Disabled)
					{
						<>4__this.waitTime = Config.ImpactFrameDuration.Value / 1000f;
					}
					else
					{
						<>4__this.waitTime = 0.5f * Mathf.Pow(<>4__this.Drama, 1.7f);
						<>4__this.waitTime = Mathf.Clamp(<>4__this.waitTime, 0f, 2f);
					}
					if (<>4__this.waitTime > 0f)
					{
						<>4__this.frozen = true;
						<>2__current = (object)new WaitForSeconds(<>4__this.waitTime);
						<>1__state = 1;
						return true;
					}
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				<>4__this.frozen = false;
				<howardDied>5__1 = false;
				if (<>4__this.HowardInvolved && (Object)(object)Core.Instance.Howard != (Object)null && Core.Instance.Howard.currentHp == 0f)
				{
					<howardDied>5__1 = true;
				}
				if (!<>4__this.HowardInvolved || (<>4__this.HowardInvolved && !<howardDied>5__1) || (Object)(object)Core.Instance.HowardSmr == (Object)null)
				{
					Core.Instance.CreateShockwave(<>4__this.DamagePos, <>4__this.DamagedPlayer.ParentController, <>4__this.Drama);
				}
				else
				{
					<howardPos>5__9 = ((Component)Core.Instance.HowardSmr).transform.position + Vector3.up * 0.8f;
					Core.Instance.CreateShockwave(<howardPos>5__9, <>4__this.DamagedPlayer.ParentController, 1f, howardInvolved: true);
				}
				if (!<>4__this.HowardInvolved || (<>4__this.HowardInvolved && !<howardDied>5__1))
				{
					Core.Instance.CreateRagdollIfNecessary(<>4__this.DamagedPlayer.ParentController, null, <>4__this.Drama);
				}
				ScreenFlash.CreateScreenFlash(((Component)Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()).transform, LayerMask.NameToLayer("PlayerController"));
				if (Config.DramaticEffectsHaptics.Value)
				{
					<>4__this.PlayerHaptics.AddHapticsSignal(1f, 1f, 1f);
				}
				<>4__this.CancelAnimation(strong: false);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public List<PlayerVisualsClone> InvolvedPlayers = new List<PlayerVisualsClone>();

		public StructureStorage InvolvedStructure;

		public List<GameObject> StructureSilhouettes = new List<GameObject>();

		public GameObject SphereBackground;

		public PlayerVisualsClone DamagedPlayer;

		private PlayerHaptics PlayerHaptics = Singleton<PlayerManager>.instance.localPlayer.Controller.PlayerHaptics;

		public float Drama = 1f;

		private bool playedRumbleAudio = false;

		private AudioSource activeRumbleAudio;

		private bool frozen = false;

		private float waitTime = 0.5f;

		private float waitedTime = 0f;

		public bool LivPlayersActive = true;

		public bool HowardInvolved = false;

		private object AnimationCoroutine;

		public static object StructureKillRoutine;

		public bool IsAnimationRunning = false;

		public static float FogEndDistanceStorage = -1f;

		public Vector3 DamagePos => (InvolvedStructure != null) ? ((InvolvedStructure.Pos + DamagedPlayer.ParentController.GetChest().position) / 2f) : DamagedPlayer.ParentController.GetChest().position;

		public static Color GetColorFromSetting(string colorString, bool isPrimary)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_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_0051: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (colorString.ToLower() == "match")
			{
				Color val = (Color)(Core.Instance.GetMatchResultEdgeCase() switch
				{
					Core.MatchResult.Won => Color.green, 
					Core.MatchResult.Lost => Color.red, 
					Core.MatchResult.Tied => Color.yellow, 
					_ => Color.gray, 
				});
				if (!isPrimary && Config.PrimaryEffectColor.Value == "match" && Config.SecondaryEffectColor.Value == "match")
				{
					((Color)(ref val))..ctor(val.r * 0.8f, val.g * 0.8f, val.b * 0.8f);
				}
				return val;
			}
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(colorString, ref result))
			{
				return result;
			}
			return isPrimary ? Color.white : Color.black;
		}

		private void Update()
		{
			if (frozen)
			{
				waitedTime += Time.deltaTime;
				runRumbleEffect();
			}
			freezeCameras();
		}

		private void runRumbleEffect()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (waitTime <= 0.8f)
			{
				return;
			}
			if (!playedRumbleAudio && waitedTime >= 0.3f)
			{
				playedRumbleAudio = true;
				PooledAudioSource obj = AudioManager.PlaySound(Core.Buildup, DamagePos, false);
				activeRumbleAudio = ((obj != null) ? obj.AudioSource : null);
				if ((Object)(object)activeRumbleAudio != (Object)null)
				{
					Core.RemoveAudioFalloff(activeRumbleAudio);
				}
			}
			float num = waitedTime / waitTime;
			float num2 = Mathf.Clamp01(num);
			if ((double)num <= 0.8)
			{
				num2 = Mathf.Pow(num2, 2f);
				PlayerHaptics.AddHapticsSignal(num2, num2, num2);
			}
			if ((double)num > 0.9)
			{
				AudioSource obj2 = activeRumbleAudio;
				if (obj2 != null)
				{
					obj2.Stop();
				}
			}
		}

		private void freezeCameras()
		{
			//IL_004c: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			if (!IsAnimationRunning)
			{
				return;
			}
			foreach (CameraInfo storedCameraInfo in Core.Instance.StoredCameraInfos)
			{
				if (!storedCameraInfo.IsVRCam)
				{
					((Component)storedCameraInfo.ParentComponent).transform.position = storedCameraInfo.FreezePos;
					if (!storedCameraInfo.IsFirstPerson)
					{
						((Component)storedCameraInfo.ParentComponent).transform.rotation = storedCameraInfo.FreezeRot;
					}
				}
				foreach (PlayerVisualsClone value in Core.Instance.PlayerSilhouettes.Values)
				{
					if ((Object)(object)value.Camera != (Object)null)
					{
						((Component)value.Camera).transform.rotation = ((Component)Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()).transform.rotation;
					}
				}
			}
		}

		public void RunAnimation()
		{
			AnimationCoroutine = MelonCoroutines.Start(C_RunAnimation());
		}

		[IteratorStateMachine(typeof(<C_RunAnimation>d__25))]
		public IEnumerator C_RunAnimation()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <C_RunAnimation>d__25(0)
			{
				<>4__this = this
			};
		}

		private void OnDestroy()
		{
			if (IsAnimationRunning)
			{
				CancelAnimation();
			}
		}

		public void CancelAnimation(bool strong = true)
		{
			IsAnimationRunning = false;
			Core.LastDamagedPlayer = null;
			if (strong)
			{
				if (StructureKillRoutine != null)
				{
					MelonCoroutines.Stop(StructureKillRoutine);
				}
				StructureKillRoutine = null;
				foreach (StructureKillStorage structureKillStorage in Core.Instance.StructureKillStorages)
				{
					structureKillStorage.Kill();
				}
				Core.Instance.StructureKillStorages.Clear();
				StructureStorage.KillDelayed.Clear();
			}
			else if ((Object)(object)Core.Instance?.ActiveShockwave?.ForceField != (Object)null)
			{
				StructureKillRoutine = MelonCoroutines.Start(StructureKillStorage.C_KillStructuresFromShockwave());
			}
			AudioSource obj = activeRumbleAudio;
			if (obj != null)
			{
				obj.Stop();
			}
			ClearPlayerSilhouettes();
			ClearStructureSilhouettes();
			Player localPlayer = Singleton<PlayerManager>.Instance.LocalPlayer;
			if ((Object)(object)((localPlayer == null) ? null : localPlayer.Controller?.GetCamera()) != (Object)null)
			{
				((Behaviour)Singleton<PlayerManager>.Instance.localPlayer.Controller.GetCamera()).enabled = true;
			}
			foreach (CameraInfo storedCameraInfo in Core.Instance.StoredCameraInfos)
			{
				if (storedCameraInfo != null && (Object)(object)storedCameraInfo.ParentComponent != (Object)null)
				{
					storedCameraInfo.ParentComponent.cullingMask = storedCameraInfo.CullingMask;
					storedCameraInfo.ParentComponent.nearClipPlane = storedCameraInfo.NearClipPlane;
					if (storedCameraInfo.IsRecordingCam)
					{
						((Behaviour)((Component)storedCameraInfo.ParentComponent).GetComponent<RecordingCamera>()).enabled = true;
					}
					LckStabilizer componentInParent = ((Component)storedCameraInfo.ParentComponent).GetComponentInParent<LckStabilizer>();
					if ((Object)(object)componentInParent != (Object)null)
					{
						((Behaviour)componentInParent).enabled = true;
					}
				}
			}
			if (HowardInvolved)
			{
				SkinnedMeshRenderer howardSmr = Core.Instance.HowardSmr;
				if ((Object)(object)howardSmr != (Object)null)
				{
					((Renderer)howardSmr).material = Core.Instance.HowardMat;
					((Component)howardSmr).gameObject.layer = 0;
				}
			}
			if ((Object)(object)SphereBackground != (Object)null)
			{
				Object.Destroy((Object)(object)SphereBackground);
			}
			if (FogEndDistanceStorage != -1f)
			{
				RenderSettings.fogEndDistance = FogEndDistanceStorage;
			}
			if (AnimationCoroutine != null)
			{
				MelonCoroutines.Stop(AnimationCoroutine);
			}
			if ((Object)(object)this != (Object)null && (Object)(object)((Component)this).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			Core.Instance.Impacts.Remove(this);
		}

		public void ClearStructureSilhouettes()
		{
			foreach (GameObject structureSilhouette in StructureSilhouettes)
			{
				Object.Destroy((Object)(object)structureSilhouette);
			}
			StructureSilhouettes.Clear();
		}

		public void CreateStructureSilhouette(StructureStorage structureInfo)
		{
			//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_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_0057: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)structureInfo.StructureGO.GetComponentInChildren<MeshRenderer>()).gameObject;
			Quaternion rotation = gameObject.transform.rotation;
			GameObject val = Object.Instantiate<GameObject>(gameObject);
			Vector3 position = structureInfo.StructureGO.transform.position;
			val.transform.SetParent(Core.Instance.ModObject_Silhouettes.transform);
			val.transform.position = position;
			val.transform.rotation = rotation;
			HelperFunctions.DisableAllComponents(val);
			Object.Destroy((Object)(object)val.GetComponent<Rigidbody>());
			foreach (Renderer componentsInChild in val.GetComponentsInChildren<Renderer>())
			{
				if (Config.PrimaryEffectColor.Value.ToLower() != "none")
				{
					componentsInChild.SetMaterial(Core.Instance.PrimarySilhouetteMat);
					componentsInChild.materials = Il2CppReferenceArray<Material>.op_Implicit((Material[])(object)new Material[1] { Core.Instance.PrimarySilhouetteMat });
				}
				((Component)componentsInChild).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer);
			}
			((Object)val).name = "StructureSilhouette";
			StructureSilhouettes.Add(val);
		}

		public static PlayerVisualsClone CreatePlayerSilhouette(PlayerController player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return null;
			}
			if (Core.Instance.PlayerSilhouettes.TryGetValue(player, out var value))
			{
				value?.ReapplyVisuals();
				return value;
			}
			GameObject val = Object.Instantiate<GameObject>(((Component)player.PlayerVisuals).gameObject);
			PlayerVisualsClone playerVisualsClone = val.AddComponent<PlayerVisualsClone>();
			playerVisualsClone.ParentController = player;
			playerVisualsClone.SetUp();
			val.SetActive(false);
			val.transform.SetParent(Core.Instance.ModObject_Silhouettes.transform);
			((Object)val).name = HelperFunctions.SanitizeString(player.assignedPlayer.Data.GeneralData.PublicUsername) + "Silhouette";
			Core.Instance.PlayerSilhouettes[player] = playerVisualsClone;
			return playerVisualsClone;
		}

		public void ClearPlayerSilhouettes()
		{
			foreach (PlayerVisualsClone involvedPlayer in InvolvedPlayers)
			{
				if ((Object)(object)involvedPlayer != (Object)null)
				{
					if ((Object)(object)involvedPlayer.Camera != (Object)null)
					{
						((Behaviour)involvedPlayer.Camera).enabled = false;
					}
					if ((Object)(object)involvedPlayer.AudioListener != (Object)null)
					{
						((Behaviour)involvedPlayer.AudioListener).enabled = true;
					}
					if ((Object)(object)involvedPlayer.Visuals != (Object)null)
					{
						involvedPlayer.Visuals.SetActive(false);
					}
				}
				else
				{
					Core.Instance.PlayerSilhouettes.Remove(involvedPlayer.ParentController);
				}
			}
		}

		public void CreateSphereBackground()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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)
			SphereBackground = GameObject.CreatePrimitive((PrimitiveType)0);
			((Collider)SphereBackground.GetComponent<SphereCollider>()).enabled = false;
			SphereBackground.GetComponent<Renderer>().material = Core.Instance.SecondarySilhouetteMat;
			SphereBackground.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer);
			SphereBackground.transform.SetParent(Core.Instance.ModObject_DramaticEffects.transform);
			SphereBackground.transform.localScale = Vector3.one * 400f;
			SphereBackground.transform.position = ((Component)Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()).transform.position;
		}
	}
	[RegisterTypeInIl2Cpp]
	public class PlayerVisualsClone : MonoBehaviour
	{
		public enum VisualsType
		{
			Silhouette,
			Ragdoll
		}

		public PlayerController ParentController;

		public GameObject Visuals;

		public Transform LIV;

		public ShiftStone[] ShiftStones = (ShiftStone[])(object)new ShiftStone[2];

		public Camera Camera = null;

		public AudioListener AudioListener = null;

		public VisualsType Type = VisualsType.Silhouette;

		private void Update()
		{
			if (!((Object)(object)Visuals == (Object)null) && (Object)(object)ParentController == (Object)null)
			{
				if (Type == VisualsType.Silhouette)
				{
					Core.Instance.PlayerSilhouettes.Remove(ParentController);
				}
				Object.DestroyImmediate((Object)(object)Visuals);
			}
		}

		public void SetUp(GameObject setupObject = null)
		{
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Invalid comparison between Unknown and I4
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Invalid comparison between Unknown and I4
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Expected O, but got Unknown
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)setupObject == (Object)null)
			{
				setupObject = ((Component)this).gameObject;
			}
			Visuals = setupObject;
			Transform child = Visuals.transform.GetChild(1).GetChild(0).GetChild(4)
				.GetChild(0);
			ShiftStone[] shiftStones = ShiftStones;
			object obj;
			if (child == null)
			{
				obj = null;
			}
			else
			{
				Transform child2 = child.GetChild(1);
				if (child2 == null)
				{
					obj = null;
				}
				else
				{
					GameObject gameObject = ((Component)child2).gameObject;
					obj = ((gameObject != null) ? gameObject.GetComponentInChildren<ShiftStone>(true) : null);
				}
			}
			shiftStones[0] = (ShiftStone)obj;
			ShiftStone[] shiftStones2 = ShiftStones;
			object obj2;
			if (child == null)
			{
				obj2 = null;
			}
			else
			{
				Transform child3 = child.GetChild(2);
				if (child3 == null)
				{
					obj2 = null;
				}
				else
				{
					GameObject gameObject2 = ((Component)child3).gameObject;
					obj2 = ((gameObject2 != null) ? gameObject2.GetComponentInChildren<ShiftStone>(true) : null);
				}
			}
			shiftStones2[1] = (ShiftStone)obj2;
			if (Type == VisualsType.Silhouette)
			{
				ShiftStone obj3 = ShiftStones[0];
				if (obj3 != null)
				{
					Transform transform = ((Component)obj3).transform;
					if (transform != null)
					{
						transform.SetParent(Visuals.transform);
					}
				}
				ShiftStone obj4 = ShiftStones[1];
				if (obj4 != null)
				{
					Transform transform2 = ((Component)obj4).transform;
					if (transform2 != null)
					{
						transform2.SetParent(Visuals.transform);
					}
				}
			}
			foreach (Renderer componentsInChild in Visuals.GetComponentsInChildren<Renderer>())
			{
				if (((Object)componentsInChild).name == "FadeScreenRenderer")
				{
					Object.Destroy((Object)(object)((Component)componentsInChild).gameObject);
				}
				else if (Type == VisualsType.Silhouette)
				{
					componentsInChild.shadowCastingMode = (ShadowCastingMode)0;
					if (Config.PrimaryEffectColor.Value.ToLower() != "none")
					{
						componentsInChild.sharedMaterial = Core.Instance.PrimarySilhouetteMat;
					}
					((Component)componentsInChild).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer);
					int num = (((int)ParentController.ControllerType == 1) ? 1 : 0);
					componentsInChild.material.SetFloat("_IsLocal", (float)num);
					componentsInChild.material.SetInt("_IsLocalPlayer", num);
				}
			}
			Transform child4 = Visuals.transform.GetChild(1).GetChild(0).GetChild(4)
				.GetChild(0);
			for (int num2 = child4.childCount - 1; num2 > 0; num2--)
			{
				if (((Object)child4.GetChild(num2)).name.Contains("VFX"))
				{
					((Component)child4.GetChild(num2)).gameObject.SetActive(false);
				}
			}
			foreach (Collider componentsInChild2 in Visuals.GetComponentsInChildren<Collider>())
			{
				componentsInChild2.enabled = false;
			}
			HelperFunctions.DisableAllComponents(Visuals, new List<Behaviour>
			{
				(Behaviour)(object)this,
				(Behaviour)(object)Visuals.GetComponent<RigDefinition>()
			});
			if (Type == VisualsType.Silhouette && (int)ParentController.controllerType == 1)
			{
				GameObject val = new GameObject("Camera");
				val.transform.SetParent(Visuals.transform);
				Camera = val.AddComponent<Camera>();
				Camera.CopyFrom(Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera());
				Camera.nearClipPlane = 0.01f;
				Camera.depth = -10f;
				((Behaviour)Camera).enabled = false;
				Camera.cullingMask = 1 << LayerMask.op_Implicit(Core.Instance.VisualLayer);
				AudioListener = ((Component)Camera).gameObject.AddComponent<AudioListener>();
				((Behaviour)AudioListener).enabled = false;
			}
			Transform child5 = Visuals.transform.GetChild(2);
			Object.Destroy((Object)(object)((child5 != null) ? ((Component)child5).gameObject : null));
		}

		public void UpdateShiftStones()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			PlayerShiftstoneSystem playerShiftstones = ParentController.PlayerShiftstones;
			object obj;
			if (playerShiftstones == null)
			{
				obj = null;
			}
			else
			{
				ShiftstoneSocket obj2 = ((Il2CppArrayBase<ShiftstoneSocket>)(object)playerShiftstones.shiftStoneSockets)[0];
				obj = ((obj2 != null) ? obj2.assignedShifstone : null);
			}
			ShiftStone val = (ShiftStone)obj;
			object obj3;
			if (playerShiftstones == null)
			{
				obj3 = null;
			}
			else
			{
				ShiftstoneSocket obj4 = ((Il2CppArrayBase<ShiftstoneSocket>)(object)playerShiftstones.shiftStoneSockets)[1];
				obj3 = ((obj4 != null) ? obj4.assignedShifstone : null);
			}
			ShiftStone val2 = (ShiftStone)obj3;
			ShiftStone val3 = ShiftStones[0];
			ShiftStone val4 = ShiftStones[1];
			if ((Object)(object)val != (Object)null)
			{
				GameObject val5 = Object.Instantiate<GameObject>(((Component)val).gameObject);
				ShiftStones[0] = val5.GetComponent<ShiftStone>();
				val5.transform.SetParent(Visuals.transform);
				((Component)val5.GetComponentInChildren<MeshRenderer>()).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer);
			}
			if ((Object)(object)val2 != (Object)null)
			{
				GameObject val6 = Object.Instantiate<GameObject>(((Component)val2).gameObject);
				ShiftStones[1] = val6.GetComponent<ShiftStone>();
				val6.transform.SetParent(Visuals.transform);
				((Component)val6.GetComponentInChildren<MeshRenderer>()).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer);
			}
			if ((Object)(object)val3 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)((Component)val3).gameObject);
			}
			if ((Object)(object)val4 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)((Component)val4).gameObject);
			}
		}

		public void CopyPose()
		{
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Invalid comparison between Unknown and I4
			//IL_00f4: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Visuals == (Object)null)
			{
				return;
			}
			SkinnedMeshRenderer componentInChildren = Visuals.GetComponentInChildren<SkinnedMeshRenderer>();
			if (Config.PrimaryEffectColor.Value.ToLower() != "none")
			{
				((Renderer)componentInChildren).material = Core.Instance.PrimarySilhouetteMat;
			}
			else if (Ragdoll.PlayerMats.ContainsKey(ParentController))
			{
				ReapplyVisuals();
			}
			if ((Object)(object)ShiftStones[0] != (Object)null)
			{
				if (Config.PrimaryEffectColor.Value.ToLower() != "none")
				{
					((Renderer)((Component)ShiftStones[0]).GetComponentInChildren<MeshRenderer>()).material = Core.Instance.PrimarySilhouetteMat;
				}
				((Component)ShiftStones[0]).transform.position = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.position;
				((Component)ShiftStones[0]).transform.rotation = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.rotation;
				((Component)ShiftStones[0]).transform.parent.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.parent.localScale;
				((Component)ShiftStones[0]).transform.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.localScale;
				Transform transform = ((Component)ShiftStones[0]).transform;
				transform.localScale *= ParentController.assignedPlayer.Data.PlayerMeasurement.ArmSpan / 1.6f;
			}
			if ((Object)(object)ShiftStones[1] != (Object)null)
			{
				if (Config.PrimaryEffectColor.Value.ToLower() != "none")
				{
					((Renderer)((Component)ShiftStones[1]).GetComponentInChildren<MeshRenderer>()).material = Core.Instance.PrimarySilhouetteMat;
				}
				((Component)ShiftStones[1]).transform.position = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.position;
				((Component)ShiftStones[1]).transform.rotation = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.rotation;
				((Component)ShiftStones[1]).transform.parent.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.parent.localScale;
				((Component)ShiftStones[1]).transform.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.localScale;
				Transform transform2 = ((Component)ShiftStones[1]).transform;
				transform2.localScale *= ParentController.assignedPlayer.Data.PlayerMeasurement.ArmSpan / 1.5f;
			}
			int num = (((int)ParentController.controllerType == 1) ? 1 : 0);
			((Renderer)componentInChildren).material.SetFloat("_IsLocal", (float)num);
			((Renderer)componentInChildren).material.SetInt("_IsLocalPlayer", num);
			List<Transform> from = (from bone in ParentController.GetBones()
				select bone.Transform).ToList();
			List<Transform> to = ((IEnumerable<BoneDefinition>)Visuals.GetComponent<RigDefinition>().BoneDefinitions).Select((BoneDefinition bone) => bone.Transform).ToList();
			if ((Object)(object)Camera != (Object)null)
			{
				((Component)Camera).transform.position = ((Component)ParentController.GetCamera()).transform.position;
			}
			HelperFunctions.CopyAllTransforms(from, to);
		}

		public void ReapplyVisuals()
		{
			if (!((Object)(object)Visuals == (Object)null))
			{
				SkinnedMeshRenderer componentInChildren = Visuals.GetComponentInChildren<SkinnedMeshRenderer>();
				SkinnedMeshRenderer componentInChildren2 = ((Component)((Component)ParentController).transform.GetChild(1)).GetComponentInChildren<SkinnedMeshRenderer>();
				componentInChildren.sharedMesh = componentInChildren2.sharedMesh;
				if (!((Object)(object)Ragdoll.PlayerMats[ParentController] == (Object)null))
				{
					((Renderer)componentInChildren).material = Ragdoll.PlayerMats[ParentController];
				}
			}
		}
	}
	[RegisterTypeInIl2Cpp]
	public class Shockwave : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <C_EnlargeVFX>d__16 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerHitmarker phm;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <C_EnlargeVFX>d__16(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					phm.SetDamage(15f);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public PlayerController DamagedPlayer;

		public bool HowardInvolved = false;

		public float Drama = 1f;

		public GameObject ForceField;

		public Renderer ForceFieldRenderer;

		private float forceFieldScale = 0f;

		private float forceFieldProximityDistance = 0.2f;

		private float forceFieldOpacity = 0.2f;

		public static List<GameObject> Dusts = new List<GameObject>();

		public List<Ragdoll> movedRagdolls = new List<Ragdoll>();

		public float Timer = 0f;

		public void SetUp()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (Drama >= 0.6f)
			{
				CreateDust();
			}
			if (Drama >= 1.3f)
			{
				CreateHitEffect();
			}
			CreateForceField(Drama < 1.6f);
			Core.Instance.PlayBlendedAudio(DamagedPlayer.GetChest().position, preImpact: false, Drama);
		}

		private void Update()
		{
			//IL_0100: 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_0260: 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_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			Timer += Time.deltaTime;
			if ((Object)(object)ForceField != (Object)null)
			{
				if (Timer <= 0.5f)
				{
					forceFieldScale += Time.deltaTime * 150f;
					forceFieldProximityDistance += Time.deltaTime;
				}
				else if (Timer <= 0.9f)
				{
					forceFieldScale += Time.deltaTime * 7000f;
					forceFieldProximityDistance += Time.deltaTime * 5f;
				}
				if (Timer >= 1f)
				{
					forceFieldProximityDistance -= Time.deltaTime * 20f;
					forceFieldOpacity -= Time.deltaTime * 0.8f;
				}
				ForceField.transform.localScale = Vector3.one * forceFieldScale;
				For