using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CodeRebirth.src.Content.Maps; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UZGCodeRebirthCompat.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UsefulZapGun; using UsefulZapGun.Compatibility.CodeRebirth.Network; using UsefulZapGun.Compatibility.CodeRebirth.Patches; using UsefulZapGun.Compatibility.CodeRebirth.Scripts; [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("UZGCodeRebirthCompat")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+085d5e4e38fb1f77575eb33d24979a5af097bd22")] [assembly: AssemblyProduct("UZGCodeRebirthCompat")] [assembly: AssemblyTitle("UZGCodeRebirthCompat")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } internal class CRConfig { internal static ConfigEntry enableACUZap; internal static ConfigEntry enableBearTrapZap; internal static ConfigEntry enableFlashZap; internal static ConfigEntry enableFanZap; internal static ConfigEntry enableLaserZap; internal static ConfigEntry enableMicrowaveZap; internal static ConfigEntry enableTeslaZap; internal static void RebirthConfigSetup(ConfigFile cfg) { enableACUZap = cfg.Bind("Hazards", "Enable ACUnit zap", true, "Decrease radius by 1/15 every second"); enableBearTrapZap = cfg.Bind("Hazards", "Enable BearTrap zap", true, "...have you ever tried to charge a conductive item?"); enableFlashZap = cfg.Bind("Hazards", "Enable FlashTurret zap", true, "Increases cooldown to a maximum of 1 minute"); enableFanZap = cfg.Bind("Hazards", "Enable IndustrialFan zap", true, "Turns off the fan during zap"); enableLaserZap = cfg.Bind("Hazards", "Enable LazerTurret zap", true, "Beware of the laser turret battery explosion"); enableMicrowaveZap = cfg.Bind("Hazards", "Enable Microwave zap", true, "Toggle microwave"); enableTeslaZap = cfg.Bind("Hazards", "Enable Tesla zap", true, "Turns off tesla at half the maximum charge of the zap gun... but beware of the zap gun explosion"); } } [BepInPlugin("mborsh.UsefulZapGun.CRCompat", "UsefulZapGun.CRCompat", "0.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class CRPlugin : BaseUnityPlugin { internal enum spamType { info, message, warning, debug, error, fatal } private static ManualLogSource mls; private readonly Harmony harmony = new Harmony("mborsh.UsefulZapGun.CRCompat"); private static ConfigFile cfg; private const string modGUID = "mborsh.UsefulZapGun.CRCompat"; private const string modName = "UsefulZapGun.CRCompat"; private const string modVersion = "0.0.3"; public static CRPlugin Instance { get; private set; } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } private void Awake() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("UsefulZapGun.CRCompat"); mls = ((BaseUnityPlugin)this).Logger; if (!Chainloader.PluginInfos.ContainsKey("CodeRebirth")) { mls.LogInfo((object)"CodeRebirth is not installed, skipping!"); return; } if (UZGConfig.enableZapHazards.Value) { mls.LogInfo((object)"enableZapHazards is not True, skipping!"); return; } NetcodePatcher(); cfg = new ConfigFile(Path.Combine(Paths.ConfigPath, "mborsh.UsefulZapGun.CRCompat.cfg"), true); CRConfig.RebirthConfigSetup(cfg); mls.LogInfo((object)"mborsh.UsefulZapGun.CRCompat loaded. Patching."); harmony.PatchAll(typeof(CodeRebirthMapHazardsPatch)); harmony.PatchAll(typeof(CodeRebirthGameNetworkManagerPatch)); } internal static void SpamLog(string message, spamType type) { if (UZGConfig.enableLogging.Value) { switch (type) { case spamType.info: mls.LogInfo((object)message); break; case spamType.message: mls.LogMessage((object)message); break; case spamType.warning: mls.LogWarning((object)message); break; case spamType.debug: mls.LogDebug((object)message); break; case spamType.error: mls.LogError((object)message); break; case spamType.fatal: mls.LogFatal((object)message); break; } } } } namespace UsefulZapGun.Compatibility.CodeRebirth.Scripts { internal class ACUShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public ACUShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_007a; case 1: { <>1__state = -1; AirControlUnit mainScript = <>4__this.mainScript; mainScript.detectionRange -= <>4__this.initialRange / 15f; goto IL_007a; } case 2: { <>1__state = -1; zapgun.StopShockingAnomalyOnClient(false); return false; } IL_007a: if (<>4__this.mainScript.detectionRange > 0f) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private AirControlUnit mainScript; private float initialRange; private Coroutine coroutine; private bool isStunnedByLocalClient; private void Start() { mainScript = ((Component)((Component)this).transform.parent).GetComponent(); initialRange = mainScript.detectionRange; } bool IShockableWithGun.CanBeShocked() { return mainScript.detectionRange > 0f && coroutine == null; } float IShockableWithGun.GetDifficultyMultiplier() { return 1.5f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) return ((Component)mainScript).transform.position + new Vector3(0f, 2f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown CRPlugin.SpamLog("Shock ac unit", CRPlugin.spamType.message); PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; coroutine = ((MonoBehaviour)this).StartCoroutine(DecreaseDetectionRangeEverySecond(zapgun)); AirControlUnit obj = mainScript; obj.rotationSpeed /= 3f; isStunnedByLocalClient = (Object)(object)shockedByPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController; } void IShockableWithGun.StopShockingWithGun() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) CRPlugin.SpamLog("Stop zaping ac unit!", CRPlugin.spamType.debug); ((MonoBehaviour)this).StopCoroutine(coroutine); coroutine = null; AirControlUnit obj = mainScript; obj.rotationSpeed *= 3f; if (isStunnedByLocalClient) { NetworkBehaviourReference aCURef = default(NetworkBehaviourReference); ((NetworkBehaviourReference)(ref aCURef))..ctor((NetworkBehaviour)(object)mainScript); CodeRebirthGameNetworkManagerPatch.rebirthNetwork.SyncACURangeServerRpc(aCURef); isStunnedByLocalClient = false; } } [IteratorStateMachine(typeof(d__12))] private IEnumerator DecreaseDetectionRangeEverySecond(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, zapgun = zapgun }; } } internal class BearTrapShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public PlayerControllerB shockedByPlayer; public BearTrapShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; zapgun.StopShockingAnomalyOnClient(true); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 3; return true; case 3: <>1__state = -1; shockedByPlayer.DamagePlayer(15, true, true, (CauseOfDeath)11, 0, false, default(Vector3)); if (!<>4__this.mainScript.trapCollider.enabled) { <>4__this.mainScript.DoOnCancelReleaseTrapServerRpc(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private BearTrap mainScript; private void Start() { mainScript = ((Component)this).GetComponent(); } bool IShockableWithGun.CanBeShocked() { return true; } float IShockableWithGun.GetDifficultyMultiplier() { return 0f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) return ((Component)mainScript).transform.position + new Vector3(0f, 0.5f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown CRPlugin.SpamLog("Shock bear trap", CRPlugin.spamType.message); if (!((Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; ((MonoBehaviour)this).StartCoroutine(WhyDoYouWantToChargeIt(zapgun, shockedByPlayer)); } } void IShockableWithGun.StopShockingWithGun() { CRPlugin.SpamLog("Stop zaping bear trap!", CRPlugin.spamType.debug); } [IteratorStateMachine(typeof(d__9))] private IEnumerator WhyDoYouWantToChargeIt(PatcherTool zapgun, PlayerControllerB shockedByPlayer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this, zapgun = zapgun, shockedByPlayer = shockedByPlayer }; } } internal class FlashShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public FlashShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_0069; case 1: <>1__state = -1; goto IL_0069; case 2: { <>1__state = -1; zapgun.StopShockingAnomalyOnClient(true); return false; } IL_0069: if (<>4__this.mainScript.flashCooldown < <>4__this.maxCooldown) { FlashTurret mainScript = <>4__this.mainScript; mainScript.flashCooldown += Time.deltaTime; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; } if (<>4__this.maxCooldown > <>4__this.mainScript.flashCooldown) { <>4__this.mainScript.flashCooldown = <>4__this.maxCooldown; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private FlashTurret mainScript; private float initialCooldown; private float maxCooldown; private Coroutine coroutine; private bool isStunnedByLocalClient; private void Start() { mainScript = ((Component)this).GetComponent(); initialCooldown = mainScript.flashCooldown; maxCooldown = 60f; } bool IShockableWithGun.CanBeShocked() { return mainScript.flashCooldown < maxCooldown && coroutine == null; } float IShockableWithGun.GetDifficultyMultiplier() { return 1.5f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) return ((Component)mainScript).transform.position + new Vector3(0f, 2f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown CRPlugin.SpamLog("Shock flash turret", CRPlugin.spamType.message); PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; coroutine = ((MonoBehaviour)this).StartCoroutine(IncreseCooldown(zapgun)); FlashTurret obj = mainScript; obj.detectionRange *= 5f; FlashTurret obj2 = mainScript; obj2.rotationSpeed /= 5f; isStunnedByLocalClient = (Object)(object)shockedByPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController; } void IShockableWithGun.StopShockingWithGun() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) CRPlugin.SpamLog("Stop zaping flash turret!", CRPlugin.spamType.debug); ((MonoBehaviour)this).StopCoroutine(coroutine); coroutine = null; FlashTurret obj = mainScript; obj.detectionRange /= 5f; FlashTurret obj2 = mainScript; obj2.rotationSpeed *= 5f; if (isStunnedByLocalClient) { NetworkBehaviourReference flashRef = default(NetworkBehaviourReference); ((NetworkBehaviourReference)(ref flashRef))..ctor((NetworkBehaviour)(object)mainScript); CodeRebirthGameNetworkManagerPatch.rebirthNetwork.SyncFlashCooldownServerRpc(flashRef); isStunnedByLocalClient = false; } } [IteratorStateMachine(typeof(d__13))] private IEnumerator IncreseCooldown(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this, zapgun = zapgun }; } } internal class IndustrialFanShockableScript : MonoBehaviour, IShockableWithGun { private IndustrialFan mainScript; private Animator animator; private float defaultSuckForce; private float defaultPushForce; private float defaultRotationSpeed; private bool isShockedByAnotherClient; private void Start() { animator = ((Component)this).GetComponent(); mainScript = ((Component)this).GetComponent(); defaultSuckForce = mainScript.suctionForce; defaultPushForce = mainScript.pushForce; defaultRotationSpeed = mainScript.rotationSpeed; } bool IShockableWithGun.CanBeShocked() { return !isShockedByAnotherClient; } float IShockableWithGun.GetDifficultyMultiplier() { return 0.9f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position + new Vector3(0f, 1f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { CRPlugin.SpamLog("Shock fan", CRPlugin.spamType.message); if ((Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController) { isShockedByAnotherClient = true; } mainScript.cutAudioSource.Pause(); mainScript.rotationSpeed = 0f; mainScript.pushForce = 0f; mainScript.suctionForce = 0f; ((Behaviour)animator).enabled = false; } void IShockableWithGun.StopShockingWithGun() { CRPlugin.SpamLog("Stop zaping fan!", CRPlugin.spamType.debug); isShockedByAnotherClient = false; mainScript.cutAudioSource.UnPause(); mainScript.rotationSpeed = defaultRotationSpeed; mainScript.pushForce = defaultPushForce; mainScript.suctionForce = defaultSuckForce; ((Behaviour)animator).enabled = true; } } internal class LaserShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__10 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public LaserShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (((GrabbableObject)zapgun).isBeingUsed && zapgun.shockedTargetScript == <>4__this) { <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } break; case 2: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 3; return true; case 3: <>1__state = -1; zapgun.StopShockingAnomalyOnClient(false); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 4; return true; case 4: <>1__state = -1; Landmine.SpawnExplosion(((Component)<>4__this.mainScript).transform.position + new Vector3(0f, 0.5f, 0f), true, 2f, 6f, 20, 5f, (GameObject)null, false); <>4__this.mainScript.impactAudioSource.Stop(); ((Component)((Component)<>4__this.mainScript).transform.Find("LaserIdleAudioSource")).gameObject.SetActive(false); ((Component)((Component)<>4__this.mainScript).transform.Find("LaserTrapArmature")).gameObject.SetActive(false); ((Component)((Component)<>4__this.mainScript).transform.Find("Light (4)")).gameObject.SetActive(false); ((Behaviour)<>4__this.mainScript).enabled = false; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private LaserTurret mainScript; private bool isExploded; private void Start() { mainScript = ((Component)this).GetComponent(); } bool IShockableWithGun.CanBeShocked() { return !isExploded; } float IShockableWithGun.GetDifficultyMultiplier() { return 0f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) return ((Component)mainScript).transform.position + new Vector3(0f, 0.5f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown CRPlugin.SpamLog("Shock laser", CRPlugin.spamType.message); PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; isExploded = true; ((MonoBehaviour)this).StartCoroutine(Explode(zapgun)); } void IShockableWithGun.StopShockingWithGun() { CRPlugin.SpamLog("Stop zaping lazer!", CRPlugin.spamType.debug); } [IteratorStateMachine(typeof(d__10))] private IEnumerator Explode(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this, zapgun = zapgun }; } } internal class MicrowaveShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public MicrowaveShockableScript <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this.mainScript.animator.GetBool("isActivated")) { <>4__this.mainScript.microwaveClosingTimer = 0f; } else { <>4__this.mainScript.microwaveOpeningTimer = 0f; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; case 2: <>1__state = -1; <>4__this.mainScript.microwaveClosingTimer = <>4__this.microwaveClosingTimer; <>4__this.mainScript.microwaveOpeningTimer = <>4__this.microwaveOpeningTimer; ((GrabbableObject)zapgun).insertedBattery.charge = Mathf.Clamp(((GrabbableObject)zapgun).insertedBattery.charge - 0.15f, 0f, 1f); zapgun.StopShockingAnomalyOnClient(true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private FunctionalMicrowave mainScript; private float microwaveOpeningTimer; private float microwaveClosingTimer; private bool isShockedByAnotherClient; private void Start() { mainScript = ((Component)this).GetComponent(); microwaveClosingTimer = mainScript.microwaveClosingTimer; microwaveOpeningTimer = mainScript.microwaveOpeningTimer; } bool IShockableWithGun.CanBeShocked() { return !isShockedByAnotherClient; } float IShockableWithGun.GetDifficultyMultiplier() { return 0f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return ((Component)mainScript).transform.position; } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown CRPlugin.SpamLog("Shock microwave", CRPlugin.spamType.message); if ((Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController) { isShockedByAnotherClient = true; } PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; ((MonoBehaviour)this).StartCoroutine(ToggleMicrowave(zapgun)); } void IShockableWithGun.StopShockingWithGun() { CRPlugin.SpamLog("Stop zaping microwave!", CRPlugin.spamType.debug); } [IteratorStateMachine(typeof(d__12))] private IEnumerator ToggleMicrowave(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, zapgun = zapgun }; } } internal class TeslaShockableScript : MonoBehaviour, IShockableWithGun { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PatcherTool zapgun; public TeslaShockableScript <>4__this; private NetworkBehaviourReference 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; goto IL_00d5; case 1: <>1__state = -1; goto IL_00d5; case 2: { <>1__state = -1; Landmine.SpawnExplosion(((Component)zapgun).transform.position, true, 2f, 4f, 30, 0f, (GameObject)null, false); return false; } IL_00d5: if (((GrabbableObject)zapgun).insertedBattery.charge > 0f) { <>4__this.charge += Time.deltaTime / 22f; if (<>4__this.charge >= <>4__this.chargeNeeded) { 5__1 = new NetworkBehaviourReference((NetworkBehaviour)(object)<>4__this.mainScript); CodeRebirthGameNetworkManagerPatch.rebirthNetwork.SyncTeslaServerRpc(<>4__this.charge, 5__1); zapgun.StopShockingAnomalyOnClient(false); } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private TeslaShock mainScript; private Coroutine coroutine; internal float chargeNeeded; internal float charge; private void Start() { mainScript = ((Component)this).GetComponent(); chargeNeeded = 0.4f; } bool IShockableWithGun.CanBeShocked() { return ((Behaviour)mainScript).enabled; } float IShockableWithGun.GetDifficultyMultiplier() { return 0.8f; } NetworkObject IShockableWithGun.GetNetworkObject() { return ((NetworkBehaviour)mainScript).NetworkObject; } Vector3 IShockableWithGun.GetShockablePosition() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) return ((Component)mainScript).transform.position + new Vector3(0f, 2f, 0f); } Transform IShockableWithGun.GetShockableTransform() { return ((Component)mainScript).transform; } void IShockableWithGun.ShockWithGun(PlayerControllerB shockedByPlayer) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown CRPlugin.SpamLog("Shock tesla", CRPlugin.spamType.message); if ((Object)(object)shockedByPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer; coroutine = ((MonoBehaviour)this).StartCoroutine(DrainChargeAndExplode(zapgun)); } } void IShockableWithGun.StopShockingWithGun() { CRPlugin.SpamLog("Stop zaping tesla!", CRPlugin.spamType.debug); if (coroutine != null) { ((MonoBehaviour)this).StopCoroutine(coroutine); coroutine = null; } } [IteratorStateMachine(typeof(d__12))] private IEnumerator DrainChargeAndExplode(PatcherTool zapgun) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this, zapgun = zapgun }; } internal void DisableMainScriptOnLocalClient() { mainScript.teslaIdleAudioSource.Stop(); mainScript.teslaAudioSource.Stop(); mainScript.vfx.Stop(); ((Behaviour)mainScript).enabled = false; ((Component)((Component)mainScript).transform.Find("vg_PlasmaSphere")).gameObject.SetActive(false); } } } namespace UsefulZapGun.Compatibility.CodeRebirth.Patches { internal class CodeRebirthGameNetworkManagerPatch { internal static GameObject netHandler; internal static CodeRebirthNetwork rebirthNetwork; internal static GameObject hostNetHandler; [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Start")] public static void SpawnNetworkHandler() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { GameObject val = Object.Instantiate(netHandler); val.GetComponent().Spawn(false); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Start")] public static void FindNetworkHandler() { rebirthNetwork = Object.FindAnyObjectByType(); CRPlugin.SpamLog("rebirthNerwork found", CRPlugin.spamType.debug); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyAfter(new string[] { "mborsh.UsefulZapGun" })] private static void AddPrefabsToNetwork() { netHandler = Plugin.mainAssetBundle.LoadAsset("CRUsefulZapGunNO.prefab"); netHandler.AddComponent(); NetworkManager.Singleton.AddNetworkPrefab(netHandler); } } internal class CodeRebirthMapHazardsPatch { [HarmonyPostfix] [HarmonyPatch(typeof(AirControlUnit), "Start")] private static void ACUStartPatch(ref AirControlUnit __instance) { if (CRConfig.enableACUZap.Value) { ((Component)((Component)__instance).transform.Find("Body")).gameObject.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch(typeof(BearTrap), "Start")] private static void BearTrapStartPatch(ref BearTrap __instance) { if (CRConfig.enableBearTrapZap.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch(typeof(FlashTurret), "Start")] private static void FlashStartPatch(ref FlashTurret __instance) { if (CRConfig.enableFlashZap.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch(typeof(IndustrialFan), "Start")] private static void FanStartPatch(ref IndustrialFan __instance) { if (CRConfig.enableFanZap.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPrefix] [HarmonyPatch(typeof(IndustrialFan), "OnTriggerEnter")] private static bool FanOnTriggerEnterPatch(ref IndustrialFan __instance) { return __instance.suctionForce != 0f; } [HarmonyPostfix] [HarmonyPatch(typeof(LaserTurret), "Start")] private static void LaserStartPatch(ref LaserTurret __instance) { if (CRConfig.enableLaserZap.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch(typeof(FunctionalMicrowave), "Start")] private static void MicrowaveStartPatch(ref FunctionalMicrowave __instance) { if (CRConfig.enableMicrowaveZap.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPostfix] [HarmonyPatch(typeof(TeslaShock), "Start")] private static void TeslaStartPatch(ref TeslaShock __instance) { if (CRConfig.enableTeslaZap.Value) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPrefix] [HarmonyPatch(typeof(TeslaShock), "OnTriggerEnter")] private static bool TeslaOnTriggerEnterPatch(ref TeslaShock __instance) { return ((Behaviour)__instance).enabled; } } } namespace UsefulZapGun.Compatibility.CodeRebirth.Network { internal class CodeRebirthNetwork : NetworkBehaviour { [ServerRpc(RequireOwnership = false)] internal void SyncACURangeServerRpc(NetworkBehaviourReference ACURef, bool disable = 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_0119: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3185104038u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref ACURef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref disable, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3185104038u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; AirControlUnit val3 = default(AirControlUnit); ((NetworkBehaviourReference)(ref ACURef)).TryGet(ref val3, (NetworkManager)null); if (disable) { val3.detectionRange = 0f; } SyncACURangeClientRpc(ACURef, val3.detectionRange); } } [ClientRpc] private void SyncACURangeClientRpc(NetworkBehaviourReference ACURef, float range) { //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) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4072061886u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref ACURef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref range, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4072061886u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; AirControlUnit val3 = default(AirControlUnit); ((NetworkBehaviourReference)(ref ACURef)).TryGet(ref val3, (NetworkManager)null); CRPlugin.SpamLog($"Sync ACU range: {val3.detectionRange} -> {range}", CRPlugin.spamType.info); val3.detectionRange = range; } } } [ServerRpc(RequireOwnership = false)] internal void SyncFlashCooldownServerRpc(NetworkBehaviourReference FlashRef, bool disable = 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_0119: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(248246971u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref FlashRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref disable, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 248246971u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; FlashTurret val3 = default(FlashTurret); ((NetworkBehaviourReference)(ref FlashRef)).TryGet(ref val3, (NetworkManager)null); if (disable) { val3.flashCooldown = 60f; } SyncFlashCooldownClientRpc(FlashRef, val3.flashCooldown); } } [ClientRpc] private void SyncFlashCooldownClientRpc(NetworkBehaviourReference FlashRef, float cooldown) { //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) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3617916993u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref FlashRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref cooldown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3617916993u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; FlashTurret val3 = default(FlashTurret); ((NetworkBehaviourReference)(ref FlashRef)).TryGet(ref val3, (NetworkManager)null); CRPlugin.SpamLog($"Sync FlashTurret CD: {val3.flashCooldown} -> {cooldown}", CRPlugin.spamType.info); val3.flashCooldown = cooldown; } } } [ServerRpc(RequireOwnership = false)] internal void SyncTeslaServerRpc(float charge, NetworkBehaviourReference TeslaRef) { //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_0125: 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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2153772629u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref charge, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref TeslaRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2153772629u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TeslaShock val3 = default(TeslaShock); ((NetworkBehaviourReference)(ref TeslaRef)).TryGet(ref val3, (NetworkManager)null); TeslaShockableScript component = ((Component)val3).GetComponent(); bool enabled = true; if (charge >= component.chargeNeeded) { enabled = false; } SyncTeslaClientRpc(charge, TeslaRef, enabled); } } [ClientRpc] private void SyncTeslaClientRpc(float charge, NetworkBehaviourReference TeslaRef, bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) 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(3625816464u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref charge, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref TeslaRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3625816464u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TeslaShock val3 = default(TeslaShock); ((NetworkBehaviourReference)(ref TeslaRef)).TryGet(ref val3, (NetworkManager)null); TeslaShockableScript component = ((Component)val3).GetComponent(); if (!enabled) { component.DisableMainScriptOnLocalClient(); } else { component.charge = charge; } } } 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 //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 references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3185104038u, new RpcReceiveHandler(__rpc_handler_3185104038), "SyncACURangeServerRpc"); ((NetworkBehaviour)this).__registerRpc(4072061886u, new RpcReceiveHandler(__rpc_handler_4072061886), "SyncACURangeClientRpc"); ((NetworkBehaviour)this).__registerRpc(248246971u, new RpcReceiveHandler(__rpc_handler_248246971), "SyncFlashCooldownServerRpc"); ((NetworkBehaviour)this).__registerRpc(3617916993u, new RpcReceiveHandler(__rpc_handler_3617916993), "SyncFlashCooldownClientRpc"); ((NetworkBehaviour)this).__registerRpc(2153772629u, new RpcReceiveHandler(__rpc_handler_2153772629), "SyncTeslaServerRpc"); ((NetworkBehaviour)this).__registerRpc(3625816464u, new RpcReceiveHandler(__rpc_handler_3625816464), "SyncTeslaClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3185104038(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_004a: 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_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference aCURef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref aCURef, default(ForNetworkSerializable)); bool disable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref disable, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthNetwork)(object)target).SyncACURangeServerRpc(aCURef, disable); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4072061886(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_004a: 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_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference aCURef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref aCURef, default(ForNetworkSerializable)); float range = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref range, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthNetwork)(object)target).SyncACURangeClientRpc(aCURef, range); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_248246971(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_004a: 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_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference flashRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashRef, default(ForNetworkSerializable)); bool disable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref disable, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthNetwork)(object)target).SyncFlashCooldownServerRpc(flashRef, disable); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3617916993(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_004a: 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_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference flashRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flashRef, default(ForNetworkSerializable)); float cooldown = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref cooldown, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthNetwork)(object)target).SyncFlashCooldownClientRpc(flashRef, cooldown); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2153772629(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_004a: 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_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float charge = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref charge, default(ForPrimitives)); NetworkBehaviourReference teslaRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref teslaRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthNetwork)(object)target).SyncTeslaServerRpc(charge, teslaRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3625816464(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_004a: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float charge = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref charge, default(ForPrimitives)); NetworkBehaviourReference teslaRef = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref teslaRef, default(ForNetworkSerializable)); bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CodeRebirthNetwork)(object)target).SyncTeslaClientRpc(charge, teslaRef, enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "CodeRebirthNetwork"; } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace UZGCodeRebirthCompat.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }