Decompiled source of LethalPotato v1.3.2

HotPotato/HotPotato.dll

Decompiled 7 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using CSync.Lib;
using CSync.Util;
using GameNetcodeStuff;
using HarmonyLib;
using HotPotato.Behaviours;
using HotPotato.NetcodePatcher;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[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("HotPotato")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HotPotato")]
[assembly: AssemblyTitle("HotPotato")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 HotPotato
{
	[BepInPlugin("cuttothechase.LethalPotato", "Lethal Potato", "1.3.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "cuttothechase.LethalPotato";

		private const string NAME = "Lethal Potato";

		private const string VERSION = "1.3.2";

		public static Plugin instance;

		public static PotatoConfig MyConfig { get; private set; }

		private void Awake()
		{
			instance = this;
			MyConfig = new PotatoConfig(((BaseUnityPlugin)this).Config);
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemmod");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/Items/HotPotatoItem.asset");
			FancyShake fancyShake = val2.spawnPrefab.AddComponent<FancyShake>();
			CountdownExplosion countdownExplosion = val2.spawnPrefab.AddComponent<CountdownExplosion>();
			countdownExplosion.beep = val.LoadAsset<AudioClip>("Assets/Items/beep-22.wav");
			((GrabbableObject)countdownExplosion).grabbable = true;
			((GrabbableObject)countdownExplosion).grabbableToEnemies = true;
			((GrabbableObject)countdownExplosion).itemProperties = val2;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, SyncedEntry<int>.op_Implicit(MyConfig.SCRAP_RARITY), (LevelTypes)(-1));
			TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
			val3.clearPreviousText = true;
			val3.displayText = "Dis potato HAWWWWWT. Gonna get spicy real fast\n\n";
			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);
					}
				}
			}
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "cuttothechase.LethalPotato");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched Lethal Potato");
		}
	}
	[DataContract]
	public class PotatoConfig : SyncedConfig<PotatoConfig>
	{
		public ConfigEntry<float> DISPLAY_DEBUG_INFO { get; private set; }

		[DataMember]
		public SyncedEntry<int> SCRAP_RARITY { get; private set; }

		[DataMember]
		public SyncedEntry<float> BATTERY_USAGE { get; private set; }

		[DataMember]
		public SyncedEntry<bool> BATTERY_RANDOM { get; private set; }

		public PotatoConfig(ConfigFile cfg)
			: base("LethalPotato")
		{
			ConfigManager.Register<PotatoConfig>(this);
			SCRAP_RARITY = Extensions.BindSyncedEntry<int>(cfg, "General", "Rarity", 25, "How rare the scrap is, higher number means more likely to spawn");
			BATTERY_USAGE = Extensions.BindSyncedEntry<float>(cfg, "General", "BatteryUsage", 165f, "How quickly the battery drains, a lower number means faster");
			BATTERY_RANDOM = Extensions.BindSyncedEntry<bool>(cfg, "General", "BatteryUsageRandom", false, "If enabled, all Hot Potatoes will start at different charge values");
		}

		public void DoSomethingAfterSync(object sender, EventArgs args)
		{
			Debug.Log((object)"LETHAL POTATO CONFIG SETTINGS SYNCED AMONGST CLIENTS");
		}
	}
}
namespace HotPotato.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("HotPotato.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace HotPotato.Behaviours
{
	internal class Beep : NetworkBehaviour
	{
		public void StartBeep()
		{
		}

		public void StopBeep()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(LetsBeep());
		}

		private IEnumerator LetsBeep()
		{
			float timeBetweenBeeps = 3f;
			float chargeVal = 1f;
			while (chargeVal > 0f)
			{
				yield return (object)new WaitForSeconds(timeBetweenBeeps);
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "Beep";
		}
	}
	internal class CountdownExplosion : GrabbableObject
	{
		private bool firstTimePickup = false;

		private float beginAtCharge = 0.2f;

		private bool disabled = false;

		private bool exploded = false;

		private float batteryCharge = 0.75f;

		private AudioSource potatoAudio;

		public AudioClip beep;

		private FancyShake shakeTools;

		public override void Start()
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			((GrabbableObject)this).Start();
			potatoAudio = ((Component)this).GetComponent<AudioSource>();
			base.isBeingUsed = false;
			base.itemProperties.isConductiveMetal = true;
			base.itemProperties.requiresBattery = true;
			base.itemProperties.automaticallySetUsingPower = true;
			if (SyncedEntry<bool>.op_Implicit(Plugin.MyConfig.BATTERY_RANDOM))
			{
				changeBatteryServerRpc();
			}
			else
			{
				batteryCharge = 0.75f;
			}
			base.itemProperties.batteryUsage = SyncedEntry<float>.op_Implicit(Plugin.MyConfig.BATTERY_USAGE);
			shakeTools = ((Component)this).GetComponent<FancyShake>();
			base.insertedBattery = new Battery(false, batteryCharge);
			Debug.Log((object)("Battery set to " + base.insertedBattery.charge));
			if (base.isInShipRoom)
			{
				Debug.Log((object)"Potato already Disabled");
				disablePotatoServerRpc();
			}
			Debug.Log((object)"HOT POTATO INITIALIZED");
		}

		[ServerRpc(RequireOwnership = false)]
		public void changeBatteryServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(762092989u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 762092989u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					float newValue = ((Random.Range(0, 101) > 35) ? Random.Range(0.01f, 0.35f) : Random.Range(0.35f, 0.75f));
					changeBatteryClientRpc(newValue);
				}
			}
		}

		[ClientRpc]
		public void changeBatteryClientRpc(float newValue)
		{
			//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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(601673450u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newValue, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 601673450u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					batteryCharge = newValue;
					base.insertedBattery = new Battery(false, batteryCharge);
				}
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			Debug.Log((object)"Hey fam, can you just check and see if values are right?");
			checkIfInShipServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void checkIfInShipServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1280335846u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1280335846u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (base.isInShipRoom)
				{
					Debug.Log((object)"Yeah, its in the Ship Room");
					disablePotatoServerRpc();
				}
				else
				{
					Debug.Log((object)"Nah. Its not in the ship room");
				}
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (disabled)
			{
				base.insertedBattery.charge = 0f;
				base.insertedBattery.empty = true;
			}
			else
			{
				if (!firstTimePickup)
				{
					return;
				}
				if (base.insertedBattery.charge <= 0f)
				{
					if (!exploded)
					{
						SetOffServerRpc();
					}
					else
					{
						Debug.Log((object)"hey this potato should be removed.");
					}
				}
				else if (base.insertedBattery.charge <= beginAtCharge)
				{
					beginShakeServerRpc();
				}
				else if (base.insertedBattery.charge >= 0.9f)
				{
					disablePotatoServerRpc();
				}
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (!disabled)
			{
				((Renderer)((Component)this).GetComponentInChildren<SpriteRenderer>()).enabled = false;
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if (!disabled)
			{
				((Renderer)((Component)this).GetComponentInChildren<SpriteRenderer>()).enabled = true;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!disabled && !exploded)
			{
				((GrabbableObject)this).ItemActivate(used, buttonDown);
				base.isBeingUsed = true;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void beginShakeServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4212117831u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4212117831u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					beginShakeClientRpc();
				}
			}
		}

		[ClientRpc]
		public void beginShakeClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3735436399u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3735436399u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					shakeTools.Begin((GrabbableObject)(object)this, beginAtCharge);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void disablePotatoServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(327740104u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 327740104u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					disablePotatoClientRpc();
				}
			}
		}

		[ClientRpc]
		public void disablePotatoClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3261967202u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3261967202u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"POTATO DISABLED");
				disabled = true;
				if ((Object)(object)shakeTools != (Object)null && shakeTools.shouldShake)
				{
					shakeTools.stopShake();
				}
				((Renderer)((Component)this).GetComponentInChildren<SpriteRenderer>()).enabled = false;
				base.isBeingUsed = false;
				base.insertedBattery.charge = 0f;
				base.insertedBattery.empty = true;
			}
		}

		public override void GrabItem()
		{
			Debug.Log((object)("First time pickup? " + firstTimePickup));
			((GrabbableObject)this).GrabItem();
			if (!disabled && !exploded && !firstTimePickup)
			{
				Debug.Log((object)"MAKIN THE FIRST TIME PICKUP TRUEEEE");
				firstTimePickup = true;
				((Renderer)((Component)this).GetComponentInChildren<SpriteRenderer>()).enabled = true;
				base.isBeingUsed = false;
				((GrabbableObject)this).UseItemBatteries(true, true);
			}
		}

		public override void LateUpdate()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!shakeTools.shouldShake)
				{
					if ((Object)(object)base.parentObject != (Object)null)
					{
						((Component)this).transform.rotation = base.parentObject.rotation;
						((Component)this).transform.Rotate(base.itemProperties.rotationOffset);
						((Component)this).transform.position = base.parentObject.position;
						Vector3 positionOffset = base.itemProperties.positionOffset;
						positionOffset = base.parentObject.rotation * positionOffset;
						Transform transform = ((Component)this).transform;
						transform.position += positionOffset;
					}
				}
				else if ((Object)(object)base.parentObject != (Object)null)
				{
					((Component)this).transform.rotation = base.parentObject.rotation;
					((Component)this).transform.Rotate(base.itemProperties.rotationOffset);
					((Component)this).transform.position = base.parentObject.position;
					Vector3 positionOffset2 = base.itemProperties.positionOffset;
					positionOffset2 = base.parentObject.rotation * positionOffset2;
					Transform transform2 = ((Component)this).transform;
					transform2.position += positionOffset2;
					Transform transform3 = ((Component)this).transform;
					transform3.position += new Vector3(0f, 0f, shakeTools.xyshake.y);
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)("Yeah fam u got - " + ex));
			}
			if ((Object)(object)base.radarIcon != (Object)null)
			{
				base.radarIcon.position = ((Component)this).transform.position;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetOffServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2119358010u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2119358010u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Debug.Log((object)"YO WE GONNA DETONATE");
					SetOffClientRpc();
				}
			}
		}

		[ClientRpc]
		public void SetOffClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2089549892u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2089549892u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Debug.Log((object)"CLIENTS SAY OK DETONATE");
					Detonate();
				}
			}
		}

		public void Detonate()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (disabled)
			{
				Debug.Log((object)"Potato is disabled, cant detonate");
				return;
			}
			exploded = true;
			Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up, true, 5f, 8f, 50, 0f, (GameObject)null);
			StunGrenadeItem.StunExplosion(((Component)this).transform.position + Vector3.up, true, 0.1f, 3f, 0.5f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f);
			base.grabbable = false;
			base.grabbableToEnemies = false;
			base.deactivated = true;
			if (((NetworkBehaviour)this).IsOwner)
			{
				RemoveScrapServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void RemoveScrapServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2560329969u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2560329969u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Debug.Log((object)"Despawning Hot Potato Object");
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
			}
		}

		public override void GrabItemFromEnemy(EnemyAI enemy)
		{
			((GrabbableObject)this).GrabItemFromEnemy(enemy);
			Debug.Log((object)"ENEMY HAS PICKED UP POTATO");
			if (!disabled && !exploded && !firstTimePickup)
			{
				Debug.Log((object)"MAKIN THE FIRST TIME PICKUP TRUEEEE");
				firstTimePickup = true;
				((Renderer)((Component)this).GetComponentInChildren<SpriteRenderer>()).enabled = true;
				base.isBeingUsed = false;
				((GrabbableObject)this).UseItemBatteries(true, true);
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CountdownExplosion()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(762092989u, new RpcReceiveHandler(__rpc_handler_762092989));
			NetworkManager.__rpc_func_table.Add(601673450u, new RpcReceiveHandler(__rpc_handler_601673450));
			NetworkManager.__rpc_func_table.Add(1280335846u, new RpcReceiveHandler(__rpc_handler_1280335846));
			NetworkManager.__rpc_func_table.Add(4212117831u, new RpcReceiveHandler(__rpc_handler_4212117831));
			NetworkManager.__rpc_func_table.Add(3735436399u, new RpcReceiveHandler(__rpc_handler_3735436399));
			NetworkManager.__rpc_func_table.Add(327740104u, new RpcReceiveHandler(__rpc_handler_327740104));
			NetworkManager.__rpc_func_table.Add(3261967202u, new RpcReceiveHandler(__rpc_handler_3261967202));
			NetworkManager.__rpc_func_table.Add(2119358010u, new RpcReceiveHandler(__rpc_handler_2119358010));
			NetworkManager.__rpc_func_table.Add(2089549892u, new RpcReceiveHandler(__rpc_handler_2089549892));
			NetworkManager.__rpc_func_table.Add(2560329969u, new RpcReceiveHandler(__rpc_handler_2560329969));
		}

		private static void __rpc_handler_762092989(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CountdownExplosion)(object)target).changeBatteryServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_601673450(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float newValue = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newValue, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CountdownExplosion)(object)target).changeBatteryClientRpc(newValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1280335846(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CountdownExplosion)(object)target).checkIfInShipServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4212117831(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CountdownExplosion)(object)target).beginShakeServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3735436399(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CountdownExplosion)(object)target).beginShakeClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_327740104(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CountdownExplosion)(object)target).disablePotatoServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3261967202(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CountdownExplosion)(object)target).disablePotatoClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2119358010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CountdownExplosion)(object)target).SetOffServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2089549892(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CountdownExplosion)(object)target).SetOffClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2560329969(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CountdownExplosion)(object)target).RemoveScrapServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "CountdownExplosion";
		}
	}
	public class FancyShake : NetworkBehaviour
	{
		[Header("Info")]
		private Vector3 _startPos;

		private float _timer;

		private Vector3 _randomPos;

		[Header("Settings")]
		[Range(0f, 2f)]
		public float _time = 2f;

		[Range(0f, 2f)]
		public float _distance = 0.0175f;

		[Range(0f, 0.1f)]
		public float _delayBetweenShakes = 0.025f;

		public Vector3 shakeval;

		public Vector2 xyshake;

		private GrabbableObject objectToShake;

		public bool shouldShake = false;

		private float beginAtCharge = 0.2f;

		public void Begin(GrabbableObject shakeThis, float whenToBegin)
		{
			//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)
			objectToShake = shakeThis;
			shouldShake = true;
			_startPos = ((Component)objectToShake).transform.position;
			beginAtCharge = whenToBegin;
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(Shake());
		}

		private IEnumerator Shake()
		{
			_timer = 0f;
			while (_timer < _time)
			{
				_timer += Time.deltaTime;
				xyshake = Random.insideUnitCircle * _distance;
				_randomPos = _startPos + new Vector3(0f, 0f, xyshake.y);
				shakeval = _randomPos;
				if (_delayBetweenShakes > 0f)
				{
					yield return (object)new WaitForSeconds(_delayBetweenShakes);
				}
				else
				{
					yield return null;
				}
			}
			shakeval = _startPos;
		}

		public void stopShake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)this).StopAllCoroutines();
			shouldShake = false;
			((Component)objectToShake).transform.position = _startPos;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "FancyShake";
		}
	}
}
namespace HotPotato.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}