Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MoreCounterplayFork v1.5.1
BaronDrakula.MoreCounterplay.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; 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 BaronDrakula.MoreCounterplay.NetcodePatcher; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreCounterplay.Behaviours; using MoreCounterplay.Config; using MoreCounterplay.Items; using MoreCounterplay.Patches; using MoreCounterplay.Util; using Unity.Netcode; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BaronDrakula.MoreCounterplay")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.4.1.0")] [assembly: AssemblyInformationalVersion("1.4.1+46dc15b7709e89f1965a391e26bd198f9de4c570")] [assembly: AssemblyProduct("MoreCounterplay")] [assembly: AssemblyTitle("BaronDrakula.MoreCounterplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MoreCounterplay { [BepInPlugin("BaronDrakula.MoreCounterplay", "MoreCounterplay", "1.4.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("com.sigurd.csync", "5.0.1")] public class MoreCounterplay : BaseUnityPlugin { public static AssetBundle? Bundle; public static MoreCounterplay Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony Harmony { get; set; } internal static ConfigSettings Settings { get; set; } private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Settings = new ConfigSettings(((BaseUnityPlugin)this).Config); NetcodePatcher(); LoadAssets(); Patch(); Logger.LogInfo((object)"BaronDrakula.MoreCounterplay v1.4.1 has loaded!"); } private void LoadAssets() { Log("Loading Assets..."); Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "morecounterplayassets")); GameObject val = Bundle.LoadAsset<GameObject>("JesterSurface.prefab"); val.AddComponent<JesterSurface>(); JesterSurface.JesterSurfacePrefab = val; NetworkPrefabs.RegisterNetworkPrefab(val); CoilExplosion.RadioactiveFirePrefab = Bundle.LoadAsset<GameObject>("RadioactiveFire.prefab"); Item val2 = Bundle.LoadAsset<Item>("CoillessCoilhead.asset"); ((GrabbableObject)val2.spawnPrefab.AddComponent<HeadItem>()).itemProperties = val2; HeadItem.Prefab = val2.spawnPrefab; Items.RegisterItem(val2); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("BaronDrakula.MoreCounterplay"); } Harmony.PatchAll(); } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } public static void Log(string message) { Logger.LogInfo((object)message); } public static void LogDebug(string message) { Logger.LogDebug((object)message); } public static void LogError(string message) { Logger.LogError((object)message); } public static void LogWarning(string message) { Logger.LogWarning((object)message); } public static bool IsModLoaded(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "BaronDrakula.MoreCounterplay"; public const string PLUGIN_NAME = "MoreCounterplay"; public const string PLUGIN_VERSION = "1.4.1"; } } namespace MoreCounterplay.Util { internal class VanillaPrefabUtils { internal static bool GetInsideEnemyPrefab(string enemyName, out GameObject? enemyPrefab) { string enemyName2 = enemyName; enemyPrefab = null; for (int i = 0; i < StartOfRound.Instance.levels.Length; i++) { EnemyType val = StartOfRound.Instance.levels[i]?.Enemies?.Find((SpawnableEnemyWithRarity enemy) => string.CompareOrdinal(enemy.enemyType.enemyName, enemyName2) == 0)?.enemyType; if ((Object)(object)val != (Object)null) { enemyPrefab = val.enemyPrefab; return true; } } MoreCounterplay.LogWarning("Could not find enemy '" + enemyName2 + "' in any moon's list of spawns."); return false; } internal static bool GetOutsideEnemyPrefab(string enemyName, out GameObject? enemyPrefab) { string enemyName2 = enemyName; enemyPrefab = null; for (int i = 0; i < StartOfRound.Instance.levels.Length; i++) { EnemyType val = StartOfRound.Instance.levels[i]?.OutsideEnemies?.Find((SpawnableEnemyWithRarity enemy) => string.CompareOrdinal(enemy.enemyType.enemyName, enemyName2) == 0)?.enemyType; if ((Object)(object)val != (Object)null) { enemyPrefab = val.enemyPrefab; return true; } } MoreCounterplay.LogWarning("Could not find enemy '" + enemyName2 + "' in any moon's list of spawns."); return false; } } } namespace MoreCounterplay.Patches { [HarmonyPatch] internal class CoilheadPatch { private const int SHOVEL_HIT_ID = 1; private const int KNIFE_HIT_ID = 5; [HarmonyPatch(typeof(EnemyAI), "HitEnemy")] [HarmonyPostfix] private static void HitCoilhead(EnemyAI __instance, int hitID = -1) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (!SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableCoilheadCounterplay) || __instance.isEnemyDead || ((object)__instance).GetType() != typeof(SpringManAI)) { return; } SpringManAI val = (SpringManAI)__instance; if (val.inCooldownAnimation) { MoreCounterplay.Log("Coilhead hit negated."); return; } if (1 == 0) { } SyncedEntry<int> val2 = (SyncedEntry<int>)(hitID switch { 5 => MoreCounterplay.Settings.CoilheadKnifeDamage, 1 => MoreCounterplay.Settings.CoilheadShovelDamage, _ => MoreCounterplay.Settings.CoilheadDefaultDamage, }); if (1 == 0) { } int num = SyncedEntry<int>.op_Implicit(val2); MoreCounterplay.Log($"Coilhead hit for {num} damage on server."); ((EnemyAI)val).enemyHP = ((EnemyAI)val).enemyHP - num; if (((EnemyAI)val).enemyHP <= 0) { MoreCounterplay.Log("Coilhead killed!"); ((EnemyAI)val).KillEnemyOnOwnerClient(false); } } [HarmonyPatch(typeof(EnemyAI), "KillEnemy")] [HarmonyPostfix] private static void KillCoilhead(EnemyAI __instance) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableCoilheadCounterplay) && !(((object)__instance).GetType() != typeof(SpringManAI))) { SpringManAI val = (SpringManAI)__instance; ResetCoilhead(val); val.DoSpringAnimation(true); IgniteCoilhead(val, SpawnHead(val)); } } private static void ResetCoilhead(SpringManAI coilhead) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) coilhead.hasStopped = true; ((EnemyAI)coilhead).creatureAnimator.SetFloat("walkSpeed", 0f); coilhead.currentAnimSpeed = 0f; coilhead.mainCollider.isTrigger = false; if (((NetworkBehaviour)coilhead).IsOwner) { ((EnemyAI)coilhead).agent.speed = 0f; ((EnemyAI)coilhead).movingTowardsTargetPlayer = false; ((EnemyAI)coilhead).SetDestinationToPosition(((Component)coilhead).transform.position, false); } } private static GameObject? SpawnHead(SpringManAI coilhead) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if ((!((NetworkBehaviour)coilhead).IsServer && !((NetworkBehaviour)coilhead).IsHost) || !SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.DropHeadAsScrap)) { return null; } if ((Object)(object)HeadItem.Prefab == (Object)null) { MoreCounterplay.LogWarning("'Coilless Coilhead' prefab did not load correctly or is missing; it will not be spawned."); return null; } GameObject gameObject = ((Component)((EnemyAI)coilhead).meshRenderers.First((MeshRenderer mesh) => ((Object)mesh).name == "Head")).gameObject; GameObject val = Object.Instantiate<GameObject>(HeadItem.Prefab, gameObject.transform.position, gameObject.transform.rotation); NetworkObject val2 = default(NetworkObject); HeadItem headItem = default(HeadItem); if (!val.TryGetComponent<NetworkObject>(ref val2) || !val.TryGetComponent<HeadItem>(ref headItem)) { MoreCounterplay.LogWarning("'Coilless Coilhead' instance has missing components; it will not be spawned."); Object.Destroy((Object)(object)val); return null; } val2.Spawn(false); ((GrabbableObject)headItem).SetScrapValue(HeadItem.Random.Next(SyncedEntry<int>.op_Implicit(MoreCounterplay.Settings.MinHeadValue), SyncedEntry<int>.op_Implicit(MoreCounterplay.Settings.MaxHeadValue) + 1)); headItem.AttachItemClientRpc(NetworkObjectReference.op_Implicit(((EnemyAI)coilhead).thisNetworkObject)); RoundManager.Instance.SyncScrapValuesClientRpc((NetworkObjectReference[])(object)new NetworkObjectReference[1] { NetworkObjectReference.op_Implicit(val2) }, new int[1] { ((GrabbableObject)headItem).scrapValue }); return val; } private static void IgniteCoilhead(SpringManAI coilhead, GameObject? scrapHead) { if (!SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.LoreAccurateCoilheads)) { return; } Transform obj = ((Component)coilhead).transform.Find("SpringManModel/RadioactiveFire"); if (obj != null) { GameObject gameObject = ((Component)obj).gameObject; if (gameObject != null) { gameObject.SetActive(true); } } if (((NetworkBehaviour)coilhead).IsServer || ((NetworkBehaviour)coilhead).IsHost) { CoilExplosion coilExplosion = default(CoilExplosion); if (!((Component)coilhead).TryGetComponent<CoilExplosion>(ref coilExplosion)) { MoreCounterplay.LogWarning("Coilhead CoilExplosion script did not load correctly or is missing; explosion will not happen."); return; } coilExplosion.HeadContainer = scrapHead; coilExplosion.UpdateScanNodeClientRpc(ignited: true); coilExplosion.TimeLeft = Mathf.Clamp(coilExplosion.TimeSinceLastStop, SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.MinExplosionTimer), SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.MaxExplosionTimer)); coilExplosion.Ticking = true; ((Behaviour)coilExplosion).enabled = true; } } [HarmonyPatch(typeof(SpringManAI), "SetAnimationGoServerRpc")] [HarmonyPostfix] private static void OnStartedMoving(SpringManAI __instance) { CoilExplosion coilExplosion = default(CoilExplosion); if ((((NetworkBehaviour)__instance).IsServer || ((NetworkBehaviour)__instance).IsHost) && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.LoreAccurateCoilheads) && ((Component)__instance).TryGetComponent<CoilExplosion>(ref coilExplosion)) { coilExplosion.TimeSinceLastStop = 0f; ((Behaviour)coilExplosion).enabled = true; } } [HarmonyPatch(typeof(SpringManAI), "SetAnimationStopServerRpc")] [HarmonyPostfix] private static void OnStoppedMoving(SpringManAI __instance) { CoilExplosion coilExplosion = default(CoilExplosion); if ((((NetworkBehaviour)__instance).IsServer || ((NetworkBehaviour)__instance).IsHost) && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.LoreAccurateCoilheads) && ((Component)__instance).TryGetComponent<CoilExplosion>(ref coilExplosion)) { ((Behaviour)coilExplosion).enabled = false; } } } [HarmonyPatch] internal class JesterPatch { [HarmonyPatch(typeof(JesterAI), "Start")] [HarmonyPostfix] public static void OnSpawn(JesterAI __instance) { if ((!((NetworkBehaviour)__instance).IsServer && !((NetworkBehaviour)__instance).IsHost) || !SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableJesterCounterplay)) { return; } if ((Object)(object)JesterSurface.JesterSurfacePrefab == (Object)null) { MoreCounterplay.LogWarning("Jester surface prefab did not load correctly or is missing; its counterplay will not work."); return; } GameObject val = Object.Instantiate<GameObject>(JesterSurface.JesterSurfacePrefab); ((Object)val).name = ((Object)JesterSurface.JesterSurfacePrefab).name; NetworkObject val2 = default(NetworkObject); if (val.TryGetComponent<NetworkObject>(ref val2)) { val2.Spawn(false); val.transform.SetParent(((Component)__instance).transform, false); } } [HarmonyPatch(typeof(EnemyAI), "SwitchToBehaviourState")] [HarmonyPrefix] public static void CheckJesterHead(EnemyAI __instance, ref int stateIndex) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) if ((!((NetworkBehaviour)__instance).IsServer && !((NetworkBehaviour)__instance).IsHost) || !SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableJesterCounterplay) || ((object)__instance).GetType() != typeof(JesterAI)) { return; } Transform obj = ((Component)__instance).transform.Find("JesterSurface"); JesterSurface jesterSurface = default(JesterSurface); if (obj == null || !((Component)obj).TryGetComponent<JesterSurface>(ref jesterSurface)) { return; } switch (stateIndex) { case 0: case 1: if (SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPanicThreshold) > 0f && jesterSurface.TotalWeight >= SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPanicThreshold)) { MoreCounterplay.Log("Uh oh..."); stateIndex = 2; jesterSurface.SwitchAnimationClientRpc(panic: true); } break; case 2: if (SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPreventThreshold) > 0f && jesterSurface.TotalWeight >= SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPreventThreshold)) { MoreCounterplay.Log("Preventing Jester from popping..."); stateIndex = 0; jesterSurface.SwitchAnimationClientRpc(); } else { jesterSurface.DropAllItemsOnClient(); jesterSurface.DropAllItemsServerRpc(NetworkObjectReference.op_Implicit(((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<NetworkObject>())); } break; } } [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] [HarmonyPrefix] public static void GrabItem(GrabbableObject __instance) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsOwner && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableJesterCounterplay)) { Transform parent = ((Component)__instance).transform.GetParent(); JesterSurface jesterSurface = default(JesterSurface); if (parent != null && ((Component)parent).TryGetComponent<JesterSurface>(ref jesterSurface)) { jesterSurface.RemoveItemOnClient(__instance); jesterSurface.RemoveItemServerRpc(NetworkObjectReference.op_Implicit(((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<NetworkObject>()), NetworkObjectReference.op_Implicit(((Component)__instance).GetComponent<NetworkObject>())); } } } [HarmonyPatch(typeof(EnemyAI), "HitEnemy")] [HarmonyPrefix] private static void HitJester(EnemyAI __instance, PlayerControllerB playerWhoHit, int hitID = -1) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)playerWhoHit == (Object)null) && ((NetworkBehaviour)playerWhoHit).IsOwner && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableJesterCounterplay) && !__instance.isEnemyDead && !(((object)__instance).GetType() != typeof(JesterAI)) && __instance.currentBehaviourStateIndex != 2 && hitID == 1 && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.DropItemsOnHit)) { Transform obj = ((Component)__instance).transform.Find("JesterSurface"); JesterSurface jesterSurface = default(JesterSurface); if (obj != null && ((Component)obj).TryGetComponent<JesterSurface>(ref jesterSurface)) { jesterSurface.DropAllItemsOnClient(hit: true); jesterSurface.DropAllItemsServerRpc(NetworkObjectReference.op_Implicit(((Component)playerWhoHit).GetComponent<NetworkObject>()), hit: true); } } } [HarmonyPatch(typeof(EnemyAI), "KillEnemy")] [HarmonyPrefix] private static void KillJester(EnemyAI __instance) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsOwner && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableJesterCounterplay) && !__instance.isEnemyDead && !(((object)__instance).GetType() != typeof(JesterAI))) { Transform obj = ((Component)__instance).transform.Find("JesterSurface"); JesterSurface jesterSurface = default(JesterSurface); if (obj != null && ((Component)obj).TryGetComponent<JesterSurface>(ref jesterSurface)) { jesterSurface.DropAllItemsOnClient(hit: true); jesterSurface.DropAllItemsServerRpc(NetworkObjectReference.op_Implicit(((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<NetworkObject>()), hit: true); } } } } [HarmonyPatch] internal class LoadPatches { [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] [HarmonyPostfix] private static void OnDisconnect() { GameObject? radioactiveFirePrefab = CoilExplosion.RadioactiveFirePrefab; if (radioactiveFirePrefab != null) { radioactiveFirePrefab.transform.SetParent((Transform)null, false); } GameObject? coilheadPrefab = CoilExplosion.CoilheadPrefab; Object.Destroy((Object)(object)((coilheadPrefab != null) ? coilheadPrefab.GetComponent<CoilExplosion>() : null)); GameObject? coilheadPrefab2 = CoilExplosion.CoilheadPrefab; SpringManAI val = default(SpringManAI); if (coilheadPrefab2 != null && coilheadPrefab2.TryGetComponent<SpringManAI>(ref val)) { ((EnemyAI)val).enemyHP = 3; ((EnemyAI)val).enemyType.canDie = false; } } internal static void FindAndModifyPrefabs() { if (!SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableCoilheadCounterplay)) { return; } MoreCounterplay.Log("Loading prefab textures..."); if (VanillaPrefabUtils.GetInsideEnemyPrefab("Spring", out GameObject enemyPrefab)) { CoilExplosion.CoilheadPrefab = enemyPrefab; if ((Object)(object)HeadItem.Prefab != (Object)null && (Object)(object)enemyPrefab != (Object)null) { SpringManAI component = enemyPrefab.GetComponent<SpringManAI>(); ((EnemyAI)component).enemyHP = SyncedEntry<int>.op_Implicit(MoreCounterplay.Settings.SpringDurability); ((EnemyAI)component).enemyType.canDie = true; if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.LoreAccurateCoilheads)) { ((Behaviour)enemyPrefab.AddComponent<CoilExplosion>()).enabled = false; if ((Object)(object)CoilExplosion.RadioactiveFirePrefab != (Object)null && (MoreCounterplay.Settings.ExplosionFire.Value || MoreCounterplay.Settings.ExplosionParticles.Value)) { CoilExplosion.RadioactiveFirePrefab.transform.SetParent(enemyPrefab.transform.Find("SpringManModel"), false); CoilExplosion.RadioactiveFirePrefab.SetActive(false); ((Behaviour)((Component)CoilExplosion.RadioactiveFirePrefab.transform.Find("FireLight")).GetComponent<Light>()).enabled = MoreCounterplay.Settings.ExplosionFire.Value; ((Renderer)((Component)CoilExplosion.RadioactiveFirePrefab.transform.Find("GreenFlame")).GetComponent<ParticleSystemRenderer>()).enabled = MoreCounterplay.Settings.ExplosionFire.Value; ((Renderer)((Component)CoilExplosion.RadioactiveFirePrefab.transform.Find("RadioactiveParticles")).GetComponent<ParticleSystemRenderer>()).enabled = MoreCounterplay.Settings.ExplosionParticles.Value; } } if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.DropHeadAsScrap)) { Material material = ((Renderer)((Component)enemyPrefab.transform.Find("SpringManModel/Head")).GetComponent<MeshRenderer>()).material; ((Renderer)HeadItem.Prefab.GetComponent<MeshRenderer>()).material = material; } } else { MoreCounterplay.LogWarning("Either the 'Coilless Coilhead' prefab did not load or the Coilhead enemy prefab could not be found. Some stuff might not load or work properly."); } } if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.LoreAccurateCoilheads) && MoreCounterplay.Settings.ExplosionFire.Value && VanillaPrefabUtils.GetOutsideEnemyPrefab("ForestGiant", out GameObject enemyPrefab2)) { if ((Object)(object)CoilExplosion.RadioactiveFirePrefab != (Object)null && (Object)(object)enemyPrefab2 != (Object)null) { Texture mainTexture = ((Renderer)((Component)enemyPrefab2.transform.Find("FireParticlesContainer/LingeringFire")).GetComponent<ParticleSystemRenderer>()).material.mainTexture; ((Renderer)((Component)CoilExplosion.RadioactiveFirePrefab.transform.Find("GreenFlame")).GetComponent<ParticleSystemRenderer>()).material.mainTexture = mainTexture; } else { MoreCounterplay.LogWarning("Either the 'RadioactiveFire' prefab did not load or the Forest Giant enemy prefab could not be found. Some stuff might not load or work properly."); } } MoreCounterplay.Log("Finished loading textures!"); } } [HarmonyPatch] internal class TurretPatch { private const int KNIFE_HIT_ID = 5; [HarmonyPatch(typeof(Turret), "IHittable.Hit")] [HarmonyPostfix] public static void CheckHitID(Turret __instance, int hitID = -1) { if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableTurretCounterplay) && hitID == 5) { MoreCounterplay.Log("Turret hit using knife"); TurretCounterplay turretCounterplay = ((Component)__instance).gameObject.AddComponent<TurretCounterplay>(); turretCounterplay.TurretDisabled = true; } } [HarmonyPatch(typeof(Turret), "Update")] [HarmonyPrefix] public static bool CheckIfTurretGotDisabled(Turret __instance) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 if (!SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.EnableTurretCounterplay)) { return true; } if ((int)__instance.turretMode > 0) { return true; } TurretCounterplay component = ((Component)__instance).gameObject.GetComponent<TurretCounterplay>(); if ((Object)(object)component != (Object)null && component.TurretDisabled) { if (__instance.turretActive) { __instance.ToggleTurretEnabled(false); __instance.mainAudio.Stop(); __instance.farAudio.Stop(); __instance.berserkAudio.Stop(); __instance.bulletCollisionAudio.Stop(); __instance.bulletParticles.Stop(); __instance.mainAudio.PlayOneShot(__instance.turretDeactivate); } return false; } return true; } } internal class TurretCounterplay : MonoBehaviour { public bool TurretDisabled = false; } } namespace MoreCounterplay.Items { public class AttachedItem : PhysicsProp { public bool IsAttached { get; private set; } = false; public Action? OnGrab { get; set; } public Action? OnEquip { get; set; } public override void Start() { ((GrabbableObject)this).Start(); ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).grabbableToEnemies = true; OnGrab = delegate { if (IsAttached && ((NetworkBehaviour)this).IsOwner) { DetachItemServerRpc(); } }; } public override void LateUpdate() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)this).radarIcon != (Object)null) { ((GrabbableObject)this).radarIcon.position = ((Component)this).transform.position; } if (!((Object)(object)((GrabbableObject)this).parentObject == (Object)null) && !IsAttached) { ((Component)this).transform.position = ((GrabbableObject)this).parentObject.position; ((Component)this).transform.rotation = ((GrabbableObject)this).parentObject.rotation; ApplyOffsets(); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); OnGrab?.Invoke(); } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); OnEquip?.Invoke(); } public virtual void ApplyOffsets() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.position += ((GrabbableObject)this).parentObject.rotation * ((GrabbableObject)this).itemProperties.positionOffset; ((Component)this).transform.Rotate(((GrabbableObject)this).itemProperties.rotationOffset); } public void AttachTo(GameObject parent) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!IsAttached) { ParentConstraint component = ((Component)this).gameObject.GetComponent<ParentConstraint>(); ConstraintSource val = default(ConstraintSource); ((ConstraintSource)(ref val)).weight = 1f; ((ConstraintSource)(ref val)).sourceTransform = parent.transform; component.AddSource(val); component.constraintActive = true; ((GrabbableObject)this).parentObject = parent.transform; IsAttached = true; } } [ClientRpc] public virtual void AttachItemClientRpc(NetworkObjectReference parent) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1876029344u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref parent, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1876029344u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref parent)).TryGet(ref val3, (NetworkManager)null)) { AttachTo(((Component)val3).gameObject); } } } [ClientRpc] public void DetachItemClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(318505161u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 318505161u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ParentConstraint component = ((Component)this).gameObject.GetComponent<ParentConstraint>(); component.RemoveSource(0); component.constraintActive = false; IsAttached = false; } } } [ServerRpc(RequireOwnership = false)] public void DetachItemServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4149983584u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4149983584u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DetachItemClientRpc(); } } } public override string __getTypeName() { return "AttachedItem"; } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1876029344u, new RpcReceiveHandler(__rpc_handler_1876029344), "AttachItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(318505161u, new RpcReceiveHandler(__rpc_handler_318505161), "DetachItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(4149983584u, new RpcReceiveHandler(__rpc_handler_4149983584), "DetachItemServerRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_1876029344(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference parent = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref parent, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((AttachedItem)(object)target).AttachItemClientRpc(parent); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_318505161(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((AttachedItem)(object)target).DetachItemClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4149983584(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((AttachedItem)(object)target).DetachItemServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "AttachedItem"; } } public class HeadItem : RotatingItem { private static Random? _random; public static GameObject? Prefab { get; internal set; } public static Random Random { get { return _random ?? (_random = new Random()); } private set { _random = value; } } public override void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) base.Start(); ((Component)this).transform.Rotate(new Vector3(0f, -90f, -35f)); ((Component)this).transform.Translate(new Vector3(-0.05f, -0.05f, 0f)); ((Object)this).hideFlags = (HideFlags)0; base.OnEquip = delegate { if (((NetworkBehaviour)this).IsOwner) { int num = Random.Next(0, 360); if (num <= 75) { OnEquipHeadServerRpc(1f / (float)Random.Next(1, 5), num); } else { SetRotationTarget(35f, 35f); } } }; } [ClientRpc] public override void AttachItemClientRpc(NetworkObjectReference coilheadReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4210478846u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref coilheadReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4210478846u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref coilheadReference)).TryGet(ref val3, (NetworkManager)null)) { GameObject gameObject = ((Component)((Component)val3).transform.Find("SpringManModel/Head")).gameObject; Material material = ((Renderer)gameObject.GetComponent<MeshRenderer>()).material; ((Renderer)((Component)this).GetComponent<MeshRenderer>()).material = material; AttachTo(gameObject); gameObject.GetComponent<Renderer>().enabled = false; } } } [ClientRpc] public void OnEquipHeadClientRpc(float rotationSpeed, int startingAngle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(156822866u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref rotationSpeed, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, startingAngle); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 156822866u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetRotationSpeed(rotationSpeed); SetRotationTarget(startingAngle, 35f); } } } [ServerRpc(RequireOwnership = false)] public void OnEquipHeadServerRpc(float rotationSpeed, int startingAngle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1697168690u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref rotationSpeed, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, startingAngle); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1697168690u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; OnEquipHeadClientRpc(rotationSpeed, startingAngle); } } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4210478846u, new RpcReceiveHandler(__rpc_handler_4210478846), "AttachItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(156822866u, new RpcReceiveHandler(__rpc_handler_156822866), "OnEquipHeadClientRpc"); ((NetworkBehaviour)this).__registerRpc(1697168690u, new RpcReceiveHandler(__rpc_handler_1697168690), "OnEquipHeadServerRpc"); base.__initializeRpcs(); } private static void __rpc_handler_4210478846(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference coilheadReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref coilheadReference, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((HeadItem)(object)target).AttachItemClientRpc(coilheadReference); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_156822866(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float rotationSpeed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotationSpeed, default(ForPrimitives)); int startingAngle = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref startingAngle); target.__rpc_exec_stage = (__RpcExecStage)1; ((HeadItem)(object)target).OnEquipHeadClientRpc(rotationSpeed, startingAngle); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1697168690(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float rotationSpeed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotationSpeed, default(ForPrimitives)); int startingAngle = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref startingAngle); target.__rpc_exec_stage = (__RpcExecStage)1; ((HeadItem)(object)target).OnEquipHeadServerRpc(rotationSpeed, startingAngle); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "HeadItem"; } } public class RotatingItem : AttachedItem { public float CurrentAngle { get; private set; } = 90f; public float RotationSpeed { get; private set; } = 0.5f; public float StartingAngle { get; private set; } = 90f; public float TargetAngle { get; private set; } = 35f; public bool ReachedTarget { get; private set; } = false; public override void Start() { base.Start(); base.OnEquip = ResetRotation; } public override void ApplyOffsets() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((GrabbableObject)this).itemProperties.rotationOffset.x, ((GrabbableObject)this).itemProperties.rotationOffset.y, CurrentAngle); Transform transform = ((Component)this).transform; transform.position += ((GrabbableObject)this).parentObject.rotation * ((GrabbableObject)this).itemProperties.positionOffset; ((Component)this).transform.Rotate(val); if (!ReachedTarget) { if (CurrentAngle > TargetAngle + RotationSpeed * 2f) { CurrentAngle -= RotationSpeed; } else if (CurrentAngle < TargetAngle - RotationSpeed * 2f) { CurrentAngle += RotationSpeed; } else { ReachedTarget = true; } } } public void ResetRotation() { SetRotation(StartingAngle); } public void SetRotation(float angle) { CurrentAngle = angle; ReachedTarget = false; } public void SetRotationTarget(float startingAngle, float targetAngle) { StartingAngle = Math.Abs(startingAngle % 360f); TargetAngle = Math.Abs(targetAngle % 360f); ResetRotation(); } public void SetRotationSpeed(float rotationSpeed) { RotationSpeed = rotationSpeed; } public override string __getTypeName() { return "RotatingItem"; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RotatingItem"; } } } namespace MoreCounterplay.Config { public class ConfigSettings : SyncedConfig2<ConfigSettings> { [field: SyncedEntryField] public SyncedEntry<bool> EnableJesterCounterplay { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> JesterPreventThreshold { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> JesterEncumberThreshold { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> JesterPanicThreshold { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> MinPanicTimer { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> MaxPanicTimer { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> ItemsStayOnLid { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> DropItemsOnHit { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> ShowWeightOnScan { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> EnableTurretCounterplay { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> EnableCoilheadCounterplay { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> SpringDurability { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> CoilheadDefaultDamage { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> CoilheadKnifeDamage { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> CoilheadShovelDamage { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> DropHeadAsScrap { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> MinHeadValue { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> MaxHeadValue { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> LoreAccurateCoilheads { get; private set; } [field: SyncedEntryField] public SyncedEntry<int> ExplosionDamage { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> ExplosionDamageRadius { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> ExplosionKillRadius { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> MinExplosionTimer { get; private set; } [field: SyncedEntryField] public SyncedEntry<float> MaxExplosionTimer { get; private set; } [field: SyncedEntryField] public SyncedEntry<bool> ExplosionDestroysHead { get; private set; } public ConfigEntry<bool> ExplosionFire { get; private set; } public ConfigEntry<bool> ExplosionParticles { get; private set; } public ConfigEntry<float> ExplosionWarnVolume { get; private set; } public ConfigEntry<bool> EnableCoilheadScanNode { get; private set; } public ConfigEntry<bool> ModifyCoilheadScanNode { get; private set; } public ConfigSettings(ConfigFile config) : base("BaronDrakula.MoreCounterplay") { //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown config.SaveOnConfigSet = false; EnableJesterCounterplay = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Jester", "EnableJesterCounterplay", true, "Add counterplay for Jesters. Required for all Jester settings under this."); JesterPreventThreshold = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Jester", "JesterPreventThreshold", 60f, "Minimum weight of items needed to prevent the Jester from popping. Set to 0 to disable."); JesterEncumberThreshold = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Jester", "JesterEncumberThreshold", 120f, "Minimum weight of items needed to prevent the Jester from walking at all. Set to 0 to disable. Can be smaller than the setting above."); JesterPanicThreshold = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Jester", "JesterPanicThreshold", 200f, "Minimum weight of items needed for the Jester to start panicking. Set to 0 to disable. Functionally disables counterplay if lower than the 'prevent' threshold."); MinPanicTimer = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Jester", "MinPanicTimer", 0.5f, "Shortest amount of time the Jester can panic for before popping."); MaxPanicTimer = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Jester", "MaxPanicTimer", 5f, "Largest amount of time the Jester can panic for before popping"); ItemsStayOnLid = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Jester", "ItemsStayOnLid", false, "Allow items to stay on top of the Jester after preventing it from popping."); DropItemsOnHit = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Jester", "DropItemsOnHit", true, "Drop all items on top of the Jester when hitting it with a shovel."); ShowWeightOnScan = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Jester", "ShowWeightOnScan", true, "Shows the total weight on top of the Jester as the subtext of its scan node."); EnableTurretCounterplay = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Turret", "EnableTurretCounterplay", true, "Add counterplay for Turret."); EnableCoilheadCounterplay = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Coilhead", "EnableCoilheadCounterplay", true, "Add counterplay for Coilheads. Required for all Coilhead settings under this."); SpringDurability = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "SpringDurability", 3, "Set Coilhead health points."); CoilheadDefaultDamage = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "CoilheadDefaultDamage", 0, "Amount of damage that Coilheads take from any source not specified below."); CoilheadKnifeDamage = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "CoilheadKnifeDamage", 1, "Amount of damage that Coilheads take from Knife."); CoilheadShovelDamage = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "CoilheadShovelDamage", 0, "Amount of damage that Coilheads take from Shovel."); DropHeadAsScrap = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Coilhead", "DropHeadAsScrap", true, "Enable the Coilhead head scrap item spawning on death."); MinHeadValue = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "MinHeadValue", 30, "Minimum value of the Coilhead head item."); MaxHeadValue = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "MaxHeadValue", 70, "Maximum value of the Coilhead head item."); LoreAccurateCoilheads = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Coilhead", "LoreAccurateCoilheads", true, "Enable lore accurate (volatile) Coilhead counterplay (requires restart). Required for all Coilhead settings under this."); ExplosionDamage = SyncedBindingExtensions.BindSyncedEntry<int>(config, "Coilhead", "ExplosionDamage", 50, "Amount of damage the Coilhead explosion deals."); ExplosionDamageRadius = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Coilhead", "ExplosionDamageRadius", 4f, "Radius of the Coilhead explosion damage zone."); ExplosionKillRadius = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Coilhead", "ExplosionKillRadius", 2f, "Radius of the Coilhead explosion kill zone."); MinExplosionTimer = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Coilhead", "MinExplosionTimer", 0.5f, "Minimum time until Coilhead explosion."); MaxExplosionTimer = SyncedBindingExtensions.BindSyncedEntry<float>(config, "Coilhead", "MaxExplosionTimer", 5f, "Maximum time until Coilhead explosion."); ExplosionDestroysHead = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Coilhead", "ExplosionDestroysHead", true, "Destroy Coilhead scrap head if still attached during explosion."); ExplosionFire = config.Bind<bool>("Coilhead", "ExplosionFire", true, "(Client-side) Enable green fire effect for Coilheads that are about to explode."); ExplosionParticles = config.Bind<bool>("Coilhead", "ExplosionParticles", true, "(Client-side) Enable radioactive particles effect for Coilheads that are about to explode."); ExplosionWarnVolume = config.Bind<float>("Coilhead", "ExplosionWarnVolume", 1f, new ConfigDescription("(Client-side) Adjust volume of the sound effect played right before exploding (NOT the actual explosion).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); EnableCoilheadScanNode = config.Bind<bool>("Coilhead", "EnableCoilheadScanNode", true, "(Client-side) Enable scanning Coilheads that have been killed."); ModifyCoilheadScanNode = config.Bind<bool>("Coilhead", "ModifyCoilheadScanNode", true, "(Client-side) Add extra text/subtext to a killed Coilhead's scan node."); base.InitialSyncCompleted += delegate { LoadPatches.FindAndModifyPrefabs(); }; ClearOrphanedEntries(config); config.SaveOnConfigSet = true; config.Save(); ConfigManager.Register<ConfigSettings>((SyncedConfig2<ConfigSettings>)(object)this); } private void ClearOrphanedEntries(ConfigFile config) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); ((Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config))?.Clear(); } } } namespace MoreCounterplay.Behaviours { public class CoilExplosion : NetworkBehaviour { public static GameObject? CoilheadPrefab { get; internal set; } public static GameObject? RadioactiveFirePrefab { get; internal set; } public bool Ticking { get; internal set; } = false; public float TimeLeft { get; internal set; } = 0f; public float TimeSinceLastStop { get; internal set; } = 0f; public bool PlayedSfx { get; internal set; } = false; public GameObject? HeadContainer { get; internal set; } public GameObject? FireContainer { get; private set; } public SpringManAI? Coilhead { get; private set; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); SpringManAI coilhead = default(SpringManAI); if (((Component)this).TryGetComponent<SpringManAI>(ref coilhead)) { Coilhead = coilhead; } Transform obj = ((Component)this).transform.Find("SpringManModel/RadioactiveFire"); FireContainer = ((obj != null) ? ((Component)obj).gameObject : null); } public void LateUpdate() { if (!Ticking) { TimeSinceLastStop += Time.deltaTime; } else if (TimeLeft <= 0f) { GameObject? headContainer = HeadContainer; AttachedItem attachedItem = default(AttachedItem); if (headContainer != null && headContainer.TryGetComponent<AttachedItem>(ref attachedItem) && attachedItem.IsAttached && !((GrabbableObject)attachedItem).heldByPlayerOnServer && SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.ExplosionDestroysHead)) { GameObject? headContainer2 = HeadContainer; if (headContainer2 != null) { headContainer2.GetComponent<NetworkObject>().Despawn(true); } } SpawnExplosionClientRpc(); UpdateScanNodeClientRpc(ignited: false); ((Behaviour)this).enabled = false; } else { if (!PlayedSfx && TimeLeft <= 1f) { PlaySfxClientRpc(); PlayedSfx = true; } TimeLeft -= Time.deltaTime; } } [ClientRpc] private void SpawnExplosionClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(854298167u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 854298167u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Landmine.SpawnExplosion(((Component)this).transform.position, true, SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.ExplosionKillRadius), SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.ExplosionDamageRadius), SyncedEntry<int>.op_Implicit(MoreCounterplay.Settings.ExplosionDamage), 0f, (GameObject)null, false); SpringManAI? coilhead = Coilhead; if (coilhead != null) { coilhead.DoSpringAnimation(true); } GameObject? fireContainer = FireContainer; if (fireContainer != null) { fireContainer.SetActive(false); } } } [ClientRpc] private void PlaySfxClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1574743326u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1574743326u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpringManAI? coilhead = Coilhead; if (coilhead != null) { AudioSource creatureVoice = ((EnemyAI)coilhead).creatureVoice; GameObject? prefab = HeadItem.Prefab; HeadItem headItem = default(HeadItem); creatureVoice.PlayOneShot((prefab != null && prefab.TryGetComponent<HeadItem>(ref headItem)) ? ((GrabbableObject)headItem).itemProperties.throwSFX : Coilhead?.enterCooldownSFX, MoreCounterplay.Settings.ExplosionWarnVolume.Value); } } } [ClientRpc] internal void UpdateScanNodeClientRpc(bool ignited) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(548278882u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref ignited, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 548278882u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!MoreCounterplay.Settings.ModifyCoilheadScanNode.Value) { return; } Transform obj = ((Component)this).transform.Find("SpringManModel/ScanNode"); ScanNodeProperties val3 = default(ScanNodeProperties); if (obj != null && ((Component)obj).TryGetComponent<ScanNodeProperties>(ref val3)) { Collider val4 = default(Collider); if (((Component)val3).TryGetComponent<Collider>(ref val4)) { val4.enabled = true; } if (MoreCounterplay.Settings.ModifyCoilheadScanNode.Value) { val3.headerText = (ignited ? "Fissile" : "Decayed") + " Coil-Head"; val3.subText = (ignited ? "Run." : "Don't get too close..."); val3.nodeType = (ignited ? 1 : 0); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(854298167u, new RpcReceiveHandler(__rpc_handler_854298167), "SpawnExplosionClientRpc"); ((NetworkBehaviour)this).__registerRpc(1574743326u, new RpcReceiveHandler(__rpc_handler_1574743326), "PlaySfxClientRpc"); ((NetworkBehaviour)this).__registerRpc(548278882u, new RpcReceiveHandler(__rpc_handler_548278882), "UpdateScanNodeClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_854298167(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((CoilExplosion)(object)target).SpawnExplosionClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1574743326(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((CoilExplosion)(object)target).PlaySfxClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_548278882(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool ignited = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref ignited, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CoilExplosion)(object)target).UpdateScanNodeClientRpc(ignited); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "CoilExplosion"; } } public class JesterSurface : PlaceableObjectsSurface { public static GameObject? JesterSurfacePrefab { get; internal set; } public float TotalWeight { get; internal set; } = 0f; public JesterAI? Jester { get; private set; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); Transform transform = ((Component)this).transform; GameObject? jesterSurfacePrefab = JesterSurfacePrefab; ((Object)transform).name = ((jesterSurfacePrefab != null) ? ((Object)jesterSurfacePrefab).name : null); base.parentTo = ((Component)this).GetComponent<NetworkObject>(); base.placeableBounds = ((Component)((Component)this).transform.Find("bounds")).GetComponent<Collider>(); base.triggerScript = ((Component)this).GetComponent<InteractTrigger>(); ((UnityEvent<PlayerControllerB>)(object)base.triggerScript.onInteract).AddListener((UnityAction<PlayerControllerB>)PlaceObject); } public void Start() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Component)this).transform.GetParent(); JesterAI jester = default(JesterAI); if (parent != null && ((Component)parent).TryGetComponent<JesterAI>(ref jester)) { Jester = jester; } ((Component)this).gameObject.layer = LayerMask.NameToLayer("InteractableObject"); ParentConstraint val = ((Component)this).gameObject.AddComponent<ParentConstraint>(); ConstraintSource val2 = default(ConstraintSource); ((ConstraintSource)(ref val2)).weight = 1f; ((ConstraintSource)(ref val2)).sourceTransform = ((Component)this).transform.GetParent().Find("MeshContainer/AnimContainer/metarig/BoxContainer"); val.AddSource(val2); val.constraintActive = true; } public void Update() { if ((Object)(object)base.triggerScript != (Object)null) { InteractTrigger triggerScript = base.triggerScript; int interactable; if (GameNetworkManager.Instance.localPlayerController.isHoldingObject) { JesterAI? jester = Jester; interactable = ((jester == null || ((EnemyAI)jester).currentBehaviourStateIndex != 2) ? 1 : 0); } else { interactable = 0; } triggerScript.interactable = (byte)interactable != 0; } } public void PlaceObject(PlayerControllerB playerWhoTriggered) { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)playerWhoTriggered).IsOwner && playerWhoTriggered.isHoldingObject && !playerWhoTriggered.isGrabbingObjectAnimation && !((Object)(object)playerWhoTriggered.currentlyHeldObjectServer == (Object)null)) { GrabbableObject currentlyHeldObjectServer = playerWhoTriggered.currentlyHeldObjectServer; Vector3 val = ((Component)base.parentTo).transform.InverseTransformPoint(itemPlacementPosition(((Component)playerWhoTriggered.gameplayCamera).transform, currentlyHeldObjectServer)); playerWhoTriggered.DiscardHeldObject(true, base.parentTo, val, false); PlaceItemOnClient(currentlyHeldObjectServer); PlaceItemServerRpc(NetworkObjectReference.op_Implicit(((Component)playerWhoTriggered).GetComponent<NetworkObject>()), NetworkObjectReference.op_Implicit(((Component)currentlyHeldObjectServer).GetComponent<NetworkObject>())); } } public Vector3 itemPlacementPosition(Transform camera, GrabbableObject heldItem) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0052: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) int num = 1074277120; RaycastHit val = default(RaycastHit); return (!Physics.Raycast(camera.position, camera.forward, ref val, 7f, num, (QueryTriggerInteraction)1)) ? ((Component)base.placeableBounds).transform.position : (base.placeableBounds.ClosestPoint(((RaycastHit)(ref val)).point) + ((Component)base.placeableBounds).transform.up * heldItem.itemProperties.verticalOffset); } public void ResetJester() { if (!((Object)(object)Jester == (Object)null)) { if (SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterEncumberThreshold) != 0f && TotalWeight < SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterEncumberThreshold) && ((EnemyAI)Jester).stunNormalizedTimer > 0f) { Jester.beginCrankingTimer = ((EnemyAI)Jester).stunNormalizedTimer * ((EnemyAI)Jester).enemyType.stunTimeMultiplier; ((EnemyAI)Jester).stunNormalizedTimer = 0f; } if (SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPanicThreshold) != 0f && TotalWeight < SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPanicThreshold) && ((EnemyAI)Jester).creatureAnimator.GetBool("turningCrank") && ((EnemyAI)Jester).currentBehaviourStateIndex == 0) { ((EnemyAI)Jester).creatureVoice.Stop(); ((EnemyAI)Jester).creatureAnimator.SetBool("turningCrank", false); ((EnemyAI)Jester).creatureAnimator.SetFloat("CrankSpeedMultiplier", 1f); ((EnemyAI)Jester).creatureAnimator.CrossFade("IdleDocile", 0.1f); } } } public void PlaceItemOnClient(GrabbableObject item) { if ((Object)(object)base.parentTo == (Object)null || (Object)(object)base.placeableBounds == (Object)null || (Object)(object)base.triggerScript == (Object)null || (Object)(object)Jester == (Object)null || ((EnemyAI)Jester).currentBehaviourStateIndex == 2) { return; } Transform child = ((Component)item).transform.GetChild(0); ScanNodeProperties val = default(ScanNodeProperties); Rigidbody val2 = default(Rigidbody); if (child != null && ((Component)child).TryGetComponent<ScanNodeProperties>(ref val) && !((Component)val).TryGetComponent<Rigidbody>(ref val2)) { ((Component)val).gameObject.AddComponent<Rigidbody>().isKinematic = true; } TotalWeight += (item.itemProperties.weight - 1f) * 105f; MoreCounterplay.Log($"Current weight: {TotalWeight}"); if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.ShowWeightOnScan)) { Transform obj = ((Component)Jester).transform.Find("ScanNode"); ScanNodeProperties val3 = default(ScanNodeProperties); if (obj != null && ((Component)obj).TryGetComponent<ScanNodeProperties>(ref val3)) { val3.subText = $"Weight: {TotalWeight} lbs"; } } if (SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterEncumberThreshold) > 0f && TotalWeight >= SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterEncumberThreshold) && ((EnemyAI)Jester).stunNormalizedTimer <= 0f && !((EnemyAI)Jester).creatureAnimator.GetBool("turningCrank")) { ((EnemyAI)Jester).stunNormalizedTimer = Jester.beginCrankingTimer / ((EnemyAI)Jester).enemyType.stunTimeMultiplier; JesterAI? jester = Jester; jester.beginCrankingTimer *= 15f; } if (SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPanicThreshold) > 0f && TotalWeight >= SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.JesterPanicThreshold)) { if (!((EnemyAI)Jester).creatureAnimator.GetBool("turningCrank")) { ((EnemyAI)Jester).creatureVoice.clip = Jester.screamingSFX; ((EnemyAI)Jester).creatureVoice.Play(); ((EnemyAI)Jester).creatureAnimator.SetBool("turningCrank", true); ((EnemyAI)Jester).creatureAnimator.SetFloat("CrankSpeedMultiplier", 2.5f); Jester.beginCrankingTimer = Mathf.Clamp(Jester.beginCrankingTimer, SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.MinPanicTimer) * 15f, SyncedEntry<float>.op_Implicit(MoreCounterplay.Settings.MaxPanicTimer) * 15f); ((EnemyAI)Jester).stunNormalizedTimer = Jester.beginCrankingTimer / (((EnemyAI)Jester).enemyType.stunTimeMultiplier * 15f); } else { ((EnemyAI)Jester).SwitchToBehaviourStateOnLocalClient(2); ((EnemyAI)Jester).stunNormalizedTimer = 0f; DropAllItemsOnClient(); } } } public void RemoveItemOnClient(GrabbableObject item) { if (!((Object)(object)base.parentTo == (Object)null) && !((Object)(object)base.placeableBounds == (Object)null) && !((Object)(object)base.triggerScript == (Object)null) && !((Object)(object)Jester == (Object)null) && ((EnemyAI)Jester).currentBehaviourStateIndex != 2) { TotalWeight -= (item.itemProperties.weight - 1f) * 105f; MoreCounterplay.Log($"Current weight: {TotalWeight}"); ((Component)item).transform.SetParent(StartOfRound.Instance.propsContainer, true); ScanNodeProperties val = default(ScanNodeProperties); if (SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.ShowWeightOnScan) && ((Component)((Component)Jester).transform.Find("ScanNode")).TryGetComponent<ScanNodeProperties>(ref val)) { val.subText = ((TotalWeight > 0f) ? $"Weight: {TotalWeight} lbs" : ""); } if (((EnemyAI)Jester).currentBehaviourStateIndex == 0) { ResetJester(); } } } public void DropAllItemsOnClient(bool hit = false) { CollectionExtensions.Do<GrabbableObject>((IEnumerable<GrabbableObject>)((Component)this).GetComponentsInChildren<GrabbableObject>(), (Action<GrabbableObject>)delegate(GrabbableObject item) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) item.parentObject = null; ((Component)item).transform.SetParent(StartOfRound.Instance.propsContainer, true); item.EnablePhysics(true); item.EnableItemMeshes(true); item.isHeld = false; item.isPocketed = false; item.startFallingPosition = StartOfRound.Instance.propsContainer.InverseTransformPoint(((Component)item).transform.position); item.FallToGround(false, false, default(Vector3)); item.fallTime = -0.3f; item.hasHitGround = false; }); JesterAI? jester = Jester; if (jester != null) { Transform obj = ((Component)jester).transform.Find("ScanNode"); ScanNodeProperties val = default(ScanNodeProperties); if (((obj != null) ? new bool?(((Component)obj).TryGetComponent<ScanNodeProperties>(ref val)) : null) == true) { val.subText = ""; } } TotalWeight = 0f; if (hit) { ResetJester(); } } [ClientRpc] public void SwitchAnimationClientRpc(bool panic = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(64899127u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref panic, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 64899127u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)Jester == (Object)null)) { if (panic || !SyncedEntry<bool>.op_Implicit(MoreCounterplay.Settings.ItemsStayOnLid)) { ((EnemyAI)Jester).creatureAnimator.CrossFade("JesterPopUp", 0.1f); ((EnemyAI)Jester).creatureVoice.Stop(); DropAllItemsOnClient(); } else { ((EnemyAI)Jester).creatureAnimator.CrossFade("IdleDocile", 0.1f); } } } [ClientRpc] public void PlaceItemClientRpc(NetworkObjectReference playerReference, NetworkObjectReference itemReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3819297365u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3819297365u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); NetworkObject val4 = default(NetworkObject); GrabbableObject item = default(GrabbableObject); if ((!((NetworkObjectReference)(ref playerReference)).TryGet(ref val3, (NetworkManager)null) || !val3.IsOwner) && ((NetworkObjectReference)(ref itemReference)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GrabbableObject>(ref item)) { PlaceItemOnClient(item); } } } [ServerRpc(RequireOwnership = false)] public void PlaceItemServerRpc(NetworkObjectReference playerReference, NetworkObjectReference itemReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2783664661u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2783664661u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlaceItemClientRpc(playerReference, itemReference); } } } [ClientRpc] public void RemoveItemClientRpc(NetworkObjectReference playerReference, NetworkObjectReference itemReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3251711782u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3251711782u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); NetworkObject val4 = default(NetworkObject); GrabbableObject item = default(GrabbableObject); if ((!((NetworkObjectReference)(ref playerReference)).TryGet(ref val3, (NetworkManager)null) || !val3.IsOwner) && ((NetworkObjectReference)(ref itemReference)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GrabbableObject>(ref item)) { RemoveItemOnClient(item); } } } [ServerRpc(RequireOwnership = false)] public void RemoveItemServerRpc(NetworkObjectReference playerReference, NetworkObjectReference itemReference) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1616201748u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1616201748u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; RemoveItemClientRpc(playerReference, itemReference); } } } [ClientRpc] public void DropAllItemsClientRpc(NetworkObjectReference playerReference, bool hit = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4025649712u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hit, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4025649712u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref playerReference)).TryGet(ref val3, (NetworkManager)null) || !val3.IsOwner) { DropAllItemsOnClient(hit); } } } [ServerRpc(RequireOwnership = false)] public void DropAllItemsServerRpc(NetworkObjectReference playerReference, bool hit = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00fe: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2288380667u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hit, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2288380667u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; DropAllItemsClientRpc(playerReference, hit); } } } protected override void __initializeVariables() { ((PlaceableObjectsSurface)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing refe