RUMBLE does not support other mod managers. If you want to use a manager, you must use the RUMBLE Mod Manager, a manager specifically designed for this game.
Decompiled source of DieHarder v2.0.0
Mods/DieHarder.dll
Decompiled 6 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using DieHarder; using DieHarder.DramaticEffects; using HarmonyLib; using Il2Cpp; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppLIV.SDK.Unity; using Il2CppLiv.Lck.Smoothing; using Il2CppRUMBLE.CharacterCreation.Interactable; using Il2CppRUMBLE.Combat.ShiftStones; using Il2CppRUMBLE.Environment.Howard; using Il2CppRUMBLE.Integrations.LIV; 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.Recording.LCK.Extensions; using Il2CppRUMBLE.Utilities; using Il2CppRootMotion; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using RumbleModUI; using RumbleModdingAPI; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; [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.0", "TacoSlayer36", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: MelonColor(255, 255, 248, 231)] [assembly: MelonAuthorColor(255, 255, 248, 231)] [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+41f532962cacab161df2ef5304fca01a47af0afd")] [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 BuildInfo { public const string Name = "DieHarder"; public const string Author = "TacoSlayer36"; public const string Version = "2.0.0"; public const string Description = "That death goes hard"; } public class Core : MelonMod { public enum MatchResult { Undecided, Won, Lost, Tied } public bool GlobalInit = false; public static Core Instance; public GameObject ModObject_Parent; public GameObject ModObject_Silhouettes; public GameObject ModObject_DramaticEffects; public GameObject ModObject_Ragdolls; public GameObject ModObject_DDOLParent; public static MelonPreferences_Category prefs_Category; public static MelonPreferences_Entry<bool> Prefs_DebugEnabled; public static MelonPreferences_Entry<bool> Prefs_LegacyRagdollJank; public static MelonPreferences_Entry<bool> Prefs_SmashBrosLaunch; public static AudioSource PreImpactAudioSource; public static AudioSource ImpactAudioSource; public bool HasRoundEnded = false; public bool WasMatchEnd = false; public List<Pool<PooledMonoBehaviour>> StructurePools = new List<Pool<PooledMonoBehaviour>>(); public List<StructureKillStorage> StructureKillStorages = new List<StructureKillStorage>(); 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 ImpactAudioPath = "UserData/DieHarder/impact.wav"; public const string PreImpactAudioPath = "UserData/DieHarder/pre-impact.wav"; public AudioClip ImpactAudioClip; public AudioClip PreImpactAudioClip; public Dictionary<PlayerController, PlayerVisualsClone> PlayerSilhouettes = new Dictionary<PlayerController, PlayerVisualsClone>(); public List<Impact> Impacts = new List<Impact>(); private List<PlayerController> playersProcessedThisFrame = new List<PlayerController>(); public Dictionary<PlayerController, int> PlayerHealths = new Dictionary<PlayerController, int>(); public Howard Howard; private bool howardDied; public Material HowardMat = null; public ScriptableRendererFeature LIVPlayersInstance; public List<CameraInfo> StoredCameraInfos = new List<CameraInfo>(); public LayerMask VisualLayer = LayerMask.op_Implicit(LayerMask.NameToLayer("Clouds")); public int PhysicsLayer = 3; public Mod Mod = new Mod(); public GameObject ModObject_DDOLRagdoll => ((Component)ModObject_DDOLParent.transform.GetChild(0)).gameObject; public bool DebugEnabled => Prefs_DebugEnabled.Value; public string CurrentScene => Scene.GetSceneName(); public bool IsInMatch => CurrentScene.Contains("Map") && Singleton<PlayerManager>.Instance.AllPlayers.Count >= 2; public Material ShockwaveMat { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if ((Object)(object)_shockwaveMat == (Object)null) { _shockwaveMat = new Material(ShockwaveShader); ((Object)_shockwaveMat).hideFlags = (HideFlags)61; } return _shockwaveMat; } } public Material PrimarySilhouetteMat { get { //IL_003e: 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(ModUISettings.PrimaryEffectColor, isPrimary: true); return _primarySilhouetteMat; } } public Material SecondarySilhouetteMat { get { //IL_003e: 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(ModUISettings.SecondaryEffectColor, 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 => ((Component)((Component)Howard).transform.GetChild(3)).GetComponentInChildren<SkinnedMeshRenderer>(); public LayerMask VisualLayerMask => LayerMask.op_Implicit(1 << LayerMask.op_Implicit(VisualLayer)); public LayerMask PhysicsLayerMask => LayerMask.op_Implicit(1 << PhysicsLayer); public override void OnLateInitializeMelon() { Instance = this; UI.instance.UI_Initialized += OnUIInit; Calls.onMapInitialized += sceneReady; prefs_Category = MelonPreferences.CreateCategory("DieHarder"); Prefs_LegacyRagdollJank = prefs_Category.CreateEntry<bool>("LegacyRagdollJank", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); Prefs_SmashBrosLaunch = prefs_Category.CreateEntry<bool>("SmashBrosLaunch", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); Prefs_DebugEnabled = prefs_Category.CreateEntry<bool>("debug_mode_enabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); SilhouetteShader = Calls.LoadAssetFromStream<Shader>((MelonMod)(object)this, "DieHarder.assets.dieharder", "SolidColorUnlit"); ((Object)SilhouetteShader).hideFlags = (HideFlags)61; ShockwaveShader = Calls.LoadAssetFromStream<Shader>((MelonMod)(object)this, "DieHarder.assets.dieharder", "Shockwave"); ((Object)ShockwaveShader).hideFlags = (HideFlags)61; GhostShader = Calls.LoadAssetFromStream<Shader>((MelonMod)(object)this, "DieHarder.assets.dieharder", "Ghost"); ((Object)GhostShader).hideFlags = (HideFlags)61; } public override void OnUpdate() { if (DebugEnabled) { if (!Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)116)) { OnPlayerHealthDepleted(Singleton<PlayerManager>.Instance.localPlayer.Controller.GetSubsystem<PlayerHealth>()); } if (Input.GetKey((KeyCode)304) && Input.GetKeyDown((KeyCode)116)) { Ragdoll ragdoll = Ragdoll.SpawnRagdoll(Singleton<PlayerManager>.Instance.localPlayer.Controller, FindClosestStructure(Singleton<PlayerManager>.Instance.LocalPlayer.Controller)); ragdoll.GhostifyOwner(); ragdoll.UndoGhostOnClear = true; ragdoll.ClearAfter(10f); } } } public override void OnFixedUpdate() { if (!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) { object obj; if (value == null) { obj = null; } else { Transform transform = value.Transform; obj = ((transform != null) ? ((Component)transform).gameObject : null); } Object.Destroy((Object)obj); Ragdoll.RagdollPools.Remove(value.parentController); } } } if ((Object)(object)Howard != (Object)null && Howard.currentHp == 0f && !howardDied) { howardDied = true; ActiveImpact = CreateImpact(Singleton<PlayerManager>.Instance.LocalPlayer.Controller, 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(); if ((!IsInMatch || ModUISettings.RagdollsInMatches < 3) && (IsInMatch || ModUISettings.RagdollsOutsideMatches < 2)) { return; } Enumerator<Player> enumerator3 = Singleton<PlayerManager>.Instance.AllPlayers.GetEnumerator(); while (enumerator3.MoveNext()) { Player current3 = enumerator3.Current; if (current3 == null || (Object)(object)current3.Controller == (Object)null) { continue; } int num = 0; if (PlayerHealths.ContainsKey(current3.Controller)) { num = PlayerHealths[current3.Controller]; } if (current3.Controller.GetSubsystem<PlayerHealth>().IsRegeneratingHealth) { continue; } int num2 = num - current3.Data.HealthPoints; if (num2 > 0) { StructureStorage killingStructure = FindClosestStructure(current3.Controller); if ((IsInMatch && ModUISettings.RagdollsInMatches < 4) || (!IsInMatch && ModUISettings.RagdollsOutsideMatches < 3)) { num2 = 1; } for (int i = 0; i < num2; i++) { Ragdoll ragdoll = Ragdoll.SpawnRagdoll(current3.Controller, killingStructure); ragdoll.Hit(killingStructure); if (IsInMatch && ModUISettings.CleanupInMatches >= 2) { ragdoll.ClearAfter(ModUISettings.CleanupInMatches); } else if (!IsInMatch) { ragdoll.ClearAfter(ModUISettings.CleanupOutsideMatches); } } } PlayerHealths[current3.Controller] = current3.Data.HealthPoints; } } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { Impact.FogEndDistanceStorage = -1f; } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown if (!(sceneName == "Loader")) { ActiveImpact?.CancelAnimation(); PlayerHealths.Clear(); PlayerSilhouettes.Clear(); 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); HasRoundEnded = false; Ragdoll.RagdollPools.Clear(); Ragdoll.LocalHeadClippedMat = null; ActiveImpact = null; ActiveShockwave = null; if (Scene.GetSceneName() == "Gym" && !GlobalInit) { RunGlobalInit(); } PreImpactAudioClip = AudioManager.LoadWavFile("UserData/DieHarder/pre-impact.wav"); PreImpactAudioSource.clip = PreImpactAudioClip; ImpactAudioClip = AudioManager.LoadWavFile("UserData/DieHarder/impact.wav"); ImpactAudioSource.clip = ImpactAudioClip; } } private void sceneReady() { if (CurrentScene == "Gym") { MelonCoroutines.Start(C_ListenForLandButton("FlatLand")); MelonCoroutines.Start(C_ListenForLandButton("VoidLand")); Howard = Howardroot.GetGameObject().GetComponent<Howard>(); SkinnedMeshRenderer howardSmr = Instance.HowardSmr; Instance.HowardMat = ((Renderer)howardSmr).material; ((Object)Instance.HowardMat).hideFlags = (HideFlags)61; } } private IEnumerator C_ListenForLandButton(string landType) { yield return (object)new WaitForSeconds(1f); GameObject obj = GameObject.Find(landType); if (obj != null) { obj.GetComponentInChildren<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate { MelonCoroutines.Start(C_OnLandEntered()); })); } } private IEnumerator C_OnLandEntered() { yield return (object)new WaitForSeconds(1.5f); ModObject_Parent.SetActive(true); } public void RunGlobalInit() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown fetchStructurePools(); LCKTabletUtility lckTablet = Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetSubsystem<PlayerLIV>().LckTablet; if ((Object)(object)lckTablet != (Object)null) { LIVPlayersInstance = CameraExtensions.GetUniversalAdditionalCameraData(lckTablet.firstPersonCamera._camera).scriptableRenderer.rendererFeatures[0]; } ModObject_DDOLParent = Object.Instantiate<GameObject>(Calls.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "DieHarder.assets.dieharder", "DieHarderDDOL")); ((Object)ModObject_DDOLParent).name = "DieHarderDDOL"; Object.DontDestroyOnLoad((Object)(object)ModObject_DDOLParent); ((Component)ModObject_DDOLParent.transform.GetChild(0)).gameObject.SetActive(false); GameObject val = new GameObject("PreImpactAudioPlayer"); val.transform.SetParent(ModObject_DDOLParent.transform); PreImpactAudioSource = val.AddComponent<AudioSource>(); PreImpactAudioSource.clip = Instance.PreImpactAudioClip; PreImpactAudioSource.spatialBlend = 0f; GameObject val2 = new GameObject("ImpactAudioPlayer"); val2.transform.SetParent(ModObject_DDOLParent.transform); ImpactAudioSource = val2.AddComponent<AudioSource>(); ImpactAudioSource.spatialBlend = 0f; GlobalInit = true; } public void DetermineIfMatchEnd() { bool wasMatchEnd = false; if ((Object)(object)Singleton<MatchHandler>.instance == (Object)null) { WasMatchEnd = false; return; } int currentRound = Singleton<MatchHandler>.instance.CurrentRound; bool flag = Instance.GetMatchResult() == MatchResult.Won; List<int> list = ((IEnumerable<int>)Singleton<MatchHandler>.instance.RoundsWonList).ToList(); switch (currentRound) { case 0: wasMatchEnd = false; break; case 1: wasMatchEnd = list[0] == 1 && flag; break; case 2: wasMatchEnd = true; break; } WasMatchEnd = wasMatchEnd; } public MatchResult GetMatchResult() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 bool flag = true; bool flag2 = false; if (Singleton<PlayerManager>.Instance.LocalPlayer != null) { flag = Singleton<PlayerManager>.Instance.LocalPlayer.Data.HealthPoints == 0; } Enumerator<Player> enumerator = Singleton<PlayerManager>.Instance.AllPlayers.GetEnumerator(); while (enumerator.MoveNext()) { Player current = enumerator.Current; if ((int)current.Controller.controllerType != 1 && current.Data.HealthPoints == 0) { flag2 = true; } } if (flag && !flag2) { return MatchResult.Lost; } if (flag && flag2) { return MatchResult.Tied; } return MatchResult.Won; } private void fetchStructurePools() { foreach (Pool<PooledMonoBehaviour> item in (Il2CppArrayBase<Pool<PooledMonoBehaviour>>)(object)Singleton<PoolManager>.instance.availablePools) { if (((Object)item.poolParent).name.Contains("RUMBLE.MoveSystem.Structure")) { StructurePools.Add(item); } } } public void ProcessNewPlayer(PlayerController player) { if (playersProcessedThisFrame.Contains(player)) { return; } PlayerHealth playerHealth = player.GetSubsystem<PlayerHealth>(); playerHealth.OnHealthDepleted.AddListener(UnityAction.op_Implicit((Action)delegate { OnPlayerHealthDepleted(playerHealth); })); try { if ((Object)(object)Ragdoll.LocalHeadClippedMat == (Object)null) { SkinnedMeshRenderer componentInChildren = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller.GetSubsystem<PlayerVisuals>()).GetComponentInChildren<SkinnedMeshRenderer>(); Ragdoll.LocalHeadClippedMat = ((Renderer)componentInChildren).material; ((Object)Ragdoll.LocalHeadClippedMat).hideFlags = (HideFlags)61; } } catch { Debug.Log("Could not create silhouette for player " + HelperFunctions.SanitizeString(player.assignedPlayer.Data.GeneralData.PublicUsername), debugOnly: false, 2); } CreateSilhouetteFromPlayer(player); playersProcessedThisFrame.Add(player); } public void OnPlayerHealthDepleted(PlayerHealth playerHealth) { if (IsInMatch && HasRoundEnded) { return; } if (IsInMatch) { HasRoundEnded = true; } bool howardInvolved = false; Howard howard = Howard; if ((Object)(object)((howard != null) ? howard.playerControllerInRange : null) != (Object)null) { howardInvolved = true; } DetermineIfMatchEnd(); PlayerController parentController = ((PlayerControllerSubsystem)playerHealth).ParentController; if (IsInMatch) { if (ModUISettings.DramaticEffectsInMatches == 2) { ActiveImpact = CreateImpact(parentController, howardInvolved); } if (ModUISettings.DramaticEffectsInMatches == 1 && WasMatchEnd) { ActiveImpact = CreateImpact(parentController, howardInvolved); } } else if (ModUISettings.DramaticEffectsOutsideMatches == 1) { ActiveImpact = CreateImpact(parentController, howardInvolved); } if ((Object)(object)ActiveImpact == (Object)null) { CreateRagdollIfNecessary(parentController); } } public void CreateRagdollIfNecessary(PlayerController damagedPlayer) { //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Invalid comparison between Unknown and I4 //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) StructureStorage structureStorage = FindClosestStructure(damagedPlayer); Ragdoll ragdoll = null; if (IsInMatch) { if ((ModUISettings.RagdollsInMatches == 1 && WasMatchEnd) || ModUISettings.RagdollsInMatches == 2) { ragdoll = Ragdoll.SpawnRagdoll(damagedPlayer, structureStorage); ragdoll.Hit(structureStorage); ragdoll.UndoGhostOnClear = true; ragdoll.GhostifyOwner(); if (ModUISettings.CleanupInMatches >= 2) { ragdoll.ClearAfter(ModUISettings.CleanupInMatches); } } } else if (ModUISettings.RagdollsOutsideMatches == 1) { ragdoll = Ragdoll.SpawnRagdoll(damagedPlayer, structureStorage); ragdoll.Hit(structureStorage); if (ModUISettings.CleanupOutsideMatches > 0) { ragdoll.UndoGhostOnClear = true; ragdoll.GhostifyOwner(); } ragdoll.ClearAfter(ModUISettings.CleanupOutsideMatches); } if (!Prefs_SmashBrosLaunch.Value || !((Object)(object)ragdoll != (Object)null)) { return; } ragdoll.DoSmashLaunch = true; Vector3 val = Vector3.zero; Vector3 val2; if (structureStorage != null) { val2 = ragdoll.Chest.position - structureStorage.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 List<PlayerVisualsClone> GetInvolvedPlayers(PlayerController damagedPlayer) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Invalid comparison between Unknown and I4 List<PlayerVisualsClone> list = new List<PlayerVisualsClone>(); if (IsInMatch) { if (PlayerSilhouettes.Count > 0) { list.Add(PlayerSilhouettes[Singleton<PlayerManager>.Instance.AllPlayers[0].Controller]); } if (PlayerSilhouettes.Count > 1) { list.Add(PlayerSilhouettes[Singleton<PlayerManager>.Instance.AllPlayers[1].Controller]); } } else { if (PlayerSilhouettes.Count > 0) { list.Add(PlayerSilhouettes[damagedPlayer]); } if ((int)damagedPlayer.controllerType != 1) { list.Add(PlayerSilhouettes[Singleton<PlayerManager>.instance.localPlayer.Controller]); } } return list; } public void CreateShockwave(Vector3 pos, PlayerController damagedPlayer, bool howardInvolved = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Shockwave"); val.transform.SetParent(ModObject_DramaticEffects.transform); val.transform.position = pos; ActiveShockwave = val.AddComponent<Shockwave>(); ActiveShockwave.DamagedPlayer = damagedPlayer; ActiveShockwave.HowardInvolved = howardInvolved; } public void CreateSilhouetteFromPlayer(PlayerController player, float waitTime = 0f) { MelonCoroutines.Start(C_CreateSilhouetteFromPlayer(player, waitTime)); } public IEnumerator C_CreateSilhouetteFromPlayer(PlayerController player, float waitTime) { yield return (object)new WaitForSeconds(waitTime); if (!((Object)(object)player == (Object)null)) { if (PlayerSilhouettes.TryGetValue(player, out var ps)) { ps?.ReapplyVisuals(); yield break; } GameObject newClone = Object.Instantiate<GameObject>(((Component)player.GetSubsystem<PlayerVisuals>()).gameObject); PlayerVisualsClone playerSilhouette = newClone.AddComponent<PlayerVisualsClone>(); playerSilhouette.ParentController = player; playerSilhouette.Setup(); newClone.SetActive(false); newClone.transform.SetParent(ModObject_Silhouettes.transform); ((Object)newClone).name = HelperFunctions.SanitizeString(player.assignedPlayer.Data.GeneralData.PublicUsername) + "Silhouette"; PlayerSilhouettes[player] = playerSilhouette; } } public Impact CreateImpact(PlayerController damagedPlayer, bool howardInvolved = false) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)damagedPlayer == (Object)null) { return null; } GameObject val = new GameObject("Impact"); val.transform.SetParent(ModObject_DramaticEffects.transform); Impact impact = val.AddComponent<Impact>(); impact.HowardInvolved = howardInvolved; Impacts.Add(impact); impact.InvolvedPlayers = GetInvolvedPlayers(damagedPlayer); impact.DamagedPlayer = PlayerSilhouettes[damagedPlayer]; if (!howardInvolved) { StructureStorage involvedStructure = FindClosestStructure(damagedPlayer); impact.InvolvedStructure = involvedStructure; } if ((Object)(object)ActiveImpact != (Object)null) { ActiveImpact.CancelAnimation(); Object.Destroy((Object)(object)ActiveImpact); } ActiveImpact = impact; impact.RunAnimation(); return impact; } public StructureStorage FindClosestStructure(PlayerController damagedPlayer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = damagedPlayer.GetChest().position; return FindClosestStructure(position); } public StructureStorage FindClosestStructure(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return (StructureStorage.GameStates.Last()?.Where((StructureStorage obj) => Vector3.Distance(obj.Pos, pos) <= 3f).ToList())?.OrderBy((StructureStorage obj) => Vector3.Distance(obj.Pos, pos))?.FirstOrDefault(); } public static List<CameraInfo> GenerateCamInfos() { List<CameraInfo> list = new List<CameraInfo>(); list.Add(new CameraInfo(Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()) { IsVRCam = true }); list.Add(new CameraInfo(Singleton<RecordingCamera>.Instance.LegacyCamera) { IsRecordingCam = true }); LivCaptureService service = LivCaptureService.Service; object obj; if (service == null) { obj = null; } else { SDKRender render = service.render; obj = ((render != null) ? render.cameraInstance : null); } Camera val = (Camera)obj; if ((Object)(object)val != (Object)null) { list.Add(new CameraInfo(val)); } LCKTabletUtility lckTablet = Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetSubsystem<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 void OnUIInit() { //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_005b: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown Mod.ModName = "DieHarder"; Mod.ModVersion = "2.0.0"; Mod.SetFolder("DieHarder"); Mod.AddDescription("Description", "", "That death goes hard", new Tags { IsSummary = true }); Mod.AddToList("Dramatic Effects In Matches", 2, "0: Disabled\n1: On match end\n2: On round end", new Tags()); Mod.AddToList("Dramatic Effects Outside Matches", 0, "0: Disabled\n1: On death", new Tags()); Mod.AddToList("Impact Frame Duration", 500f, "The time in milliseconds the freeze frame will last\n0ms - 1500ms\n(It's recommended to keep this slightly longer than your pre-impact audio length)", new Tags()); Mod.AddToList("Include Structure In Impact", true, 0, "Include the structure that delivered the killing blow in the impact frame", new Tags()); Mod.AddToList("Dramatic Effects Volume", 1f, "Volume of the sounds for the dramatic effects\n0-1; default is 1", new Tags()); Mod.AddToList("Dramatic Effects Screen Shake", 1, "When to shake the screen during dramatic effects\n0: Never\n1: Take comfort settings into account\n2: Always fully", new Tags()); Mod.AddToList("Primary Effect Color", "#000000", "The color of the player/structure silhouettes during dramatic effects\nUse \"Match\" to base it on winning/losing matches and rounds", new Tags()); Mod.AddToList("Secondary Effect Color", "Match", "The color of the background during dramatic effects\nUse \"Match\" to base it on winning/losing matches and rounds", new Tags()); Mod.AddToList("Ragdolls In Matches", 2, "0: Disabled\n1: On match end\n2: On round end\n<#F80>3: On hit (prone to lag)\n<#F00>4: Per damage (God help you)", new Tags()); Mod.AddToList("Ragdolls Outside Matches", 1, "0: Disabled\n1: On death\n<#F80>2: On hit (prone to lag)\n<#F00>3: Per damage (God help you)", new Tags()); Mod.AddToList("Cleanup In Matches", 1, "When to remove ragdolls in matches\n0: Between matches\n1: Between rounds\n2 and above: Seconds until vanishing", new Tags()); Mod.AddToList("Cleanup Outside Matches", 7, "When to remove ragdolls outside matches\n0: On scene change\n1 and above: Seconds until vanishing", new Tags()); Mod.GetFromFile(); Mod.ModSaved += OnUISave; UI.instance.AddMod(Mod); } public void OnUISave() { if (IsInMatch && ModUISettings.CleanupInMatches >= 2) { foreach (Ragdoll.RagdollPool value in Ragdoll.RagdollPools.Values) { foreach (Ragdoll poolItem in value.PoolItems) { poolItem.ClearAfter(ModUISettings.CleanupInMatches); } } return; } if (IsInMatch || ModUISettings.CleanupOutsideMatches < 1) { return; } foreach (Ragdoll.RagdollPool value2 in Ragdoll.RagdollPools.Values) { foreach (Ragdoll poolItem2 in value2.PoolItems) { poolItem2.ClearAfter(ModUISettings.CleanupOutsideMatches); } } } } public static class Debug { public static bool debugMode => Core.Instance.DebugEnabled; public static GameObject DebugUi { get; private set; } public static TextMeshPro DebugUiText { get; private set; } public static void Log(string message, bool debugOnly = false, int logLevel = 0) { if (!debugOnly || debugMode) { switch (logLevel) { case 1: Melon<Core>.Logger.Warning("Warn: " + message); break; case 2: Melon<Core>.Logger.Error("Error: " + message); break; default: Melon<Core>.Logger.Msg(message); break; } } } public static GameObject CreateDebugUi(GameObject PlayerUi) { //IL_000b: 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_0033: 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_0080: Unknown result type (might be due to invalid IL or missing references) DebugUi = Create.NewText("Placeholder text.", 1f, Color.white, new Vector3(0f, 0.1f, 1f), Quaternion.Euler(0f, 0f, 0f)); DebugUi.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); DebugUi.transform.localPosition = new Vector3(0f, 0.1f, 0.96f); DebugUi.transform.SetParent(PlayerUi.transform, false); DebugUiText = DebugUi.GetComponent<TextMeshPro>(); DebugUi.SetActive(debugMode); return DebugUi; } 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 static class AudioManager { public static AudioClip LoadWavFile(string filePath) { byte[] fileBytes = File.ReadAllBytes(filePath); return LoadWavFromBytes(fileBytes, Path.GetFileNameWithoutExtension(filePath)); } private static AudioClip LoadWavFromBytes(byte[] fileBytes, string name) { int i = 12; int num = -1; int num2 = 0; int num3; for (; i < fileBytes.Length - 8; i += 8 + num3) { string @string = Encoding.ASCII.GetString(fileBytes, i, 4); num3 = BitConverter.ToInt32(fileBytes, i + 4); if (@string == "data") { num = i + 8; num2 = num3; break; } } if (num == -1) { MelonLogger.Error("Could not find data chunk in WAV file"); return null; } int num4 = fileBytes[22]; int num5 = BitConverter.ToInt32(fileBytes, 24); int num6 = num2 / 2 / num4; float[] array = new float[num6 * num4]; for (int j = 0; j < num6 * num4; j++) { short num7 = BitConverter.ToInt16(fileBytes, num + j * 2); array[j] = (float)num7 / 32768f; } AudioClip val = AudioClip.Create(name, num6, num4, num5, false); val.SetData(Il2CppStructArray<float>.op_Implicit(array), 0); return val; } public static IEnumerator SilenceAudioAfter(AudioSource audioSource, float time) { yield return (object)new WaitForSeconds(time); audioSource.volume = 0.1f; yield return (object)new WaitForFixedUpdate(); audioSource.volume = 0f; } } public class CameraInfo { public int CullingMask; public Camera ParentComponent; public Vector3 FreezePos; public Quaternion FreezeRot; public float NearClipPlane; public bool IsVRCam = false; public bool IsRecordingCam = false; public bool IsFirstPerson => ParentComponent.IsFirstPerson(); public CameraInfo(Camera camera) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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; } } [RegisterTypeInIl2Cpp] public class Impact : MonoBehaviour { public List<PlayerVisualsClone> InvolvedPlayers = new List<PlayerVisualsClone>(); public StructureStorage InvolvedStructure; public List<GameObject> StructureSilhouettes = new List<GameObject>(); public GameObject SphereBackground; public PlayerVisualsClone DamagedPlayer; public bool LivPlayersActive = true; public bool HowardInvolved = false; private object AnimationCoroutine; 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_00b5: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) if (colorString == "match") { Color val = (Color)(Core.Instance.GetMatchResult() switch { Core.MatchResult.Won => Color.green, Core.MatchResult.Lost => Color.red, _ => Color.yellow, }); if (!isPrimary && ModUISettings.PrimaryEffectColor == "match" && ModUISettings.SecondaryEffectColor == "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() { FreezeCameras(); } public 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_00d9: Unknown result type (might be due to invalid IL or missing references) if (!IsAnimationRunning) { return; } foreach (CameraInfo storedCameraInfo in Core.Instance.StoredCameraInfos) { if (!storedCameraInfo.IsVRCam) { ((Component)storedCameraInfo.ParentComponent).transform.position = storedCameraInfo.FreezePos; if (!storedCameraInfo.IsFirstPerson) { ((Component)storedCameraInfo.ParentComponent).transform.rotation = storedCameraInfo.FreezeRot; } } foreach (PlayerVisualsClone value in Core.Instance.PlayerSilhouettes.Values) { if ((Object)(object)value.Camera != (Object)null) { ((Component)value.Camera).transform.rotation = ((Component)Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()).transform.rotation; } } } } public void RunAnimation() { AnimationCoroutine = MelonCoroutines.Start(C_RunAnimation()); } public IEnumerator C_RunAnimation() { if (IsAnimationRunning) { CancelAnimation(); } IsAnimationRunning = true; LivPlayersActive = Core.Instance.LIVPlayersInstance.m_Active; Core.Instance.LIVPlayersInstance.m_Active = false; Core.Instance.StoredCameraInfos = Core.GenerateCamInfos(); foreach (CameraInfo cameraInfo in Core.Instance.StoredCameraInfos) { Camera parentComponent = cameraInfo.ParentComponent; parentComponent.cullingMask = LayerMask.op_Implicit(Core.Instance.VisualLayerMask); if (cameraInfo.IsRecordingCam) { parentComponent.nearClipPlane = 0.05f; } if (cameraInfo.IsRecordingCam) { ((Behaviour)((Component)cameraInfo.ParentComponent).GetComponent<RecordingCamera>()).enabled = false; } LckStabilizer stabilizer = ((Component)cameraInfo.ParentComponent).GetComponentInParent<LckStabilizer>(); if ((Object)(object)stabilizer != (Object)null) { ((Behaviour)stabilizer).enabled = false; } } if (FogEndDistanceStorage == -1f) { FogEndDistanceStorage = RenderSettings.fogEndDistance; } RenderSettings.fogEndDistance = 10000f; ((Behaviour)Singleton<PlayerManager>.Instance.localPlayer.Controller.GetCamera()).enabled = false; foreach (PlayerVisualsClone playerSilhouette in InvolvedPlayers) { playerSilhouette.CopyPose(); playerSilhouette.Visuals.SetActive(true); if ((Object)(object)playerSilhouette.Camera != (Object)null) { ((Behaviour)playerSilhouette.Camera).enabled = true; } } if (HowardInvolved) { SkinnedMeshRenderer howardSmr = Core.Instance.HowardSmr; ((Renderer)howardSmr).material = Core.Instance.PrimarySilhouetteMat; ((Component)howardSmr).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); } if (ModUISettings.IncludeStructureInImpact && InvolvedStructure != null) { CreateStructureSilhouette(InvolvedStructure); } CreateSphereBackground(); Core.PreImpactAudioSource.volume = ModUISettings.DramaticEffectsVolume; Core.PreImpactAudioSource.Play(); MelonCoroutines.Start(AudioManager.SilenceAudioAfter(Core.PreImpactAudioSource, (ModUISettings.ImpactFrameDuration - 170f) / 1000f)); yield return (object)new WaitForSeconds(ModUISettings.ImpactFrameDuration / 1000f); bool howardDied = false; if (HowardInvolved && (Object)(object)Core.Instance.Howard != (Object)null && Core.Instance.Howard.currentHp == 0f) { howardDied = true; } if (!HowardInvolved || (HowardInvolved && !howardDied)) { Core.Instance.CreateShockwave(DamagePos, DamagedPlayer.ParentController); } else { Core.Instance.CreateShockwave(((Component)Core.Instance.HowardSmr).transform.position + Vector3.up * 0.8f, DamagedPlayer.ParentController); } if (!HowardInvolved || (HowardInvolved && !howardDied)) { Core.Instance.CreateRagdollIfNecessary(DamagedPlayer.ParentController); } ScreenFlash.CreateScreenFlash(((Component)Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()).transform, LayerMask.NameToLayer("PlayerController")); PlayerHaptics ph = Singleton<PlayerManager>.instance.localPlayer.Controller.GetSubsystem<PlayerHaptics>(); if (ModUISettings.DramaticEffectsScreenShake == 2) { ph.AddHapticsSignal(10f, 10f, 10f); } else if (ModUISettings.DramaticEffectsScreenShake == 1) { ph.AddHapticsSignal(ph.comfortSettings.ControllerShakeStrength, ph.comfortSettings.ControllerShakeStrength, ph.comfortSettings.CameraShakeStrength); } CancelAnimation(strong: false); } private void OnDestroy() { if (IsAnimationRunning) { CancelAnimation(); } } public void CancelAnimation(bool strong = true) { IsAnimationRunning = false; if (strong) { foreach (StructureKillStorage structureKillStorage in Core.Instance.StructureKillStorages) { structureKillStorage.Kill(); Core.Instance.StructureKillStorages.Clear(); } } else { MelonCoroutines.Start(StructureKillStorage.C_KillStructuresFromShockwave()); } ClearPlayerSilhouettes(); ClearStructureSilhouettes(); Player localPlayer = Singleton<PlayerManager>.Instance.LocalPlayer; if ((Object)(object)((localPlayer == null) ? null : localPlayer.Controller?.GetCamera()) != (Object)null) { ((Behaviour)Singleton<PlayerManager>.Instance.localPlayer.Controller.GetCamera()).enabled = true; } Core.Instance.LIVPlayersInstance.m_Active = LivPlayersActive; foreach (CameraInfo storedCameraInfo in Core.Instance.StoredCameraInfos) { if (storedCameraInfo != null && (Object)(object)storedCameraInfo.ParentComponent != (Object)null) { storedCameraInfo.ParentComponent.cullingMask = storedCameraInfo.CullingMask; storedCameraInfo.ParentComponent.nearClipPlane = storedCameraInfo.NearClipPlane; if (storedCameraInfo.IsRecordingCam) { ((Behaviour)((Component)storedCameraInfo.ParentComponent).GetComponent<RecordingCamera>()).enabled = true; } LckStabilizer componentInParent = ((Component)storedCameraInfo.ParentComponent).GetComponentInParent<LckStabilizer>(); if ((Object)(object)componentInParent != (Object)null) { ((Behaviour)componentInParent).enabled = true; } } } if (HowardInvolved) { SkinnedMeshRenderer howardSmr = Core.Instance.HowardSmr; ((Renderer)howardSmr).material = Core.Instance.HowardMat; ((Component)howardSmr).gameObject.layer = 0; } if ((Object)(object)SphereBackground != (Object)null) { Object.Destroy((Object)(object)SphereBackground); } if (strong && 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)structureInfo.StructureGO.GetComponentInChildren<MeshRenderer>()).gameObject; Quaternion rotation = gameObject.transform.rotation; GameObject val = Object.Instantiate<GameObject>(gameObject); Vector3 position = structureInfo.StructureGO.transform.position; val.transform.SetParent(Core.Instance.ModObject_Silhouettes.transform); val.transform.position = position; val.transform.rotation = rotation; HelperFunctions.DisableAllComponents(val); Object.Destroy((Object)(object)val.GetComponent<Rigidbody>()); ((Object)val).name = "StructureSilhouette"; ((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = Core.Instance.PrimarySilhouetteMat; val.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); if (structureInfo.Type == StructureStorage.StructureType.BoulderBall) { ((Renderer)((Component)val.transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = Core.Instance.PrimarySilhouetteMat; ((Component)val.transform.GetChild(0)).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); } StructureSilhouettes.Add(val); } public void ClearPlayerSilhouettes() { foreach (PlayerVisualsClone involvedPlayer in InvolvedPlayers) { if ((Object)(object)involvedPlayer.Camera != (Object)null) { ((Behaviour)involvedPlayer.Camera).enabled = false; } if ((Object)(object)involvedPlayer != (Object)null) { 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) SphereBackground = GameObject.CreatePrimitive((PrimitiveType)0); ((Collider)SphereBackground.GetComponent<SphereCollider>()).enabled = false; SphereBackground.GetComponent<Renderer>().material = Core.Instance.SecondarySilhouetteMat; SphereBackground.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); SphereBackground.transform.SetParent(Core.Instance.ModObject_DramaticEffects.transform); SphereBackground.transform.localScale = Vector3.one * 200f; } } [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 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Invalid comparison between Unknown and I4 //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Invalid comparison between Unknown and I4 //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)setupObject == (Object)null) { setupObject = ((Component)this).gameObject; } Visuals = setupObject; Transform child = Visuals.transform.GetChild(1).GetChild(0).GetChild(4) .GetChild(0); ShiftStone[] shiftStones = ShiftStones; object obj; if (child == null) { obj = null; } else { Transform child2 = child.GetChild(1); if (child2 == null) { obj = null; } else { GameObject gameObject = ((Component)child2).gameObject; obj = ((gameObject != null) ? gameObject.GetComponentInChildren<ShiftStone>() : null); } } shiftStones[0] = (ShiftStone)obj; ShiftStone[] shiftStones2 = ShiftStones; object obj2; if (child == null) { obj2 = null; } else { Transform child3 = child.GetChild(2); if (child3 == null) { obj2 = null; } else { GameObject gameObject2 = ((Component)child3).gameObject; obj2 = ((gameObject2 != null) ? gameObject2.GetComponentInChildren<ShiftStone>() : null); } } shiftStones2[1] = (ShiftStone)obj2; if (Type == VisualsType.Silhouette) { ((Component)ShiftStones[0]).transform.SetParent(Visuals.transform); ((Component)ShiftStones[1]).transform.SetParent(Visuals.transform); } foreach (Renderer componentsInChild in Visuals.GetComponentsInChildren<Renderer>()) { if (((Object)componentsInChild).name == "FadeScreenRenderer") { Object.Destroy((Object)(object)((Component)componentsInChild).gameObject); } else if (Type == VisualsType.Silhouette) { componentsInChild.shadowCastingMode = (ShadowCastingMode)0; componentsInChild.sharedMaterial = Core.Instance.PrimarySilhouetteMat; ((Component)componentsInChild).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); if ((int)ParentController.ControllerType == 1) { componentsInChild.material.SetFloat("_IsLocal", 1f); } } } Transform child4 = Visuals.transform.GetChild(1).GetChild(0).GetChild(4) .GetChild(0); for (int num = child4.childCount - 1; num > 0; num--) { if (((Object)child4.GetChild(num)).name.Contains("VFX")) { ((Component)child4.GetChild(num)).gameObject.SetActive(false); } } foreach (Collider componentsInChild2 in Visuals.GetComponentsInChildren<Collider>()) { componentsInChild2.enabled = false; } HelperFunctions.DisableAllComponents(Visuals, new List<Behaviour> { (Behaviour)(object)this, (Behaviour)(object)Visuals.GetComponent<RigDefinition>() }); if (Type == VisualsType.Silhouette && (int)ParentController.controllerType == 1) { GameObject val = new GameObject("Camera"); val.transform.SetParent(Visuals.transform); Camera = val.AddComponent<Camera>(); Camera.CopyFrom(Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetCamera()); Camera.nearClipPlane = 0.01f; Camera.depth = -10f; ((Behaviour)Camera).enabled = false; Camera.cullingMask = 1 << LayerMask.op_Implicit(Core.Instance.VisualLayer); } 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 subsystem = ParentController.GetSubsystem<PlayerShiftstoneSystem>(); object obj; if (subsystem == null) { obj = null; } else { ShiftstoneSocket obj2 = ((Il2CppArrayBase<ShiftstoneSocket>)(object)subsystem.shiftStoneSockets)[0]; obj = ((obj2 != null) ? obj2.assignedShifstone : null); } ShiftStone val = (ShiftStone)obj; object obj3; if (subsystem == null) { obj3 = null; } else { ShiftstoneSocket obj4 = ((Il2CppArrayBase<ShiftstoneSocket>)(object)subsystem.shiftStoneSockets)[1]; obj3 = ((obj4 != null) ? obj4.assignedShifstone : null); } ShiftStone val2 = (ShiftStone)obj3; ShiftStone val3 = ShiftStones[0]; ShiftStone val4 = ShiftStones[1]; if ((Object)(object)val != (Object)null) { GameObject val5 = Object.Instantiate<GameObject>(((Component)val).gameObject); ShiftStones[0] = val5.GetComponent<ShiftStone>(); val5.transform.SetParent(Visuals.transform); ((Component)val5.GetComponentInChildren<MeshRenderer>()).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); } if ((Object)(object)val2 != (Object)null) { GameObject val6 = Object.Instantiate<GameObject>(((Component)val2).gameObject); ShiftStones[1] = val6.GetComponent<ShiftStone>(); val6.transform.SetParent(Visuals.transform); ((Component)val6.GetComponentInChildren<MeshRenderer>()).gameObject.layer = LayerMask.op_Implicit(Core.Instance.VisualLayer); } if ((Object)(object)val3 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val3).gameObject); } if ((Object)(object)val4 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val4).gameObject); } } public void CopyPose() { //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Invalid comparison between Unknown and I4 //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: 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_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Invalid comparison between Unknown and I4 //IL_0446: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Visuals == (Object)null) { return; } SkinnedMeshRenderer componentInChildren = Visuals.GetComponentInChildren<SkinnedMeshRenderer>(); ((Renderer)componentInChildren).material = Core.Instance.PrimarySilhouetteMat; if ((Object)(object)ShiftStones[0] != (Object)null) { ((Renderer)((Component)ShiftStones[0]).GetComponentInChildren<MeshRenderer>()).material = Core.Instance.PrimarySilhouetteMat; ((Component)ShiftStones[0]).transform.position = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[0].assignedShifstone).transform.position; ((Component)ShiftStones[0]).transform.rotation = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[0].assignedShifstone).transform.rotation; ((Component)ShiftStones[0]).transform.parent.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[0].assignedShifstone).transform.parent.localScale; ((Component)ShiftStones[0]).transform.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().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) { ((Renderer)((Component)ShiftStones[1]).GetComponentInChildren<MeshRenderer>()).material = Core.Instance.PrimarySilhouetteMat; ((Component)ShiftStones[1]).transform.position = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[1].assignedShifstone).transform.position; ((Component)ShiftStones[1]).transform.rotation = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[1].assignedShifstone).transform.rotation; ((Component)ShiftStones[1]).transform.parent.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[1].assignedShifstone).transform.parent.localScale; ((Component)ShiftStones[1]).transform.localScale = ((Component)((Il2CppArrayBase<ShiftstoneSocket>)(object)ParentController.GetSubsystem<PlayerShiftstoneSystem>().shiftStoneSockets)[1].assignedShifstone).transform.localScale; Transform transform2 = ((Component)ShiftStones[1]).transform; transform2.localScale *= ParentController.assignedPlayer.Data.PlayerMeasurement.ArmSpan / 1.5f; } bool flag = false; try { PlayerLIV subsystem = Singleton<PlayerManager>.Instance.LocalPlayer.Controller.GetSubsystem<PlayerLIV>(); LCKCameraController component = ((Component)subsystem.LckTablet).gameObject.GetComponent<LCKCameraController>(); LCKTabletDetachedPreview component2 = ((Component)subsystem.LckTablet).gameObject.GetComponent<LCKTabletDetachedPreview>(); if ((int)component.CurrentCameraMode != 1 && (PlayerLIV.LCKIsRecording || component2.ActivePreviewNo == 5)) { flag = true; } } catch { } if ((int)ParentController.controllerType == 1 && !flag) { ((Renderer)componentInChildren).material.SetFloat("_IsLocal", 1f); } else { ((Renderer)componentInChildren).material.SetFloat("_IsLocal", 0f); } List<Transform> from = (from bone in ParentController.GetBones() select bone.Transform).ToList(); List<Transform> to = ((IEnumerable<BoneDefinition>)Visuals.GetComponent<RigDefinition>().BoneDefinitions).Select((BoneDefinition bone) => bone.Transform).ToList(); if ((Object)(object)Camera != (Object)null) { ((Component)Camera).transform.position = ((Component)ParentController.GetCamera()).transform.position; } HelperFunctions.CopyAllTransforms(from, to); } public void ReapplyVisuals() { if (!((Object)(object)Visuals == (Object)null)) { SkinnedMeshRenderer componentInChildren = Visuals.GetComponentInChildren<SkinnedMeshRenderer>(); SkinnedMeshRenderer componentInChildren2 = ((Component)((Component)ParentController).transform.GetChild(1)).GetComponentInChildren<SkinnedMeshRenderer>(); componentInChildren.sharedMesh = componentInChildren2.sharedMesh; ((Renderer)componentInChildren).material = ParentController.GetSubsystem<PlayerVisuals>().NonHeadClippedMaterial; } } } [RegisterTypeInIl2Cpp] public class Shockwave : MonoBehaviour { public PlayerController DamagedPlayer; public bool HowardInvolved = false; public GameObject ForceField; public Renderer ForceFieldRenderer; private float forceFieldScale = 0f; private float forceFieldProximityDistance = 0.2f; private float forceFieldOpacity = 0.2f; public static List<GameObject> Dusts = new List<GameObject>(); public List<Ragdoll> movedRagdolls = new List<Ragdoll>(); public float Timer = 0f; private void Start() { CreateForceField(); CreateDust(); CreateHitEffect(); PlayAudio(); } private void Update() { //IL_00ec: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0330: 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 { forceFieldScale += Time.deltaTime * 2000f; 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 > 10f) { AudioManager.SilenceAudioAfter(Core.ImpactAudioSource, 0f); } if (Timer > 11f) { Object.Destroy((Object)(object)((Component)this).gameObject); } if (Timer <= 10f) { float num = Mathf.Lerp(10000f, Impact.FogEndDistanceStorage, Timer / 10f); RenderSettings.fogEndDistance = Mathf.Clamp(num, Impact.FogEndDistanceStorage, 10000f); } 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 num2 = Vector3.Distance(poolItem.Chest.position, ForceField.transform.position); if (num2 <= ForceField.transform.localScale.x) { movedRagdolls.Add(poolItem); Vector3 val = ((Component)poolItem.Chest).GetComponent<Rigidbody>().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); } } } } } public void CreateForceField() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown ForceField = GameObject.CreatePrimitive((PrimitiveType)0); ForceField.transform.SetParent(((Component)this).transform, false); ((Collider)ForceField.GetComponent<SphereCollider>()).enabled = false; ForceFieldRenderer = ForceField.GetComponent<Renderer>(); ForceFieldRenderer.material = new Material(Core.Instance.ShockwaveShader); } 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!HowardInvolved && DamagedPlayer.GetSubsystem<PlayerMovement>().WasGrounded) { Structure component = ((Component)((Il2CppArrayBase<PoolSettings>)(object)Singleton<PoolManager>.Instance.resourcesToPool)[55].Resource).GetComponent<Structure>(); PooledVisualEffect component2 = ((Component)((Il2CppArrayBase<Pool<PooledMonoBehaviour>>)(object)Singleton<PoolManager>.instance.availablePools)[50].FetchFromPool(DamagedPlayer.GetStandingPosition(), Quaternion.identity)).gameObject.GetComponent<PooledVisualEffect>(); component2.SetStructureData(component); Dusts.Add(((Component)component2).gameObject); ((Component)component2).transform.localScale = Vector3.one * 1.7f; } } 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) bool flag = false; 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)(object)Core.Instance.Howard != (Object)null)) ? DamagedPlayer.GetChest().position : ((Component)Core.Instance.HowardSmr).transform.position)); GameObject gameObject = ((Component)((Il2CppArrayBase<Pool<PooledMonoBehaviour>>)(object)Singleton<PoolManager>.instance.availablePools)[32].FetchFromPool(val, Quaternion.identity)).gameObject; object obj; if (gameObject == null) { obj = null; } else { GameObject gameObject2 = gameObject.gameObject; obj = ((gameObject2 != null) ? gameObject2.GetComponent<PlayerHitmarker>() : null); } PlayerHitmarker val2 = (PlayerHitmarker)obj; if ((Object)(object)val2 != (Object)null) { val2.SetDamage(7f); MelonCoroutines.Start(C_EnlargeVFX(val2)); } } private static IEnumerator C_EnlargeVFX(PlayerHitmarker phm) { yield return (object)new WaitForSeconds(0.1f); phm.SetDamage(15f); } public void PlayAudio() { Core.ImpactAudioSource.volume = ModUISettings.DramaticEffectsVolume; Core.ImpactAudioSource.Play(); } } internal static class HelperFunctions { public static List<Transform> FindChildrenRecursive(Transform parent) { List<Transform> list = new List<Transform>(); 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<Behaviour> except = null) { foreach (Behaviour component in gameObject.GetComponents<Behaviour>()) { component.enabled = except?.Contains(component) ?? false; } } public static void CopyAllTransforms(List<Transform> from, List<Transform> 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 class ModUISettings { public static int DramaticEffectsInMatches => (int)Core.Instance.Mod.Settings[1].SavedValue; public static int DramaticEffectsOutsideMatches => (int)Core.Instance.Mod.Settings[2].SavedValue; public static float ImpactFrameDuration => Mathf.Clamp((float)Core.Instance.Mod.Settings[3].SavedValue, 0f, Core.Instance.DebugEnabled ? float.MaxValue : 1500f); public static bool IncludeStructureInImpact => (bool)Core.Instance.Mod.Settings[4].SavedValue; public static float DramaticEffectsVolume => (float)Core.Instance.Mod.Settings[5].SavedValue; public static int DramaticEffectsScreenShake => (int)Core.Instance.Mod.Settings[6].SavedValue; public static string PrimaryEffectColor => ((string)Core.Instance.Mod.Settings[7].SavedValue).ToLower(); public static string SecondaryEffectColor => ((string)Core.Instance.Mod.Settings[8].SavedValue).ToLower(); public static int RagdollsInMatches => (int)Core.Instance.Mod.Settings[9].SavedValue; public static int RagdollsOutsideMatches => (int)Core.Instance.Mod.Settings[10].SavedValue; public static int CleanupInMatches => (int)Core.Instance.Mod.Settings[11].SavedValue; public static int CleanupOutsideMatches => (int)Core.Instance.Mod.Settings[12].SavedValue; } [HarmonyPatch(typeof(PlayerVisuals), "ApplyPlayerVisuals", new Type[] { typeof(GeneratedPlayerVisuals) })] public static class PlayerVisuals_ApplyPlayerVisuals_Patch { private static void Postfix(ref PlayerVisuals __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 MelonCoroutines.Start(C_Delay(3f, ((PlayerControllerSubsystem)__instance).parentController)); if ((int)((PlayerControllerSubsystem)__instance).parentController.controllerType == 1) { Ragdoll.LocalHeadClippedMat = ((Renderer)((Component)((PlayerControllerSubsystem)__instance).parentController.GetSubsystem<PlayerVisuals>()).GetComponentInChildren<SkinnedMeshRenderer>()).material; } } private static IEnumerator C_Delay(float waitTime, PlayerController player) { yield return (object)new WaitForSeconds(waitTime); Core.Instance.ProcessNewPlayer(player); } } [HarmonyPatch(typeof(DressingRoom), "DelayedApplyData", new Type[] { typeof(GeneratedPlayerVisuals) })] public static class dressingRoomPatch { private static void Postfix() { Ragdoll.ReapplyVisualsFor(Singleton<PlayerManager>.Instance.LocalPlayer.Controller); } } [HarmonyPatch(typeof(MatchHandler), "StopMatch", new Type[] { typeof(bool) })] public static class MatchHandler_StopMatch_Patch { private static void Prefix() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 if (Core.Instance.IsInMatch) { MatchHandler instance = Singleton<MatchHandler>.Instance; if (instance != null && (int)instance.CurrentMatchPhase == 2) { MelonCoroutines.Start(SetRoundHasEnded()); } } } private static IEnumerator SetRoundHasEnded() { yield return (object)new WaitForSeconds(1.5f); Core.Instance.HasRoundEnded = true; Core.Instance.PlayerHealths.Clear(); } } [HarmonyPatch(typeof(MatchHandler), "ExecuteNextRound", new Type[] { })] public static class MatchHandler_ExecuteNextRound_Patch { private static void Postfix() { Core.Instance.HasRoundEnded = false; if (ModUISettings.CleanupInMatches > 0) { Ragdoll.ClearAllRagdolls(); } Enumerator<Player> enumerator = Singleton<PlayerManager>.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) { 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_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Core.Instance.ActiveImpact != (Object)null && Core.Instance.ActiveImpact.IsAnimationRunning && Core.Instance.IsInMatch && Core.Instance.HasRoundEnded) { Core.Instance.StructureKillStorages.Add(new StructureKillStorage(__instance, killVelocity, playSFX, playVFX, networked)); return false; } return true; } } [HarmonyPatch(typeof(PooledMonoBehaviour), "ReturnToPool", new Type[] { })] public static class PooledMonoBehaviour_ReturnToPool_Patch { private static void Prefix(ref Structure __instance) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) 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); } } } } [HarmonyPatch(typeof(Pool<PooledMonoBehaviour>), "FetchFromPool", new Type[] { typeof(Vector3), typeof(Quaternion) })] public static class PooledMonoBehaviour_OnFetchFromPool_Patch { private static void Postfix(ref PooledMonoBehaviour __result, ref Vector3 position) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (((Object)__result).name == "ExplodeFinale_VFX" && StructureStorage.GameStates.Count >= 3) { List<StructureStorage> 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.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.Instance.PlayerSilhouettes.TryGetValue(((PlayerControllerSubsystem)__instance).parentController, out var value)) { value.UpdateShiftStones(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class LIVRenderPlayerFeature_Constructor_Patch { private static void Postfix(ref LIVRenderPlayerFeature __instance) { Core.Instance.LIVPlayersInstance = (ScriptableRendererFeature)(object)__instance; } } public static class Extensions { public static Transform GetChest(this PlayerController player) { return ((Component)player).GetComponentInChildren<RigDefinition>().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.GetSubsystem<PlayerPhysics>().footCollider).transform.position; } public static Camera GetCamera(this PlayerController player) { return player.GetSubsystem<PlayerCamera>().Camera; } public static List<BoneDefinition> GetBones(this PlayerController player) { return ((IEnumerable<BoneDefinition>)((Component)player).GetComponentInChildren<RigDefinition>().BoneDefinitions).ToList(); } public static bool IsFirstPerson(this Camera camera) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)camera).transform.position, ((Component)Singleton<PlayerManager>.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<Ragdoll> PoolItems { get { Transform transform = Transform; List<Ragdoll> list = ((transform == null) ? null : ((IEnumerable<Ragdoll>)((Component)transform).GetComponentsInChildren<Ragdoll>(true))?.ToList()); if (list == null) { return new List<Ragdoll>(); } return list; } } public Ragdoll FetchRagdoll() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) Ragdoll ragdoll; if (Transform.childCount == 0) { ragdoll = CreateRagdoll(); } else { List<Ragdoll> list = PoolItems.Where((Ragdoll pr) => !((Component)pr).gameObject.activeSelf).ToList(); ragdoll = ((list.Count != 0) ? list.First() : CreateRagdoll()); } ((Component)ragdoll).gameObject.SetActive(true); ragdoll.CopyPose(); if (Core.Prefs_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<GameObject>(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>(); ragdoll.ParentController = parentController; ragdoll.SetupRagdoll(); return ragdoll; } } public static Dictionary<PlayerController, RagdollPool> RagdollPools = new Dictionary<PlayerController, RagdollPool>(); public static Material LocalHeadClippedMat = null; public List<BoneRef> BoneRefs = new List<BoneRef>(); private Dictionary<Joint, Transform> boneAnchorPosStorage = new Dictionary<Joint, Transform>(); private Dictionary<Joint, Vector3> originalBoneAnchors = new Dictionary<Joint, Vector3>(); public float Age = 0f; public float ClearAfterSeconds = 0f; public bool UndoGhostOnClear = false; public Transform Chest; public bool IsJanky = false; public bool DoSmashLaunch = false; public Vector3 SmashLaunchDir = Vector3.zero; public static Ragdoll SpawnRagdoll(PlayerController player, StructureStorage killingStructure = null) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) RagdollPool ragdollPool = FindOrCreateRagdollPool(player); Ragdoll ragdoll = ragdollPool.FetchRagdoll(); bool flag = Core.Instance.CurrentScene == "Map0" && ragdoll.Chest.position.y <= -3f && ragdoll.Chest.position.y >= -8f; if (killingStructure != null) { ragdoll.Hit(killingStructure); } else if (!flag) { ragdoll.AddVelocity(new Vector3((float)Random.RandomRange(-15, 15), 25f, (float)Random.RandomRange(-15, 15))); } else { Vector3 val = new Vector3(ragdoll.Chest.position.x, 0f, ragdoll.Chest.position.z); Vector3 val2 = ((Vector3)(ref val)).normalized * -45f; ragdoll.AddVelocity(val2 + Vector3.up * 95f); } if ((Core.Instance.IsInMatch && ModUISettings.RagdollsInMatches >= 3) || (!Core.Instance.IsInMatch && ModUISettings.RagdollsOutsideMatches >= 2)) { ragdoll.AddVelocity(((Component)ragdoll.Chest).GetComponentInChildren<Rigidbody>().velocity); ragdoll.AddVelocity(new Vector3((float)Random.RandomRange(-15, 15), 25f, (float)Random.RandomRange(-15, 15))); } 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 subsystem = player.GetSubsystem<PlayerVisuals>(); obj = ((subsystem != null) ? ((Component)subsystem).GetComponentInChildren<SkinnedMeshRenderer>() : 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) { item?.SetActive(active: false); } } } 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0167: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) Type = VisualsType.Ragdoll; Visuals = Object.Instantiate<GameObject>(((Component)ParentController.GetSubsystem<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(); PlayerVisuals subsystem = ParentController.GetSubsystem<PlayerVisuals>(); SkinnedMeshRenderer componentInChildren = ((Component)subsystem).GetComponentInChildren<SkinnedMeshRenderer>(); SkinnedMeshRenderer componentInChildren2 = Visuals.GetComponentInChildren<SkinnedMeshRenderer>(); if ((int)ParentController.ControllerType != 1) { subsystem.NonHeadClippedMaterial = ((Renderer)componentInChildren).material; ((Renderer)componentInChildren2).material = new Material(subsystem.NonHeadClippedMaterial); } else { ((Renderer)componentInChildren2).material = subsystem.NonHeadClippedMaterial; } ((Component)componentInChildren2).gameObject.layer = 0; foreach (Rigidbody componentsInChild in ((Component)this).GetComponentsInChildren<Rigidbody>()) { string[] array = new string[5] { "Floor", "CombatFloor", "Environment", "LeanableEnvironment", "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)); if (!Core.Prefs_LegacyRagdollJank.Value) { componentsInChild.excludeLayers = LayerMask.op_Implicit(LayerMask.GetMask(new string[6] { "Move", "PlayerController", "PlayerHitbox", "PlayerPhysicsBone", "PlayerFeet", "PlayerOnPlayerInteraction" })); } ((Component)componentsInChild).gameObject.layer = Core.Instance.PhysicsLayer; componentsInChild.ResetCenterOfMass(); } CacheOriginalJointData(); CopyPose(); if (!Core.Prefs_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<BoneDefinition>)(object)Visuals.GetComponent<RigDefinition>().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<Joint>(); if ((Object)(object)component != (Object)null) { originalBoneAnchors[component] = component.connectedAnchor; } BoneRefs.Add(new BoneRef(((Object)item.Transform).name, item.Transform, item2)); break; } } } } private IEnumerator C_SetLayersDelayed() { foreach (BoneRef boneRef2 in BoneRefs) { ((Component)boneRef2.RagdollBone).gameObject.layer = 0; } yield return (object)new WaitForSeconds(1f); foreach (BoneRef boneRef in BoneRefs) { ((Component)boneRef.RagdollBone).gameObject.layer = Core.Instance.PhysicsLayer; } } private void Update() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) Age += Time.deltaTime; TrackVisualsToRbBones(); if (ClearAfterSeconds > 0f && Age >= ClearAfterSeconds) { if (UndoGhostOnClear) { UnGhostifyOwner(); } SetActive(active: false); } if (Chest.position.y < -20f) { SetActive(active: false); } Vector3 position = Chest.position; if (((Vector3)(ref position)).magnitude > 300f) { SetActive(active: false); } } private void FixedUpdate() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) 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 || !Core.Prefs_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 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<Joint>(); 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<Transform> list = new List<Transform>(); foreach (BoneDefinition item in (Il2CppArrayBase<BoneDefinition>)(object)((Component)ParentController).GetComponentInChildren<RigDefinition>().boneDefinitions) { list.Add(item.Transform); } List<Transform> list2 = new List<Transform>(); foreach (BoneRef boneRef in BoneRefs) { list2.Add(boneRef.RagdollBone); } foreach (Rigidbody componentsInChild in ((Component)((Component)this).transform.GetChild(0)).GetComponentsInChildren<Rigidbody>()) { if (!((Object)(object)componentsInChild == (Object)null)) { componentsInChild.velocity = Vector3.zero; } } HelperFunctions.CopyAllTransforms(list, list2); ResetAnchors(); if ((Core.Instance.IsInMatch && ModUISettings.RagdollsInMatches == 4) || (!Core.Instance.IsInMatch && ModUISettings.RagdollsOutsideMatches == 3))