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 DramaticEffectsInMatches; public static MelonPreferences_Entry DramaticEffectsOutsideMatches; public static MelonPreferences_Entry IncludeStructureInImpact; public static MelonPreferences_Entry DramaticEffectsVolume; public static MelonPreferences_Entry DramaticEffectsHaptics; public static MelonPreferences_Entry PrimaryEffectColor; public static MelonPreferences_Entry SecondaryEffectColor; public static MelonPreferences_Entry VariableEffects; public static MelonPreferences_Entry ImpactFrameDuration; public static MelonPreferences_Category Cat_Ragdolls; public static MelonPreferences_Entry RagdollsInMatches; public static MelonPreferences_Entry RagdollsOutsideMatches; public static MelonPreferences_Entry CleanupInMatches; public static MelonPreferences_Entry CleanupOutsideMatches; public static MelonPreferences_Entry RagdollSoundsVolume; public static MelonPreferences_Entry EnableGhostification; public static MelonPreferences_Category Cat_Hidden; public static MelonPreferences_Entry DebugEnabled; public static MelonPreferences_Entry LegacyRagdollJank; public static MelonPreferences_Entry SmashBrosLaunch; public static void SetUpUI() { Cat_DramaticEffects = MelonPreferences.CreateCategory("DramaticEffects", "Dramatic Effects"); Cat_DramaticEffects.SetFilePath("UserData/DieHarder/Config.cfg"); DramaticEffectsInMatches = Cat_DramaticEffects.CreateEntry("DramaticEffectsInMatches", EffectsInMatches_Type.OnRoundEnd, "In Matches", "", false, false, (ValueValidator)null, (string)null); DramaticEffectsOutsideMatches = Cat_DramaticEffects.CreateEntry("DramaticEffectsOutsideMatches", EffectsOutsideMatches_Type.Disabled, "Outside Matches", "", false, false, (ValueValidator)null, (string)null); IncludeStructureInImpact = Cat_DramaticEffects.CreateEntry("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("DramaticEffectsVolume", 1f, "Volume", "Volume multiplier for the dramatic sounds\n0-1; default is 1", false, false, (ValueValidator)null, (string)null); DramaticEffectsHaptics = Cat_DramaticEffects.CreateEntry("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("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("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", 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("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", RagdollsInMatches_Type.OnRoundEnd, "Spawning In Matches", "", false, false, (ValueValidator)null, (string)null); RagdollsOutsideMatches = Cat_Ragdolls.CreateEntry("RagdollsOutsideMatches", RagdollsOutsideMatches_Type.OnDeath, "Spawning Outside Matches", (string)null, false, false, (ValueValidator)null, (string)null); CleanupInMatches = Cat_Ragdolls.CreateEntry("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("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("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("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("debug_mode_enabled", false, "debug mode enabled", "For use when TacoSlayer36 tells you to", false, false, (ValueValidator)null, (string)null); LegacyRagdollJank = Cat_Hidden.CreateEntry("LegacyRagdollJank", false, "legacy ragdoll jank", "Brings back the janky ragdolls of older versions", false, false, (ValueValidator)null, (string)null); SmashBrosLaunch = Cat_Hidden.CreateEntry("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 enumerator5 = Singleton.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 <g__checkForUI|71_1>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private string 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__checkForUI|71_1>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 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; 5__1 = "Could not create UIFramework interface. Disabling DieHarder to prevent game-breaking bugs. Make sure you have the dependency installed"; Debug.Log(5__1, debugOnly: false, 2); MelonCoroutines.Start(delayedError(15f, 5__1)); 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 <g__slight_delay|77_0>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <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 d__78 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; private SkinnedMeshRenderer 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__78(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 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(); 5__1 = Instance.HowardSmr; if ((Object)(object)5__1 != (Object)null) { Instance.HowardMat = ((Renderer)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 d__79 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string landType; public Core <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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().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 d__80 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Core <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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 d__73 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float waitTime; public string msg; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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 PlayersKilledToGutter = new List(); public List> StructurePools = new List>(); public List StructureKillStorages = new List(); 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 RagdollAudioClipsSoft = new List(); public List RagdollAudioClipsHard = new List(); public Dictionary PlayerSilhouettes = new Dictionary(); public List Impacts = new List(); private List playersProcessedThisFrame = new List(); public Dictionary> PlayerDamages = new Dictionary>(); public Howard Howard; private bool howardDied; public Material HowardMat = null; public List StoredCameraInfos = new List(); 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.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(); } } 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>)(object)MelonPreferences.OnPreferencesSaved).Subscribe((LemonAction)Config.OnMyPrefsSaved, 0, false); if (!Directory.Exists("UserData/DieHarder/")) { Directory.CreateDirectory("UserData/DieHarder/"); } AssetBundle = AssetBundle.LoadFromMemory(Il2CppStructArray.op_Implicit(HelperFunctions.LoadEmbeddedResource("DieHarder.assets.dieharder"))); SilhouetteShader = AssetBundle.LoadAsset("SolidColorUnlit"); ((Object)SilhouetteShader).hideFlags = (HideFlags)61; ShockwaveShader = AssetBundle.LoadAsset("Shockwave"); ((Object)ShockwaveShader).hideFlags = (HideFlags)61; GhostShader = AssetBundle.LoadAsset("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(<g__checkForUI|71_1>d))] static IEnumerator checkForUI() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <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 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(d__73))] private static IEnumerator delayedError(float waitTime, string msg) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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.Instance.localPlayer.Controller, AA_Drama); } if (Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)116) && (int)Singleton.Instance.LocalPlayer.Controller.PlayerSessionStateSystem.CurrentVRState == 0) { Ragdoll ragdoll = Ragdoll.SpawnRagdoll(Singleton.Instance.localPlayer.Controller, FindClosestStructure(Singleton.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.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 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(<g__slight_delay|77_0>d))] IEnumerator slight_delay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__slight_delay|77_0>d(0) { <>4__this = this }; } } [IteratorStateMachine(typeof(d__78))] private IEnumerator C_GrabHowardStuff() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__78(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__79))] private IEnumerator C_ListenForLandButton(string landType) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__79(0) { <>4__this = this, landType = landType }; } [IteratorStateMachine(typeof(d__80))] private IEnumerator C_OnLandEntered() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__80(0) { <>4__this = this }; } public void RunGlobalInit() { if (!ForceDisabled) { fetchStructurePools(); ModObject_DDOLParent = Object.Instantiate(AssetBundle.LoadAsset("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.instance == (Object)null) { WasMatchEnd = false; return; } int currentRound = Singleton.instance.CurrentRound; bool flag = Instance.GetMatchResultEdgeCase(damagedPlayer) == MatchResult.Won; List list = ((IEnumerable)Singleton.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.Instance.LocalPlayer != null) { flag = Singleton.Instance.LocalPlayer.Data.HealthPoints == 0; } Enumerator enumerator = Singleton.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.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 item in (Il2CppArrayBase>)(object)Singleton.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.<g___|0>d))] IEnumerator _() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass87_0.<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(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 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 list = new List(); if (IsInMatch) { if (PlayerSilhouettes.Count > 0) { list.Add(FindOrCreateSilhouette(Singleton.Instance.AllPlayers[0].Controller)); } if (PlayerSilhouettes.Count > 1) { list.Add(FindOrCreateSilhouette(Singleton.Instance.AllPlayers[1].Controller)); } } else { if (PlayerSilhouettes.Count > 0) { list.Add(FindOrCreateSilhouette(damagedPlayer)); } if ((int)damagedPlayer.controllerType != 1) { list.Add(FindOrCreateSilhouette(Singleton.instance.localPlayer.Controller)); } } List list2 = new List(); 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(); 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.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 GenerateCamInfos() { List list = new List(); list.Add(new CameraInfo(Singleton.Instance.LocalPlayer.Controller.GetCamera()) { IsVRCam = true }); list.Add(new CameraInfo(Singleton.Instance.LegacyCamera) { IsRecordingCam = true }); LCKTabletUtility lckTablet = Singleton.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.Logger.Warning("Warn: " + message); break; case 2: Melon.Logger.Error("Error: " + message); break; default: Melon.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 d__25 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Impact <>4__this; private bool 5__1; private List.Enumerator <>s__2; private CameraInfo 5__3; private Camera 5__4; private LckStabilizer 5__5; private List.Enumerator <>s__6; private PlayerVisualsClone 5__7; private SkinnedMeshRenderer 5__8; private Vector3 5__9; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = default(List.Enumerator); 5__3 = null; 5__4 = null; 5__5 = null; <>s__6 = default(List.Enumerator); 5__7 = null; 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()) { 5__3 = <>s__2.Current; 5__4 = 5__3.ParentComponent; 5__4.cullingMask = LayerMask.op_Implicit(Core.Instance.VisualLayerMask); if (5__3.IsRecordingCam) { 5__4.nearClipPlane = 0.05f; } if (5__3.IsRecordingCam) { ((Behaviour)((Component)5__3.ParentComponent).GetComponent()).enabled = false; } 5__5 = ((Component)5__3.ParentComponent).GetComponentInParent(); if ((Object)(object)5__5 != (Object)null) { ((Behaviour)5__5).enabled = false; } 5__4 = null; 5__5 = null; 5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(List.Enumerator); if (FogEndDistanceStorage == -1f) { FogEndDistanceStorage = RenderSettings.fogEndDistance; } RenderSettings.fogEndDistance = 10000f; ((Behaviour)Singleton.Instance.localPlayer.Controller.GetCamera()).enabled = false; <>s__6 = <>4__this.InvolvedPlayers.GetEnumerator(); try { while (<>s__6.MoveNext()) { 5__7 = <>s__6.Current; 5__7.CopyPose(); 5__7.Visuals.SetActive(true); if ((Object)(object)5__7.Camera != (Object)null) { ((Behaviour)5__7.Camera).enabled = true; } if ((Object)(object)5__7.AudioListener != (Object)null) { ((Behaviour)5__7.AudioListener).enabled = true; } 5__7 = null; } } finally { ((IDisposable)<>s__6).Dispose(); } <>s__6 = default(List.Enumerator); if (<>4__this.HowardInvolved) { 5__8 = Core.Instance.HowardSmr; if ((Object)(object)5__8 != (Object)null) { if (Config.PrimaryEffectColor.Value.ToLower() != "none") { ((Renderer)5__8).material = Core.Instance.PrimarySilhouetteMat; } ((Component)5__8).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); } 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; 5__1 = false; if (<>4__this.HowardInvolved && (Object)(object)Core.Instance.Howard != (Object)null && Core.Instance.Howard.currentHp == 0f) { 5__1 = true; } if (!<>4__this.HowardInvolved || (<>4__this.HowardInvolved && !5__1) || (Object)(object)Core.Instance.HowardSmr == (Object)null) { Core.Instance.CreateShockwave(<>4__this.DamagePos, <>4__this.DamagedPlayer.ParentController, <>4__this.Drama); } else { 5__9 = ((Component)Core.Instance.HowardSmr).transform.position + Vector3.up * 0.8f; Core.Instance.CreateShockwave(5__9, <>4__this.DamagedPlayer.ParentController, 1f, howardInvolved: true); } if (!<>4__this.HowardInvolved || (<>4__this.HowardInvolved && !5__1)) { Core.Instance.CreateRagdollIfNecessary(<>4__this.DamagedPlayer.ParentController, null, <>4__this.Drama); } ScreenFlash.CreateScreenFlash(((Component)Singleton.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 InvolvedPlayers = new List(); public StructureStorage InvolvedStructure; public List StructureSilhouettes = new List(); public GameObject SphereBackground; public PlayerVisualsClone DamagedPlayer; private PlayerHaptics PlayerHaptics = Singleton.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.Instance.LocalPlayer.Controller.GetCamera()).transform.rotation; } } } } public void RunAnimation() { AnimationCoroutine = MelonCoroutines.Start(C_RunAnimation()); } [IteratorStateMachine(typeof(d__25))] public IEnumerator C_RunAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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.Instance.LocalPlayer; if ((Object)(object)((localPlayer == null) ? null : localPlayer.Controller?.GetCamera()) != (Object)null) { ((Behaviour)Singleton.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()).enabled = true; } LckStabilizer componentInParent = ((Component)storedCameraInfo.ParentComponent).GetComponentInParent(); 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()).gameObject; Quaternion rotation = gameObject.transform.rotation; GameObject val = Object.Instantiate(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()); foreach (Renderer componentsInChild in val.GetComponentsInChildren()) { if (Config.PrimaryEffectColor.Value.ToLower() != "none") { componentsInChild.SetMaterial(Core.Instance.PrimarySilhouetteMat); componentsInChild.materials = Il2CppReferenceArray.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(((Component)player.PlayerVisuals).gameObject); PlayerVisualsClone playerVisualsClone = val.AddComponent(); 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()).enabled = false; SphereBackground.GetComponent().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.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(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(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()) { 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()) { componentsInChild2.enabled = false; } HelperFunctions.DisableAllComponents(Visuals, new List { (Behaviour)(object)this, (Behaviour)(object)Visuals.GetComponent() }); if (Type == VisualsType.Silhouette && (int)ParentController.controllerType == 1) { GameObject val = new GameObject("Camera"); val.transform.SetParent(Visuals.transform); Camera = val.AddComponent(); Camera.CopyFrom(Singleton.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(); ((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)(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)(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(((Component)val).gameObject); ShiftStones[0] = val5.GetComponent(); val5.transform.SetParent(Visuals.transform); ((Component)val5.GetComponentInChildren()).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); } if ((Object)(object)val2 != (Object)null) { GameObject val6 = Object.Instantiate(((Component)val2).gameObject); ShiftStones[1] = val6.GetComponent(); val6.transform.SetParent(Visuals.transform); ((Component)val6.GetComponentInChildren()).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(); 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()).material = Core.Instance.PrimarySilhouetteMat; } ((Component)ShiftStones[0]).transform.position = ((Component)((Il2CppArrayBase)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.position; ((Component)ShiftStones[0]).transform.rotation = ((Component)((Il2CppArrayBase)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.rotation; ((Component)ShiftStones[0]).transform.parent.localScale = ((Component)((Il2CppArrayBase)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[0].assignedShifstone).transform.parent.localScale; ((Component)ShiftStones[0]).transform.localScale = ((Component)((Il2CppArrayBase)(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()).material = Core.Instance.PrimarySilhouetteMat; } ((Component)ShiftStones[1]).transform.position = ((Component)((Il2CppArrayBase)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.position; ((Component)ShiftStones[1]).transform.rotation = ((Component)((Il2CppArrayBase)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.rotation; ((Component)ShiftStones[1]).transform.parent.localScale = ((Component)((Il2CppArrayBase)(object)ParentController.PlayerShiftstones.shiftStoneSockets)[1].assignedShifstone).transform.parent.localScale; ((Component)ShiftStones[1]).transform.localScale = ((Component)((Il2CppArrayBase)(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 from = (from bone in ParentController.GetBones() select bone.Transform).ToList(); List to = ((IEnumerable)Visuals.GetComponent().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 componentInChildren2 = ((Component)((Component)ParentController).transform.GetChild(1)).GetComponentInChildren(); 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 d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerHitmarker phm; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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 Dusts = new List(); public List movedRagdolls = new List(); 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; ForceFieldRenderer.material.SetFloat("_ProximityDistance", forceFieldProximityDistance); ForceFieldRenderer.material.SetFloat("_BaseOpacity", forceFieldOpacity); if (Timer > 3f) { Object.Destroy((Object)(object)ForceField); } } if (Timer > 11f) { foreach (StructureKillStorage structureKillStorage in Core.Instance.StructureKillStorages) { structureKillStorage.Kill(); } Core.Instance.StructureKillStorages.Clear(); StructureStorage.KillDelayed.Clear(); Object.Destroy((Object)(object)((Component)this).gameObject); } if ((Object)(object)ForceField == (Object)null) { return; } Vector3 val2 = default(Vector3); foreach (Ragdoll.RagdollPool value in Ragdoll.RagdollPools.Values) { foreach (Ragdoll poolItem in value.PoolItems) { if (movedRagdolls.Contains(poolItem)) { continue; } float num = Vector3.Distance(poolItem.Chest.position, ForceField.transform.position); if (num <= ForceField.transform.localScale.x) { movedRagdolls.Add(poolItem); Vector3 val = ((Component)poolItem.Chest).GetComponent().velocity; if (((Vector3)(ref val)).magnitude < 0.3f) { ((Vector3)(ref val2))..ctor(ForceField.transform.position.x, -1f, ForceField.transform.position.z); val = poolItem.Chest.position - val2; poolItem.AddVelocity(((Vector3)(ref val)).normalized * 40f * Drama); } } } } } public void CreateForceField(bool invisible = false) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown ForceField = GameObject.CreatePrimitive((PrimitiveType)0); ForceField.transform.SetParent(((Component)this).transform, false); ((Collider)ForceField.GetComponent()).enabled = false; ForceFieldRenderer = ForceField.GetComponent(); if (!invisible) { ForceFieldRenderer.material = new Material(Core.Instance.ShockwaveShader); } else { ForceFieldRenderer.enabled = false; } } public void CreateDust() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) if (!HowardInvolved && DamagedPlayer.PlayerMovement.WasGrounded) { Structure component = ((Component)((Il2CppArrayBase)(object)Singleton.Instance.resourcesToPool)[68].Resource).GetComponent(); PooledVisualEffect component2 = ((Component)((Il2CppArrayBase>)(object)Singleton.instance.availablePools)[63].FetchFromPool(DamagedPlayer.GetStandingPosition(), Quaternion.identity)).gameObject.GetComponent(); component2.parameterCollection.Apply(component2.visualEffect, component); Dusts.Add(((Component)component2).gameObject); ((Component)component2).transform.localScale = Vector3.one * 2.5f; } } public void CreateHitEffect() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (HowardInvolved && (Object)(object)Core.Instance.Howard != (Object)null && Core.Instance.Howard.currentHp == 0f) { flag = true; } Vector3 val = ((!HowardInvolved || (HowardInvolved && !flag)) ? DamagedPlayer.GetChest().position : ((!Object.op_Implicit((Object)(object)Core.Instance.HowardSmr)) ? DamagedPlayer.GetChest().position : ((Component)Core.Instance.HowardSmr).transform.position)); GameObject gameObject = ((Component)((Il2CppArrayBase>)(object)Singleton.instance.availablePools)[46].FetchFromPool(val, Quaternion.identity)).gameObject; object obj; if (gameObject == null) { obj = null; } else { GameObject gameObject2 = gameObject.gameObject; obj = ((gameObject2 != null) ? gameObject2.GetComponent() : null); } PlayerHitmarker val2 = (PlayerHitmarker)obj; if ((Object)(object)val2 != (Object)null) { val2.SetDamage(7f); MelonCoroutines.Start(C_EnlargeVFX(val2)); } } [IteratorStateMachine(typeof(d__16))] private static IEnumerator C_EnlargeVFX(PlayerHitmarker phm) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { phm = phm }; } } internal static class HelperFunctions { public static List FindChildrenRecursive(Transform parent) { List list = new List(); for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); list.Add(child); list.AddRange(FindChildrenRecursive(child)); } return list; } public static void DisableAllComponents(GameObject gameObject, List except = null) { foreach (Behaviour component in gameObject.GetComponents()) { component.enabled = except?.Contains(component) ?? false; } } public static void CopyAllTransforms(List from, List to) { //IL_002f: 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_0061: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < from.Count; i++) { if (to.Count >= i || from.Count >= 1) { to[i].position = from[i].position; to[i].rotation = from[i].rotation; to[i].localScale = from[i].localScale; } } } public static string SanitizeString(string Input) { string pattern = "<[^>]*>"; return Regex.Replace(Input, pattern, string.Empty); } public static Vector3 GetRelativeVelocity(Vector3 velocityA, Collision collision) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Rigidbody rigidbody = collision.rigidbody; Vector3 val = (((Object)(object)rigidbody != (Object)null) ? rigidbody.velocity : Vector3.zero); return velocityA - val; } public static byte[] LoadEmbeddedResource(string resourcePath) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(resourcePath); if (stream == null) { throw new FileNotFoundException("Embedded resource '" + resourcePath + "' not found."); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } } [HarmonyPatch(typeof(PlayerVisuals), "ApplyPlayerVisuals", new Type[] { typeof(GeneratedPlayerVisuals) })] public static class PlayerVisuals_ApplyPlayerVisuals_Patch { [CompilerGenerated] private sealed class <g___|0_0>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerController player; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g___|0_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; Core.Instance.ProcessNewPlayer(player); 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(); } } private static void Postfix(ref PlayerVisuals __instance) { if (!Core.ForceDisabled) { PlayerVisuals obj = __instance; MelonCoroutines.Start(_((obj != null) ? ((PlayerControllerSubsystem)obj).parentController : null)); } [IteratorStateMachine(typeof(<g___|0_0>d))] static IEnumerator _(PlayerController player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g___|0_0>d(0) { player = player }; } } } [HarmonyPatch(typeof(DressingRoom), "DelayedApplyData", new Type[] { typeof(GeneratedPlayerVisuals) })] public static class dressingRoomPatch { private static void Postfix() { if (!Core.ForceDisabled) { Ragdoll.ReapplyVisualsFor(Singleton.Instance.LocalPlayer.Controller); } } } [HarmonyPatch(typeof(MatchHandler), "StopMatch", new Type[] { typeof(bool) })] public static class MatchHandler_StopMatch_Patch { [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(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; Core.Instance.HasRoundEnded = true; Core.Instance.PlayerDamages.Clear(); 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(); } } private static void Prefix() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if (Core.ForceDisabled) { return; } try { if (Core.Instance.IsInMatch) { MatchHandler instance = Singleton.Instance; if (instance != null && (int)instance.CurrentMatchPhase == 2) { MelonCoroutines.Start(SetRoundHasEnded()); } } } catch { } } [IteratorStateMachine(typeof(d__1))] private static IEnumerator SetRoundHasEnded() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0); } } [HarmonyPatch(typeof(MatchHandler), "ExecuteNextRound", new Type[] { })] public static class MatchHandler_ExecuteNextRound_Patch { private static void Postfix() { if (!Core.ForceDisabled) { Core.Instance.HasRoundEnded = false; Core.Instance.PlayersKilledToGutter.Clear(); if (Config.CleanupInMatches.Value > 0) { Ragdoll.ClearAllRagdolls(); } Enumerator enumerator = Singleton.Instance.AllPlayers.GetEnumerator(); while (enumerator.MoveNext()) { Player current = enumerator.Current; Ragdoll.UnGhostify(current.Controller); } } } } [HarmonyPatch(typeof(PlayerScaling), "ScaleController", new Type[] { typeof(PlayerMeasurement) })] public static class PlayerScaling_ScaleController_Patch { private static void Postfix(ref PlayerScaling __instance) { if (!Core.ForceDisabled) { PlayerScaling obj = __instance; if (!((Object)(object)((obj != null) ? ((PlayerControllerSubsystem)obj).parentController : null) == (Object)null) && Ragdoll.RagdollPools.ContainsKey(((PlayerControllerSubsystem)__instance).parentController)) { Ragdoll.RagdollPool ragdollPool = Ragdoll.RagdollPools[((PlayerControllerSubsystem)__instance).parentController]; GameObject gameObject = ((Component)ragdollPool.Transform).gameObject; ((Object)gameObject).name = ((Object)gameObject).name + " (old calibration)"; Ragdoll.RagdollPools.Remove(((PlayerControllerSubsystem)__instance).parentController); } } } } [HarmonyPatch(typeof(Structure), "Kill", new Type[] { typeof(Vector3), typeof(bool), typeof(bool), typeof(bool) })] public static class Structure_Kill_Patch { private static bool Prefix(ref Structure __instance, ref Vector3 killVelocity, ref bool playSFX, ref bool playVFX, ref bool networked) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (Core.ForceDisabled) { return true; } try { bool flag = (Object)(object)Core.Instance.ActiveImpact != (Object)null && Core.Instance.ActiveImpact.IsAnimationRunning; bool flag2 = Core.Instance.IsInMatch && Core.Instance.HasRoundEnded; bool flag3 = Core.Instance.CurrentScene == "Gym"; if (flag && (flag2 || flag3)) { if (StructureStorage.KillDelayed.Contains(__instance)) { return true; } Core.Instance.StructureKillStorages.Add(new StructureKillStorage(__instance, killVelocity, playSFX, playVFX, networked)); Rigidbody componentInChildren = ((Component)__instance).GetComponentInChildren(); componentInChildren.velocity = Vector3.zero; componentInChildren.angularVelocity = Vector3.zero; foreach (Collider componentsInChild in ((Component)__instance).GetComponentsInChildren()) { componentsInChild.enabled = false; } StructureStorage.KillDelayed.Add(__instance); return false; } return true; } catch { return true; } } } [HarmonyPatch(typeof(PooledMonoBehaviour), "ReturnToPool", new Type[] { })] public static class PooledMonoBehaviour_ReturnToPool_Patch { private static void Prefix(ref Structure __instance) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (Core.ForceDisabled) { return; } try { if (Shockwave.Dusts != null && Shockwave.Dusts.Count != 0) { Structure obj = __instance; if (!((Object)(object)((obj != null) ? ((Component)obj).gameObject : null) == (Object)null) && Shockwave.Dusts.Contains(((Component)__instance).gameObject)) { ((Component)__instance).gameObject.transform.localScale = Vector3.one; Shockwave.Dusts.Remove(((Component)__instance).gameObject); } } } catch { } } } [HarmonyPatch(typeof(Pool), "FetchFromPool", new Type[] { typeof(Vector3), typeof(Quaternion) })] public static class PooledMonoBehaviour_OnFetchFromPool_Patch { private static void Postfix(ref PooledMonoBehaviour __result, ref Vector3 position) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!Core.ForceDisabled && ((Object)__result).name == "ExplodeFinale_VFX" && StructureStorage.GameStates.Count >= 3) { List gameState = StructureStorage.GameStates[StructureStorage.GameStates.Count - 2]; StructureStorage source = StructureStorage.FindStructureStorageAt(position, gameState); Ragdoll.Explode(source); } } } [HarmonyPatch(typeof(PlayerShiftstoneSystem), "AttachShiftStone", new Type[] { typeof(ShiftStone), typeof(int), typeof(bool), typeof(bool) })] public static class PlayerShifstoneSystem_AttachShiftStone_Patch { private static void Postfix(ref PlayerShiftstoneSystem __instance) { if (!Core.ForceDisabled && Core.Instance.PlayerSilhouettes.TryGetValue(((PlayerControllerSubsystem)__instance).parentController, out var value)) { value.UpdateShiftStones(); } } } [HarmonyPatch(typeof(PlayerShiftstoneSystem), "RemoveShiftStone", new Type[] { typeof(int), typeof(bool), typeof(bool) })] public static class PlayerShifstoneSystem_RemoveShiftStone_Patch { private static void Postfix(ref PlayerShiftstoneSystem __instance) { if (!Core.ForceDisabled && Core.Instance.PlayerSilhouettes.TryGetValue(((PlayerControllerSubsystem)__instance).parentController, out var value)) { value.UpdateShiftStones(); } } } [HarmonyPatch(typeof(PlayerHealth), "SetHealth", new Type[] { typeof(short), typeof(short), typeof(bool) })] public static class PlayerHealth_SetHealth_Patch { private static void Prefix(ref PlayerHealth __instance, short newHealth, short previousHealth, bool useEffects) { if (Core.ForceDisabled) { return; } try { if (newHealth < previousHealth) { Core instance = Core.Instance; PlayerHealth obj = __instance; instance.OnPlayerDamage((obj != null) ? ((PlayerControllerSubsystem)obj).parentController : null, newHealth, previousHealth); if (newHealth <= 0) { Core.Instance.OnPlayerHealthDepleted(__instance); } } } catch (Exception ex) { Debug.Log(ex.Message, debugOnly: false, 2); Debug.Log(Environment.StackTrace); } } } [HarmonyPatch(typeof(KillPlayerOnCollision), "AttemptKillPlayer", new Type[] { typeof(Transform) })] public static class KillPlayerOnCollision_AttemptKillPlayer_Patch { private static void Prefix(Transform tr) { if (Core.ForceDisabled) { return; } try { Core.Instance.PlayersKilledToGutter.Add(((Component)tr.root).GetComponent()); } catch { } } } public static class Extensions { public static Transform GetChest(this PlayerController player) { return ((Component)player).GetComponentInChildren().ChestDefinition.Transform; } public static Vector3 GetStandingPosition(this PlayerController player) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return ((Component)player.PlayerPhysics.footCollider).transform.position; } public static Camera GetCamera(this PlayerController player) { object result; if (player == null) { result = null; } else { PlayerCamera playerCamera = player.PlayerCamera; result = ((playerCamera != null) ? playerCamera.Camera : null); } return (Camera)result; } public static List GetBones(this PlayerController player) { return ((IEnumerable)((Component)player).GetComponentInChildren().BoneDefinitions).ToList(); } public static bool IsFirstPerson(this Camera camera) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) PlayerManager instance = Singleton.Instance; object obj; if (instance == null) { obj = null; } else { Player localPlayer = instance.LocalPlayer; if (localPlayer == null) { obj = null; } else { PlayerController controller = localPlayer.Controller; if (controller == null) { obj = null; } else { Camera camera2 = controller.GetCamera(); obj = ((camera2 != null) ? ((Component)camera2).transform : null); } } } return (Object)obj == (Object)null || Vector3.Distance(((Component)camera).transform.position, ((Component)Singleton.Instance.LocalPlayer.Controller.GetCamera()).transform.position) <= 0.3f; } } [RegisterTypeInIl2Cpp] public class Ragdoll : PlayerVisualsClone { public class BoneRef { public string Name; public Transform VisualBone; public Transform RagdollBone; public BoneRef(string name, Transform visualsBone, Transform ragdollBone) { Name = name; VisualBone = visualsBone; RagdollBone = ragdollBone; } } public class RagdollPool { public PlayerController parentController; public Transform Transform; public List PoolItems { get { Transform transform = Transform; List list = ((transform == null) ? null : ((IEnumerable)((Component)transform).GetComponentsInChildren(true))?.ToList()); if (list == null) { return new List(); } return list; } } public bool AnyRagdollsEnabled => PoolItems?.Any((Ragdoll r) => r.IsActive && ((Component)r).gameObject.active) ?? false; public Ragdoll FetchRagdoll() { //IL_010c: Unknown result type (might be due to invalid IL or missing references) Ragdoll ragdoll; if (Transform.childCount == 0) { ragdoll = CreateRagdoll(); } else { List list = PoolItems.Where((Ragdoll pr) => !pr.IsActive).ToList(); ragdoll = ((list.Count != 0) ? list.First() : CreateRagdoll()); } if (ragdoll.SinkRoutine != null) { MelonCoroutines.Stop(ragdoll.SinkRoutine); } ragdoll.SinkRoutine = null; ((Component)ragdoll).gameObject.SetActive(true); ragdoll.IsActive = true; ragdoll.CopyPose(); if (Config.LegacyRagdollJank.Value) { ragdoll.IsJanky = Random.RandomRangeInt(0, 30) == 0; if (Random.RandomRangeInt(0, 10) == 0) { ragdoll.AddVelocity(new Vector3(Random.RandomRange(-100f, 100f), Random.RandomRange(-100f, 100f), Random.RandomRange(-100f, 100f))); } } return ragdoll; } public Ragdoll CreateRagdoll() { GameObject val = Object.Instantiate(Core.Instance.ModObject_DDOLRagdoll); val.SetActive(true); ((Object)val).name = HelperFunctions.SanitizeString(parentController.assignedPlayer.Data.GeneralData.PublicUsername + "Ragdoll"); val.transform.SetParent(RagdollPools[parentController].Transform); Ragdoll ragdoll = val.AddComponent(); ragdoll.ParentController = parentController; ragdoll.SetupRagdoll(); return ragdoll; } } [CompilerGenerated] private sealed class d__25 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Ragdoll <>4__this; private List.Enumerator <>s__1; private BoneRef 5__2; private List.Enumerator <>s__3; private BoneRef 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(List.Enumerator); 5__2 = null; <>s__3 = default(List.Enumerator); 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = <>4__this.BoneRefs.GetEnumerator(); try { while (<>s__1.MoveNext()) { 5__2 = <>s__1.Current; ((Component)5__2.RagdollBone).gameObject.layer = 0; 5__2 = null; } } finally { ((IDisposable)<>s__1).Dispose(); } <>s__1 = default(List.Enumerator); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; <>s__3 = <>4__this.BoneRefs.GetEnumerator(); try { while (<>s__3.MoveNext()) { 5__4 = <>s__3.Current; ((Component)5__4.RagdollBone).gameObject.layer = Core.Instance.PhysicsLayer; 5__4 = null; } } finally { ((IDisposable)<>s__3).Dispose(); } <>s__3 = default(List.Enumerator); 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 d__36 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Ragdoll <>4__this; private int 5__1; private IEnumerator <>s__2; private Rigidbody 5__3; private Collider 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_00e3: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; <>s__2 = ((Component)((Component)<>4__this).transform.GetChild(0)).GetComponentsInChildren().GetEnumerator(); try { while (<>s__2.MoveNext()) { 5__3 = <>s__2.Current; 5__3.isKinematic = true; 5__4 = ((Component)5__3).GetComponent(); if ((Object)(object)5__4 != (Object)null) { 5__4.enabled = false; } 5__4 = null; 5__3 = null; } } finally { if (<>s__2 != null) { <>s__2.Dispose(); } } <>s__2 = null; break; case 1: <>1__state = -1; <>4__this.Visuals.transform.Translate(Vector3.down * 0.0005f * (float)5__1); break; } if (5__1++ < 50) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } <>4__this.SetActive(active: 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 static Dictionary RagdollPools = new Dictionary(); public static Dictionary PlayerMats = new Dictionary(); public static Dictionary MiscMats = new Dictionary(); public static Material LocalHeadClippedMat = null; public static List ghosts = new List(); public List BoneRefs = new List(); private Dictionary boneAnchorPosStorage = new Dictionary(); private Dictionary originalBoneAnchors = new Dictionary(); public bool IsActive = true; public float Age = 0f; public float ClearAfterSeconds = 0f; public bool UndoGhostOnClear = true; public Transform Chest; public float Drama = 1f; public object SinkRoutine = null; public bool IsJanky = false; public bool DoSmashLaunch = false; public Vector3 SmashLaunchDir = Vector3.zero; public static Ragdoll SpawnRagdoll(PlayerController player, StructureStorage killingStructure = null, float drama = 1f) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) RagdollPool ragdollPool = FindOrCreateRagdollPool(player); Ragdoll ragdoll = ragdollPool.FetchRagdoll(); Vector3 val; if (Core.Instance.CurrentScene == "Map0") { Vector3 standingPosition = player.GetStandingPosition(); val = new Vector3(standingPosition.x, 0f, standingPosition.z); float magnitude = ((Vector3)(ref val)).magnitude; if (player.GetStandingPosition().y <= -0.09f || magnitude >= 12f) { Core.Instance.PlayersKilledToGutter.Add(player); } } bool flag = Core.Instance.PlayersKilledToGutter.Contains(player); bool flag2 = (Core.Instance.IsInMatch && Config.RagdollsInMatches.Value >= Config.RagdollsInMatches_Type.PerDamage) || (!Core.Instance.IsInMatch && Config.RagdollsOutsideMatches.Value >= Config.RagdollsOutsideMatches_Type.PerDamage); ragdoll.Drama = drama; float num = (flag ? 1f : drama); if (killingStructure != null) { ragdoll.Hit(killingStructure); } else if (!flag) { Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor((float)Random.RandomRange(-15, 15), (float)Random.RandomRange(23, 29), (float)Random.RandomRange(-15, 15)); ragdoll.AddVelocity(val2 * num); } else { val = new Vector3(ragdoll.Chest.position.x, 0f, ragdoll.Chest.position.z); Vector3 val3 = ((Vector3)(ref val)).normalized * -35f; Vector3 velocity = val3 + Vector3.up * Random.RandomRange(90f, 150f) * 0.7f; ragdoll.AddVelocity(velocity); } if (flag2) { ragdoll.AddVelocity(((Component)ragdoll.Chest).GetComponentInChildren().velocity); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor((float)Random.RandomRange(-15, 15), (float)Random.RandomRange(23, 29), (float)Random.RandomRange(-15, 15)); val4 *= 0.85f; ragdoll.AddVelocity(val4 * num); } return ragdoll; } public static RagdollPool FindOrCreateRagdollPool(PlayerController player) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown object obj; if (player == null) { obj = null; } else { PlayerVisuals playerVisuals = player.PlayerVisuals; obj = ((playerVisuals != null) ? ((Component)playerVisuals).GetComponentInChildren() : null); } if ((Object)obj == (Object)null) { Debug.Log("Could not create silhouette for player " + HelperFunctions.SanitizeString(player.assignedPlayer.Data.GeneralData.PublicUsername), debugOnly: false, 2); return null; } if (RagdollPools.ContainsKey(player)) { return RagdollPools[player]; } string text = HelperFunctions.SanitizeString(player.assignedPlayer.Data.GeneralData.PublicUsername + "RagdollPool"); GameObject val = new GameObject(text); val.transform.SetParent(Core.Instance.ModObject_Ragdolls.transform, true); RagdollPool ragdollPool = new RagdollPool { parentController = player, Transform = val.transform }; RagdollPools[player] = ragdollPool; return ragdollPool; } public static void ClearAllRagdolls() { foreach (RagdollPool value in RagdollPools.Values) { foreach (Ragdoll item in value?.PoolItems) { if (!((Object)(object)item == (Object)null)) { item.SinkRoutine = MelonCoroutines.Start(item.Sink()); } } } } public static void ReapplyVisualsFor(PlayerController player) { foreach (RagdollPool value in RagdollPools.Values) { foreach (Ragdoll poolItem in value.PoolItems) { if ((Object)(object)poolItem.ParentController == (Object)(object)player) { poolItem.ReapplyVisuals(); } } } } public static void Explode(StructureStorage source) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (source == null) { return; } int type = (int)source.Type; float num = 0f; if (type >= 2 && type <= 4) { num = 1f; } else if (type == 5 || type == 6) { num = 2f; } else { switch (type) { case 7: num = 3f; break; case 8: num = 5f; break; } } foreach (RagdollPool value in RagdollPools.Values) { foreach (Ragdoll poolItem in value.PoolItems) { float num2 = Vector3.Distance(poolItem.Chest.position, source.Pos); num2 = Mathf.Clamp(num2, 0.2f, 2.5f); float num3 = 2.5f - num2; Vector3 val = poolItem.Chest.position - source.Pos; Vector3 normalized = ((Vector3)(ref val)).normalized; poolItem.AddVelocity(normalized * num3 * num * 75f); } } } public void SetupRagdoll() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_032a: Unknown result type (might be due to invalid IL or missing references) Type = VisualsType.Ragdoll; Visuals = Object.Instantiate(((Component)ParentController.PlayerVisuals).gameObject); Visuals.SetActive(false); SetUp(Visuals); Visuals.transform.SetParent(((Component)this).transform); Chest = ((Component)this).transform.GetChild(0).GetChild(0).GetChild(3); PlayerMeasurement playerMeasurement = ParentController.assignedPlayer.Data.PlayerMeasurement; float length = playerMeasurement.Length; float armSpan = playerMeasurement.ArmSpan; GrabBoneRefs(); SkinnedMeshRenderer componentInChildren = Visuals.GetComponentInChildren(); ((Component)componentInChildren).gameObject.layer = 0; ((Renderer)componentInChildren).material = PlayerMats[ParentController]; foreach (Rigidbody componentsInChild in ((Component)this).GetComponentsInChildren()) { string[] array = new string[5] { "Floor", "CombatFloor", "Environment", "Leanable", "PedestalFloor" }; componentsInChild.includeLayers = LayerMaskExtensions.AddToMask(default(LayerMask), Il2CppStringArray.op_Implicit(array)); componentsInChild.includeLayers = LayerMask.op_Implicit(LayerMask.op_Implicit(componentsInChild.includeLayers) | LayerMask.op_Implicit(Core.Instance.PhysicsLayerMask)); ((Component)componentsInChild).gameObject.tag = "Audio_Stone"; if (!Config.LegacyRagdollJank.Value) { componentsInChild.excludeLayers = LayerMask.op_Implicit(LayerMask.GetMask(new string[7] { "Move", "PlayerController", "PlayerHitbox", "PlayerPhysics", "PlayerPhysicsTransform", "PlayerFeet", "PlayerOnPlayerInteraction" })); } ((Component)componentsInChild).gameObject.layer = Core.Instance.PhysicsLayer; if (((Object)componentsInChild).name.Contains("Foot") || ((Object)componentsInChild).name.Contains("Head") || ((Object)componentsInChild).name.Contains("Hand") || ((Object)componentsInChild).name.Contains("Spine_A")) { AddImpactAudio(((Component)componentsInChild).gameObject, isImpact: true); } if (((Object)componentsInChild).name.Contains("Pelvis")) { AddImpactAudio(((Component)componentsInChild).gameObject, isImpact: false); } componentsInChild.ResetCenterOfMass(); } CacheOriginalJointData(); CopyPose(); if (!Config.LegacyRagdollJank.Value) { return; } float num = Random.RandomRange(0.5f, 1.5f); if (Random.RandomRangeInt(0, 2) == 0) { num *= num; } if (Random.RandomRangeInt(0, 15) == 0) { num *= num * num * num; } foreach (BoneRef boneRef in BoneRefs) { Transform ragdollBone = boneRef.RagdollBone; ragdollBone.localScale *= num; } } public void GrabBoneRefs() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) foreach (BoneDefinition item in (Il2CppArrayBase)(object)Visuals.GetComponent().boneDefinitions) { foreach (Transform item2 in HelperFunctions.FindChildrenRecursive(((Component)this).transform.GetChild(0))) { if (((Object)item.Transform).name == ((Object)item2).name) { Joint component = ((Component)item2).GetComponent(); if ((Object)(object)component != (Object)null) { originalBoneAnchors[component] = component.connectedAnchor; } BoneRefs.Add(new BoneRef(((Object)item.Transform).name, item.Transform, item2)); break; } } } } [IteratorStateMachine(typeof(d__25))] private IEnumerator C_SetLayersDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__25(0) { <>4__this = this }; } private void Update() { Age += Time.deltaTime; } private void FixedUpdate() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (SinkRoutine == null) { TrackVisualsToRbBones(); if (ClearAfterSeconds > 0f && Age >= ClearAfterSeconds) { SinkRoutine = MelonCoroutines.Start(Sink()); } if (!Core.Instance.IsInMatch && Age >= 8.5f && ghosts.Contains(ParentController)) { UnGhostifyOwner(); } if (Chest.position.y < -20f) { SetActive(active: false); } Vector3 position = Chest.position; if (((Vector3)(ref position)).magnitude > 300f) { SetActive(active: false); } if (DoSmashLaunch && ((Vector3)(ref SmashLaunchDir)).magnitude > 0.1f) { AddVelocity(SmashLaunchDir * 20f); } } } private void TrackVisualsToRbBones() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) foreach (BoneRef boneRef in BoneRefs) { if (!IsJanky || !Config.LegacyRagdollJank.Value) { ((Component)boneRef.VisualBone).transform.position = ((Component)boneRef.RagdollBone).transform.position; ((Component)boneRef.VisualBone).transform.rotation = ((Component)boneRef.RagdollBone).transform.rotation; } else { ((Component)boneRef.VisualBone).transform.localPosition = ((Component)boneRef.RagdollBone).transform.position; ((Component)boneRef.VisualBone).transform.localRotation = ((Component)boneRef.RagdollBone).transform.rotation; } } } private void AddImpactAudio(GameObject gameObject, bool isImpact) { AudioSource val = gameObject.AddComponent(); val.spatialBlend = 1f; val.spatialize = true; gameObject.AddComponent().IsImpact = isImpact; } private void CacheOriginalJointData() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) foreach (BoneRef boneRef in BoneRefs) { Transform ragdollBone = boneRef.RagdollBone; Joint component = ((Component)ragdollBone).GetComponent(); if ((Object)(object)component != (Object)null) { component.autoConfigureConnectedAnchor = false; GameObject val = new GameObject(); val.transform.SetParent(((Component)component.connectedBody).transform); val.transform.position = ((Component)component).transform.position; ((Object)val).name = ((Object)component).name; boneAnchorPosStorage[component] = val.transform; } } } public new void CopyPose() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (BoneDefinition item in (Il2CppArrayBase)(object)((Component)ParentController).GetComponentInChildren().boneDefinitions) { list.Add(item.Transform); } List list2 = new List(); foreach (BoneRef boneRef in BoneRefs) { list2.Add(boneRef.RagdollBone); } foreach (Rigidbody componentsInChild in ((Component)((Component)this).transform.GetChild(0)).GetComponentsInChildren()) { if (!((Object)(object)componentsInChild == (Object)null)) { componentsInChild.velocity = Vector3.zero; } } HelperFunctions.CopyAllTransforms(list, list2); ResetAnchors(); if ((Core.Instance.IsInMatch && Config.RagdollsInMatches.Value == Config.RagdollsInMatches_Type.PerDamage) || (!Core.Instance.IsInMatch && Config.RagdollsOutsideMatches.Value == Config.RagdollsOutsideMatches_Type.PerDamage)) { MelonCoroutines.Start(C_SetLayersDelayed()); } TrackVisualsToRbBones(); Visuals.SetActive(true); } public void ResetAnchors() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (BoneRef boneRef in BoneRefs) { list.Add(boneRef.RagdollBone); } foreach (Transform item in list) { Joint component = ((Component)item).GetComponent(); if (!((Object)(object)component == (Object)null)) { if (!boneAnchorPosStorage.ContainsKey(component)) { CacheOriginalJointData(); } Vector3 val = ((Component)component).transform.InverseTransformPoint(((Component)boneAnchorPosStorage[component]).transform.position); if (!Config.LegacyRagdollJank.Value) { component.connectedAnchor = originalBoneAnchors[component] * (item.lossyScale.x / 100f); continue; } float num = Random.RandomRange(50f, 180f); component.connectedAnchor = originalBoneAnchors[component] * (item.lossyScale.x / num); } } } public void AddVelocity(Vector3 velocity) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((Component)Chest).GetComponent().AddForce(velocity, (ForceMode)2); } public void Hit(StructureStorage killingStructure) { //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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (killingStructure != null && !((Object)(object)killingStructure.StructureGO == (Object)null)) { Rigidbody component = ((Component)((Component)this).transform.GetChild(0).GetChild(0).GetChild(3)).GetComponent(); if (((Vector3)(ref killingStructure.Velocity)).magnitude > 0.01f) { Vector3 val = killingStructure.Pos - ((Component)component).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = ((((Vector3)(ref killingStructure.Velocity)).magnitude < 0.5f) ? normalized : killingStructure.Velocity); component.AddForceAtPosition(val2 * Drama * 20f, killingStructure.Pos, (ForceMode)1); } else { Vector3 velocity = ParentController.PlayerPhysics.physicsRigidbody.velocity; ((Vector3)(ref velocity))..ctor(velocity.x, velocity.y / 2f, velocity.z); component.AddForce(velocity * 10f * Drama, (ForceMode)2); } } } public void SetActive(bool active) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (!active) { if (UndoGhostOnClear) { UnGhostifyOwner(); } foreach (Rigidbody componentsInChild in ((Component)((Component)this).transform.GetChild(0)).GetComponentsInChildren()) { componentsInChild.isKinematic = false; componentsInChild.velocity = Vector3.zero; Collider component = ((Component)componentsInChild).GetComponent(); if ((Object)(object)component != (Object)null) { component.enabled = true; } } IsJanky = false; DoSmashLaunch = false; } ((Component)this).gameObject.SetActive(false); } [IteratorStateMachine(typeof(d__36))] public IEnumerator Sink() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__36(0) { <>4__this = this }; } public static void Ghostify(PlayerController player) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 if (!Config.EnableGhostification.Value) { return; } SkinnedMeshRenderer componentInChildren = ((Component)player.PlayerVisuals).GetComponentInChildren(); ((Renderer)componentInChildren).material = Core.Instance.GhostMat; float num = (((int)player.controllerType == 1) ? 1f : 0f); ((Renderer)componentInChildren).material.SetFloat("_IsLocal", num); foreach (Renderer componentsInChild in ((Component)player.PlayerVisuals).GetComponentsInChildren(true)) { if ((Object)(object)((Component)((Component)componentsInChild).transform.parent).GetComponent() != (Object)null) { if (!MiscMats.ContainsKey(componentsInChild)) { MiscMats[componentsInChild] = componentsInChild.material; } componentsInChild.material = Core.Instance.GhostMat; } } ghosts.Add(player); } public void GhostifyOwner() { Ghostify(ParentController); } public static void UnGhostify(PlayerController player) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 PlayerVisuals playerVisuals = player.PlayerVisuals; SkinnedMeshRenderer componentInChildren = ((Component)playerVisuals).GetComponentInChildren(); if ((int)player.ControllerType == 1) { ((Renderer)componentInChildren).material = LocalHeadClippedMat; } else { if ((Object)(object)PlayerMats[player] == (Object)null) { return; } ((Renderer)componentInChildren).material = PlayerMats[player]; } foreach (Renderer componentsInChild in ((Component)player.PlayerVisuals).GetComponentsInChildren(true)) { if (MiscMats.ContainsKey(componentsInChild)) { componentsInChild.material = MiscMats[componentsInChild]; } } if (ghosts.Contains(player)) { ghosts.Remove(player); } } public static void UnGhostifyAllGhosts() { List list = new List(ghosts); foreach (PlayerController item in list) { UnGhostify(item); } } public void UnGhostifyOwner() { UnGhostify(ParentController); } public void ClearAfter(float time, bool ghostify = true) { if (ghostify) { GhostifyOwner(); } ClearAfterSeconds = Age + time; } } [RegisterTypeInIl2Cpp] public class RagdollAudio : MonoBehaviour { private AudioSource audioSource; private Rigidbody rigidbody; public bool IsImpact = true; private bool isWhooshing = false; private List vels = new List(); public AudioClip AudioClip => audioSource.clip; public float Volume => audioSource.volume; public void Play() { audioSource.Play(); } private void Start() { audioSource = ((Component)this).GetComponent(); rigidbody = ((Component)this).GetComponent(); } private void OnCollisionEnter(Collision collision) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)audioSource == (Object)null || !IsImpact) { return; } Vector3 relativeVelocity = HelperFunctions.GetRelativeVelocity(vels[0], collision); float magnitude = ((Vector3)(ref relativeVelocity)).magnitude; bool flag = false; if (magnitude <= 2f && Core.Instance.RagdollAudioClipsSoft.Count > 0) { flag = true; } if (!flag) { if (Core.Instance.RagdollAudioClipsHard.Count > 0) { audioSource.clip = Core.Instance.RagdollAudioClipsHard[Random.RandomRangeInt(0, Core.Instance.RagdollAudioClipsHard.Count)]; audioSource.volume = Mathf.Clamp01(magnitude * 0.4f) * Config.RagdollSoundsVolume.Value; } } else { audioSource.clip = Core.Instance.RagdollAudioClipsSoft[Random.RandomRangeInt(0, Core.Instance.RagdollAudioClipsSoft.Count)]; audioSource.volume = Mathf.Clamp01(magnitude * 0.6f) * Config.RagdollSoundsVolume.Value; } audioSource.Play(); } private void FixedUpdate() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) vels.Add(rigidbody.velocity); if (vels.Count > 1) { vels.RemoveAt(0); } if (IsImpact || (Object)(object)audioSource == (Object)null) { return; } if ((Object)(object)audioSource.clip == (Object)null) { AudioSource obj = audioSource; Pool obj2 = Core.Instance.StructurePools[0]; object clip; if (obj2 == null) { clip = null; } else { PooledMonoBehaviour poolItem = obj2.PoolItem; if (poolItem == null) { clip = null; } else { Structure componentInChildren = ((Component)poolItem).GetComponentInChildren(); if (componentInChildren == null) { clip = null; } else { AudioCall whooshAudioCall = componentInChildren.whooshAudioCall; if (whooshAudioCall == null) { clip = null; } else { Il2CppReferenceArray clips = whooshAudioCall.Clips; if (clips == null) { clip = null; } else { WeightedClip? obj3 = ((IEnumerable)clips).FirstOrDefault(); clip = ((obj3 != null) ? obj3.Clip : null); } } } } } obj.clip = (AudioClip)clip; } if (!((Object)(object)audioSource == (Object)null)) { audioSource.loop = true; Vector3 velocity = rigidbody.velocity; if (((Vector3)(ref velocity)).magnitude > 0.5f && !isWhooshing) { audioSource.Play(); isWhooshing = true; } velocity = rigidbody.velocity; if (((Vector3)(ref velocity)).magnitude < 0.5f && isWhooshing) { audioSource.Stop(); isWhooshing = false; } AudioSource obj4 = audioSource; velocity = rigidbody.velocity; obj4.volume = Mathf.Clamp01((((Vector3)(ref velocity)).magnitude - 1f) * 0.4f) * Config.RagdollSoundsVolume.Value; } } } public class StructureStorage { public enum StructureType { Unknown, Disc, Ball, Pillar, BoulderBall, RockCube, SmallRock, Wall, LargeRock } public GameObject StructureGO; public Vector3 Pos; public Quaternion Rot; public Vector3 Velocity; public float Mass; public static List ProcessedStructuresForPhysics = new List(); public static List> GameStates = new List>(); public static List KillDelayed = new List(); public StructureType Type; public Structure StructureComponent => StructureGO.GetComponentInChildren(); public static StructureType ParseType(string type) { return type switch { "Disc" => StructureType.Disc, "Ball" => StructureType.Ball, "Pillar" => StructureType.Pillar, "RockCube" => StructureType.RockCube, "SmallRock" => StructureType.SmallRock, "Wall" => StructureType.Wall, "LargeRock" => StructureType.LargeRock, "DockedDisk" => StructureType.Disc, "BoulderBall" => StructureType.Ball, "PrisonedPillar" => StructureType.Pillar, "CageCube" => StructureType.RockCube, "WrappedWall" => StructureType.Wall, _ => StructureType.Unknown, }; } public static StructureStorage FindStructureStorageAt(Vector3 pos, List gameState) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) StructureStorage result = null; float num = 2f; foreach (StructureStorage item in gameState) { float num2 = Vector3.Distance(item.Pos, pos); if (num2 < num) { result = item; num = num2; } } return result; } public override string ToString() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) return $"{Type}: {Pos}"; } public static List GenerateStructureStorages() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (Pool structurePool in Core.Instance.StructurePools) { Enumerator enumerator2 = structurePool.PooledObjects.GetEnumerator(); while (enumerator2.MoveNext()) { PooledMonoBehaviour current2 = enumerator2.Current; GameObject gameObject = ((Component)current2).gameObject; if (!gameObject.activeSelf) { continue; } Match match = Regex.Match(((Object)structurePool.poolParent).name, "Pool: ([a-zA-Z]+) "); string value = match.Groups[1].Value; StructureType structureType = ParseType(value); Rigidbody component = gameObject.GetComponent(); Vector3 val; if (component != null) { _ = component.velocity; if (0 == 0) { val = component.velocity; goto IL_00bc; } } val = Vector3.zero; goto IL_00bc; IL_00bc: Vector3 velocity = val; float num; if (component != null) { _ = component.mass; if (0 == 0) { num = component.mass; goto IL_00de; } } num = 200f; goto IL_00de; IL_00de: float num2 = num; if (structureType == StructureType.Disc) { num2 /= 2.5f; } StructureStorage structureStorage = new StructureStorage { StructureGO = gameObject, Pos = gameObject.transform.position, Rot = gameObject.transform.rotation, Velocity = velocity, Mass = num2, Type = structureType }; list.Add(structureStorage); if (!ProcessedStructuresForPhysics.Contains(gameObject)) { ProcessStructureForPhysics(structureStorage); } } } return list; } public static void ProcessStructureForPhysics(StructureStorage structureStorage) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) GameObject structureGO = structureStorage.StructureGO; Transform transform = structureGO.transform; ProcessedStructuresForPhysics.Add(structureGO); StructureType type = structureStorage.Type; GameObject val = new GameObject("RagdollCollider"); structureGO.GetComponentInChildren().excludeLayers = Core.Instance.PhysicsLayerMask; if (type == StructureType.Disc) { val.AddComponent().size = new Vector3(0.63f, 0.14f, 0.63f); } if (type == StructureType.Ball) { val.AddComponent().radius = 0.45f; } bool flag; switch (type) { case StructureType.Pillar: case StructureType.RockCube: case StructureType.Wall: flag = true; break; default: flag = false; break; } if (flag) { BoxCollider componentInChildren = ((Component)transform).GetComponentInChildren(); val.AddComponent().size = componentInChildren.size; } if ((type == StructureType.SmallRock || type == StructureType.LargeRock) ? true : false) { MeshCollider component = ((Component)transform).GetComponent(); BoxCollider obj = val.AddComponent(); Bounds bounds = ((Collider)component).bounds; obj.size = ((Bounds)(ref bounds)).size; } val.layer = Core.Instance.PhysicsLayer; val.transform.SetParent(transform, false); Rigidbody val2 = val.AddComponent(); val2.isKinematic = true; val2.excludeLayers = LayerMask.op_Implicit(~LayerMask.op_Implicit(Core.Instance.PhysicsLayerMask)); val2.includeLayers = Core.Instance.PhysicsLayerMask; } } public class StructureKillStorage { [CompilerGenerated] private sealed class d__6 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private GameObject 5__1; private int 5__2; private List.Enumerator <>s__3; private StructureKillStorage 5__4; private List.Enumerator <>s__5; private StructureKillStorage 5__6; private float 5__7; private float 5__8; private float 5__9; private Vector3 5__10; private Vector3 5__11; private List.Enumerator <>s__12; private StructureKillStorage 5__13; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>s__3 = default(List.Enumerator); 5__4 = null; <>s__5 = default(List.Enumerator); 5__6 = null; <>s__12 = default(List.Enumerator); 5__13 = null; <>1__state = -2; } private bool MoveNext() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0196: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) 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; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; case 2: <>1__state = -1; 5__1 = Core.Instance.ActiveShockwave.ForceField; if ((Object)(object)5__1 == (Object)null) { <>s__3 = Core.Instance.StructureKillStorages.GetEnumerator(); try { while (<>s__3.MoveNext()) { 5__4 = <>s__3.Current; 5__4.Kill(); 5__4 = null; } } finally { ((IDisposable)<>s__3).Dispose(); } <>s__3 = default(List.Enumerator); Core.Instance.StructureKillStorages.Clear(); StructureStorage.KillDelayed.Clear(); return false; } 5__2 = 0; break; case 3: <>1__state = -1; break; } if (5__2++ < 500 && !((Object)(object)5__1 == (Object)null)) { <>s__5 = Core.Instance.StructureKillStorages.GetEnumerator(); try { while (<>s__5.MoveNext()) { 5__6 = <>s__5.Current; if ((Object)(object)5__6.__instance == (Object)null) { continue; } 5__7 = Vector3.Distance(((Component)5__6.__instance).transform.position, 5__1.transform.position); 5__8 = 5__1.transform.localScale.x; if (5__7 < 5__8) { 5__9 = ((Core.Instance.CurrentScene == "Map0") ? (-1f) : (-2f)); 5__10 = new Vector3(5__1.transform.position.x, 5__9, 5__1.transform.position.y); Vector3 val = ((Component)5__6.__instance).transform.position - 5__1.transform.position; 5__11 = ((Vector3)(ref val)).normalized * 20f; Structure _instance = 5__6.__instance; if (_instance != null) { _instance.Kill(5__11, true, true, false); } } 5__6 = null; } } finally { ((IDisposable)<>s__5).Dispose(); } <>s__5 = default(List.Enumerator); <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 3; return true; } <>s__12 = Core.Instance.StructureKillStorages.GetEnumerator(); try { while (<>s__12.MoveNext()) { 5__13 = <>s__12.Current; 5__13.Kill(); 5__13 = null; } } finally { ((IDisposable)<>s__12).Dispose(); } <>s__12 = default(List.Enumerator); Core.Instance.StructureKillStorages.Clear(); StructureStorage.KillDelayed.Clear(); 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 Structure __instance = null; private Vector3 killVelocity; private bool playSFX; private bool playVFX; private bool networked; public void Kill() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)null)) { return; } foreach (Collider componentsInChild in ((Component)__instance).GetComponentsInChildren()) { componentsInChild.enabled = true; } __instance.Kill(killVelocity, playSFX, playVFX, networked); } [IteratorStateMachine(typeof(d__6))] public static IEnumerator C_KillStructuresFromShockwave() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__6(0); } public StructureKillStorage(Structure instance, Vector3 killVelocity, bool playSFX, bool playVFX, bool networked) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) __instance = instance; this.killVelocity = killVelocity; this.playSFX = playSFX; this.playVFX = playVFX; this.networked = networked; } } } namespace DieHarder.DramaticEffects { [RegisterTypeInIl2Cpp] public class ScreenFlash : MonoBehaviour { private float timer = 0f; private const float flashDuration = 0.07f; private Renderer renderer; public static void CreateScreenFlash(Transform parent, int layer) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); val.transform.SetParent(parent, false); val.transform.localScale = Vector3.one * 0.2f; ((Collider)val.GetComponent()).enabled = false; val.layer = layer; Renderer component = val.GetComponent(); component.material = new Material(Shader.Find("Universal Render Pipeline/Unlit")); component.material.SetInt("_Cull", 1); component.material.SetFloat("_Surface", 1f); component.material.SetFloat("_Blend", 0f); val.AddComponent(); } private void Update() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) timer += Time.deltaTime; if ((Object)(object)renderer == (Object)null) { renderer = ((Component)this).GetComponent(); } if ((Object)(object)renderer != (Object)null) { float num = Mathf.Lerp(1f, 0f, timer / 0.07f); renderer.material.color = new Color(1f, 1f, 1f, num); } if (timer > 0.07f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }