Decompiled source of Useful Zap Gun v0.6.0

UsefulZapGun.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UsefulZapGun.Methods;
using UsefulZapGun.NetcodePatcher;
using UsefulZapGun.Network;
using UsefulZapGun.Patches;
using UsefulZapGun.Patches.Enemy;
using UsefulZapGun.Patches.Items;
using UsefulZapGun.Scripts.Hazards;
using UsefulZapGun.Scripts.Items;

[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("UsefulZapGun")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+085d5e4e38fb1f77575eb33d24979a5af097bd22")]
[assembly: AssemblyProduct("UsefulZapGun")]
[assembly: AssemblyTitle("UsefulZapGun")]
[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;
		}
	}
}
namespace UsefulZapGun
{
	public class UZGConfig
	{
		private static ConfigFile cfg;

		public static ConfigEntry<bool> enableLogging;

		public static ConfigEntry<int> zapgunPrice;

		public static ConfigEntry<bool> enableDifficultyMultiplierPatch;

		public static ConfigEntry<float> distanceDivider;

		public static ConfigEntry<string> enemyListString;

		public static Dictionary<Item, ConfigEntry<float>> multiplayerDict = new Dictionary<Item, ConfigEntry<float>>();

		public static List<string> enemyList;

		public static Dictionary<EnemyType, ConfigEntry<float>> timeDict = new Dictionary<EnemyType, ConfigEntry<float>>();

		public static ConfigEntry<bool> enableExplosion;

		public static ConfigEntry<bool> setForestGiantsOnFire;

		public static ConfigEntry<float> timeToStartAFire;

		public static ConfigEntry<bool> evaporateBlob;

		public static ConfigEntry<float> timeToEvaporate;

		public static ConfigEntry<bool> enableDOTEnemy;

		public static ConfigEntry<bool> enableDOTPlayers;

		public static ConfigEntry<int> zapDamage;

		public static ConfigEntry<int> zapDamageToPlayer;

		public static ConfigEntry<float> zapTimeToDamage;

		public static ConfigEntry<bool> enableItemCharging;

		public static ConfigEntry<float> chargeLifeTime;

		public static ConfigEntry<bool> enableWeaponCharging;

		public static ConfigEntry<float> needForShovelCharge;

		public static ConfigEntry<bool> enableZapHazards;

		public static ConfigEntry<float> timeNeedForTurretDisable;

		public static ConfigEntry<int> spiketrapZapNeeded;

		internal static void ConfigSetup(ConfigFile PluginConfig)
		{
			cfg = PluginConfig;
			enableLogging = cfg.Bind<bool>("General", "Enable logging", true, (ConfigDescription)null);
			zapgunPrice = cfg.Bind<int>("General", "Zap gun price", 400, (ConfigDescription)null);
			enableDifficultyMultiplierPatch = cfg.Bind<bool>("General", "Enable Difficulty Multiplier Patch", true, "Formula: result = vanilaValue * Distance(localPlayer, enemy)/distanceDivider");
			distanceDivider = cfg.Bind<float>("General", "Distance Divider", 5f, (ConfigDescription)null);
			setForestGiantsOnFire = cfg.Bind<bool>("Enemies", "Set forest giants on fire", true, (ConfigDescription)null);
			timeToStartAFire = cfg.Bind<float>("Enemies", "Time to start a fire", 3f, (ConfigDescription)null);
			evaporateBlob = cfg.Bind<bool>("Enemies", "Evaporate blob", true, (ConfigDescription)null);
			enemyListString = cfg.Bind<string>("Enemies", "Enemy list", "Red Locust Bees,Butler Bees", (ConfigDescription)null);
			enableExplosion = cfg.Bind<bool>("Enemies", "Enable enemy explosion", true, (ConfigDescription)null);
			enableDOTEnemy = cfg.Bind<bool>("DOT", "Damage enemy with zap", false, (ConfigDescription)null);
			enableDOTPlayers = cfg.Bind<bool>("DOT", "Damage players with zap", false, (ConfigDescription)null);
			zapDamage = cfg.Bind<int>("DOT", "Zapgun damage to enemy", 1, (ConfigDescription)null);
			zapDamageToPlayer = cfg.Bind<int>("DOT", "Zapgun damage to player", 10, (ConfigDescription)null);
			zapTimeToDamage = cfg.Bind<float>("DOT", "Time to damage (seconds)", 1f, (ConfigDescription)null);
			enemyList = enemyListString.Value.Split(',').ToList();
			enableItemCharging = cfg.Bind<bool>("Items", "Enable equipment charging", true, "Charging ratio: chargeMultiplier * (Time.deltaTime / item.itemProperties.batteryUsage)");
			enableWeaponCharging = cfg.Bind<bool>("Weapon", "Enable weapon charging", true, "x2 damage for charged weapon (shovel, stop sign, mace (code rebirth), etc.");
			chargeLifeTime = cfg.Bind<float>("Weapon", "Time until charge runs out", 15f, (ConfigDescription)null);
			needForShovelCharge = cfg.Bind<float>("Weapon", "Zap gun charge% for charged state", 33f, (ConfigDescription)null);
			enableZapHazards = cfg.Bind<bool>("Hazards", "Enable hazard zap", true, (ConfigDescription)null);
			timeNeedForTurretDisable = cfg.Bind<float>("Hazards", "Time need for turret", 3f, (ConfigDescription)null);
			spiketrapZapNeeded = cfg.Bind<int>("Hazards", "Zaps before deactivating the spiketrap", 2, (ConfigDescription)null);
			CheckConfig();
		}

		private static void CheckConfig()
		{
			enemyList.Remove("Bruce");
			if (zapDamage.Value <= 0)
			{
				zapDamage.Value = 1;
			}
		}

		internal static void CreateAndCheckConfigEntryForItem(Item item, float multiplayer)
		{
			ConfigEntry<float> value = cfg.Bind<float>("Items", item.itemName + ": charge multiplayer", multiplayer, (ConfigDescription)null);
			multiplayerDict.TryAdd(item, value);
		}

		internal static void CreateAndCheckConfigEntryForEnemy(EnemyType enemy, float time)
		{
			ConfigEntry<float> val = cfg.Bind<float>("Enemies", enemy.enemyName + ": time needed for explosion", time, (ConfigDescription)null);
			if (val.Value <= 0f)
			{
				val.Value = 1f;
			}
			timeDict.TryAdd(enemy, val);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("mborsh.UsefulZapGun", "UsefulZapGun", "0.6.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal enum spamType
		{
			info,
			message,
			warning,
			debug,
			error,
			fatal
		}

		private const string modGUID = "mborsh.UsefulZapGun";

		private const string modName = "UsefulZapGun";

		private const string modVersion = "0.6.0";

		private readonly Harmony harmony = new Harmony("mborsh.UsefulZapGun");

		private static ManualLogSource mls;

		private static Plugin Instance;

		internal static bool enemiesAndItemsFound;

		private static string sAssemblyLocation;

		public static AssetBundle mainAssetBundle;

		private static ConfigFile cfg;

		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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			NetcodePatcher();
			Instance = this;
			mls = Logger.CreateLogSource("UsefulZapGun");
			mls = ((BaseUnityPlugin)this).Logger;
			sAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "zapgunnetworkobject"));
			cfg = new ConfigFile(Path.Combine(Paths.ConfigPath, "mborsh.UsefulZapGun.cfg"), true);
			UZGConfig.ConfigSetup(cfg);
			mls.LogInfo((object)"UsefulZapGun 0.6.0 loaded. Patching.");
			PatchAllStuff();
		}

		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;
				}
			}
		}

		private void PatchAllStuff()
		{
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(MenuManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(TerminalPatch));
			harmony.PatchAll(typeof(EnemyAICollisionDetectPatch));
			harmony.PatchAll(typeof(EnemyAIPatch));
			harmony.PatchAll(typeof(PatcherToolPatch));
			if (UZGConfig.enableZapHazards.Value)
			{
				harmony.PatchAll(typeof(MapHazardsPatch));
			}
			if (UZGConfig.enableWeaponCharging.Value)
			{
				harmony.PatchAll(typeof(ShovelPatch));
			}
			if (UZGConfig.enableItemCharging.Value)
			{
				harmony.PatchAll(typeof(GrabbableObjectPatch));
			}
		}
	}
}
namespace UsefulZapGun.Scripts.Items
{
	internal class ConductiveShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <WaitFrameAndDamage>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public PlayerControllerB shockedByPlayer;

			public ConductiveShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <WaitFrameAndDamage>d__8(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));
					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 GrabbableObject itemScript;

		private void Start()
		{
			itemScript = ((Component)this).GetComponent<GrabbableObject>();
		}

		public bool CanBeShocked()
		{
			return (Object)(object)itemScript.playerHeldBy == (Object)null;
		}

		public float GetDifficultyMultiplier()
		{
			return 0f;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)itemScript).NetworkObject;
		}

		public Vector3 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)itemScript).transform.position + new Vector3(0f, 0.2f, 0f);
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			Plugin.SpamLog("Shock conductive item (" + itemScript.itemProperties.itemName + ")", Plugin.spamType.message);
			if (!((Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				itemScript.grabbable = false;
				PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer;
				((MonoBehaviour)this).StartCoroutine(WaitFrameAndDamage(zapgun, shockedByPlayer));
			}
		}

		[IteratorStateMachine(typeof(<WaitFrameAndDamage>d__8))]
		private IEnumerator WaitFrameAndDamage(PatcherTool zapgun, PlayerControllerB shockedByPlayer)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitFrameAndDamage>d__8(0)
			{
				<>4__this = this,
				zapgun = zapgun,
				shockedByPlayer = shockedByPlayer
			};
		}

		public void StopShockingWithGun()
		{
			itemScript.grabbable = true;
		}
	}
	internal class EquipmentShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <ChargeItem>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public GrabbableObject item;

			public EquipmentShockableScript <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (item.insertedBattery.empty)
					{
						item.insertedBattery.empty = false;
					}
					break;
				case 1:
				{
					<>1__state = -1;
					Battery insertedBattery = item.insertedBattery;
					insertedBattery.charge += <>4__this.chargeMultiplier * (Time.deltaTime / item.itemProperties.batteryUsage);
					break;
				}
				}
				if (item.insertedBattery.charge < 1f)
				{
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				}
				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 GrabbableObject itemScript;

		private float chargeMultiplier;

		private Coroutine chargeCoroutine;

		private void Start()
		{
			itemScript = ((Component)this).GetComponent<GrabbableObject>();
			string itemName = itemScript.itemProperties.itemName;
			chargeMultiplier = UZGConfig.multiplayerDict[itemScript.itemProperties].Value;
		}

		public bool CanBeShocked()
		{
			return itemScript.insertedBattery.charge < 1f && (Object)(object)itemScript.playerHeldBy == (Object)null;
		}

		public float GetDifficultyMultiplier()
		{
			return 0.3f;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)itemScript).NetworkObject;
		}

		public Vector3 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)itemScript).transform.position + new Vector3(0f, 0.2f, 0f);
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			Plugin.SpamLog("Shock item with battery (" + itemScript.itemProperties.itemName + ")", Plugin.spamType.message);
			itemScript.grabbable = false;
			PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer;
			chargeCoroutine = ((MonoBehaviour)this).StartCoroutine(ChargeItem(zapgun, itemScript));
		}

		public void StopShockingWithGun()
		{
			((MonoBehaviour)this).StopCoroutine(chargeCoroutine);
			itemScript.grabbable = true;
			Plugin.SpamLog($"charge = {itemScript.insertedBattery.charge}", Plugin.spamType.debug);
			itemScript.SyncBatteryServerRpc((int)(itemScript.insertedBattery.charge * 100f));
		}

		[IteratorStateMachine(typeof(<ChargeItem>d__11))]
		private IEnumerator ChargeItem(PatcherTool zapgun, GrabbableObject item)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ChargeItem>d__11(0)
			{
				<>4__this = this,
				zapgun = zapgun,
				item = item
			};
		}
	}
	internal class WeaponShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <ChargeWeapon>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public WeaponShockableScript <>4__this;

			private float <chargeNeeded>5__1;

			private NetworkObjectReference <shovelNORef>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected O, but got Unknown
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<chargeNeeded>5__1 = ((GrabbableObject)zapgun).insertedBattery.charge - <>4__this.batteryChargeNeedUntilChargedState;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (((GrabbableObject)zapgun).insertedBattery.charge > 0f && ((GrabbableObject)zapgun).insertedBattery.charge >= <chargeNeeded>5__1)
				{
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				}
				<shovelNORef>5__2 = new NetworkObjectReference(<>4__this.GetNetworkObject());
				GameNetworkManagerPatch.hostNetHandler.SyncShovelDamageServerRpc(<shovelNORef>5__2);
				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();
			}
		}

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

			private object <>2__current;

			public PatcherTool zapgun;

			public PlayerControllerB shockedByPlayer;

			public WeaponShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <WaitFrameAndDamage>d__12(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));
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public float seconds;

			public WeaponShockableScript <>4__this;

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

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

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

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

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

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

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

		private Shovel itemScript;

		private bool charged;

		private Coroutine chargeCoroutine;

		private float batteryChargeNeedUntilChargedState;

		private void Start()
		{
			itemScript = ((Component)this).GetComponent<Shovel>();
			charged = false;
			batteryChargeNeedUntilChargedState = UZGConfig.needForShovelCharge.Value / 100f;
		}

		public bool CanBeShocked()
		{
			return (Object)(object)((GrabbableObject)itemScript).playerHeldBy == (Object)null && !charged;
		}

		public float GetDifficultyMultiplier()
		{
			return 0.3f;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)itemScript).NetworkObject;
		}

		public Vector3 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)itemScript).transform.position + new Vector3(0f, 0.2f, 0f);
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			Plugin.SpamLog("Shock weapon (" + ((GrabbableObject)itemScript).itemProperties.itemName + ")", Plugin.spamType.message);
			PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer;
			if (charged)
			{
				WaitFrameAndDamage(zapgun, shockedByPlayer);
				return;
			}
			chargeCoroutine = ((MonoBehaviour)this).StartCoroutine(ChargeWeapon(zapgun));
			((GrabbableObject)itemScript).grabbable = false;
		}

		public void StopShockingWithGun()
		{
			if (chargeCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(chargeCoroutine);
			}
			((GrabbableObject)itemScript).grabbable = true;
		}

		[IteratorStateMachine(typeof(<WaitFrameAndDamage>d__12))]
		private IEnumerator WaitFrameAndDamage(PatcherTool zapgun, PlayerControllerB shockedByPlayer)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitFrameAndDamage>d__12(0)
			{
				<>4__this = this,
				zapgun = zapgun,
				shockedByPlayer = shockedByPlayer
			};
		}

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

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

		internal void SyncDamageOnLocalClient(float seconds = 0f)
		{
			charged = true;
			Shovel obj = itemScript;
			obj.shovelHitForce *= 2;
			((MonoBehaviour)this).StartCoroutine(WaitUntilChargeRunsOut(seconds));
		}
	}
}
namespace UsefulZapGun.Scripts.Hazards
{
	internal class LandmineShockableScript : MonoBehaviour, IShockableWithGun
	{
		private Landmine mineScript;

		private bool isShocked;

		private void Start()
		{
			mineScript = ((Component)this).GetComponent<Landmine>();
		}

		public bool CanBeShocked()
		{
			return !mineScript.hasExploded && !isShocked;
		}

		public float GetDifficultyMultiplier()
		{
			return 0f;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)mineScript).NetworkObject;
		}

		public Vector3 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)mineScript).transform.position + new Vector3(0f, 0.5f, 0f);
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			Plugin.SpamLog("Shock landmine", Plugin.spamType.message);
			isShocked = (Object)(object)shockedByPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController;
		}

		public void StopShockingWithGun()
		{
			mineScript.ExplodeMineServerRpc();
		}
	}
	internal class SpiketrapShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <WaitAndStopShocking>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public SpiketrapShockableScript <>4__this;

			private NetworkObjectReference <NORef>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: 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 WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (zapgun.shockedTargetScript == <>4__this && ((GrabbableObject)zapgun).isBeingUsed && <>4__this.localPlayer)
					{
						<NORef>5__1 = new NetworkObjectReference(<>4__this.GetNetworkObject());
						GameNetworkManagerPatch.hostNetHandler.SyncZapCountServerRpc(<NORef>5__1, <>4__this.zapCount + 1);
						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();
			}
		}

		internal int zapCount;

		private SpikeRoofTrap spikeScript;

		private Coroutine coroutine;

		private bool localPlayer;

		private void Start()
		{
			zapCount = 0;
			spikeScript = ((Component)((Component)this).transform.parent.Find("Trigger")).GetComponent<SpikeRoofTrap>();
		}

		public bool CanBeShocked()
		{
			return spikeScript.trapActive && !localPlayer;
		}

		public float GetDifficultyMultiplier()
		{
			return 0.4f;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)spikeScript).NetworkObject;
		}

		public Vector3 GetShockablePosition()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position;
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			Plugin.SpamLog("Shock spiketrap", Plugin.spamType.message);
			PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer;
			coroutine = ((MonoBehaviour)this).StartCoroutine(WaitAndStopShocking(zapgun));
			localPlayer = (Object)(object)shockedByPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController;
		}

		public void StopShockingWithGun()
		{
			if (coroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(coroutine);
			}
			localPlayer = false;
		}

		internal void SyncCanShockOnLocalClient(bool sync)
		{
			spikeScript.trapActive = sync;
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = sync;
		}

		[IteratorStateMachine(typeof(<WaitAndStopShocking>d__13))]
		private IEnumerator WaitAndStopShocking(PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitAndStopShocking>d__13(0)
			{
				<>4__this = this,
				zapgun = zapgun
			};
		}
	}
	internal class TurretShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <BerserkAndDisable>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerControllerB player;

			public TurretShockableScript <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0040: 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_0072: Expected O, but got Unknown
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.turretScript.turretMode = (TurretMode)3;
					<>4__this.turretScript.EnterBerserkModeServerRpc((int)player.playerClientId);
					<>2__current = (object)new WaitForSeconds(10.4f);
					<>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.turretScript.turretMode = (TurretMode)0;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>4__this.turretScript.ToggleTurretServerRpc(false);
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public PatcherTool zapgun;

			public PlayerControllerB player;

			public TurretShockableScript <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(UZGConfig.timeNeedForTurretDisable.Value);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (zapgun.shockedTargetScript == <>4__this && ((GrabbableObject)zapgun).isBeingUsed)
					{
						((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.BerserkAndDisable(player));
					}
					return false;
				}
			}

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

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

		private Turret turretScript;

		private Coroutine coroutine;

		private void Start()
		{
			turretScript = ((Component)this).GetComponent<Turret>();
		}

		public bool CanBeShocked()
		{
			return turretScript.turretActive;
		}

		public float GetDifficultyMultiplier()
		{
			return 0.9f;
		}

		public NetworkObject GetNetworkObject()
		{
			return ((NetworkBehaviour)turretScript).NetworkObject;
		}

		public Vector3 GetShockablePosition()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position;
		}

		public Transform GetShockableTransform()
		{
			return ((Component)this).transform;
		}

		public void ShockWithGun(PlayerControllerB shockedByPlayer)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			Plugin.SpamLog("Shock turret", Plugin.spamType.message);
			PatcherTool zapgun = (PatcherTool)shockedByPlayer.currentlyHeldObjectServer;
			coroutine = ((MonoBehaviour)this).StartCoroutine(Wait(zapgun, shockedByPlayer));
		}

		public void StopShockingWithGun()
		{
			if (coroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(coroutine);
			}
		}

		[IteratorStateMachine(typeof(<Wait>d__10))]
		private IEnumerator Wait(PatcherTool zapgun, PlayerControllerB player)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Wait>d__10(0)
			{
				<>4__this = this,
				zapgun = zapgun,
				player = player
			};
		}

		[IteratorStateMachine(typeof(<BerserkAndDisable>d__11))]
		private IEnumerator BerserkAndDisable(PlayerControllerB player)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <BerserkAndDisable>d__11(0)
			{
				<>4__this = this,
				player = player
			};
		}
	}
}
namespace UsefulZapGun.Patches
{
	internal class GameNetworkManagerPatch
	{
		internal static GameObject netHandler;

		internal static UZGNetwork hostNetHandler;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		public static void SpawnNetworkHandler()
		{
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(netHandler);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		public static void FindNetworkHandler()
		{
			hostNetHandler = Object.FindAnyObjectByType<UZGNetwork>();
			Plugin.SpamLog("hostNetHandler found", Plugin.spamType.debug);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		private static void AddPrefabsToNetwork()
		{
			netHandler = Plugin.mainAssetBundle.LoadAsset<GameObject>("zapgunnetworkobject.prefab");
			netHandler.AddComponent<UZGNetwork>();
			NetworkManager.Singleton.AddNetworkPrefab(netHandler);
		}
	}
	internal class MapHazardsPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Turret), "Start")]
		private static void TurretStartPatch(ref Turret __instance)
		{
			((Component)__instance).gameObject.AddComponent<TurretShockableScript>();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Landmine), "Start")]
		private static void LandmineStartPatch(ref Landmine __instance)
		{
			((Component)__instance).gameObject.AddComponent<LandmineShockableScript>();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(SpikeRoofTrap), "Start")]
		private static void SpiketrapStartPatch(ref SpikeRoofTrap __instance)
		{
			GameObject gameObject = ((Component)__instance).gameObject;
			gameObject = ((Component)gameObject.transform.parent.Find("Spot Light")).gameObject;
			BoxCollider val = gameObject.AddComponent<BoxCollider>();
			((Collider)val).isTrigger = true;
			gameObject.AddComponent<SpiketrapShockableScript>();
			gameObject.layer = 21;
			((Component)gameObject.transform.parent).gameObject.layer = 21;
			((Component)gameObject.transform.parent.parent).gameObject.layer = 21;
			((Component)gameObject.transform.parent.parent.parent).gameObject.layer = 21;
		}
	}
	internal class MenuManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(MenuManager), "Start")]
		private static void FindAllEnemiesPatch()
		{
			if (Plugin.enemiesAndItemsFound)
			{
				return;
			}
			EnemyType[] array = Resources.FindObjectsOfTypeAll<EnemyType>();
			EnemyType[] array2 = array;
			foreach (EnemyType val in array2)
			{
				if (!string.IsNullOrEmpty(val.enemyName))
				{
					Plugin.SpamLog(val.enemyName + " has been found!", Plugin.spamType.message);
					if (UZGConfig.enemyList.Contains(val.enemyName))
					{
						UZGConfig.CreateAndCheckConfigEntryForEnemy(val, 3f);
						val.canBeStunned = true;
						val.canBeDestroyed = true;
						Plugin.SpamLog(val.enemyName + " can be stunned and destoyed now!", Plugin.spamType.info);
					}
				}
			}
			Plugin.SpamLog("---------------------------------------------------------", Plugin.spamType.message);
			if (UZGConfig.enableItemCharging.Value)
			{
				Item[] array3 = Resources.FindObjectsOfTypeAll<Item>();
				Item[] array4 = array3;
				foreach (Item val2 in array4)
				{
					if (val2.requiresBattery && !string.IsNullOrEmpty(val2.itemName))
					{
						UZGConfig.CreateAndCheckConfigEntryForItem(val2, val2.batteryUsage / 22f);
						Plugin.SpamLog(val2.itemName + " has been found!", Plugin.spamType.message);
					}
				}
			}
			Plugin.enemiesAndItemsFound = true;
		}
	}
	internal class PlayerControllerBPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "IShockableWithGun.ShockWithGun")]
		private static void ShockWithGunPatch(ref PlayerControllerB __instance, PlayerControllerB shockedByPlayer)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Plugin.SpamLog("Shock Player", Plugin.spamType.message);
			if (UZGConfig.enableDOTPlayers.Value)
			{
				NetworkBehaviourReference val = default(NetworkBehaviourReference);
				((NetworkBehaviourReference)(ref val))..ctor((NetworkBehaviour)(object)__instance);
				GameNetworkManagerPatch.hostNetHandler.DOTPlayerServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), (int)shockedByPlayer.playerClientId);
			}
		}
	}
	internal class TerminalPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Terminal), "Awake")]
		[HarmonyPriority(200)]
		private static void AwakePatch(ref Terminal __instance)
		{
			Item[] buyableItemsList = __instance.buyableItemsList;
			foreach (Item val in buyableItemsList)
			{
				if (val.itemName == "Zap gun")
				{
					val.creditsWorth = UZGConfig.zapgunPrice.Value;
					Plugin.SpamLog("Zap gun price: " + val.creditsWorth, Plugin.spamType.message);
					break;
				}
			}
		}
	}
}
namespace UsefulZapGun.Patches.Items
{
	internal class GrabbableObjectPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		private static void StartPatch(ref GrabbableObject __instance)
		{
			if (!(__instance is Shovel))
			{
				EquipmentShockableScript equipmentShockableScript = default(EquipmentShockableScript);
				ConductiveShockableScript conductiveShockableScript = default(ConductiveShockableScript);
				if (__instance.itemProperties.requiresBattery && !((Component)__instance).gameObject.TryGetComponent<EquipmentShockableScript>(ref equipmentShockableScript) && __instance.itemProperties.requiresBattery)
				{
					((Component)__instance).gameObject.AddComponent<EquipmentShockableScript>();
				}
				else if (!((Component)__instance).gameObject.TryGetComponent<ConductiveShockableScript>(ref conductiveShockableScript) && __instance.itemProperties.isConductiveMetal)
				{
					((Component)__instance).gameObject.AddComponent<ConductiveShockableScript>();
				}
			}
		}
	}
	internal class PatcherToolPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(PatcherTool), "BeginShockingAnomalyOnClient")]
		private static void AddZapGun(ref PatcherTool __instance)
		{
			ZapGunMethods.zapGuns.Add(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PatcherTool), "StopShockingAnomalyOnClient")]
		private static void RemoveZapGun(ref PatcherTool __instance)
		{
			if (!ZapGunMethods.zapGuns.Remove(__instance))
			{
				Plugin.SpamLog($"Couldn't remove the zap gun! networkObjectID: {((NetworkBehaviour)__instance).NetworkObjectId}", Plugin.spamType.warning);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PatcherTool), "Start")]
		private static void StartPatch(ref int ___anomalyMask)
		{
			___anomalyMask = 2621512;
		}
	}
	internal class ShovelPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		private static void StartPatch(ref GrabbableObject __instance)
		{
			WeaponShockableScript weaponShockableScript = default(WeaponShockableScript);
			if (__instance is Shovel && !((Component)__instance).gameObject.TryGetComponent<WeaponShockableScript>(ref weaponShockableScript))
			{
				((Component)__instance).gameObject.AddComponent<WeaponShockableScript>();
			}
		}
	}
}
namespace UsefulZapGun.Patches.Enemy
{
	internal class EnemyAICollisionDetectPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAICollisionDetect), "IShockableWithGun.ShockWithGun")]
		private static void ShockWithGunPatch(ref EnemyAICollisionDetect __instance, PlayerControllerB shockedByPlayer)
		{
			//IL_0082: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			Plugin.SpamLog("Shock Enemy", Plugin.spamType.message);
			if (UZGConfig.timeDict.ContainsKey(__instance.mainScript.enemyType) && UZGConfig.enableExplosion.Value)
			{
				ZapGunMethods.WaitAndExplode(__instance, __instance.mainScript, UZGConfig.timeDict[__instance.mainScript.enemyType].Value);
				return;
			}
			NetworkBehaviourReference enemyNBRef = default(NetworkBehaviourReference);
			((NetworkBehaviourReference)(ref enemyNBRef))..ctor((NetworkBehaviour)(object)__instance.mainScript);
			NetworkBehaviourReference playerWhoHitNBRef = default(NetworkBehaviourReference);
			((NetworkBehaviourReference)(ref playerWhoHitNBRef))..ctor((NetworkBehaviour)(object)shockedByPlayer);
			GameNetworkManagerPatch.hostNetHandler.DOTEnemyServerRpc(enemyNBRef, playerWhoHitNBRef);
			if (__instance.mainScript is ForestGiantAI && UZGConfig.setForestGiantsOnFire.Value && !UZGConfig.timeDict.ContainsKey(__instance.mainScript.enemyType))
			{
				ZapGunMethods.StartFire(__instance, (ForestGiantAI)__instance.mainScript);
			}
			else if (__instance.mainScript is BlobAI && UZGConfig.evaporateBlob.Value && !UZGConfig.timeDict.ContainsKey(__instance.mainScript.enemyType))
			{
				ZapGunMethods.StartEvaporation(__instance, (BlobAI)__instance.mainScript);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAICollisionDetect), "IShockableWithGun.GetDifficultyMultiplier")]
		private static void GetDifficultyMultiplierPatch(ref EnemyAICollisionDetect __instance, ref float __result)
		{
			//IL_0050: 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)
			if (UZGConfig.enableDifficultyMultiplierPatch.Value && UZGConfig.distanceDivider.Value != 0f)
			{
				Plugin.SpamLog("GetDifficultyMultilier before = " + __result, Plugin.spamType.debug);
				__result *= Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)__instance.mainScript).transform.position) / UZGConfig.distanceDivider.Value;
				Plugin.SpamLog("GetDifficultyMultilier after = " + __result, Plugin.spamType.debug);
			}
		}
	}
	internal class EnemyAIPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyAI), "KillEnemyServerRpc")]
		private static void KillEnemyServerRpcPatch(ref EnemyAI __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			foreach (PatcherTool zapGun in ZapGunMethods.zapGuns)
			{
				EnemyAICollisionDetect val = (EnemyAICollisionDetect)zapGun.shockedTargetScript;
				if (((GrabbableObject)zapGun).isBeingUsed && (Object)(object)val.mainScript == (Object)(object)__instance)
				{
					zapGun.StopShockingAnomalyOnClient(true);
				}
			}
		}
	}
}
namespace UsefulZapGun.Network
{
	internal class UZGNetwork : NetworkBehaviour
	{
		internal PatcherTool zapgun;

		[ServerRpc(RequireOwnership = false)]
		internal void BlowUpEnemyServerRpc(NetworkObjectReference enemyNORef)
		{
			//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)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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(2089966051u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyNORef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2089966051u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref enemyNORef)).TryGet(ref val3, (NetworkManager)null))
			{
				if (!UZGConfig.enemyList.Contains(((Component)val3).GetComponent<EnemyAI>().enemyType.enemyName))
				{
					Plugin.SpamLog("The client is trying to send an enemy that is not in the config!!!", Plugin.spamType.error);
				}
				else if (UZGConfig.enableExplosion.Value)
				{
					Vector3 position = ((Component)val3).gameObject.transform.position;
					EnemyAI component = ((Component)val3).gameObject.GetComponent<EnemyAI>();
					if (component.enemyType.canDie)
					{
						component.KillEnemyServerRpc(false);
					}
					else
					{
						component.KillEnemyServerRpc(true);
					}
					BlowUpEnemyClientRpc(position);
				}
			}
			else
			{
				Plugin.SpamLog("The client is trying to send a non-existent enemy!!!", Plugin.spamType.error);
			}
		}

		[ClientRpc]
		private void BlowUpEnemyClientRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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(1035235681u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1035235681u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(ZapGunMethods.ExplodeNextFrame(position));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void SyncShovelDamageServerRpc(NetworkObjectReference shovelNORef)
		{
			//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)
			//IL_011e: 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(3194388427u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref shovelNORef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3194388427u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref shovelNORef)).TryGet(ref val3, (NetworkManager)null))
			{
				if (!UZGConfig.enableWeaponCharging.Value)
				{
					Plugin.SpamLog("The client is trying to charge a weapon!!!", Plugin.spamType.error);
					return;
				}
				WeaponShockableScript component = ((Component)val3).gameObject.GetComponent<WeaponShockableScript>();
				SyncShovelDamageClientRpc(shovelNORef, UZGConfig.chargeLifeTime.Value);
			}
			else
			{
				Plugin.SpamLog("The client is trying to send a non-existent shovel!!!", Plugin.spamType.error);
			}
		}

		[ClientRpc]
		private void SyncShovelDamageClientRpc(NetworkObjectReference shovelNORef, float seconds)
		{
			//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(1596931241u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref shovelNORef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref seconds, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1596931241u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					NetworkObject val3 = default(NetworkObject);
					((NetworkObjectReference)(ref shovelNORef)).TryGet(ref val3, (NetworkManager)null);
					((Component)val3).GetComponent<WeaponShockableScript>().SyncDamageOnLocalClient(seconds);
				}
			}
		}

		[ClientRpc]
		private void SyncCanShockSpikeClientRpc(NetworkObjectReference obj, bool canShock)
		{
			//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(1887262031u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref canShock, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1887262031u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					NetworkObject val3 = default(NetworkObject);
					((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null);
					SpiketrapShockableScript componentInChildren = ((Component)val3).GetComponentInChildren<SpiketrapShockableScript>();
					componentInChildren.SyncCanShockOnLocalClient(canShock);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void SyncZapCountServerRpc(NetworkObjectReference obj, int zapCount)
		{
			//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)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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(23251114u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, zapCount);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 23251114u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (zapCount >= UZGConfig.spiketrapZapNeeded.Value)
				{
					SyncCanShockSpikeClientRpc(obj, canShock: false);
				}
				SyncZapCountClientRpc(obj, zapCount);
			}
		}

		[ClientRpc]
		private void SyncZapCountClientRpc(NetworkObjectReference obj, int zapCount)
		{
			//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)
			//IL_010f: 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(2552547060u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, zapCount);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2552547060u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null);
				SpiketrapShockableScript componentInChildren = ((Component)val3).GetComponentInChildren<SpiketrapShockableScript>();
				if (componentInChildren.zapCount > zapCount)
				{
					SyncZapCountServerRpc(obj, componentInChildren.zapCount + 1);
				}
				else
				{
					componentInChildren.zapCount = zapCount;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void DOTPlayerServerRpc(NetworkBehaviourReference playerNBRef, int playerWhoHit)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2387514609u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNBRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, playerWhoHit);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2387514609u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = default(PlayerControllerB);
			if (((NetworkBehaviourReference)(ref playerNBRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null))
			{
				if (!UZGConfig.enableDOTPlayers.Value || UZGConfig.zapDamageToPlayer.Value == 0)
				{
					return;
				}
				foreach (PatcherTool zapGun in ZapGunMethods.zapGuns)
				{
					if (((GrabbableObject)zapGun).isBeingUsed && zapGun.shockedTargetScript == val3)
					{
						zapgun = zapGun;
					}
				}
				((MonoBehaviour)this).StartCoroutine(DOT.DOTPlayer(val3, playerWhoHit, UZGConfig.zapDamageToPlayer.Value, UZGConfig.zapTimeToDamage.Value, zapgun));
			}
			else
			{
				Plugin.SpamLog("Can't find targetedPlayer!!!", Plugin.spamType.error);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		internal void DOTEnemyServerRpc(NetworkBehaviourReference enemyNBRef, NetworkBehaviourReference playerWhoHitNBRef)
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2311549797u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref enemyNBRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerWhoHitNBRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2311549797u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			EnemyAI val3 = default(EnemyAI);
			if (((NetworkBehaviourReference)(ref enemyNBRef)).TryGet<EnemyAI>(ref val3, (NetworkManager)null))
			{
				PlayerControllerB playerWhoHit = default(PlayerControllerB);
				if (((NetworkBehaviourReference)(ref playerWhoHitNBRef)).TryGet<PlayerControllerB>(ref playerWhoHit, (NetworkManager)null))
				{
					if (!UZGConfig.enableDOTEnemy.Value)
					{
						return;
					}
					EnemyAICollisionDetect componentInChildren = ((Component)val3).GetComponentInChildren<EnemyAICollisionDetect>();
					if ((Object)(object)componentInChildren == (Object)null)
					{
						Plugin.SpamLog("Can't find EnemyAICollisionDetect!!!", Plugin.spamType.error);
						return;
					}
					foreach (PatcherTool zapGun in ZapGunMethods.zapGuns)
					{
						if (((GrabbableObject)zapGun).isBeingUsed && zapGun.shockedTargetScript == componentInChildren)
						{
							zapgun = zapGun;
						}
					}
					((MonoBehaviour)this).StartCoroutine(DOT.DOTEnemy(componentInChildren, playerWhoHit, UZGConfig.zapDamage.Value, UZGConfig.zapTimeToDamage.Value, zapgun));
				}
				else
				{
					Plugin.SpamLog("Can't find playerWhoHit!!!", Plugin.spamType.error);
				}
			}
			else
			{
				Plugin.SpamLog("The client is trying to send a non-existent enemy!!!", Plugin.spamType.error);
			}
		}

		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
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2089966051u, new RpcReceiveHandler(__rpc_handler_2089966051), "BlowUpEnemyServerRpc");
			((NetworkBehaviour)this).__registerRpc(1035235681u, new RpcReceiveHandler(__rpc_handler_1035235681), "BlowUpEnemyClientRpc");
			((NetworkBehaviour)this).__registerRpc(3194388427u, new RpcReceiveHandler(__rpc_handler_3194388427), "SyncShovelDamageServerRpc");
			((NetworkBehaviour)this).__registerRpc(1596931241u, new RpcReceiveHandler(__rpc_handler_1596931241), "SyncShovelDamageClientRpc");
			((NetworkBehaviour)this).__registerRpc(1887262031u, new RpcReceiveHandler(__rpc_handler_1887262031), "SyncCanShockSpikeClientRpc");
			((NetworkBehaviour)this).__registerRpc(23251114u, new RpcReceiveHandler(__rpc_handler_23251114), "SyncZapCountServerRpc");
			((NetworkBehaviour)this).__registerRpc(2552547060u, new RpcReceiveHandler(__rpc_handler_2552547060), "SyncZapCountClientRpc");
			((NetworkBehaviour)this).__registerRpc(2387514609u, new RpcReceiveHandler(__rpc_handler_2387514609), "DOTPlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(2311549797u, new RpcReceiveHandler(__rpc_handler_2311549797), "DOTEnemyServerRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2089966051(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 enemyNORef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyNORef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).BlowUpEnemyServerRpc(enemyNORef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1035235681(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).BlowUpEnemyClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3194388427(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 shovelNORef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref shovelNORef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).SyncShovelDamageServerRpc(shovelNORef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1596931241(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)
			{
				NetworkObjectReference shovelNORef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref shovelNORef, default(ForNetworkSerializable));
				float seconds = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref seconds, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).SyncShovelDamageClientRpc(shovelNORef, seconds);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1887262031(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)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				bool canShock = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref canShock, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).SyncCanShockSpikeClientRpc(obj, canShock);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_23251114(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_005c: 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)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int zapCount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref zapCount);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).SyncZapCountServerRpc(obj, zapCount);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2552547060(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_005c: 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)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				int zapCount = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref zapCount);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).SyncZapCountClientRpc(obj, zapCount);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2387514609(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_005c: 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)
			{
				NetworkBehaviourReference playerNBRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerNBRef, default(ForNetworkSerializable));
				int playerWhoHit = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerWhoHit);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).DOTPlayerServerRpc(playerNBRef, playerWhoHit);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2311549797(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_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)
			{
				NetworkBehaviourReference enemyNBRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref enemyNBRef, default(ForNetworkSerializable));
				NetworkBehaviourReference playerWhoHitNBRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerWhoHitNBRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((UZGNetwork)(object)target).DOTEnemyServerRpc(enemyNBRef, playerWhoHitNBRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "UZGNetwork";
		}
	}
}
namespace UsefulZapGun.Methods
{
	internal class DOT
	{
		[CompilerGenerated]
		private sealed class <DOTEnemy>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyAICollisionDetect enemyAICol;

			public PlayerControllerB playerWhoHit;

			public int force;

			public float time;

			public PatcherTool zapgun;

			private IHittable <enemyAIColIHittable>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<enemyAIColIHittable>5__1 = (IHittable)(object)enemyAICol;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (zapgun.shockedTargetScript == enemyAICol && ((GrabbableObject)zapgun).isBeingUsed)
				{
					<enemyAIColIHittable>5__1.Hit(force, ((Component)enemyAICol).transform.position, playerWhoHit, false, -1);
					<>2__current = (object)new WaitForSeconds(time);
					<>1__state = 1;
					return true;
				}
				return false;
			}

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

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

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

			private object <>2__current;

			public PlayerControllerB player;

			public int playerWhoHit;

			public int damageToPlayer;

			public float time;

			public PatcherTool zapgun;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003a: 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_005c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (zapgun.shockedTargetScript == player && ((GrabbableObject)zapgun).isBeingUsed)
				{
					player.DamagePlayerFromOtherClientServerRpc(damageToPlayer, ((Component)player).transform.position, playerWhoHit);
					<>2__current = (object)new WaitForSeconds(time);
					<>1__state = 1;
					return 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();
			}
		}

		[IteratorStateMachine(typeof(<DOTPlayer>d__0))]
		internal static IEnumerator DOTPlayer(PlayerControllerB player, int playerWhoHit, int damageToPlayer, float time, PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DOTPlayer>d__0(0)
			{
				player = player,
				playerWhoHit = playerWhoHit,
				damageToPlayer = damageToPlayer,
				time = time,
				zapgun = zapgun
			};
		}

		[IteratorStateMachine(typeof(<DOTEnemy>d__1))]
		internal static IEnumerator DOTEnemy(EnemyAICollisionDetect enemyAICol, PlayerControllerB playerWhoHit, int force, float time, PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DOTEnemy>d__1(0)
			{
				enemyAICol = enemyAICol,
				playerWhoHit = playerWhoHit,
				force = force,
				time = time,
				zapgun = zapgun
			};
		}
	}
	internal class ZapGunMethods
	{
		[CompilerGenerated]
		private sealed class <Evaporate>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public BlobAI enemyScript;

			public PatcherTool zapgun;

			public EnemyAICollisionDetect enemyCol;

			private float <blobYScale>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: 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_008b: Expected O, but got Unknown
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<blobYScale>5__1 = 1f;
					goto IL_0112;
				case 1:
				{
					<>1__state = -1;
					Transform transform = ((Component)enemyScript).transform;
					transform.localScale -= new Vector3(0.01f, 0.01f, 0.01f);
					if (zapgun.shockedTargetScript != enemyCol || !((GrabbableObject)zapgun).isBeingUsed)
					{
						Plugin.SpamLog("Stop zapping blob!", Plugin.spamType.debug);
						((MonoBehaviour)StartOfRound.Instance).StopCoroutine(coroutine);
					}
					goto IL_0112;
				}
				case 2:
					{
						<>1__state = -1;
						if (((EnemyAI)enemyScript).enemyType.canDie)
						{
							((EnemyAI)enemyScript).KillEnemyServerRpc(false);
						}
						else
						{
							((EnemyAI)enemyScript).KillEnemyServerRpc(true);
						}
						return false;
					}
					IL_0112:
					if (<blobYScale>5__1 > 0f)
					{
						<blobYScale>5__1 = ((Component)enemyScript).gameObject.transform.localScale.y;
						Plugin.SpamLog($"blob Y scale: {<blobYScale>5__1}", Plugin.spamType.debug);
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 1;
						return true;
					}
					zapgun.StopShockingAnomalyOnClient(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();
			}
		}

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

			private object <>2__current;

			public Vector3 position;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				//IL_003c: 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;
					Landmine.SpawnExplosion(position, true, 0f, 5f, 20, 3f, (GameObject)null, false);
					return false;
				}
			}

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

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

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

			private object <>2__current;

			public PatcherTool zapgun;

			public EnemyAICollisionDetect enemyCol;

			public EnemyAI enemyScript;

			public float time;

			private NetworkObjectReference <enemyNORef>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Expected O, but got Unknown
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_00cb;
				case 1:
					<>1__state = -1;
					time -= 0.1f;
					Plugin.SpamLog($"time = {time}", Plugin.spamType.debug);
					if (!((GrabbableObject)zapgun).isBeingUsed || zapgun.shockedTargetScript != enemyCol)
					{
						Plugin.SpamLog("Stop charging explosion!", Plugin.spamType.debug);
						((MonoBehaviour)StartOfRound.Instance).StopCoroutine(coroutine);
					}
					goto IL_00cb;
				case 2:
					{
						<>1__state = -1;
						<enemyNORef>5__1 = new NetworkObjectReference(((NetworkBehaviour)enemyScript).NetworkObject);
						GameNetworkManagerPatch.hostNetHandler.BlowUpEnemyServerRpc(<enemyNORef>5__1);
						return false;
					}
					IL_00cb:
					if (time > 0f)
					{
						<>2__current = (object)new WaitForSeconds(0.1f);
						<>1__state = 1;
						return true;
					}
					zapgun.StopShockingAnomalyOnClient(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();
			}
		}

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

			private object <>2__current;

			public ForestGiantAI enemyScript;

			public PatcherTool zapgun;

			public EnemyAICollisionDetect enemyCol;

			private float <time>5__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: 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_0054: Expected O, but got Unknown
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<time>5__1 = UZGConfig.timeToStartAFire.Value;
					goto IL_00db;
				case 1:
					<>1__state = -1;
					<time>5__1 -= 0.1f;
					Plugin.SpamLog($"time = {<time>5__1}", Plugin.spamType.debug);
					if (!((GrabbableObject)zapgun).isBeingUsed || zapgun.shockedTargetScript != enemyCol)
					{
						Plugin.SpamLog("Stop zapping giant!", Plugin.spamType.debug);
						((MonoBehaviour)StartOfRound.Instance).StopCoroutine(coroutine);
					}
					goto IL_00db;
				case 2:
					{
						<>1__state = -1;
						((EnemyAI)enemyScript).HitFromExplosion(Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)enemyScript).transform.position));
						return false;
					}
					IL_00db:
					if (<time>5__1 > 0f)
					{
						<>2__current = (object)new WaitForSeconds(0.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();
			}
		}

		internal static List<PatcherTool> zapGuns = new List<PatcherTool>();

		private static Coroutine coroutine;

		[IteratorStateMachine(typeof(<ExplodeNextFrame>d__2))]
		internal static IEnumerator ExplodeNextFrame(Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or 

UZGCodeRebirthCompat.dll

Decompiled 3 weeks ago
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<bool> enableACUZap;

	internal static ConfigEntry<bool> enableBearTrapZap;

	internal static ConfigEntry<bool> enableFlashZap;

	internal static ConfigEntry<bool> enableFanZap;

	internal static ConfigEntry<bool> enableLaserZap;

	internal static ConfigEntry<bool> enableMicrowaveZap;

	internal static ConfigEntry<bool> enableTeslaZap;

	internal static void RebirthConfigSetup(ConfigFile cfg)
	{
		enableACUZap = cfg.Bind<bool>("Hazards", "Enable ACUnit zap", true, "Decrease radius by 1/15 every second");
		enableBearTrapZap = cfg.Bind<bool>("Hazards", "Enable BearTrap zap", true, "...have you ever tried to charge a conductive item?");
		enableFlashZap = cfg.Bind<bool>("Hazards", "Enable FlashTurret zap", true, "Increases cooldown to a maximum of 1 minute");
		enableFanZap = cfg.Bind<bool>("Hazards", "Enable IndustrialFan zap", true, "Turns off the fan during zap");
		enableLaserZap = cfg.Bind<bool>("Hazards", "Enable LazerTurret zap", true, "Beware of the laser turret battery explosion");
		enableMicrowaveZap = cfg.Bind<bool>("Hazards", "Enable Microwave zap", true, "Toggle microwave");
		enableTeslaZap = cfg.Bind<bool>("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 <DecreaseDetectionRangeEverySecond>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public ACUShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <DecreaseDetectionRangeEverySecond>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<AirControlUnit>();
			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(<DecreaseDetectionRangeEverySecond>d__12))]
		private IEnumerator DecreaseDetectionRangeEverySecond(PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DecreaseDetectionRangeEverySecond>d__12(0)
			{
				<>4__this = this,
				zapgun = zapgun
			};
		}
	}
	internal class BearTrapShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <WhyDoYouWantToChargeIt>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public PlayerControllerB shockedByPlayer;

			public BearTrapShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <WhyDoYouWantToChargeIt>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<BearTrap>();
		}

		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(<WhyDoYouWantToChargeIt>d__9))]
		private IEnumerator WhyDoYouWantToChargeIt(PatcherTool zapgun, PlayerControllerB shockedByPlayer)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WhyDoYouWantToChargeIt>d__9(0)
			{
				<>4__this = this,
				zapgun = zapgun,
				shockedByPlayer = shockedByPlayer
			};
		}
	}
	internal class FlashShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <IncreseCooldown>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public FlashShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <IncreseCooldown>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<FlashTurret>();
			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(<IncreseCooldown>d__13))]
		private IEnumerator IncreseCooldown(PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <IncreseCooldown>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<Animator>();
			mainScript = ((Component)this).GetComponent<IndustrialFan>();
			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 <Explode>d__10 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public LaserShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <Explode>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<LaserTurret>();
		}

		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(<Explode>d__10))]
		private IEnumerator Explode(PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Explode>d__10(0)
			{
				<>4__this = this,
				zapgun = zapgun
			};
		}
	}
	internal class MicrowaveShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <ToggleMicrowave>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public MicrowaveShockableScript <>4__this;

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

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

			[DebuggerHidden]
			public <ToggleMicrowave>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<FunctionalMicrowave>();
			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(<ToggleMicrowave>d__12))]
		private IEnumerator ToggleMicrowave(PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ToggleMicrowave>d__12(0)
			{
				<>4__this = this,
				zapgun = zapgun
			};
		}
	}
	internal class TeslaShockableScript : MonoBehaviour, IShockableWithGun
	{
		[CompilerGenerated]
		private sealed class <DrainChargeAndExplode>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PatcherTool zapgun;

			public TeslaShockableScript <>4__this;

			private NetworkBehaviourReference <TeslaRef>5__1;

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

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

			[DebuggerHidden]
			public <DrainChargeAndExplode>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)
						{
							<TeslaRef>5__1 = new NetworkBehaviourReference((NetworkBehaviour)(object)<>4__this.mainScript);
							CodeRebirthGameNetworkManagerPatch.rebirthNetwork.SyncTeslaServerRpc(<>4__this.charge, <TeslaRef>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<TeslaShock>();
			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(<DrainChargeAndExplode>d__12))]
		private IEnumerator DrainChargeAndExplode(PatcherTool zapgun)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DrainChargeAndExplode>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<GameObject>(netHandler);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		public static void FindNetworkHandler()
		{
			rebirthNetwork = Object.FindAnyObjectByType<CodeRebirthNetwork>();
			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<GameObject>("CRUsefulZapGunNO.prefab");
			netHandler.AddComponent<CodeRebirthNetwork>();
			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<ACUShockableScript>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BearTrap), "Start")]
		private static void BearTrapStartPatch(ref BearTrap __instance)
		{
			if (CRConfig.enableBearTrapZap.Value)
			{
				((Component)__instance).gameObject.AddComponent<BearTrapShockableScript>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(FlashTurret), "Start")]
		private static void FlashStartPatch(ref FlashTurret __instance)
		{
			if (CRConfig.enableFlashZap.Value)
			{
				((Component)__instance).gameObject.AddComponent<FlashShockableScript>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(IndustrialFan), "Start")]
		private static void FanStartPatch(ref IndustrialFan __instance)
		{
			if (CRConfig.enableFanZap.Value)
			{
				((Component)__instance).gameObject.AddComponent<IndustrialFanShockableScript>();
			}
		}

		[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<LaserShockableScript>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(FunctionalMicrowave), "Start")]
		private static void MicrowaveStartPatch(ref FunctionalMicrowave __instance)
		{
			if (CRConfig.enableMicrowaveZap.Value)
			{
				((Component)__instance).gameObject.AddComponent<MicrowaveShockableScript>();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TeslaShock), "Start")]
		private static void TeslaStartPatch(ref TeslaShock __instance)
		{
			if (CRConfig.enableTeslaZap.Value)
			{
				((Component)__instance).gameObject.AddComponent<TeslaShockableScript>();
			}
		}

		[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<NetworkBehaviourReference>(ref ACURef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(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<AirControlUnit>(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<NetworkBehaviourReference>(ref ACURef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(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<AirControlUnit>(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<NetworkBehaviourReference>(ref FlashRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(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<FlashTurret>(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<NetworkBehaviourReference>(ref FlashRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(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<FlashTurret>(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<float>(ref charge, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(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<TeslaShock>(ref val3, (NetworkManager)null);
				TeslaShockableScript component = ((Component)val3).GetComponent<TeslaShockableScript>();
				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<float>(ref charge, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref TeslaRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(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<TeslaShock>(ref val3, (NetworkManager)null);
				TeslaShockableScript component = ((Component)val3).GetComponent<TeslaShockableScript>();
				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<NetworkBehaviourReference>(ref aCURef, default(ForNetworkSerializable));
				bool disable = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(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<NetworkBehaviourReference>(ref aCURef, default(ForNetworkSerializable));
				float range = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(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<NetworkBehaviourReference>(ref flashRef, default(ForNetworkSerializable));
				bool disable = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(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<NetworkBehaviourReference>(ref flashRef, default(ForNetworkSerializable));
				float cooldown = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(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<float>(ref charge, default(ForPrimitives));
				NetworkBehaviourReference teslaRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(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<float>(ref charge, default(ForPrimitives));
				NetworkBehaviourReference teslaRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref teslaRef, default(ForNetworkSerializable));
				bool enabled = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(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
	{
	}
}