Decompiled source of Chocobo Getaway Scraps v1.0.0

plugins/com.github.zehsteam.Whiteboard.dll

Decompiled a day 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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using com.github.zehsteam.Whiteboard.MonoBehaviours;
using com.github.zehsteam.Whiteboard.NetcodePatcher;
using com.github.zehsteam.Whiteboard.Patches;

[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("com.github.zehsteam.Whiteboard")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a new whiteboard store item that you can write on!")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyInformationalVersion("1.1.4+5bcbfa114228d0849c0387bc44b6461ec716f56d")]
[assembly: AssemblyProduct("Whiteboard")]
[assembly: AssemblyTitle("com.github.zehsteam.Whiteboard")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace com.github.zehsteam.Whiteboard
{
	public class ConfigManager
	{
		public ConfigEntry<bool> ExtendedLogging { get; private set; }

		public ConfigEntry<int> Price { get; private set; }

		public ConfigEntry<bool> HostOnly { get; private set; }

		public ConfigEntry<string> DefaultDisplayText { get; private set; }

		public ConfigManager()
		{
			BindConfigs();
			SetupChangedEvents();
			ClearUnusedEntries();
		}

		private void BindConfigs()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			ExtendedLogging = config.Bind<bool>("General Settings", "ExtendedLogging", false, "Enable extended logging.");
			Price = config.Bind<int>("Whiteboard Settings", "Price", 100, new ConfigDescription("The price of the whiteboard in the store.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
			HostOnly = config.Bind<bool>("Whiteboard Settings", "HostOnly", false, "If enabled, only the host can edit the whiteboard.");
			DefaultDisplayText = config.Bind<string>("Whiteboard Settings", "DefaultDisplayText", "", "The default display text that shows on the whiteboard. Supports rich text tags.");
		}

		private void SetupChangedEvents()
		{
			Price.SettingChanged += Price_SettingChanged;
			HostOnly.SettingChanged += HostOnly_SettingChanged;
		}

		private void Price_SettingChanged(object sender, EventArgs e)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.IsHostOrServer && (Object)(object)PluginNetworkBehaviour.Instance != (Object)null)
			{
				PluginNetworkBehaviour.Instance.SetWhiteboardUnlockablePriceClientRpc(Price.Value);
			}
		}

		private void HostOnly_SettingChanged(object sender, EventArgs e)
		{
			if (Plugin.IsHostOrServer && (Object)(object)WhiteboardBehaviour.Instance != (Object)null)
			{
				WhiteboardBehaviour.Instance.IsHostOnly.Value = HostOnly.Value;
			}
		}

		private void ClearUnusedEntries()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
			dictionary.Clear();
			config.Save();
		}
	}
	internal class Content
	{
		public static GameObject NetworkHandlerPrefab;

		public static UnlockableItemDef WhiteboardUnlockableItemDef;

		public static TerminalNode WhiteboardBuyTerminalNode;

		public static GameObject WhiteboardEditorCanvasPrefab;

		public static void Load()
		{
			LoadAssetsFromAssetBundle();
		}

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "whiteboard_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				NetworkHandlerPrefab = val.LoadAsset<GameObject>("NetworkHandler");
				NetworkHandlerPrefab.AddComponent<PluginNetworkBehaviour>();
				WhiteboardUnlockableItemDef = val.LoadAsset<UnlockableItemDef>("Whiteboard");
				WhiteboardBuyTerminalNode = val.LoadAsset<TerminalNode>("WhiteboardBuy");
				WhiteboardEditorCanvasPrefab = val.LoadAsset<GameObject>("WhiteboardEditorCanvas");
				Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Failed to load assets from AssetBundle.\n\n{arg}");
			}
		}
	}
	internal class NetworkUtils
	{
		public static int GetLocalClientId()
		{
			return (int)NetworkManager.Singleton.LocalClientId;
		}

		public static bool IsLocalClientId(int clientId)
		{
			return clientId == GetLocalClientId();
		}
	}
	internal class PlayerUtils
	{
		public static int GetLocalPlayerId()
		{
			PlayerControllerB localPlayerScript = GetLocalPlayerScript();
			if ((Object)(object)localPlayerScript == (Object)null)
			{
				return -1;
			}
			return (int)localPlayerScript.playerClientId;
		}

		public static bool IsLocalPlayerId(int playerId)
		{
			return playerId == GetLocalPlayerId();
		}

		public static PlayerControllerB GetPlayerScript(int playerId)
		{
			try
			{
				return StartOfRound.Instance.allPlayerScripts[playerId];
			}
			catch
			{
				return null;
			}
		}

		public static PlayerControllerB GetLocalPlayerScript()
		{
			return GameNetworkManager.Instance.localPlayerController;
		}

		public static bool IsLocalPlayerSpawned()
		{
			PlayerControllerB localPlayerScript = GetLocalPlayerScript();
			if ((Object)(object)localPlayerScript == (Object)null)
			{
				return false;
			}
			return ((NetworkBehaviour)localPlayerScript).IsSpawned;
		}

		public static void SetControlsEnabled(bool value)
		{
			if (value)
			{
				EnableControls();
			}
			else
			{
				DisableControls();
			}
		}

		private static void EnableControls()
		{
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerScript = GetLocalPlayerScript();
			if (!((Object)(object)localPlayerScript == (Object)null))
			{
				localPlayerScript.disableMoveInput = false;
				InputActionAsset actions = IngamePlayerSettings.Instance.playerInput.actions;
				MovementActions movement;
				try
				{
					movement = localPlayerScript.playerActions.Movement;
					((MovementActions)(ref movement)).Look.performed += localPlayerScript.Look_performed;
					actions.FindAction("Jump", false).performed += localPlayerScript.Jump_performed;
					actions.FindAction("Crouch", false).performed += localPlayerScript.Crouch_performed;
					actions.FindAction("Interact", false).performed += localPlayerScript.Interact_performed;
					actions.FindAction("ItemSecondaryUse", false).performed += localPlayerScript.ItemSecondaryUse_performed;
					actions.FindAction("ItemTertiaryUse", false).performed += localPlayerScript.ItemTertiaryUse_performed;
					actions.FindAction("ActivateItem", false).performed += localPlayerScript.ActivateItem_performed;
					actions.FindAction("ActivateItem", false).canceled += localPlayerScript.ActivateItem_canceled;
					actions.FindAction("Discard", false).performed += localPlayerScript.Discard_performed;
					actions.FindAction("SwitchItem", false).performed += localPlayerScript.ScrollMouse_performed;
					actions.FindAction("InspectItem", false).performed += localPlayerScript.InspectItem_performed;
					actions.FindAction("SpeedCheat", false).performed += localPlayerScript.SpeedCheat_performed;
					actions.FindAction("Emote1", false).performed += localPlayerScript.Emote1_performed;
					actions.FindAction("Emote2", false).performed += localPlayerScript.Emote2_performed;
					localPlayerScript.isTypingChat = false;
					actions.FindAction("EnableChat", false).performed += HUDManager.Instance.EnableChat_performed;
					actions.FindAction("SubmitChat", false).performed += HUDManager.Instance.SubmitChat_performed;
					actions.FindAction("PingScan", false).performed += HUDManager.Instance.PingScan_performed;
					movement = localPlayerScript.playerActions.Movement;
					((MovementActions)(ref movement)).Enable();
				}
				catch (Exception arg)
				{
					Plugin.logger.LogError((object)$"Error while subscribing to input in PlayerController\n\n{arg}");
				}
				movement = localPlayerScript.playerActions.Movement;
				((MovementActions)(ref movement)).Enable();
			}
		}

		private static void DisableControls()
		{
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerScript = GetLocalPlayerScript();
			if (!((Object)(object)localPlayerScript == (Object)null))
			{
				localPlayerScript.disableMoveInput = true;
				InputActionAsset actions = IngamePlayerSettings.Instance.playerInput.actions;
				MovementActions movement;
				try
				{
					movement = localPlayerScript.playerActions.Movement;
					((MovementActions)(ref movement)).Look.performed -= localPlayerScript.Look_performed;
					actions.FindAction("Jump", false).performed -= localPlayerScript.Jump_performed;
					actions.FindAction("Crouch", false).performed -= localPlayerScript.Crouch_performed;
					actions.FindAction("Interact", false).performed -= localPlayerScript.Interact_performed;
					actions.FindAction("ItemSecondaryUse", false).performed -= localPlayerScript.ItemSecondaryUse_performed;
					actions.FindAction("ItemTertiaryUse", false).performed -= localPlayerScript.ItemTertiaryUse_performed;
					actions.FindAction("ActivateItem", false).performed -= localPlayerScript.ActivateItem_performed;
					actions.FindAction("ActivateItem", false).canceled -= localPlayerScript.ActivateItem_canceled;
					actions.FindAction("Discard", false).performed -= localPlayerScript.Discard_performed;
					actions.FindAction("SwitchItem", false).performed -= localPlayerScript.ScrollMouse_performed;
					actions.FindAction("InspectItem", false).performed -= localPlayerScript.InspectItem_performed;
					actions.FindAction("SpeedCheat", false).performed -= localPlayerScript.SpeedCheat_performed;
					actions.FindAction("Emote1", false).performed -= localPlayerScript.Emote1_performed;
					actions.FindAction("Emote2", false).performed -= localPlayerScript.Emote2_performed;
					localPlayerScript.isTypingChat = true;
					actions.FindAction("EnableChat", false).performed -= HUDManager.Instance.EnableChat_performed;
					actions.FindAction("SubmitChat", false).performed -= HUDManager.Instance.SubmitChat_performed;
					actions.FindAction("PingScan", false).performed -= HUDManager.Instance.PingScan_performed;
					movement = localPlayerScript.playerActions.Movement;
					((MovementActions)(ref movement)).Disable();
				}
				catch (Exception arg)
				{
					Plugin.logger.LogError((object)$"Error while unsubscribing to input in PlayerController\n\n{arg}");
				}
				movement = localPlayerScript.playerActions.Movement;
				((MovementActions)(ref movement)).Disable();
			}
		}
	}
	[BepInPlugin("com.github.zehsteam.Whiteboard", "Whiteboard", "1.1.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("com.github.zehsteam.Whiteboard");

		internal static Plugin Instance;

		internal static ManualLogSource logger;

		internal static ConfigManager ConfigManager;

		public static bool IsHostOrServer => NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("com.github.zehsteam.Whiteboard");
			logger.LogInfo((object)"Whiteboard has awoken!");
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(ShipBuildModeManagerPatch));
			ConfigManager = new ConfigManager();
			Content.Load();
			RegisterUnlockableItems();
			NetcodePatcherAwake();
		}

		private void NetcodePatcherAwake()
		{
			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 RegisterUnlockableItems()
		{
			UnlockableHelper.RegisterUnlockable(Content.WhiteboardUnlockableItemDef, (StoreType)2, ConfigManager.Price.Value, Content.WhiteboardBuyTerminalNode);
		}

		public void SpawnWhiteboardEditorCanvas()
		{
			if (!((Object)(object)WhiteboardEditorBehaviour.Instance != (Object)null))
			{
				Object.Instantiate<GameObject>(Content.WhiteboardEditorCanvasPrefab);
				logger.LogInfo((object)"Spawned WhiteboardEditorCanvas.");
			}
		}

		public void LogInfoExtended(object data)
		{
			if (ConfigManager.ExtendedLogging.Value)
			{
				logger.LogInfo(data);
			}
		}
	}
	[CreateAssetMenu(menuName = "Whiteboard/SpriteSheetData")]
	public class SpriteSheetData : ScriptableObject
	{
		[Header("Editor Buttons")]
		[Space(5f)]
		public bool ImportSpriteData = false;

		[Header("Data")]
		[Space(5f)]
		public TMP_SpriteAsset SpriteAsset;

		[TextArea(3, 20)]
		public string SpriteDataImportCode;

		public List<SpriteSheetItem> SpriteData = new List<SpriteSheetItem>();

		public string GetAllSpritesText()
		{
			string text = string.Empty;
			foreach (SpriteSheetItem spriteDatum in SpriteData)
			{
				text = text + spriteDatum.GetText() + " ";
			}
			return text.Trim();
		}

		public string GetParsedText(string text, bool matchCase = false)
		{
			string text2 = text;
			StringComparison comparisonType = (matchCase ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
			if (text2.Contains("<all>", comparisonType))
			{
				text2 = text2.Replace("<all>", GetAllSpritesText(), comparisonType);
			}
			List<SpriteSheetItem> list = SpriteData.OrderBy((SpriteSheetItem _) => _.Name.Length).Reverse().ToList();
			foreach (SpriteSheetItem item in list)
			{
				if (text2.Contains(item.Name, comparisonType))
				{
					text2 = text2.Replace(item.Name, item.GetText(), comparisonType);
				}
			}
			return text2;
		}

		private void OnValidate()
		{
			if (ImportSpriteData)
			{
				ImportSpriteData = false;
				OnImportSpriteDataClicked();
			}
		}

		private void OnImportSpriteDataClicked()
		{
			if (string.IsNullOrWhiteSpace(SpriteDataImportCode))
			{
				LogError("Failed to import sprite data code. Sprite data import code is null or empty.");
				return;
			}
			string[] array = SpriteDataImportCode.Trim().Split(",", StringSplitOptions.RemoveEmptyEntries);
			if (array.Length == 0)
			{
				LogError("Failed to import sprite data code. Sprite data import code contains no entries.");
				return;
			}
			SpriteData = new List<SpriteSheetItem>();
			for (int i = 0; i < array.Length; i++)
			{
				if (string.IsNullOrWhiteSpace(array[i]))
				{
					LogEntryError(i, "Entry is null or empty.");
					continue;
				}
				string[] array2 = array[i].Trim().Split(":", StringSplitOptions.RemoveEmptyEntries);
				if (array2.Length < 3)
				{
					LogEntryError(i, "Entry has less than 3 items.");
					continue;
				}
				string name = array2[0];
				if (TryParseInt(i, array2[1], out var result) && TryParseInt(i, array2[2], out var result2))
				{
					float result3 = 10f;
					if (array2.Length < 4 || TryParseFloat(i, array2[3], out result3))
					{
						SpriteData.Add(new SpriteSheetItem(name, result, result2, result3));
					}
				}
			}
			LogInfo("Finished importing sprite data from sprite data import code.");
		}

		private static bool TryParseInt(int entryIndex, string text, out int result)
		{
			if (!int.TryParse(text, out result))
			{
				LogEntryError(entryIndex, "Could not parse \"" + text + "\" as an integer.");
				return false;
			}
			return true;
		}

		private static bool TryParseFloat(int entryIndex, string text, out float result)
		{
			if (!float.TryParse(text, out result))
			{
				LogEntryError(entryIndex, "Could not parse \"" + text + "\" as a float.");
				return false;
			}
			return true;
		}

		private static void LogEntryError(int entryIndex, object data)
		{
			LogError($"Failed to import sprite data entry #{entryIndex}. " + data);
		}

		private static void LogInfo(object data)
		{
			Debug.Log((object)("[SpriteSheetData] " + data));
		}

		private static void LogError(object data)
		{
			Debug.LogError((object)("[SpriteSheetData] " + data));
		}
	}
	[Serializable]
	public class SpriteSheetItem
	{
		public string Name;

		public int Index;

		public int EndIndex;

		public float AnimationSpeed;

		public SpriteSheetItem(string name, int index, int endIndex, float animationSpeed)
		{
			Name = name;
			Index = index;
			EndIndex = endIndex;
			AnimationSpeed = animationSpeed;
		}

		public string GetText()
		{
			if (EndIndex > Index)
			{
				return $"<sprite anim=\"{Index},{EndIndex},{AnimationSpeed}\">";
			}
			return $"<sprite={Index}>";
		}
	}
	internal class UnlockableHelper
	{
		public static void RegisterUnlockable(UnlockableItemDef unlockableItemDef, StoreType storeType, int price, TerminalNode terminalNode)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				unlockableItemDef.unlockable.shopSelectionNode.itemCost = price;
				unlockableItemDef.unlockable.shopSelectionNode.terminalOptions[0].result.itemCost = price;
			}
			catch
			{
			}
			Utilities.FixMixerGroups(unlockableItemDef.unlockable.prefabObject);
			NetworkPrefabs.RegisterNetworkPrefab(unlockableItemDef.unlockable.prefabObject);
			Unlockables.RegisterUnlockable(unlockableItemDef, storeType, (TerminalNode)null, (TerminalNode)null, terminalNode, price);
			Plugin.logger.LogInfo((object)$"Registered \"{unlockableItemDef.unlockable.unlockableName}\" unlockable shop item with a price of ${price}.");
		}

		public static void UpdateUnlockablePrice(UnlockableItemDef unlockableItemDef, int price)
		{
			try
			{
				unlockableItemDef.unlockable.shopSelectionNode.itemCost = price;
				unlockableItemDef.unlockable.shopSelectionNode.terminalOptions[0].result.itemCost = price;
			}
			catch
			{
			}
			Unlockables.UpdateUnlockablePrice(unlockableItemDef.unlockable, price);
			Plugin.logger.LogInfo((object)$"Updated \"{unlockableItemDef.unlockable.unlockableName}\" unlockable shop item price to ${price}.");
		}
	}
	internal class Utils
	{
		public static void SetCursorLockState(bool value)
		{
			if (!IsQuickMenuOpen())
			{
				Cursor.lockState = (CursorLockMode)(value ? 1 : 0);
				if (value)
				{
					Cursor.visible = false;
				}
				else if (!StartOfRound.Instance.localPlayerUsingController)
				{
					Cursor.visible = true;
				}
			}
		}

		public static string GetCurrentSaveFileName()
		{
			return GameNetworkManager.Instance.currentSaveFileName;
		}

		public static void SaveToCurrentSaveFile<T>(string key, T value)
		{
			ES3.Save<T>("com.github.zehsteam.Whiteboard." + key, value, GetCurrentSaveFileName());
		}

		public static T LoadFromCurrentSaveFile<T>(string key, T defaultValue = default(T))
		{
			return ES3.Load<T>("com.github.zehsteam.Whiteboard." + key, GetCurrentSaveFileName(), defaultValue);
		}

		public static bool KeyExistsInCurrentSaveFile(string key)
		{
			return ES3.KeyExists("com.github.zehsteam.Whiteboard." + key, GetCurrentSaveFileName());
		}

		public static bool ArrayContains(string[] array, string value)
		{
			foreach (string text in array)
			{
				if (text.Equals(value, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		public static bool IsQuickMenuOpen()
		{
			PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript();
			if ((Object)(object)localPlayerScript == (Object)null)
			{
				return false;
			}
			return localPlayerScript.quickMenuManager.isMenuOpen;
		}
	}
	[Serializable]
	public class WhiteboardData : INetworkSerializable
	{
		public string DisplayText;

		public string TextHexColor;

		public int FontSizeIndex;

		public int FontStyleIndex;

		public int FontFamilyIndex;

		public int HorizontalAlignmentIndex;

		public int VerticalAlignmentIndex;

		public WhiteboardData()
		{
			try
			{
				DisplayText = Plugin.ConfigManager.DefaultDisplayText.Value;
			}
			catch
			{
			}
			TextHexColor = "#000000";
			FontSizeIndex = 7;
		}

		public WhiteboardData(string displayText)
		{
			DisplayText = displayText;
			TextHexColor = "#000000";
			FontSizeIndex = 7;
		}

		public WhiteboardData(string displayText, string textHexColor, int fontSizeIndex, int fontStyleIndex, int fontFamilyIndex, int horizontalAlignmentIndex, int verticalAlignmentIndex)
			: this(displayText)
		{
			TextHexColor = textHexColor;
			FontSizeIndex = fontSizeIndex;
			FontStyleIndex = fontStyleIndex;
			FontFamilyIndex = fontFamilyIndex;
			HorizontalAlignmentIndex = horizontalAlignmentIndex;
			VerticalAlignmentIndex = verticalAlignmentIndex;
		}

		public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0074: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			serializer.SerializeValue(ref DisplayText, false);
			serializer.SerializeValue(ref TextHexColor, false);
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref FontSizeIndex, default(ForPrimitives));
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref FontStyleIndex, default(ForPrimitives));
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref FontFamilyIndex, default(ForPrimitives));
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref HorizontalAlignmentIndex, default(ForPrimitives));
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref VerticalAlignmentIndex, default(ForPrimitives));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.Whiteboard";

		public const string PLUGIN_NAME = "Whiteboard";

		public const string PLUGIN_VERSION = "1.1.4";
	}
}
namespace com.github.zehsteam.Whiteboard.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			AddNetworkPrefabs();
		}

		private static void AddNetworkPrefabs()
		{
			AddNetworkPrefab(Content.NetworkHandlerPrefab);
		}

		private static void AddNetworkPrefab(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				Plugin.logger.LogError((object)"Failed to add network prefab. GameObject is null.");
				return;
			}
			NetworkManager.Singleton.AddNetworkPrefab(prefab);
			Plugin.logger.LogInfo((object)("Registered \"" + ((Object)prefab).name + "\" network prefab."));
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			Plugin.Instance.SpawnWhiteboardEditorCanvas();
		}

		[HarmonyPatch("OpenMenu_performed")]
		[HarmonyPrefix]
		private static void OpenMenu_performedPatch()
		{
			if (!((Object)(object)WhiteboardEditorBehaviour.Instance == (Object)null) && WhiteboardEditorBehaviour.Instance.IsWindowOpen)
			{
				WhiteboardEditorBehaviour.Instance.CloseWindow();
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(ref PlayerControllerB __instance)
		{
			if (!((Object)(object)__instance != (Object)(object)PlayerUtils.GetLocalPlayerScript()) && (Object)(object)WhiteboardBehaviour.Instance != (Object)null)
			{
				WhiteboardBehaviour.Instance.SetWorldCanvasCamera();
			}
		}

		[HarmonyPatch("KillPlayer")]
		[HarmonyPostfix]
		private static void KillPlayerPatch()
		{
			if (!((Object)(object)WhiteboardEditorBehaviour.Instance == (Object)null) && WhiteboardEditorBehaviour.Instance.IsWindowOpen)
			{
				WhiteboardEditorBehaviour.Instance.CloseWindow();
			}
		}
	}
	[HarmonyPatch(typeof(ShipBuildModeManager))]
	internal class ShipBuildModeManagerPatch
	{
		[HarmonyPatch("PlayerMeetsConditionsToBuild")]
		[HarmonyPostfix]
		private static void PlayerMeetsConditionsToBuild(ref bool __result)
		{
			if (!((Object)(object)WhiteboardEditorBehaviour.Instance == (Object)null) && WhiteboardEditorBehaviour.Instance.IsWindowOpen)
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch()
		{
			SpawnNetworkHandler();
		}

		private static void SpawnNetworkHandler()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.IsHostOrServer)
			{
				GameObject val = Object.Instantiate<GameObject>(Content.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPatch("OnClientConnect")]
		[HarmonyPrefix]
		private static void OnClientConnectPatch(ref ulong clientId)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			ClientRpcParams val = default(ClientRpcParams);
			val.Send = new ClientRpcSendParams
			{
				TargetClientIds = new <>z__ReadOnlyArray<ulong>(new ulong[1] { clientId })
			};
			ClientRpcParams clientRpcParams = val;
			PluginNetworkBehaviour.Instance.SetWhiteboardUnlockablePriceClientRpc(Plugin.ConfigManager.Price.Value, clientRpcParams);
		}

		[HarmonyPatch("ReviveDeadPlayers")]
		[HarmonyPostfix]
		private static void ReviveDeadPlayersPatch()
		{
			if (!((Object)(object)WhiteboardEditorBehaviour.Instance == (Object)null) && WhiteboardEditorBehaviour.Instance.IsWindowOpen)
			{
				PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript();
				if (!((Object)(object)localPlayerScript == (Object)null))
				{
					localPlayerScript.disableMoveInput = true;
				}
			}
		}
	}
}
namespace com.github.zehsteam.Whiteboard.MonoBehaviours
{
	public class ColorPickerBehaviour : MonoBehaviour
	{
		public static ColorPickerBehaviour Instance;

		public GameObject ColorPickerWindowObject = null;

		public ColorPickerControlBehaviour ColorPickerControlBehaviour = null;

		public bool IsWindowOpen { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		private void Start()
		{
			CloseWindow();
		}

		public void OpenWindow()
		{
			if (WhiteboardEditorBehaviour.Instance.IsWindowOpen && !IsWindowOpen)
			{
				IsWindowOpen = true;
				ColorPickerWindowObject.SetActive(true);
				ColorPickerControlBehaviour.SetColor(WhiteboardEditorBehaviour.Instance.TextHexColor);
			}
		}

		public void CloseWindow()
		{
			IsWindowOpen = false;
			ColorPickerWindowObject.SetActive(false);
		}

		public void OnConfirmButtonClicked()
		{
			WhiteboardEditorBehaviour.Instance.SetTextHexColor(ColorPickerControlBehaviour.GetHexColor());
			CloseWindow();
		}

		public void OnCancelButtonClicked()
		{
			CloseWindow();
		}
	}
	public class ColorPickerControlBehaviour : MonoBehaviour
	{
		[SerializeField]
		private float _currentHue;

		[SerializeField]
		private float _currentSat;

		[SerializeField]
		private float _currentVal = 0f;

		[SerializeField]
		private RawImage _hueImage;

		[SerializeField]
		private RawImage _satValImage;

		[SerializeField]
		private RawImage _outputImage = null;

		[SerializeField]
		private Slider _hueSlider = null;

		[SerializeField]
		private TMP_InputField _hexColorInputField = null;

		[SerializeField]
		private SVImageControlBehaviour _svImageControlBehaviour = null;

		private Texture2D _hueTexture;

		private Texture2D _satValTexture;

		private Texture2D _outputTexture = null;

		private bool _updatedHexColorInputFieldInternally = false;

		private bool _initialized = false;

		private void Start()
		{
			Initialize();
		}

		private void Initialize()
		{
			if (!_initialized)
			{
				_initialized = true;
				CreateHueImage();
				CreateSatValImage();
				CreateOutputImage();
				UpdateOutputImage();
			}
		}

		private void CreateHueImage()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			_hueTexture = new Texture2D(1, 16);
			((Texture)_hueTexture).wrapMode = (TextureWrapMode)1;
			((Object)_hueTexture).name = "HueTexture";
			for (int i = 0; i < ((Texture)_hueTexture).height; i++)
			{
				_hueTexture.SetPixel(0, i, Color.HSVToRGB((float)i / (float)((Texture)_hueTexture).height, 1f, 0.95f));
			}
			_hueTexture.Apply();
			_currentHue = 0f;
			_hueImage.texture = (Texture)(object)_hueTexture;
		}

		private void CreateSatValImage()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			_satValTexture = new Texture2D(16, 16);
			((Texture)_satValTexture).wrapMode = (TextureWrapMode)1;
			((Object)_satValTexture).name = "SatValTexture";
			for (int i = 0; i < ((Texture)_satValTexture).height; i++)
			{
				for (int j = 0; j < ((Texture)_satValTexture).width; j++)
				{
					_satValTexture.SetPixel(j, i, Color.HSVToRGB(_currentHue, (float)j / (float)((Texture)_satValTexture).width, (float)i / (float)((Texture)_satValTexture).height));
				}
			}
			_satValTexture.Apply();
			_currentSat = 0f;
			_currentVal = 0f;
			_satValImage.texture = (Texture)(object)_satValTexture;
		}

		private void CreateOutputImage()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_003f: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			_outputTexture = new Texture2D(1, 16);
			((Texture)_outputTexture).wrapMode = (TextureWrapMode)1;
			((Object)_outputTexture).name = "OutputTexture";
			Color val = Color.HSVToRGB(_currentHue, _currentSat, _currentVal);
			for (int i = 0; i < ((Texture)_outputTexture).height; i++)
			{
				_outputTexture.SetPixel(0, i, val);
			}
			_outputTexture.Apply();
			_outputImage.texture = (Texture)(object)_outputTexture;
		}

		private void UpdateOutputImage()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.HSVToRGB(_currentHue, _currentSat, _currentVal);
			for (int i = 0; i < ((Texture)_outputTexture).height; i++)
			{
				_outputTexture.SetPixel(0, i, val);
			}
			_outputTexture.Apply();
			_updatedHexColorInputFieldInternally = true;
			_hexColorInputField.text = GetHexColor();
		}

		public void SetSatVal(float saturation, float value)
		{
			_currentSat = saturation;
			_currentVal = value;
			UpdateOutputImage();
		}

		public void UpdateSatValImage()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			_currentHue = _hueSlider.value;
			for (int i = 0; i < ((Texture)_satValTexture).height; i++)
			{
				for (int j = 0; j < ((Texture)_satValTexture).width; j++)
				{
					_satValTexture.SetPixel(j, i, Color.HSVToRGB(_currentHue, (float)j / (float)((Texture)_satValTexture).width, (float)i / (float)((Texture)_satValTexture).height));
				}
			}
			_satValTexture.Apply();
			UpdateOutputImage();
		}

		public void OnHexColorInputFieldValueChanged()
		{
			if (_updatedHexColorInputFieldInternally)
			{
				_updatedHexColorInputFieldInternally = false;
			}
			else if (_hexColorInputField.text.Length >= 6)
			{
				string hexColor = ((!_hexColorInputField.text.StartsWith("#")) ? ("#" + _hexColorInputField.text) : _hexColorInputField.text);
				UpdateColor(hexColor);
			}
		}

		private void UpdateColor(string hexColor)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			if (ColorUtility.TryParseHtmlString(hexColor, ref val))
			{
				Color.RGBToHSV(val, ref _currentHue, ref _currentSat, ref _currentVal);
				_hueSlider.value = _currentHue;
				UpdateOutputImage();
				_svImageControlBehaviour.SetPickerLocation(_currentSat, _currentVal);
			}
		}

		public void SetColor(string hexColor)
		{
			Initialize();
			_updatedHexColorInputFieldInternally = true;
			_hexColorInputField.text = hexColor;
			UpdateColor(hexColor);
		}

		public string GetHexColor()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.HSVToRGB(_currentHue, _currentSat, _currentVal);
			return "#" + ColorUtility.ToHtmlStringRGB(val);
		}
	}
	internal class PluginNetworkBehaviour : NetworkBehaviour
	{
		public static PluginNetworkBehaviour Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		[ClientRpc]
		public void SetWhiteboardUnlockablePriceClientRpc(int price, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//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_0071: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(151062475u, clientRpcParams, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, price);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 151062475u, clientRpcParams, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					UnlockableHelper.UpdateUnlockablePrice(Content.WhiteboardUnlockableItemDef, price);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PluginNetworkBehaviour()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(151062475u, new RpcReceiveHandler(__rpc_handler_151062475));
		}

		private static void __rpc_handler_151062475(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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)
			{
				int price = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref price);
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PluginNetworkBehaviour)(object)target).SetWhiteboardUnlockablePriceClientRpc(price, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PluginNetworkBehaviour";
		}
	}
	public class SVImageControlBehaviour : MonoBehaviour, IDragHandler, IEventSystemHandler, IPointerClickHandler
	{
		[SerializeField]
		private ColorPickerControlBehaviour _colorPickerControlBehaviour;

		[SerializeField]
		private Image _pickerImage;

		private RectTransform _rectTransform;

		private RectTransform _pickerTransform;

		private void Awake()
		{
			//IL_002a: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			_rectTransform = ((Component)this).GetComponent<RectTransform>();
			_pickerTransform = ((Component)_pickerImage).GetComponent<RectTransform>();
			((Transform)_pickerTransform).localPosition = Vector2.op_Implicit(new Vector2(0f - _rectTransform.sizeDelta.x * 0.5f, 0f - _rectTransform.sizeDelta.y * 0.5f));
		}

		private void UpdateColor(PointerEventData eventData)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_009f: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Transform)_rectTransform).InverseTransformPoint(Vector2.op_Implicit(eventData.position));
			float num = _rectTransform.sizeDelta.x * 0.5f;
			float num2 = _rectTransform.sizeDelta.y * 0.5f;
			val.x = Mathf.Clamp(val.x, 0f - num, num);
			val.y = Mathf.Clamp(val.y, 0f - num2, num2);
			float num3 = val.x + num;
			float num4 = val.y + num2;
			float saturation = num3 / _rectTransform.sizeDelta.x;
			float num5 = num4 / _rectTransform.sizeDelta.y;
			((Transform)_pickerTransform).localPosition = val;
			((Graphic)_pickerImage).color = Color.HSVToRGB(0f, 0f, 1f - num5);
			_colorPickerControlBehaviour.SetSatVal(saturation, num5);
		}

		public void OnDrag(PointerEventData eventData)
		{
			UpdateColor(eventData);
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			UpdateColor(eventData);
		}

		public void SetPickerLocation(float saturation, float value)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			float num = saturation * _rectTransform.sizeDelta.x - _rectTransform.sizeDelta.x * 0.5f;
			float num2 = value * _rectTransform.sizeDelta.y - _rectTransform.sizeDelta.y * 0.5f;
			((Transform)_pickerTransform).localPosition = Vector2.op_Implicit(new Vector2(num, num2));
			((Graphic)_pickerImage).color = Color.HSVToRGB(0f, 0f, 1f - value);
			Plugin.Instance.LogInfoExtended($"SetPickerLocation (saturation: {saturation}, value: {value}), (x: {num}, y: {num2})");
		}
	}
	public class WhiteboardBehaviour : NetworkBehaviour
	{
		public static WhiteboardBehaviour Instance;

		public InteractTrigger InteractTrigger;

		public Canvas WorldCanvas = null;

		public TextMeshProUGUI WhiteboardText = null;

		public float[] FontSizeArray = Array.Empty<float>();

		public FontStyles[] FontStyleArray = Array.Empty<FontStyles>();

		public TMP_FontAsset[] FontAssetArray = Array.Empty<TMP_FontAsset>();

		public SpriteSheetData EmotesSpriteSheetData = null;

		[HideInInspector]
		public NetworkVariable<bool> IsHostOnly = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public WhiteboardData Data { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Data = new WhiteboardData();
		}

		private void Start()
		{
			if ((Object)(object)EmotesSpriteSheetData != (Object)null)
			{
				((TMP_Text)WhiteboardText).spriteAsset = EmotesSpriteSheetData.SpriteAsset;
			}
			if (PlayerUtils.IsLocalPlayerSpawned())
			{
				SetWorldCanvasCamera();
			}
			if (Plugin.IsHostOrServer)
			{
				LoadData();
			}
			else
			{
				RequestDataServerRpc(NetworkUtils.GetLocalClientId());
			}
		}

		public override void OnNetworkSpawn()
		{
			NetworkVariable<bool> isHostOnly = IsHostOnly;
			isHostOnly.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isHostOnly.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsHostOnlyChanged));
			if (Plugin.IsHostOrServer)
			{
				IsHostOnly.Value = Plugin.ConfigManager.HostOnly.Value;
			}
			else if (IsHostOnly.Value)
			{
				InteractTrigger.interactable = false;
			}
		}

		public override void OnNetworkDespawn()
		{
			NetworkVariable<bool> isHostOnly = IsHostOnly;
			isHostOnly.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isHostOnly.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsHostOnlyChanged));
			if (!((Object)(object)WhiteboardEditorBehaviour.Instance == (Object)null) && WhiteboardEditorBehaviour.Instance.IsWindowOpen)
			{
				WhiteboardEditorBehaviour.Instance.CloseWindow();
			}
		}

		private void OnIsHostOnlyChanged(bool previous, bool current)
		{
			if (!Plugin.IsHostOrServer)
			{
				InteractTrigger.interactable = !current;
			}
		}

		public void OnInteract()
		{
			if ((Object)(object)WhiteboardEditorBehaviour.Instance == (Object)null)
			{
				Plugin.logger.LogError((object)"Failed to open whiteboard editor window. WhiteboardEditorBehaviour instance was not found.");
			}
			else
			{
				WhiteboardEditorBehaviour.Instance.OpenWindow();
			}
		}

		public void SetWorldCanvasCamera()
		{
			PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript();
			if ((Object)(object)localPlayerScript == (Object)null)
			{
				Plugin.logger.LogWarning((object)"Failed to set whiteboard world canvas camera. Could not find the local player script or the local player is not spawned yet.");
				return;
			}
			WorldCanvas.worldCamera = localPlayerScript.gameplayCamera;
			Plugin.Instance.LogInfoExtended("Set whiteboard world canvas camera.");
		}

		private void LoadData()
		{
			if (Plugin.IsHostOrServer)
			{
				string displayText = Utils.LoadFromCurrentSaveFile("Whiteboard_DisplayText", Plugin.ConfigManager.DefaultDisplayText.Value);
				string textHexColor = Utils.LoadFromCurrentSaveFile("Whiteboard_TextHexColor", "#000000");
				int fontSizeIndex = Utils.LoadFromCurrentSaveFile("Whiteboard_FontSizeIndex", 7);
				int fontStyleIndex = Utils.LoadFromCurrentSaveFile("Whiteboard_FontStyleIndex", 0);
				int fontFamilyIndex = Utils.LoadFromCurrentSaveFile("Whiteboard_FontFamilyIndex", 0);
				int horizontalAlignmentIndex = Utils.LoadFromCurrentSaveFile("Whiteboard_HorizontalAlignmentIndex", 0);
				int verticalAlignmentIndex = Utils.LoadFromCurrentSaveFile("Whiteboard_VerticalAlignmentIndex", 0);
				SetData(new WhiteboardData(displayText, textHexColor, fontSizeIndex, fontStyleIndex, fontFamilyIndex, horizontalAlignmentIndex, verticalAlignmentIndex));
			}
		}

		private void SaveData()
		{
			if (Plugin.IsHostOrServer)
			{
				Utils.SaveToCurrentSaveFile("Whiteboard_DisplayText", Data.DisplayText);
				Utils.SaveToCurrentSaveFile("Whiteboard_TextHexColor", Data.TextHexColor);
				Utils.SaveToCurrentSaveFile("Whiteboard_FontSizeIndex", Data.FontSizeIndex);
				Utils.SaveToCurrentSaveFile("Whiteboard_FontStyleIndex", Data.FontStyleIndex);
				Utils.SaveToCurrentSaveFile("Whiteboard_FontFamilyIndex", Data.FontFamilyIndex);
				Utils.SaveToCurrentSaveFile("Whiteboard_HorizontalAlignmentIndex", Data.HorizontalAlignmentIndex);
				Utils.SaveToCurrentSaveFile("Whiteboard_VerticalAlignmentIndex", Data.VerticalAlignmentIndex);
			}
		}

		public void SetData(WhiteboardData data)
		{
			SetDataServerRpc(data, NetworkUtils.GetLocalClientId());
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetDataServerRpc(WhiteboardData data, int fromClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			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(2180141345u, val, (RpcDelivery)0);
				bool flag = data != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<WhiteboardData>(ref data, default(ForNetworkSerializable));
				}
				BytePacker.WriteValueBitPacked(val2, fromClientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2180141345u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			if (fromClientId == NetworkUtils.GetLocalClientId())
			{
				Plugin.Instance.LogInfoExtended("Set the whiteboard data. Display text: \"" + data.DisplayText + "\".");
			}
			else
			{
				if (Plugin.ConfigManager.HostOnly.Value)
				{
					Plugin.logger.LogWarning((object)$"Client #{fromClientId} tried to edit the whiteboard while HostOnly mode is enabled.");
					return;
				}
				Plugin.Instance.LogInfoExtended($"Client #{fromClientId} set the whiteboard data. Display text: \"{data.DisplayText}\".");
			}
			SetDataClientRpc(data);
			SetDataOnLocalClient(data);
		}

		[ClientRpc]
		private void SetDataClientRpc(WhiteboardData data)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2144233494u, val, (RpcDelivery)0);
				bool flag = data != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<WhiteboardData>(ref data, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2144233494u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !Plugin.IsHostOrServer)
			{
				SetDataOnLocalClient(data);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestDataServerRpc(int toClientId)
		{
			//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_0071: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3228134666u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, toClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3228134666u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Plugin.Instance.LogInfoExtended($"Recieved request for whiteboard data from client #{toClientId}");
					ClientRpcParams val3 = default(ClientRpcParams);
					val3.Send = new ClientRpcSendParams
					{
						TargetClientIds = new <>z__ReadOnlyArray<ulong>(new ulong[1] { (ulong)toClientId })
					};
					ClientRpcParams clientRpcParams = val3;
					RequestDataClientRpc(Data, clientRpcParams);
				}
			}
		}

		[ClientRpc]
		private void RequestDataClientRpc(WhiteboardData data, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4129067645u, clientRpcParams, (RpcDelivery)0);
				bool flag = data != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<WhiteboardData>(ref data, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 4129067645u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Plugin.Instance.LogInfoExtended("Recieved whiteboard data.");
				SetDataOnLocalClient(data);
			}
		}

		public void SetDataOnLocalClient(WhiteboardData data)
		{
			Data = data;
			SaveData();
			UpdateWorldCanvas();
			LogDataExtended();
		}

		private void UpdateWorldCanvas()
		{
			UpdateWhiteboardText();
		}

		private void UpdateWhiteboardText()
		{
			//IL_0160: 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_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: 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)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			if (Data == null)
			{
				Plugin.logger.LogWarning((object)"WhiteboardData is null in WhiteboardBehaviour.UpdateWhiteboardText(); Setting WhiteboardData to default.");
				Data = new WhiteboardData();
			}
			string text = string.Empty;
			if (!string.IsNullOrWhiteSpace(Data.TextHexColor))
			{
				text = text + "<color=" + Data.TextHexColor + ">";
			}
			text = ((!((Object)(object)EmotesSpriteSheetData != (Object)null)) ? (text + Data.DisplayText) : (text + EmotesSpriteSheetData.GetParsedText(Data.DisplayText)));
			if (Data.FontFamilyIndex == 2)
			{
				text = text.ToLower();
			}
			((TMP_Text)WhiteboardText).text = text;
			((TMP_Text)WhiteboardText).fontSize = FontSizeArray[Data.FontSizeIndex];
			((TMP_Text)WhiteboardText).fontStyle = FontStyleArray[Data.FontStyleIndex];
			((TMP_Text)WhiteboardText).font = FontAssetArray[Data.FontFamilyIndex];
			TextMeshProUGUI whiteboardText = WhiteboardText;
			int horizontalAlignmentIndex = Data.HorizontalAlignmentIndex;
			if (1 == 0)
			{
			}
			HorizontalAlignmentOptions horizontalAlignment = (HorizontalAlignmentOptions)(horizontalAlignmentIndex switch
			{
				0 => 1, 
				1 => 2, 
				2 => 4, 
				_ => 1, 
			});
			if (1 == 0)
			{
			}
			((TMP_Text)whiteboardText).horizontalAlignment = horizontalAlignment;
			TextMeshProUGUI whiteboardText2 = WhiteboardText;
			int verticalAlignmentIndex = Data.VerticalAlignmentIndex;
			if (1 == 0)
			{
			}
			VerticalAlignmentOptions verticalAlignment = (VerticalAlignmentOptions)(verticalAlignmentIndex switch
			{
				0 => 256, 
				1 => 512, 
				2 => 1024, 
				_ => 256, 
			});
			if (1 == 0)
			{
			}
			((TMP_Text)whiteboardText2).verticalAlignment = verticalAlignment;
		}

		private void LogDataExtended()
		{
			string empty = string.Empty;
			empty = empty + "DisplayText: \n\"" + Data.DisplayText + "\"\n\n";
			empty = empty + "TextHexColor: \"" + Data.TextHexColor + "\"\n";
			empty += $"FontSizeIndex: {Data.FontSizeIndex}\n";
			empty += $"FontStyleIndex: {Data.FontStyleIndex}\n";
			empty += $"FontFamilyIndex: {Data.FontFamilyIndex}\n";
			empty += $"HorizontalAlignmentIndex: {Data.HorizontalAlignmentIndex}\n";
			empty += $"VerticalAlignmentIndex: {Data.VerticalAlignmentIndex}\n";
			Plugin.Instance.LogInfoExtended("\n" + empty.Trim() + "\n\n");
		}

		protected override void __initializeVariables()
		{
			if (IsHostOnly == null)
			{
				throw new Exception("WhiteboardBehaviour.IsHostOnly cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)IsHostOnly).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)IsHostOnly, "IsHostOnly");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)IsHostOnly);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_WhiteboardBehaviour()
		{
			//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
			NetworkManager.__rpc_func_table.Add(2180141345u, new RpcReceiveHandler(__rpc_handler_2180141345));
			NetworkManager.__rpc_func_table.Add(2144233494u, new RpcReceiveHandler(__rpc_handler_2144233494));
			NetworkManager.__rpc_func_table.Add(3228134666u, new RpcReceiveHandler(__rpc_handler_3228134666));
			NetworkManager.__rpc_func_table.Add(4129067645u, new RpcReceiveHandler(__rpc_handler_4129067645));
		}

		private static void __rpc_handler_2180141345(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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				WhiteboardData data = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<WhiteboardData>(ref data, default(ForNetworkSerializable));
				}
				int fromClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref fromClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WhiteboardBehaviour)(object)target).SetDataServerRpc(data, fromClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2144233494(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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				WhiteboardData dataClientRpc = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<WhiteboardData>(ref dataClientRpc, default(ForNetworkSerializable));
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((WhiteboardBehaviour)(object)target).SetDataClientRpc(dataClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3228134666(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int toClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref toClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WhiteboardBehaviour)(object)target).RequestDataServerRpc(toClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4129067645(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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				WhiteboardData data = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<WhiteboardData>(ref data, default(ForNetworkSerializable));
				}
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((WhiteboardBehaviour)(object)target).RequestDataClientRpc(data, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "WhiteboardBehaviour";
		}
	}
	public class WhiteboardEditorBehaviour : MonoBehaviour
	{
		public static WhiteboardEditorBehaviour Instance;

		public GameObject EditorWindowObject = null;

		public TMP_InputField DisplayTextInputField = null;

		public GameObject HostOnlyObject = null;

		public Button HostOnlyButton = null;

		public GameObject HostOnlyCheckedObject = null;

		public Image TextColorPreviewImage = null;

		public TMP_Dropdown FontSizeDropdown = null;

		public TMP_Dropdown FontStyleDropdown = null;

		public TMP_Dropdown FontFamilyDropdown = null;

		public TMP_Dropdown HorizontalAlignmentDropdown = null;

		public TMP_Dropdown VerticalAlignmentDropdown = null;

		public const int DefaultFontSizeIndex = 7;

		public const string DefaultTextHexColor = "#000000";

		public bool IsWindowOpen { get; private set; }

		public string TextHexColor { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
		}

		private void Start()
		{
			CloseWindow();
			TextHexColor = "#000000";
		}

		public void OpenWindow()
		{
			if ((Object)(object)WhiteboardBehaviour.Instance == (Object)null)
			{
				Plugin.logger.LogError((object)"Failed to open whiteboard editor window. Whiteboard instance was not found.");
			}
			else if (!Utils.IsQuickMenuOpen() && !IsWindowOpen)
			{
				HostOnlyObject.SetActive(Plugin.IsHostOrServer);
				if (Plugin.IsHostOrServer)
				{
					UpdateHostOnlyCheckbox();
				}
				IsWindowOpen = true;
				EditorWindowObject.SetActive(true);
				SetDataToUI(WhiteboardBehaviour.Instance.Data);
				Utils.SetCursorLockState(value: false);
				PlayerUtils.SetControlsEnabled(value: false);
			}
		}

		public void CloseWindow()
		{
			if (ColorPickerBehaviour.Instance.IsWindowOpen)
			{
				ColorPickerBehaviour.Instance.CloseWindow();
			}
			IsWindowOpen = false;
			EditorWindowObject.SetActive(false);
			Utils.SetCursorLockState(value: true);
			PlayerUtils.SetControlsEnabled(value: true);
		}

		public void OnConfirmButtonClicked()
		{
			if ((Object)(object)WhiteboardBehaviour.Instance == (Object)null)
			{
				Plugin.logger.LogError((object)"Failed to confirm whiteboard changes. Whiteboard instance was not found.");
				return;
			}
			WhiteboardBehaviour.Instance.SetData(GetDataFromUI());
			CloseWindow();
		}

		public void OnCancelButtonClicked()
		{
			CloseWindow();
		}

		public void OnResetButtonClicked()
		{
			SetDataToUI(new WhiteboardData());
		}

		public void OnHostOnlyButtonClicked()
		{
			if (Plugin.IsHostOrServer)
			{
				Plugin.ConfigManager.HostOnly.Value = !Plugin.ConfigManager.HostOnly.Value;
				UpdateHostOnlyCheckbox();
			}
		}

		public void OnColorPickerButtonClicked()
		{
			if (!((Object)(object)ColorPickerBehaviour.Instance == (Object)null))
			{
				ColorPickerBehaviour.Instance.OpenWindow();
			}
		}

		private void UpdateHostOnlyCheckbox()
		{
			HostOnlyCheckedObject.SetActive(Plugin.ConfigManager.HostOnly.Value);
		}

		private WhiteboardData GetDataFromUI()
		{
			string text = DisplayTextInputField.text;
			string textHexColor = TextHexColor;
			int value = FontSizeDropdown.value;
			int value2 = FontStyleDropdown.value;
			int value3 = FontFamilyDropdown.value;
			int value4 = HorizontalAlignmentDropdown.value;
			int value5 = VerticalAlignmentDropdown.value;
			return new WhiteboardData(text, textHexColor, value, value2, value3, value4, value5);
		}

		private void SetDataToUI(WhiteboardData data)
		{
			if (data == null)
			{
				Plugin.logger.LogWarning((object)"WhiteboardData is null in WhiteboardEditorBehaviour.SetDataToUI(); Setting WhiteboardData to default.");
				data = new WhiteboardData();
			}
			try
			{
				DisplayTextInputField.text = data.DisplayText;
				SetTextHexColor(data.TextHexColor);
				FontSizeDropdown.value = data.FontSizeIndex;
				FontStyleDropdown.value = data.FontStyleIndex;
				FontFamilyDropdown.value = data.FontFamilyIndex;
				HorizontalAlignmentDropdown.value = data.HorizontalAlignmentIndex;
				VerticalAlignmentDropdown.value = data.VerticalAlignmentIndex;
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Failed to set whiteboard editor ui data.\n\n{arg}");
			}
		}

		private void UpdateTextColorPreview()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			if (ColorUtility.TryParseHtmlString(TextHexColor, ref color))
			{
				((Graphic)TextColorPreviewImage).color = color;
			}
		}

		public void SetTextHexColor(string newTextColorHex)
		{
			TextHexColor = newTextColorHex;
			UpdateTextColorPreview();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace com.github.zehsteam.Whiteboard.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

plugins/Frizzbee dependencies.dll

Decompiled a day ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using LethalLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Frizzbee dependencies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Frizzbee dependencies")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b4bd11df-1c87-4390-9600-40b8e5dc00c2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Frizzbee_dependencies;

[BepInPlugin("TreyFrizzBee", "FrizzBee", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string GUID = "TreyFrizzBee";

	private const string NAME = "FrizzBee";

	private const string VERSION = "1.0.0";

	public static Plugin instance;

	private void Awake()
	{
		instance = this;
		string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemmod");
		AssetBundle val = AssetBundle.LoadFromFile(text);
		ConfigEntry<int> val2 = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Rarity", 28, "Higher means more common.");
		ConfigEntry<int> val3 = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxValue", 120, "Determines the Max value of the Scrap. (Note: The max number does not mean the max amount of credits, it's a little skewed. So 120 would be around 50.)");
		ConfigEntry<int> val4 = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MinValue", 80, "Determines the Min value of the Scrap. (Note: The min number does not mean the min amount of credits, it's a little skewed. So 80 would be around 30.)");
		Item val5 = val.LoadAsset<Item>("Assets/ModelsTrey/FrizzBee/FrizzBeeScript.asset");
		NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
		Utilities.FixMixerGroups(val5.spawnPrefab);
		Items.RegisterScrap(val5, val2.Value, (LevelTypes)(-1));
		val5.minValue = val4.Value;
		val5.maxValue = val3.Value;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"FrizzBee Yay");
	}
}
internal class keyframe
{
	private int v1;

	private int v2;

	public keyframe(int v1, int v2)
	{
		this.v1 = v1;
		this.v2 = v2;
	}
}

plugins/ImmersiveScrap.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using ImmersiveScrap.Configs;
using ImmersiveScrap.Keybinds;
using ImmersiveScrap.Misc;
using ImmersiveScrap.NetcodePatcher;
using LethalCompanyInputUtils.Api;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ImmersiveScrap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Immersive Scrap mod with 40+ Vanilla style Scrap!")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: AssemblyInformationalVersion("1.4.1+423798bcc22618cfc1f7fa83f7357cbf3e6b55ee")]
[assembly: AssemblyProduct("ImmersiveScrap")]
[assembly: AssemblyTitle("ImmersiveScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ImmersiveScrap
{
	[BepInPlugin("ImmersiveScrap", "ImmersiveScrap", "1.4.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static GameObject explosionPrefab;

		internal static IngameKeybinds InputActionsInstance;

		public static ImmersiveScrapConfig ModConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			InputActionsInstance = new IngameKeybinds();
			ModConfig = new ImmersiveScrapConfig(((BaseUnityPlugin)this).Config);
			AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)OnExtendedModRegistered, "XuXiaolan", "ImmersiveScraps");
			AssetBundleLoader.AddOnLethalBundleLoadedListener((Action<AssetBundle>)OnLethalBundleLoaded, "immersivescrapassets.lethalbundle");
			InitializeNetworkBehaviours();
			Logger.LogInfo((object)"Plugin ImmersiveScrap is loaded!");
		}

		internal static void OnExtendedModRegistered(ExtendedMod extendedMod)
		{
			if ((Object)(object)extendedMod == (Object)null)
			{
				return;
			}
			foreach (ExtendedItem extendedItem in extendedMod.ExtendedItems)
			{
				string configValueForItem = GetConfigValueForItem(extendedItem.Item.itemName);
				if (!string.IsNullOrEmpty(configValueForItem))
				{
					List<StringWithRarity> collection = ConfigParsing(configValueForItem);
					extendedItem.LevelMatchingProperties.levelTags.AddRange(collection);
					extendedItem.LevelMatchingProperties.planetNames.AddRange(collection);
					Logger.LogInfo((object)$"Updated matching properties for {extendedItem.Item}.");
				}
			}
		}

		internal static void OnLethalBundleLoaded(AssetBundle assetBundle)
		{
			_ = (Object)(object)assetBundle == (Object)null;
		}

		private static string GetConfigValueForItem(string itemName)
		{
			switch (itemName)
			{
			case "Alcohol Flask":
				return ImmersiveScrapConfig.ConfigAlcoholSpawnWeight.Value;
			case "ImmersiveAnvil":
				return ImmersiveScrapConfig.ConfigAnvilSpawnWeight.Value;
			case "IBaseball bat":
				return ImmersiveScrapConfig.ConfigBaseballSpawnWeight.Value;
			case "Beer can":
				return ImmersiveScrapConfig.ConfigBeercanSpawnWeight.Value;
			case "IBrick":
				return ImmersiveScrapConfig.ConfigBrickSpawnWeight.Value;
			case "Broken engine":
				return ImmersiveScrapConfig.ConfigBrokenEngineSpawnWeight.Value;
			case "Bucket":
				return ImmersiveScrapConfig.ConfigBucketSpawnWeight.Value;
			case "Can paint":
				return ImmersiveScrapConfig.ConfigCanPaintSpawnWeight.Value;
			case "Canteen":
				return ImmersiveScrapConfig.ConfigCanteenSpawnWeight.Value;
			case "Car battery":
				return ImmersiveScrapConfig.ConfigCarBatterySpawnWeight.Value;
			case "Clamp":
				return ImmersiveScrapConfig.ConfigClampSpawnWeight.Value;
			case "IClock":
				return ImmersiveScrapConfig.ConfigClockSpawnWeight.Value;
			case "IFan":
				return ImmersiveScrapConfig.ConfigFanSpawnWeight.Value;
			case "Fancy Painting":
				return ImmersiveScrapConfig.ConfigFancyPaintingSpawnWeight.Value;
			case "IFireAxe":
				return ImmersiveScrapConfig.ConfigFireAxeSpawnWeight.Value;
			case "Fire extinguisher":
				return ImmersiveScrapConfig.ConfigFireExtingSpawnWeight.Value;
			case "Fire hydrant":
				return ImmersiveScrapConfig.ConfigFireHydrantSpawnWeight.Value;
			case "Food can":
				return ImmersiveScrapConfig.ConfigFoodCanSpawnWeight.Value;
			case "Gameboy":
				return ImmersiveScrapConfig.ConfigGameboySpawnWeight.Value;
			case "Garbage":
				return ImmersiveScrapConfig.ConfigGarbageSpawnWeight.Value;
			case "ImmersiveHammer":
				return ImmersiveScrapConfig.ConfigHammerSpawnWeight.Value;
			case "Jerrycan":
				return ImmersiveScrapConfig.ConfigJerryCanSpawnWeight.Value;
			case "IKeyboard":
				return ImmersiveScrapConfig.ConfigKeyboardSpawnWeight.Value;
			case "ILantern":
				return ImmersiveScrapConfig.ConfigLanternSpawnWeight.Value;
			case "Library lamp":
				return ImmersiveScrapConfig.ConfigLibraryLampSpawnWeight.Value;
			case "ImmersivePlant":
				return ImmersiveScrapConfig.ConfigPlantSpawnWeight.Value;
			case "Pliers":
				return ImmersiveScrapConfig.ConfigPliersSpawnWeight.Value;
			case "Plunger":
				return ImmersiveScrapConfig.ConfigPlungerSpawnWeight.Value;
			case "Retro Toy":
				return ImmersiveScrapConfig.ConfigRetroToySpawnWeight.Value;
			case "Screwdriver":
				return ImmersiveScrapConfig.ConfigScrewdriverSpawnWeight.Value;
			case "Sink":
				return ImmersiveScrapConfig.ConfigSinkSpawnWeight.Value;
			case "Socket Wrench":
				return ImmersiveScrapConfig.ConfigSocketSpawnWeight.Value;
			case "ISqueaky toy":
				return ImmersiveScrapConfig.ConfigSqueakyToySpawnWeight.Value;
			case "Suitcase":
				return ImmersiveScrapConfig.ConfigSuitcaseSpawnWeight.Value;
			case "Toaster":
				return ImmersiveScrapConfig.ConfigToasterSpawnWeight.Value;
			case "IToolbox":
				return ImmersiveScrapConfig.ConfigToolboxSpawnWeight.Value;
			case "Top hat":
				return ImmersiveScrapConfig.ConfigTophatSpawnWeight.Value;
			case "Traffic cone":
				return ImmersiveScrapConfig.ConfigTrafficConeSpawnWeight.Value;
			case "Vent":
				return ImmersiveScrapConfig.ConfigVentSpawnWeight.Value;
			case "Watering Can":
				return ImmersiveScrapConfig.ConfigWateringCanSpawnWeight.Value;
			case "Wheel":
				return ImmersiveScrapConfig.ConfigWheelSpawnWeight.Value;
			case "Wine bottle":
				return ImmersiveScrapConfig.ConfigWineBottleSpawnWeight.Value;
			case "Wrench":
				return ImmersiveScrapConfig.ConfigWrenchSpawnWeight.Value;
			default:
				Logger.LogInfo((object)("No configuration found for item type: " + itemName));
				return null;
			}
		}

		private static List<StringWithRarity> ConfigParsing(string configMoonRarity)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			List<StringWithRarity> list = new List<StringWithRarity>();
			foreach (string item in from s in configMoonRarity.Split(",")
				select s.Trim())
			{
				string[] array = item.Split(":");
				if (array.Length == 2)
				{
					string text = array[0];
					if (int.TryParse(array[1], out var result))
					{
						list.Add(new StringWithRarity(text, result));
						Logger.LogInfo((object)$"Registered spawn rate for {text} to {result}");
					}
				}
			}
			return list;
		}

		private void InitializeNetworkBehaviours()
		{
			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);
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ImmersiveScrap";

		public const string PLUGIN_NAME = "ImmersiveScrap";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace ImmersiveScrap.Misc
{
	public class ThrowableNoisemaker : NoisemakerProp
	{
		public bool throwWithRight;

		public bool beingThrown;

		public AnimationCurve itemFallCurve;

		public AnimationCurve itemVerticalFallCurve;

		public AnimationCurve itemVerticalFallCurveNoBounce;

		public RaycastHit itemHit;

		public Ray itemThrowRay;

		public override void FallWithCurve()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_005b: 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_007e: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition;
			float magnitude = ((Vector3)(ref val)).magnitude;
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, ((GrabbableObject)this).itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude);
			((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, itemFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			if (magnitude > 5f)
			{
				((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), itemVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime));
			}
			else
			{
				((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), itemVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime));
			}
			((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
		}

		public Vector3 GetItemThrowDestination()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_0082: 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_0094: 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_009e: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			itemThrowRay = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward);
			float num = 30f;
			position = ((!Physics.Raycast(itemThrowRay, ref itemHit, num, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) ? ((Ray)(ref itemThrowRay)).GetPoint(num) : ((Ray)(ref itemThrowRay)).GetPoint(((RaycastHit)(ref itemHit)).distance - 0.05f));
			itemThrowRay = new Ray(position, Vector3.down);
			if (Physics.Raycast(itemThrowRay, ref itemHit, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref itemHit)).point + Vector3.up * 0.05f;
			}
			return ((Ray)(ref itemThrowRay)).GetPoint(30f);
		}

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

		protected internal override string __getTypeName()
		{
			return "ThrowableNoisemaker";
		}
	}
	public class Utilities
	{
		private static Dictionary<int, int> _masksByLayer;

		public static void Init()
		{
			GenerateLayerMap();
		}

		public static void GenerateLayerMap()
		{
			_masksByLayer = new Dictionary<int, int>();
			for (int i = 0; i < 32; i++)
			{
				int num = 0;
				for (int j = 0; j < 32; j++)
				{
					if (!Physics.GetIgnoreLayerCollision(i, j))
					{
						num |= 1 << j;
					}
				}
				_masksByLayer.Add(i, num);
			}
		}

		public static Transform TryFindRoot(Transform child)
		{
			Transform val = child;
			while ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)((Component)val).GetComponent<NetworkObject>() != (Object)null)
				{
					return val;
				}
				val = ((Component)val).transform.parent;
			}
			return null;
		}

		public static int MaskForLayer(int layer)
		{
			return _masksByLayer[layer];
		}

		public static void TeleportPlayer(int playerObj, Vector3 teleportPos)
		{
			//IL_004c: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj];
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val);
			}
			val.isInElevator = false;
			val.isInHangarShipRoom = false;
			val.isInsideFactory = true;
			val.averageVelocity = 0f;
			val.velocityLastFrame = Vector3.zero;
			StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true);
			StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
			if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
		}

		public static IEnumerator TeleportPlayerBody(int playerObj, Vector3 teleportPosition)
		{
			//IL_000e: 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)
			float startTime = Time.realtimeSinceStartup;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj].deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f));
			if (StartOfRound.Instance.inShipPhase || SceneManager.sceneCount <= 1)
			{
				yield break;
			}
			DeadBodyInfo deadBody = StartOfRound.Instance.allPlayerScripts[playerObj].deadBody;
			if ((Object)(object)deadBody != (Object)null)
			{
				deadBody.attachedTo = null;
				deadBody.attachedLimb = null;
				deadBody.secondaryAttachedLimb = null;
				deadBody.secondaryAttachedTo = null;
				if ((Object)(object)deadBody.grabBodyObject != (Object)null && deadBody.grabBodyObject.isHeld && (Object)(object)deadBody.grabBodyObject.playerHeldBy != (Object)null)
				{
					deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false);
				}
				deadBody.isInShip = false;
				deadBody.parentedToShip = false;
				((Component)deadBody).transform.SetParent((Transform)null, true);
				deadBody.SetRagdollPositionSafely(teleportPosition, true);
			}
		}

		public static void TeleportEnemy(EnemyAI enemy, Vector3 teleportPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			enemy.serverPosition = teleportPos;
			((Component)enemy).transform.position = teleportPos;
			enemy.agent.Warp(teleportPos);
			enemy.SyncPositionToClients();
		}

		public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 1f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_007a: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: 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)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//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_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)$"Spawning explosion at pos: {explosionPosition}");
			Transform val = null;
			if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null)
			{
				val = RoundManager.Instance.mapPropsContainer.transform;
			}
			if (spawnExplosionEffect)
			{
				Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true);
			}
			float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition);
			if (num < 14f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			else if (num < 25f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
			}
			Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2);
			PlayerControllerB val2 = null;
			for (int i = 0; i < array.Length; i++)
			{
				float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position);
				if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1))
				{
					continue;
				}
				if (((Component)array[i]).gameObject.layer == 3)
				{
					val2 = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>();
					if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner)
					{
						float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange));
						val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, default(Vector3));
					}
				}
				else if (((Component)array[i]).gameObject.layer == 21)
				{
					Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>();
					if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f)
					{
						Debug.Log((object)"Setting off other mine");
						((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren));
					}
				}
				else if (((Component)array[i]).gameObject.layer == 19)
				{
					EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>();
					if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f)
					{
						componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyHitForce, default(Vector3), attacker, false, -1);
					}
				}
			}
			int num4 = ~LayerMask.GetMask(new string[1] { "Room" });
			num4 = ~LayerMask.GetMask(new string[1] { "Colliders" });
			array = Physics.OverlapSphere(explosionPosition, 10f, num4);
			for (int j = 0; j < array.Length; j++)
			{
				Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>();
				if ((Object)(object)component != (Object)null)
				{
					component.AddExplosionForce(70f, explosionPosition, 10f);
				}
			}
		}
	}
}
namespace ImmersiveScrap.Scrap
{
	public class Brick : ThrowableNoisemaker
	{
		public AudioClip[] cookieSpecialAudio;

		public AudioSource brickPlayer;

		private float explodePercentage = 100f;

		public bool wasThrown;

		private Random noiseMakerRandom;

		public override void Start()
		{
			((NoisemakerProp)this).Start();
			noiseMakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
		}

		public void DetectThrowKeyPressed()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.InputActionsInstance.ThrowKey.triggered && !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				wasThrown = true;
				Vector3 itemThrowDestination = GetItemThrowDestination();
				((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, itemThrowDestination, true);
				PlayCookieAudioServerRpc(0);
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)(object)this))
			{
				DetectThrowKeyPressed();
			}
		}

		[ServerRpc]
		public void PlayCookieAudioServerRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00b7: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3742843923u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3742843923u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayCookieAudioClientRpc(index);
			}
		}

		[ClientRpc]
		public void PlayCookieAudioClientRpc(int index)
		{
			//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_0071: 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_0108: 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(2929058189u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2929058189u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && cookieSpecialAudio.Length != 0)
				{
					brickPlayer.PlayOneShot(cookieSpecialAudio[index]);
					WalkieTalkie.TransmitOneShotAudio(brickPlayer, cookieSpecialAudio[index], 0.5f);
					RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.5f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				}
			}
		}

		[ServerRpc]
		public void StopPlayingCookieAudioServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4170301725u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4170301725u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				StopPlayingCookieAudioClientRpc();
			}
		}

		[ClientRpc]
		public void StopPlayingCookieAudioClientRpc()
		{
			//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(366094878u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 366094878u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					brickPlayer.Stop();
				}
			}
		}

		[ClientRpc]
		public void BoomClientRpc()
		{
			//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(2731884806u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2731884806u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Boom();
				}
			}
		}

		[ServerRpc]
		public void BoomServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3369954093u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3369954093u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Boom();
				BoomClientRpc();
			}
		}

		public void CreateExplosion()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId));
			int num = 0;
			if (ImmersiveScrapConfig.ConfigBrickDealingDamage.Value)
			{
				num = ImmersiveScrapConfig.ConfigBrickDealingXDamage.Value;
			}
			Utilities.CreateExplosion(((Component)this).transform.position, ImmersiveScrapConfig.ConfigBrickExploding.Value, 20, 0f, num, 2, (CauseOfDeath)3, attacker);
		}

		public void Boom()
		{
			CreateExplosion();
		}

		public override void OnHitGround()
		{
			if (wasThrown)
			{
				wasThrown = false;
				if (((NetworkBehaviour)this).IsOwner && (float)noiseMakerRandom.Next(0, 101) <= explodePercentage)
				{
					Boom();
					BoomServerRpc();
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Brick()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3742843923u, new RpcReceiveHandler(__rpc_handler_3742843923));
			NetworkManager.__rpc_func_table.Add(2929058189u, new RpcReceiveHandler(__rpc_handler_2929058189));
			NetworkManager.__rpc_func_table.Add(4170301725u, new RpcReceiveHandler(__rpc_handler_4170301725));
			NetworkManager.__rpc_func_table.Add(366094878u, new RpcReceiveHandler(__rpc_handler_366094878));
			NetworkManager.__rpc_func_table.Add(2731884806u, new RpcReceiveHandler(__rpc_handler_2731884806));
			NetworkManager.__rpc_func_table.Add(3369954093u, new RpcReceiveHandler(__rpc_handler_3369954093));
		}

		private static void __rpc_handler_3742843923(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Brick)(object)target).PlayCookieAudioServerRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2929058189(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Brick)(object)target).PlayCookieAudioClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4170301725(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Brick)(object)target).StopPlayingCookieAudioServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_366094878(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;
				((Brick)(object)target).StopPlayingCookieAudioClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2731884806(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;
				((Brick)(object)target).BoomClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3369954093(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Brick)(object)target).BoomServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Brick";
		}
	}
	internal class HittingStuff : GrabbableObject
	{
		public int hammerHitForce = 1;

		public float hammerHitPercentage = 1f;

		public bool reelingUp;

		public bool isHoldingButton;

		private RaycastHit rayHit;

		private Coroutine reelingUpCoroutine;

		private RaycastHit[] objectsHitByHammer;

		private List<RaycastHit> objectsHitByHammerList = new List<RaycastHit>();

		public AudioClip reelUp;

		public AudioClip swing;

		public AudioClip[] hitSFX;

		public AudioSource hammerAudio;

		private PlayerControllerB previousPlayerHeldBy;

		private int hammerMask = 11012424;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((Object)(object)base.playerHeldBy == (Object)null)
			{
				return;
			}
			isHoldingButton = buttonDown;
			if (!reelingUp && buttonDown)
			{
				reelingUp = true;
				previousPlayerHeldBy = base.playerHeldBy;
				if (reelingUpCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
				}
				reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpHammer());
			}
		}

		private IEnumerator reelUpHammer()
		{
			base.playerHeldBy.activatingItem = true;
			base.playerHeldBy.twoHanded = true;
			base.playerHeldBy.playerBodyAnimator.ResetTrigger("hammerHit");
			base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
			hammerAudio.PlayOneShot(reelUp);
			ReelUpSFXServerRpc();
			yield return (object)new WaitForSeconds(0.35f);
			yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
			SwingHammer(!base.isHeld);
			yield return (object)new WaitForSeconds(0.13f);
			HitHammer(!base.isHeld);
			yield return (object)new WaitForSeconds(0.3f);
			reelingUp = false;
			reelingUpCoroutine = null;
		}

		[ServerRpc]
		public void ReelUpSFXServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2951614796u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2951614796u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ReelUpSFXClientRpc();
			}
		}

		[ClientRpc]
		public void ReelUpSFXClientRpc()
		{
			//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(989564174u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 989564174u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					hammerAudio.PlayOneShot(reelUp);
				}
			}
		}

		public override void DiscardItem()
		{
			base.playerHeldBy.activatingItem = false;
			((GrabbableObject)this).DiscardItem();
		}

		public void SwingHammer(bool cancel = false)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
			if (!cancel)
			{
				hammerAudio.PlayOneShot(swing);
				previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
			}
		}

		public void HitHammer(bool cancel = false)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0065: 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_0084: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			int num = -1;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				Debug.DrawRay(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward * 1.85f, Color.blue, 5f);
				objectsHitByHammer = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.75f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.85f, hammerMask, (QueryTriggerInteraction)2);
				objectsHitByHammerList = objectsHitByHammer.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				Vector3 val = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
				IHittable val3 = default(IHittable);
				RaycastHit val5 = default(RaycastHit);
				for (int i = 0; i < objectsHitByHammerList.Count; i++)
				{
					RaycastHit val2 = objectsHitByHammerList[i];
					if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 8)
					{
						val2 = objectsHitByHammerList[i];
						if (((Component)((RaycastHit)(ref val2)).transform).gameObject.layer != 11)
						{
							val2 = objectsHitByHammerList[i];
							if (!((Component)((RaycastHit)(ref val2)).transform).TryGetComponent<IHittable>(ref val3))
							{
								continue;
							}
							val2 = objectsHitByHammerList[i];
							if ((Object)(object)((RaycastHit)(ref val2)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val2 = objectsHitByHammerList[i];
							if (!(((RaycastHit)(ref val2)).point == Vector3.zero))
							{
								Vector3 val4 = val;
								val2 = objectsHitByHammerList[i];
								if (Physics.Linecast(val4, ((RaycastHit)(ref val2)).point, ref val5, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							val3.Hit(hammerHitForce, forward, previousPlayerHeldBy, true, -1);
							continue;
						}
					}
					val2 = objectsHitByHammerList[i];
					Vector3 point = ((RaycastHit)(ref val2)).point;
					val2 = objectsHitByHammerList[i];
					val = point + ((RaycastHit)(ref val2)).normal * 0.01f;
					flag = true;
					val2 = objectsHitByHammerList[i];
					string tag = ((Component)((RaycastHit)(ref val2)).collider).gameObject.tag;
					for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
					{
						if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
						{
							hammerAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX);
							WalkieTalkie.TransmitOneShotAudio(hammerAudio, StartOfRound.Instance.footstepSurfaces[j].hitSurfaceSFX, 1f);
							num = j;
							break;
						}
					}
				}
			}
			if (flag)
			{
				int soundID = RoundManager.PlayRandomClip(hammerAudio, hitSFX, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				base.playerHeldBy.playerBodyAnimator.SetTrigger("hammerHit");
				HitHammerServerRpc(soundID);
			}
		}

		[ServerRpc]
		public void HitHammerServerRpc(int soundID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00b7: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2176195719u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, soundID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2176195719u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitHammerClientRpc(soundID);
			}
		}

		[ClientRpc]
		public void HitHammerClientRpc(int soundID)
		{
			//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_0071: 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)
			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(3269527847u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, soundID);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3269527847u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					HitSurfaceWithHammer(soundID);
				}
			}
		}

		private void HitSurfaceWithHammer(int soundID)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				hammerAudio.PlayOneShot(hitSFX[soundID]);
			}
			WalkieTalkie.TransmitOneShotAudio(hammerAudio, hitSFX[soundID], 1f);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_HittingStuff()
		{
			//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
			NetworkManager.__rpc_func_table.Add(2951614796u, new RpcReceiveHandler(__rpc_handler_2951614796));
			NetworkManager.__rpc_func_table.Add(989564174u, new RpcReceiveHandler(__rpc_handler_989564174));
			NetworkManager.__rpc_func_table.Add(2176195719u, new RpcReceiveHandler(__rpc_handler_2176195719));
			NetworkManager.__rpc_func_table.Add(3269527847u, new RpcReceiveHandler(__rpc_handler_3269527847));
		}

		private static void __rpc_handler_2951614796(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HittingStuff)(object)target).ReelUpSFXServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_989564174(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;
				((HittingStuff)(object)target).ReelUpSFXClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2176195719(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int soundID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref soundID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HittingStuff)(object)target).HitHammerServerRpc(soundID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3269527847(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int soundID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref soundID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((HittingStuff)(object)target).HitHammerClientRpc(soundID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "HittingStuff";
		}
	}
}
namespace ImmersiveScrap.Weapons
{
	public class BaseballBat : Shovel
	{
		protected override void __initializeVariables()
		{
			((Shovel)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BaseballBat";
		}
	}
	public class Plunger : Shovel
	{
		protected override void __initializeVariables()
		{
			((Shovel)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "Plunger";
		}
	}
}
namespace ImmersiveScrap.Keybinds
{
	public class IngameKeybinds : LcInputActions
	{
		[InputAction("<Keyboard>/q", Name = "ThrowKeybind")]
		public InputAction ThrowKey { get; set; }
	}
}
namespace ImmersiveScrap.Configs
{
	public class ImmersiveScrapConfig
	{
		public static ConfigEntry<int> ConfigVanillaSpawnWeight { get; private set; }

		public static ConfigEntry<int> ConfigCustomSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigAlcoholSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigAnvilSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigBaseballSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigBeercanSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigBrickSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigBrokenEngineSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigBucketSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigCanPaintSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigCanteenSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigCarBatterySpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigClampSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigClockSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigFanSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigFancyPaintingSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigFireAxeSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigFireExtingSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigFireHydrantSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigFoodCanSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigGameboySpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigGarbageSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigHammerSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigJerryCanSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigKeyboardSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigLanternSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigLibraryLampSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigPlantSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigPliersSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigPlungerSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigRetroToySpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigScrewdriverSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigSinkSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigSocketSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigSqueakyToySpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigSuitcaseSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigToasterSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigToolboxSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigTophatSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigTrafficConeSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigVentSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigWateringCanSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigWheelSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigWineBottleSpawnWeight { get; private set; }

		public static ConfigEntry<string> ConfigWrenchSpawnWeight { get; private set; }

		public static ConfigEntry<bool> ConfigBrickExploding { get; private set; }

		public static ConfigEntry<bool> ConfigBrickDealingDamage { get; private set; }

		public static ConfigEntry<int> ConfigBrickDealingXDamage { get; private set; }

		public ImmersiveScrapConfig(ConfigFile configFile)
		{
			ConfigBrickExploding = configFile.Bind<bool>("Scrap Options", "Brick Exploding", false, "Enable/Disable Brick Exploding");
			ConfigBrickDealingDamage = configFile.Bind<bool>("Scrap Options", "Brick Dealing Damage", false, "Enable/Disable Brick Dealing Damage");
			ConfigBrickDealingXDamage = configFile.Bind<int>("Scrap Options", "Brick Dealing X Damage", 1, "Set how much damage the Brick deals");
			ConfigAlcoholSpawnWeight = configFile.Bind<string>("Scrap Options", "Alcohol | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for alcohol scrap on moons");
			ConfigAnvilSpawnWeight = configFile.Bind<string>("Scrap Options", "Anvil | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for anvil scrap on moons");
			ConfigBaseballSpawnWeight = configFile.Bind<string>("Scrap Options", "Baseball | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for baseball scrap on moons");
			ConfigBeercanSpawnWeight = configFile.Bind<string>("Scrap Options", "Beercan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for beer can scrap on moons");
			ConfigBrickSpawnWeight = configFile.Bind<string>("Scrap Options", "Brick | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for brick scrap on moons");
			ConfigCanteenSpawnWeight = configFile.Bind<string>("Scrap Options", "Canteen | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for canteen scrap on moons");
			ConfigCarBatterySpawnWeight = configFile.Bind<string>("Scrap Options", "CarBattery | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for car battery scrap on moons");
			ConfigFireAxeSpawnWeight = configFile.Bind<string>("Scrap Options", "FireAxe | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fire axe scrap on moons");
			ConfigFireExtingSpawnWeight = configFile.Bind<string>("Scrap Options", "FireExtinguisher | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fire extinguisher scrap on moons");
			ConfigFireHydrantSpawnWeight = configFile.Bind<string>("Scrap Options", "FireHydrant | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fire hydrant scrap on moons");
			ConfigFoodCanSpawnWeight = configFile.Bind<string>("Scrap Options", "FoodCan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for food can scrap on moons");
			ConfigLibraryLampSpawnWeight = configFile.Bind<string>("Scrap Options", "LibraryLamp | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for library lamp scrap on moons");
			ConfigPlantSpawnWeight = configFile.Bind<string>("Scrap Options", "Plant | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for plant scrap on moons");
			ConfigPliersSpawnWeight = configFile.Bind<string>("Scrap Options", "Pliers | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for pliers scrap on moons");
			ConfigPlungerSpawnWeight = configFile.Bind<string>("Scrap Options", "Plunger | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for plunger scrap on moons");
			ConfigTrafficConeSpawnWeight = configFile.Bind<string>("Scrap Options", "TrafficCone | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for traffic cone scrap on moons");
			ConfigWateringCanSpawnWeight = configFile.Bind<string>("Scrap Options", "WateringCan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for watering can scrap on moons");
			ConfigWrenchSpawnWeight = configFile.Bind<string>("Scrap Options", "Wrench | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for wrench scrap on moons");
			ConfigBrokenEngineSpawnWeight = configFile.Bind<string>("Scrap Options", "BrokenEngine | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for broken engine scrap on moons");
			ConfigBucketSpawnWeight = configFile.Bind<string>("Scrap Options", "Bucket | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for bucket scrap on moons");
			ConfigCanPaintSpawnWeight = configFile.Bind<string>("Scrap Options", "CanPaint | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for can of paint scrap on moons");
			ConfigClampSpawnWeight = configFile.Bind<string>("Scrap Options", "Clamp | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for clamp scrap on moons");
			ConfigClockSpawnWeight = configFile.Bind<string>("Scrap Options", "Clock | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for clock scrap on moons");
			ConfigFanSpawnWeight = configFile.Bind<string>("Scrap Options", "Fan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fan scrap on moons");
			ConfigFancyPaintingSpawnWeight = configFile.Bind<string>("Scrap Options", "FancyPainting | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for fancy painting scrap on moons");
			ConfigGarbageSpawnWeight = configFile.Bind<string>("Scrap Options", "Garbage | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for garbage scrap on moons");
			ConfigGameboySpawnWeight = configFile.Bind<string>("Scrap Options", "Gameboy | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for Gameboy scrap on moons");
			ConfigHammerSpawnWeight = configFile.Bind<string>("Scrap Options", "Hammer | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for hammer scrap on moons");
			ConfigJerryCanSpawnWeight = configFile.Bind<string>("Scrap Options", "JerryCan | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for jerry can scrap on moons");
			ConfigKeyboardSpawnWeight = configFile.Bind<string>("Scrap Options", "Keyboard | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for keyboard scrap on moons");
			ConfigLanternSpawnWeight = configFile.Bind<string>("Scrap Options", "Lantern | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for lantern scrap on moons");
			ConfigRetroToySpawnWeight = configFile.Bind<string>("Scrap Options", "RetroToy | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for retro toy scrap on moons");
			ConfigScrewdriverSpawnWeight = configFile.Bind<string>("Scrap Options", "Screwdriver | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for screwdriver scrap on moons");
			ConfigSinkSpawnWeight = configFile.Bind<string>("Scrap Options", "Sink | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for sink scrap on moons");
			ConfigSocketSpawnWeight = configFile.Bind<string>("Scrap Options", "Socket | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for socket scrap on moons");
			ConfigSqueakyToySpawnWeight = configFile.Bind<string>("Scrap Options", "SqueakyToy | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for squeaky toy scrap on moons");
			ConfigSuitcaseSpawnWeight = configFile.Bind<string>("Scrap Options", "Suitcase | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for suitcase scrap on moons");
			ConfigToasterSpawnWeight = configFile.Bind<string>("Scrap Options", "Toaster | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for toaster scrap on moons");
			ConfigToolboxSpawnWeight = configFile.Bind<string>("Scrap Options", "Toolbox | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for toolbox scrap on moons");
			ConfigTophatSpawnWeight = configFile.Bind<string>("Scrap Options", "Tophat | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for top hat scrap on moons");
			ConfigVentSpawnWeight = configFile.Bind<string>("Scrap Options", "Vent | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for vent scrap on moons");
			ConfigWheelSpawnWeight = configFile.Bind<string>("Scrap Options", "Wheel | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for wheel scrap on moons");
			ConfigWineBottleSpawnWeight = configFile.Bind<string>("Scrap Options", "WineBottle | SpawnWeight", "Vanilla:20, Custom:20", "Configurable Spawn Weight of Scrap for wine bottle scrap on moons");
			ClearUnusedEntries(configFile);
			Plugin.Logger.LogInfo((object)"Setting up config for ImmersiveScrap plugin...");
		}

		private void ClearUnusedEntries(ConfigFile configFile)
		{
			PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(configFile, null);
			dictionary.Clear();
			configFile.Save();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ImmersiveScrap.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

plugins/LCGoldScrapMod.dll

Decompiled a day ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using HarmonyLib.Tools;
using LethalConfig;
using LethalConfig.ConfigItems;
using STSharedAudioLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/ArtOfGoldMaterials", order = 1)]
public class ArtOfGoldMaterials : ScriptableObject
{
	public List<Material> allArtwork;

	public List<Material> allSillyArtwork;
}
public enum GoldScrapLevels
{
	Experimentation,
	Assurance,
	Vow,
	Offense,
	March,
	Rend,
	Dine,
	Titan,
	Adamance,
	Artifice,
	Embrion
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/ItemData", order = 0)]
public class ItemData : ScriptableObject
{
	[Header("Item")]
	[Tooltip("The LCGoldScrapMod itemProperties the game will read from on the host.")]
	public Item itemProperties;

	[Tooltip("If true, it will be registered to levels and its itemProperties' weight, max-, and minValues will be put through the configMultipliers.\nIf false, only weight will be multiplied by its configMultiplier.")]
	public bool isScrap = true;

	[Tooltip("If true, its value will not be counted when collected in levels and when sold on the Company desk.")]
	public bool isStoreItem;

	[Space(3f)]
	[Header("Defaults")]
	[Tooltip("The intended default weight not yet taking the default 1.5x weightMultiplier into account.\nUsually the weight of the original item, unless that has no weight.")]
	public float defaultWeight = 1f;

	[Tooltip("The intended default maxValue not yet taking the default 2x maxValueMultiplier into account.\nUsually the maxValue of the original item.")]
	public int defaultMaxValue;

	[Tooltip("The intended default minValue not yet taking the default 2.5x minValueMultiplier into account.\nUsually the minValue of the original item.")]
	public int defaultMinValue;

	[Tooltip("The intended default rarity not yet taking the custom plusGain and minusLoss into account.\nRefer to 'GoldScrap - Items' document.")]
	public int defaultRarity = 3;

	[Space(3f)]
	[Header("Levels")]
	[Tooltip("The vanilla levels where this gold scrap can appear.\nTakes a calculation of 'Default Rarity - 1' into account.")]
	public GoldScrapLevels[] levelsToAddMinus;

	[Tooltip("The vanilla levels where this gold scrap can appear.\nOnly takes Default Rarity into account.")]
	public GoldScrapLevels[] levelsToAddDefault;

	[Tooltip("The vanilla levels where this gold scrap can appear.\nTakes a calculation of 'Default Rarity + 2' into account.")]
	public GoldScrapLevels[] levelsToAddPlus;

	[Tooltip("A custom positive gain or negative loss that will influence the Default Rarity of gold scrap on levels selected in 'Levels To Add Custom'.\nWill have no effect if Default Rarity is 2 or smaller and Custom Change is -2 or lower.")]
	public int customChange;

	[Tooltip("The vanilla levels where this gold scrap can appear.\nTakes a calculation of 'Default Rarity + Custom Change' into account.")]
	public GoldScrapLevels[] levelsToAddCustom;

	[Space(3f)]
	[Header("Host values")]
	[HideInInspector]
	public int localMaxValue;

	[HideInInspector]
	public int localMinValue;
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/AudioClipList")]
public class AudioClipList : ScriptableObject
{
	public List<AudioClip> allClips = new List<AudioClip>();
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/GameObjectList")]
public class GameObjectList : ScriptableObject
{
	public GameObject[] allPrefabs;
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/ItemDataList")]
public class ItemDataList : ScriptableObject
{
	public ItemData[] allItemData;
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/StringList")]
public class StringList : ScriptableObject
{
	[TextArea(1, 20)]
	public string[] allStrings;
}
public interface IGoldenGlassSecret
{
	void BeginReveal();

	void EndReveal();
}
public class GoldBirdScript : GrabbableObject
{
	[HarmonyPatch(typeof(HUDManager), "RadiationWarningHUD")]
	public class NewHUDManagerRadiationWarning
	{
		[HarmonyPostfix]
		public static void AwakenGoldBirds()
		{
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && GameNetworkManager.Instance.localPlayerController.isHostPlayerObject)
			{
				GoldBirdScript[] array = Object.FindObjectsOfType<GoldBirdScript>();
				foreach (GoldBirdScript obj in array)
				{
					obj.AwakenClientRpc((int)((float)((GrabbableObject)obj).scrapValue * Random.Range(3f, 4f)));
				}
			}
		}
	}

	private static ManualLogSource Logger = Plugin.Logger;

	[Space(3f)]
	[Header("Alarm")]
	public AudioSource alarmSource;

	public AudioClip alarmClip;

	private float alarmTimer;

	private bool canAlarmFire;

	[Space(3f)]
	[Header("Spotlight")]
	public AudioSource spotlightAudio;

	public AudioClip lightOnClip;

	public AudioClip lightOffClip;

	public Light headlight;

	public Color normalColor;

	public Color alarmColor;

	[Space(3f)]
	[Header("Dormancy")]
	public AudioSource awakeSource;

	public AudioClip awakeClip;

	public AudioClip dieClip;

	public bool dormant = true;

	public ScanNodeProperties scanNode;

	private bool canWakeThisRound = true;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		alarmSource.clip = alarmClip;
		if (base.isInShipRoom)
		{
			canWakeThisRound = false;
		}
		else
		{
			scanNode.headerText = "Gold Bird (Dormant)";
		}
	}

	public override void Update()
	{
		((GrabbableObject)this).Update();
		if (!((NetworkBehaviour)this).IsServer || dormant)
		{
			return;
		}
		canAlarmFire = (Object)(object)base.playerHeldBy != (Object)null && StartOfRound.Instance.shipDoorsEnabled && !StartOfRound.Instance.inShipPhase;
		if (!canAlarmFire && alarmTimer < 0.1f)
		{
			alarmTimer = 0.1f;
			ToggleAlarmClientRpc(alarm: false);
			return;
		}
		alarmTimer += Time.deltaTime;
		if (alarmTimer > 2f)
		{
			alarmTimer = 0f;
			DoAlarmInterval();
		}
	}

	private void DoAlarmInterval()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (canAlarmFire)
		{
			if (IsNearbyPlayerInSight())
			{
				ToggleAlarmClientRpc(alarm: true);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, alarmSource.maxDistance + 15f, 1f, 0, false, 0);
			}
			else
			{
				ToggleAlarmClientRpc(alarm: false);
			}
		}
	}

	private bool IsNearbyPlayerInSight()
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		if (StartOfRound.Instance.connectedPlayersAmount > 0)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)base.playerHeldBy) && val.isPlayerControlled && !(Vector3.Distance(((Component)headlight).transform.position, ((Component)val).transform.position) > alarmSource.maxDistance - 15f))
				{
					return !Physics.Linecast(((Component)headlight).transform.position, val.playerEye.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1);
				}
			}
		}
		return false;
	}

	[ClientRpc]
	private void ToggleAlarmClientRpc(bool alarm)
	{
		//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_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: 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(3862976390u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref alarm, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3862976390u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (!((Behaviour)headlight).enabled)
			{
				((Behaviour)headlight).enabled = true;
			}
			if (alarm && !alarmSource.isPlaying)
			{
				spotlightAudio.PlayOneShot(lightOnClip);
				alarmSource.Play();
				headlight.color = alarmColor;
			}
			else if (!alarm && alarmSource.isPlaying)
			{
				spotlightAudio.PlayOneShot(lightOffClip);
				alarmSource.Stop();
				headlight.color = normalColor;
			}
		}
	}

	[ClientRpc]
	public void AwakenClientRpc(int awakenedValue)
	{
		//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_0071: 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_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		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(4211676833u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, awakenedValue);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4211676833u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId}: canWake {canWakeThisRound} // dormant {dormant}");
		if (canWakeThisRound && dormant)
		{
			Logger.LogDebug((object)"awakening");
			awakeSource.PlayOneShot(awakeClip);
			WalkieTalkie.TransmitOneShotAudio(awakeSource, awakeClip, 0.5f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, awakeSource.maxDistance, 0.1f, 0, false, 0);
			((Behaviour)headlight).enabled = true;
			headlight.color = normalColor;
			dormant = false;
			canWakeThisRound = false;
			if (scanNode.headerText.Contains("(Dormant)"))
			{
				scanNode.headerText = scanNode.headerText.Replace("Dormant", "Awake");
			}
			((GrabbableObject)this).SetScrapValue(awakenedValue);
		}
	}

	[ClientRpc]
	public void DeactivateAtEndOfDayClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		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(634004460u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 634004460u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !canWakeThisRound)
		{
			return;
		}
		canWakeThisRound = false;
		Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId} can no longer wake");
		if (dormant)
		{
			if (scanNode.headerText.Contains("(Dormant)"))
			{
				scanNode.headerText = scanNode.headerText.Replace("Dormant", "Dead");
			}
			spotlightAudio.PlayOneShot(dieClip);
			Object.Instantiate<GameObject>(AssetsCollection.poofParticle, ((Component)headlight).transform.position, new Quaternion(0f, 0f, 0f, 0f)).GetComponent<ParticleSystem>().Play();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncUponJoinServerRpc(int playerID)
	{
		//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_0071: 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)
		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(2991509102u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2991509102u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncUponJoinClientRpc(canWakeThisRound, ((Behaviour)headlight).enabled, scanNode.headerText, playerID);
			}
		}
	}

	[ClientRpc]
	private void SyncUponJoinClientRpc(bool hostCanWakeValue, bool enableHeadlight, string scanNodeName, int playerID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: 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(1832698290u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostCanWakeValue, default(ForPrimitives));
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enableHeadlight, default(ForPrimitives));
			bool flag = scanNodeName != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(scanNodeName, false);
			}
			BytePacker.WriteValueBitPacked(val2, playerID);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1832698290u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
		{
			canWakeThisRound = hostCanWakeValue;
			((Behaviour)headlight).enabled = enableHeadlight;
			if (enableHeadlight)
			{
				headlight.color = (alarmSource.isPlaying ? alarmColor : normalColor);
			}
			scanNode.headerText = scanNodeName;
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_GoldBirdScript()
	{
		//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
		NetworkManager.__rpc_func_table.Add(3862976390u, new RpcReceiveHandler(__rpc_handler_3862976390));
		NetworkManager.__rpc_func_table.Add(4211676833u, new RpcReceiveHandler(__rpc_handler_4211676833));
		NetworkManager.__rpc_func_table.Add(634004460u, new RpcReceiveHandler(__rpc_handler_634004460));
		NetworkManager.__rpc_func_table.Add(2991509102u, new RpcReceiveHandler(__rpc_handler_2991509102));
		NetworkManager.__rpc_func_table.Add(1832698290u, new RpcReceiveHandler(__rpc_handler_1832698290));
	}

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

	private static void __rpc_handler_4211676833(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int awakenedValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref awakenedValue);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldBirdScript)(object)target).AwakenClientRpc(awakenedValue);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_634004460(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;
			((GoldBirdScript)(object)target).DeactivateAtEndOfDayClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2991509102(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GoldBirdScript)(object)target).SyncUponJoinServerRpc(playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1832698290(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_0091: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool hostCanWakeValue = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostCanWakeValue, default(ForPrimitives));
			bool enableHeadlight = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enableHeadlight, default(ForPrimitives));
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string scanNodeName = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref scanNodeName, false);
			}
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldBirdScript)(object)target).SyncUponJoinClientRpc(hostCanWakeValue, enableHeadlight, scanNodeName, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "GoldBirdScript";
	}
}
public class GoldenClockScript : GrabbableObject
{
	private static ManualLogSource Logger = Plugin.Logger;

	[Space(3f)]
	[Header("Original Clock")]
	public Transform minuteHand;

	public Transform secondHand;

	private float timeOfLastSecond;

	public AudioSource tickAudio;

	public AudioClip tickSFX;

	public AudioClip tockSFX;

	private bool tickOrTock;

	[Space(3f)]
	[Header("Custom Timer")]
	public AudioClip intervalClip;

	public AudioClip failClip;

	public int maxRealSeconds;

	public int minRealSeconds;

	public float countdownInterval;

	[Space(3f)]
	[Header("Close Call")]
	public AudioSource closeCallAudio;

	public AudioClip closeCallApproach;

	public AudioClip closeCallSuccess;

	public AudioClip closeCallFail;

	private bool shouldCountDown;

	private bool approachedShipFinalPhase;

	private int secondsLeft;

	private int thisClocksStartingSeconds;

	private int thisClocksStartingValue;

	private int thisClocksIntervalAmount;

	private int thisClocksSpecialMultiplier;

	private float timeOfLastTickTock;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		if (((NetworkBehaviour)this).IsServer && !base.isInShipRoom)
		{
			((MonoBehaviour)this).StartCoroutine(RollForNewTimer());
		}
	}

	public override void Update()
	{
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		if (!shouldCountDown)
		{
			return;
		}
		if (Time.realtimeSinceStartup - timeOfLastSecond > countdownInterval)
		{
			timeOfLastSecond = Time.realtimeSinceStartup;
			if (((NetworkBehaviour)this).IsServer || (!((NetworkBehaviour)this).IsServer && secondsLeft % 60 != 1))
			{
				secondsLeft--;
				secondHand.Rotate(6f, 0f, 0f, (Space)1);
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				if (secondsLeft <= 0)
				{
					shouldCountDown = false;
					SyncFailureClientRpc(base.scrapValue / thisClocksSpecialMultiplier);
					return;
				}
				if (secondsLeft % 60 == 0)
				{
					SyncTimeAndValueClientRpc(secondsLeft, base.scrapValue - (int)Mathf.Lerp(0f, (float)thisClocksStartingValue, (float)(Random.Range(40, 70) / thisClocksIntervalAmount) / 100f), isMinute: true);
				}
				if (secondsLeft < 60 && !approachedShipFinalPhase && (Object)(object)base.playerHeldBy != (Object)null && Vector3.Distance(((Component)base.playerHeldBy).transform.position, ((Component)StartOfRound.Instance.shipDoorNode).transform.position) < 10f)
				{
					approachedShipFinalPhase = true;
					SyncApproachClientRpc();
				}
			}
			if (secondsLeft > 60)
			{
				TickTock();
			}
		}
		if (secondsLeft <= 60 && Time.realtimeSinceStartup - timeOfLastTickTock > countdownInterval / 2f)
		{
			TickTock();
		}
	}

	public override void OnBroughtToShip()
	{
		((GrabbableObject)this).OnBroughtToShip();
		if (shouldCountDown)
		{
			SyncSuccessServerRpc();
		}
	}

	private IEnumerator RollForNewTimer()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.shipHasLanded));
		int num = Random.Range(minRealSeconds, maxRealSeconds);
		int num2 = (int)((float)num / countdownInterval);
		int intervalAmount = num2 / 60;
		int num3 = Mathf.Clamp(TimeOfDay.Instance.daysUntilDeadline, 1, 3) + 1;
		int num4 = base.scrapValue * num3 + (maxRealSeconds - num) / 2;
		if (RarityManager.CurrentlyGoldFever())
		{
			num4 *= 2;
		}
		SendNewTimerClientRpc(num2, intervalAmount, num3, num4);
	}

	[ClientRpc]
	private void SendNewTimerClientRpc(int startingSeconds, int intervalAmount, int specialMultiplier, int startingValue)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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(724639717u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, startingSeconds);
				BytePacker.WriteValueBitPacked(val2, intervalAmount);
				BytePacker.WriteValueBitPacked(val2, specialMultiplier);
				BytePacker.WriteValueBitPacked(val2, startingValue);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 724639717u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				thisClocksStartingSeconds = startingSeconds;
				thisClocksIntervalAmount = intervalAmount;
				thisClocksSpecialMultiplier = specialMultiplier;
				thisClocksStartingValue = startingValue;
				shouldCountDown = true;
				minuteHand.Rotate(-20f * (float)(thisClocksIntervalAmount % 18), 0f, 0f, (Space)1);
				SetTimerRotationAndValue(thisClocksStartingSeconds, isMinute: false, thisClocksStartingValue);
				Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId}:");
				Logger.LogDebug((object)$"{thisClocksStartingSeconds}");
				Logger.LogDebug((object)$"{thisClocksIntervalAmount}");
				Logger.LogDebug((object)$"{thisClocksSpecialMultiplier}");
				Logger.LogDebug((object)$"{thisClocksStartingValue}");
			}
		}
	}

	private void SetTimerRotationAndValue(int seconds, bool isMinute = false, int newScrapValue = -1)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		secondsLeft = seconds;
		if (isMinute)
		{
			secondHand.localRotation = new Quaternion(0f, 0f, 0f, 0f);
		}
		else
		{
			secondHand.Rotate(-6f * (float)(seconds % 60), 0f, 0f, (Space)1);
		}
		if (newScrapValue != -1)
		{
			((GrabbableObject)this).SetScrapValue(newScrapValue);
		}
	}

	[ClientRpc]
	private void SyncTimeAndValueClientRpc(int hostSecondsLeft, int newScrapValue, bool isMinute)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: 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(173399023u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hostSecondsLeft);
				BytePacker.WriteValueBitPacked(val2, newScrapValue);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMinute, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 173399023u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				minuteHand.Rotate(20f, 0f, 0f, (Space)1);
				tickAudio.PlayOneShot(intervalClip);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 5f, 0.5f, 0, false, 0);
				WalkieTalkie.TransmitOneShotAudio(tickAudio, intervalClip, 1f);
				SetTimerRotationAndValue(hostSecondsLeft, isMinute, newScrapValue);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void SyncSuccessServerRpc()
	{
		//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(1373350663u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1373350663u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncSuccessClientRpc(secondsLeft < 60);
			}
		}
	}

	[ClientRpc]
	private void SyncSuccessClientRpc(bool inFinalPhase)
	{
		//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)
		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(2850989775u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref inFinalPhase, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2850989775u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			shouldCountDown = false;
			tickAudio.PlayOneShot(intervalClip);
			WalkieTalkie.TransmitOneShotAudio(tickAudio, intervalClip, 1f);
			if (inFinalPhase)
			{
				closeCallAudio.Stop();
				closeCallAudio.PlayOneShot(closeCallSuccess);
				WalkieTalkie.TransmitOneShotAudio(closeCallAudio, closeCallSuccess, 1f);
			}
		}
	}

	[ClientRpc]
	private void SyncFailureClientRpc(int failedScrapValue)
	{
		//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_0071: 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_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: 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(3360715093u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, failedScrapValue);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3360715093u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			shouldCountDown = false;
			secondsLeft = 0;
			tickAudio.PlayOneShot(failClip);
			WalkieTalkie.TransmitOneShotAudio(tickAudio, failClip, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 1f, 0, false, 0);
			((GrabbableObject)this).SetScrapValue(failedScrapValue);
			secondHand.localRotation = new Quaternion(0f, 0f, 0f, 0f);
			minuteHand.localRotation = new Quaternion(0f, 0f, 0f, 0f);
			if (approachedShipFinalPhase)
			{
				closeCallAudio.Stop();
				closeCallAudio.PlayOneShot(closeCallFail);
				WalkieTalkie.TransmitOneShotAudio(closeCallAudio, closeCallFail, 1f);
			}
		}
	}

	[ClientRpc]
	private void SyncApproachClientRpc()
	{
		//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(2869504692u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2869504692u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				approachedShipFinalPhase = true;
				closeCallAudio.PlayOneShot(closeCallApproach);
				WalkieTalkie.TransmitOneShotAudio(closeCallAudio, closeCallApproach, 1f);
			}
		}
	}

	private void TickTock()
	{
		tickOrTock = !tickOrTock;
		AudioClip val = (tickOrTock ? tickSFX : tockSFX);
		tickAudio.PlayOneShot(val);
		WalkieTalkie.TransmitOneShotAudio(tickAudio, val, 0.33f);
		timeOfLastTickTock = Time.realtimeSinceStartup;
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncUponJoinServerRpc(int playerID)
	{
		//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_0071: 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)
		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(118909299u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 118909299u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncUponJoinClientRpc(shouldCountDown, secondsLeft, playerID);
			}
		}
	}

	[ClientRpc]
	private void SyncUponJoinClientRpc(bool hostBroughtToShip, int hostSecondsLeft, int playerID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: 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(3919497654u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostBroughtToShip, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, hostSecondsLeft);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3919497654u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
			{
				shouldCountDown = hostBroughtToShip;
				SetTimerRotationAndValue(hostSecondsLeft);
			}
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_GoldenClockScript()
	{
		//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
		NetworkManager.__rpc_func_table.Add(724639717u, new RpcReceiveHandler(__rpc_handler_724639717));
		NetworkManager.__rpc_func_table.Add(173399023u, new RpcReceiveHandler(__rpc_handler_173399023));
		NetworkManager.__rpc_func_table.Add(1373350663u, new RpcReceiveHandler(__rpc_handler_1373350663));
		NetworkManager.__rpc_func_table.Add(2850989775u, new RpcReceiveHandler(__rpc_handler_2850989775));
		NetworkManager.__rpc_func_table.Add(3360715093u, new RpcReceiveHandler(__rpc_handler_3360715093));
		NetworkManager.__rpc_func_table.Add(2869504692u, new RpcReceiveHandler(__rpc_handler_2869504692));
		NetworkManager.__rpc_func_table.Add(118909299u, new RpcReceiveHandler(__rpc_handler_118909299));
		NetworkManager.__rpc_func_table.Add(3919497654u, new RpcReceiveHandler(__rpc_handler_3919497654));
	}

	private static void __rpc_handler_724639717(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: 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_005d: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int startingSeconds = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref startingSeconds);
			int intervalAmount = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref intervalAmount);
			int specialMultiplier = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref specialMultiplier);
			int startingValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref startingValue);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenClockScript)(object)target).SendNewTimerClientRpc(startingSeconds, intervalAmount, specialMultiplier, startingValue);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_173399023(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: 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)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int hostSecondsLeft = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostSecondsLeft);
			int newScrapValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref newScrapValue);
			bool isMinute = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMinute, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenClockScript)(object)target).SyncTimeAndValueClientRpc(hostSecondsLeft, newScrapValue, isMinute);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1373350663(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;
			((GoldenClockScript)(object)target).SyncSuccessServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_3360715093(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int failedScrapValue = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref failedScrapValue);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenClockScript)(object)target).SyncFailureClientRpc(failedScrapValue);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2869504692(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;
			((GoldenClockScript)(object)target).SyncApproachClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_118909299(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GoldenClockScript)(object)target).SyncUponJoinServerRpc(playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3919497654(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_004b: 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)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool hostBroughtToShip = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostBroughtToShip, default(ForPrimitives));
			int hostSecondsLeft = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref hostSecondsLeft);
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenClockScript)(object)target).SyncUponJoinClientRpc(hostBroughtToShip, hostSecondsLeft, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "GoldenClockScript";
	}
}
public class GoldenGirlScript : GrabbableObject, IGoldenGlassSecret
{
	private static ManualLogSource Logger = Plugin.Logger;

	private Mesh loadedMesh;

	private bool broughtToShip;

	private bool choseLocalPlayer;

	[Space(3f)]
	[Header("(In)visibility")]
	public MeshFilter meshToToggle;

	public MeshRenderer materialToToggle;

	public AudioSource audioToMute;

	[Space(3f)]
	[Header("Audiovisual feedback")]
	public AudioSource reappearSource;

	public AudioClip reappearClip;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		loadedMesh = ((Component)this).GetComponent<MeshFilter>().mesh;
		if (((NetworkBehaviour)this).IsServer)
		{
			if (base.isInShipRoom)
			{
				broughtToShip = true;
			}
			else
			{
				ChoosePlayer();
			}
		}
	}

	private void ChoosePlayer()
	{
		if (base.isInFactory && !base.isInShipRoom)
		{
			ChoosePlayerClientRpc((int)General.GetRandomPlayer().playerClientId);
		}
	}

	[ClientRpc]
	private void ChoosePlayerClientRpc(int playerClientId)
	{
		//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_0071: 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)
		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(2685509517u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerClientId);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2685509517u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId}: [{playerClientId}]");
			if ((Object)(object)StartOfRound.Instance.allPlayerScripts[playerClientId] == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				choseLocalPlayer = true;
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(ToggleOnDelay());
			}
		}
	}

	private IEnumerator ToggleOnDelay()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)loadedMesh != (Object)null));
		ToggleGirl(enabled: false);
	}

	public override void OnHitGround()
	{
		((GrabbableObject)this).OnHitGround();
		if (!broughtToShip && !choseLocalPlayer)
		{
			ToggleGirl(enabled: false);
		}
	}

	public override void OnBroughtToShip()
	{
		((GrabbableObject)this).OnBroughtToShip();
		if (((NetworkBehaviour)this).IsOwner && !broughtToShip)
		{
			ReappearForEveryoneServerRpc();
		}
	}

	private void ToggleGirl(bool enabled)
	{
		//IL_0038: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		meshToToggle.mesh = (enabled ? loadedMesh : null);
		audioToMute.volume = (enabled ? 1 : 0);
		Collider[] propColliders = base.propColliders;
		for (int i = 0; i < propColliders.Length; i++)
		{
			((Collider)(BoxCollider)propColliders[i]).enabled = enabled;
		}
		if (!enabled && (Object)(object)base.radarIcon != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)base.radarIcon).gameObject);
		}
		if (enabled && !StartOfRound.Instance.inShipPhase)
		{
			reappearSource.PlayOneShot(reappearClip);
			Object.Instantiate<GameObject>(AssetsCollection.poofParticle, ((Component)this).transform.position, new Quaternion(0f, 0f, 0f, 0f)).GetComponent<ParticleSystem>().Play();
		}
		if (enabled)
		{
			((Renderer)materialToToggle).material = AssetsCollection.defaultMaterialGold;
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void ReappearForEveryoneServerRpc()
	{
		//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(247589533u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 247589533u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ReappearForEveryoneClientRpc();
			}
		}
	}

	[ClientRpc]
	private void ReappearForEveryoneClientRpc()
	{
		//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(958526731u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 958526731u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			broughtToShip = true;
			if (!choseLocalPlayer)
			{
				ToggleGirl(enabled: true);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncUponJoinServerRpc(int playerID)
	{
		//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_0071: 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)
		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(2777299986u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2777299986u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncUponJoinClientRpc(broughtToShip, playerID);
			}
		}
	}

	[ClientRpc]
	private void SyncUponJoinClientRpc(bool onShip, int playerID)
	{
		//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)
		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(4022450178u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref onShip, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4022450178u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
			{
				broughtToShip = onShip;
			}
		}
	}

	void IGoldenGlassSecret.BeginReveal()
	{
		if (!Config.hostToolRebalance && !broughtToShip && !choseLocalPlayer)
		{
			meshToToggle.mesh = loadedMesh;
			((Renderer)materialToToggle).material = AssetsCollection.defaultMaterialGoldTransparent;
		}
	}

	void IGoldenGlassSecret.EndReveal()
	{
		if (!broughtToShip && !choseLocalPlayer)
		{
			meshToToggle.mesh = null;
			((Renderer)materialToToggle).material = AssetsCollection.defaultMaterialGold;
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_GoldenGirlScript()
	{
		//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
		NetworkManager.__rpc_func_table.Add(2685509517u, new RpcReceiveHandler(__rpc_handler_2685509517));
		NetworkManager.__rpc_func_table.Add(247589533u, new RpcReceiveHandler(__rpc_handler_247589533));
		NetworkManager.__rpc_func_table.Add(958526731u, new RpcReceiveHandler(__rpc_handler_958526731));
		NetworkManager.__rpc_func_table.Add(2777299986u, new RpcReceiveHandler(__rpc_handler_2777299986));
		NetworkManager.__rpc_func_table.Add(4022450178u, new RpcReceiveHandler(__rpc_handler_4022450178));
	}

	private static void __rpc_handler_2685509517(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerClientId = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenGirlScript)(object)target).ChoosePlayerClientRpc(playerClientId);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_247589533(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;
			((GoldenGirlScript)(object)target).ReappearForEveryoneServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_958526731(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;
			((GoldenGirlScript)(object)target).ReappearForEveryoneClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_2777299986(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GoldenGirlScript)(object)target).SyncUponJoinServerRpc(playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4022450178(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool onShip = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref onShip, default(ForPrimitives));
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenGirlScript)(object)target).SyncUponJoinClientRpc(onShip, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "GoldenGirlScript";
	}
}
public class GoldenGlassScript : GrabbableObject
{
	private static ManualLogSource Logger = Plugin.Logger;

	private Coroutine beginRevealCoroutine;

	private Coroutine endRevealCoroutine;

	[Space(3f)]
	[Header("Audiovisual")]
	public AudioSource audio2D;

	public AudioClip beginRevealClip;

	public AudioClip endRevealClip;

	[Tooltip("The fewer reveals per frame, the better performance, but the slower things will appear/disappear on-screen when using the Glass.")]
	public int revealPerFrame;

	public override void InspectItem()
	{
		((GrabbableObject)this).InspectItem();
		if (base.playerHeldBy.IsInspectingItem)
		{
			StartAndStopCoroutine(beginReveal: true);
		}
		else
		{
			StartAndStopCoroutine(beginReveal: false);
		}
	}

	public override void PocketItem()
	{
		if ((Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
		{
			StartAndStopCoroutine(beginReveal: false, base.playerHeldBy.IsInspectingItem);
		}
		((GrabbableObject)this).PocketItem();
	}

	public override void DiscardItem()
	{
		StartAndStopCoroutine(beginReveal: false, base.playerHeldBy.IsInspectingItem);
		((GrabbableObject)this).DiscardItem();
	}

	private void StartAndStopCoroutine(bool beginReveal, bool playClip = true)
	{
		if (beginReveal)
		{
			if (endRevealCoroutine != null)
			{
				Logger.LogDebug((object)"!!!STOPPING END REVEAL COROUTINE!!!");
				((MonoBehaviour)this).StopCoroutine(endRevealCoroutine);
				endRevealCoroutine = null;
			}
			beginRevealCoroutine = ((MonoBehaviour)this).StartCoroutine(BeginRevealLocal(playClip));
		}
		else
		{
			if (beginRevealCoroutine != null)
			{
				Logger.LogDebug((object)"!!!STOPPING BEGIN REVEAL COROUTINE!!!");
				((MonoBehaviour)this).StopCoroutine(beginRevealCoroutine);
				beginRevealCoroutine = null;
			}
			endRevealCoroutine = ((MonoBehaviour)this).StartCoroutine(EndRevealLocal(playClip));
		}
	}

	private IEnumerator BeginRevealLocal(bool playClip = true)
	{
		if (!playClip)
		{
			yield break;
		}
		audio2D.Stop();
		audio2D.PlayOneShot(beginRevealClip);
		int num = 0;
		GoldScrapObject[] array = Object.FindObjectsOfType<GoldScrapObject>();
		GoldScrapObject[] array2 = array;
		foreach (GoldScrapObject goldScrapObject in array2)
		{
			if (RarityManager.CurrentlyGoldFever() && (Object)(object)goldScrapObject.item != (Object)null)
			{
				SetAllItemsScanNodes(goldScrapObject.item, setTo: true);
			}
			IGoldenGlassSecret component = ((Component)goldScrapObject).GetComponent<IGoldenGlassSecret>();
			if (component != null)
			{
				Logger.LogDebug((object)("BEGIN revealing " + ((Object)((Component)goldScrapObject).gameObject).name));
				component.BeginReveal();
				num++;
				if (num >= revealPerFrame)
				{
					yield return null;
					num = 0;
				}
			}
		}
		beginRevealCoroutine = null;
	}

	private IEnumerator EndRevealLocal(bool playClip = true)
	{
		if (!playClip)
		{
			yield break;
		}
		audio2D.Stop();
		audio2D.PlayOneShot(endRevealClip);
		int num = 0;
		GoldScrapObject[] array = Object.FindObjectsOfType<GoldScrapObject>();
		GoldScrapObject[] array2 = array;
		foreach (GoldScrapObject goldScrapObject in array2)
		{
			if ((StartOfRound.Instance.inShipPhase || RarityManager.CurrentlyGoldFever()) && (Object)(object)goldScrapObject.item != (Object)null)
			{
				SetAllItemsScanNodes(goldScrapObject.item, setTo: false);
			}
			IGoldenGlassSecret component = ((Component)goldScrapObject).GetComponent<IGoldenGlassSecret>();
			if (component != null)
			{
				Logger.LogDebug((object)("STOP revealing " + ((Object)((Component)goldScrapObject).gameObject).name));
				component.EndReveal();
				num++;
				if (num >= revealPerFrame)
				{
					yield return null;
					num = 0;
				}
			}
		}
		endRevealCoroutine = null;
	}

	private void SetAllItemsScanNodes(GrabbableObject item, bool setTo)
	{
		ScanNodeProperties componentInChildren = ((Component)item).gameObject.GetComponentInChildren<ScanNodeProperties>();
		if ((Object)(object)componentInChildren != (Object)null)
		{
			if (setTo && !item.isInShipRoom)
			{
				componentInChildren.maxRange = (Config.hostToolRebalance ? 128 : 256);
				componentInChildren.requiresLineOfSight = false;
			}
			else if (!setTo)
			{
				componentInChildren.maxRange = 13;
				componentInChildren.requiresLineOfSight = true;
			}
		}
	}

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

	protected internal override string __getTypeName()
	{
		return "GoldenGlassScript";
	}
}
public class GoldenGuardianScript : GrabbableObject
{
	[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
	public class NewPlayerDamage
	{
		[HarmonyPrefix]
		public static bool PreventDamage(PlayerControllerB __instance)
		{
			return PatchToPreventDamage(__instance, isKillCommand: false);
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
	public class NewPlayerKill
	{
		[HarmonyPrefix]
		public static bool PreventKill(PlayerControllerB __instance)
		{
			return PatchToPreventDamage(__instance, isKillCommand: true);
		}
	}

	private static ManualLogSource Logger = Plugin.Logger;

	private bool aboutToExplode;

	private Coroutine explosionCoroutine;

	[Space(3f)]
	[Header("Audiovisual")]
	public AudioSource audioSource;

	public AudioClip buildUpClip;

	public AudioClip explodeClip;

	public GameObject stunGrenadeExplosion;

	public override void Update()
	{
		((GrabbableObject)this).Update();
		if (((NetworkBehaviour)this).IsOwner && !((Object)(object)base.playerHeldBy == (Object)null) && (Object)(object)base.playerHeldBy.inAnimationWithEnemy != (Object)null && !aboutToExplode)
		{
			LocalPlayerStartExplosion(delay: true);
		}
	}

	public void LocalPlayerStartExplosion(bool delay = false, bool fromKillCommand = false)
	{
		float delayTime = 1.75f;
		if (Config.hostToolRebalance)
		{
			delayTime = 1.3f;
			delay = true;
		}
		if (fromKillCommand)
		{
			delay = false;
		}
		StartExplosion(delay, delayTime);
		StartExplosionServerRpc(delay, delayTime, (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
	}

	private void StartExplosion(bool delay, float delayTime)
	{
		Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} called StartExplosion with delay {delay} and delayTime {delayTime}");
		aboutToExplode = true;
		if (delay)
		{
			explosionCoroutine = ((MonoBehaviour)this).StartCoroutine(ExplodeOnDelay(delayTime));
			return;
		}
		if (explosionCoroutine != null)
		{
			Logger.LogDebug((object)"interrupting coroutine to explode immediately!");
			((MonoBehaviour)this).StopCoroutine(explosionCoroutine);
		}
		Explode();
	}

	private IEnumerator ExplodeOnDelay(float delayTime = 1.75f)
	{
		yield return (object)new WaitForSeconds(0.1f);
		audioSource.PlayOneShot(buildUpClip);
		WalkieTalkie.TransmitOneShotAudio(audioSource, buildUpClip, 0.5f);
		yield return (object)new WaitForSeconds(delayTime);
		Explode();
	}

	public void Explode()
	{
		//IL_00e6: 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)
		//IL_007b: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		if (!base.deactivated)
		{
			audioSource.Stop();
			((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
			if (!Config.hostToolRebalance)
			{
				audioSource.PlayOneShot(explodeClip);
				WalkieTalkie.TransmitOneShotAudio(audioSource, explodeClip, 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 25f, 0.3f, 0, false, 0);
				StunGrenadeItem.StunExplosion(((Component)this).transform.position, true, 0.2f, 10f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f);
				Transform val = (base.isInElevator ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.mapPropsContainer.transform);
				Object.Instantiate<GameObject>(stunGrenadeExplosion, ((Component)this).transform.position, Quaternion.identity, val);
			}
			else
			{
				Landmine.SpawnExplosion(((Component)this).transform.position, true, 4f, 8f, 25, 5f, (GameObject)null, false);
			}
			((MonoBehaviour)this).StartCoroutine(DelaySettingObjectAway());
		}
	}

	private IEnumerator DelaySettingObjectAway()
	{
		yield return (object)new WaitForSeconds(5f);
		base.targetFloorPosition = new Vector3(3000f, -400f, 3000f);
		base.startFallingPosition = new Vector3(3000f, -400f, 3000f);
	}

	public override void PlayDropSFX()
	{
		if (!base.deactivated)
		{
			((GrabbableObject)this).PlayDropSFX();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void StartExplosionServerRpc(bool delay, float delayTime, int heldPlayerID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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(619446056u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref delay, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref delayTime, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, heldPlayerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 619446056u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				StartExplosionClientRpc(delay, delayTime, heldPlayerID);
			}
		}
	}

	[ClientRpc]
	private void StartExplosionClientRpc(bool delay, float delayTime, int heldPlayerID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: 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(4234394122u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref delay, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref delayTime, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, heldPlayerID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4234394122u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && heldPlayerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				Logger.LogDebug((object)$"non-owner client starting GoldenGuardian #{((NetworkBehaviour)this).NetworkObjectId} explosion");
				StartExplosion(delay, delayTime);
			}
		}
	}

	public static bool PatchToPreventDamage(PlayerControllerB __instance, bool isKillCommand)
	{
		if (!((NetworkBehaviour)__instance).IsOwner || __instance.isPlayerDead || !__instance.AllowPlayerDeath() || (Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
		{
			return true;
		}
		GoldenGuardianScript component = ((Component)__instance.currentlyHeldObjectServer).GetComponent<GoldenGuardianScript>();
		if ((Object)(object)component != (Object)null && !((GrabbableObject)component).deactivated && (isKillCommand || !component.aboutToExplode))
		{
			Logger.LogDebug((object)$"GoldenGuardianScript patch: local player likely holding GoldenGuardian on server, trying to execute explosion | isKillCommand = {isKillCommand}");
			bool delay = !isKillCommand && Config.hostToolRebalance;
			component.LocalPlayerStartExplosion(delay, isKillCommand);
			return false;
		}
		return true;
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_GoldenGuardianScript()
	{
		//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
		NetworkManager.__rpc_func_table.Add(619446056u, new RpcReceiveHandler(__rpc_handler_619446056));
		NetworkManager.__rpc_func_table.Add(4234394122u, new RpcReceiveHandler(__rpc_handler_4234394122));
	}

	private static void __rpc_handler_619446056(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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool delay = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref delay, default(ForPrimitives));
			float delayTime = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref delayTime, default(ForPrimitives));
			int heldPlayerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref heldPlayerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GoldenGuardianScript)(object)target).StartExplosionServerRpc(delay, delayTime, heldPlayerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4234394122(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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool delay = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref delay, default(ForPrimitives));
			float delayTime = default(float);
			((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref delayTime, default(ForPrimitives));
			int heldPlayerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref heldPlayerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldenGuardianScript)(object)target).StartExplosionClientRpc(delay, delayTime, heldPlayerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "GoldenGuardianScript";
	}
}
public class GoldkeeperScript : GrabbableObject
{
	private static ManualLogSource Logger = Plugin.Logger;

	[Space(3f)]
	[Header("Blockers")]
	public Collider losBlocker;

	public NavMeshObstacle navBlocker;

	private Coroutine checkDistanceCoroutine;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		navBlocker.carveOnlyStationary = true;
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
		if (checkDistanceCoroutine != null)
		{
			Logger.LogDebug((object)"stopped CheckDistance Coroutine");
			((MonoBehaviour)this).StopCoroutine(checkDistanceCoroutine);
			checkDistanceCoroutine = null;
		}
		losBlocker.enabled = false;
		navBlocker.carving = false;
		((Behaviour)navBlocker).enabled = false;
		LogEnabled();
	}

	public override void PlayDropSFX()
	{
		((GrabbableObject)this).PlayDropSFX();
		if (checkDistanceCoroutine != null)
		{
			Logger.LogDebug((object)"stopped CheckDistance Coroutine");
			((MonoBehaviour)this).StopCoroutine(checkDistanceCoroutine);
			checkDistanceCoroutine = null;
		}
		checkDistanceCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckDistance());
	}

	private IEnumerator CheckDistance()
	{
		bool playerInRange = true;
		bool setTo = true;
		PlayerControllerB player = StartOfRound.Instance.localPlayerController;
		while (playerInRange)
		{
			yield return (object)new WaitForSeconds(0.1f);
			if ((Object)(object)((Component)this).GetComponentInParent<VehicleController>() != (Object)null || (Object)(object)((Component)this).GetComponentInParent<MineshaftElevatorController>() != (Object)null)
			{
				setTo = false;
				Logger.LogDebug((object)$"WARNING!!! {((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId} dropped inside vehicle or elevator! breaking and setting collision enabled to {setTo}");
				break;
			}
			if ((Object)(object)player == (Object)null || !player.isPlayerControlled)
			{
				playerInRange = false;
			}
			if (Vector3.Distance(((Component)this).transform.position - Vector3.back * 0.15f, ((Component)player).transform.position) >= 0.65f)
			{
				playerInRange = false;
			}
		}
		checkDistanceCoroutine = null;
		losBlocker.enabled = setTo;
		navBlocker.carving = setTo;
		((Behaviour)navBlocker).enabled = setTo;
		LogEnabled();
	}

	private void LogEnabled()
	{
		Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId}: {((Object)((Component)losBlocker).gameObject).name} enabled = {losBlocker.enabled}");
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncUponJoinServerRpc(int playerID)
	{
		//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_0071: 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)
		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(688314264u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 688314264u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncUponJoinClientRpc((Object)(object)base.playerHeldBy == (Object)null, playerID);
			}
		}
	}

	[ClientRpc]
	private void SyncUponJoinClientRpc(bool hostNullHeld, int playerID)
	{
		//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)
		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(4258008049u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostNullHeld, default(ForPrimitives));
			BytePacker.WriteValueBitPacked(val2, playerID);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4258008049u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
		{
			losBlocker.enabled = hostNullHeld;
			navBlocker.carving = hostNullHeld;
			((Behaviour)navBlocker).enabled = hostNullHeld;
			if (!hostNullHeld)
			{
				Logger.LogDebug((object)$"custom injecting hasHitGround on {((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId} since likely held on host");
				base.hasHitGround = false;
			}
			LogEnabled();
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_GoldkeeperScript()
	{
		//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
		NetworkManager.__rpc_func_table.Add(688314264u, new RpcReceiveHandler(__rpc_handler_688314264));
		NetworkManager.__rpc_func_table.Add(4258008049u, new RpcReceiveHandler(__rpc_handler_4258008049));
	}

	private static void __rpc_handler_688314264(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GoldkeeperScript)(object)target).SyncUponJoinServerRpc(playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4258008049(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool hostNullHeld = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostNullHeld, default(ForPrimitives));
			int playerID = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((GoldkeeperScript)(object)target).SyncUponJoinClientRpc(hostNullHeld, playerID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "GoldkeeperScript";
	}
}
public class GoldmineScript : GrabbableObject
{
	private static ManualLogSource Logger = Plugin.Logger;

	[Space(3f)]
	[Header("Functionality")]
	public GoldmineTrigger trigger;

	public bool hasExploded;

	public bool activated;

	public bool willExplodeImmediately;

	public bool willExplodeOnDelay;

	private float timeAtLastLightToggle;

	[Space(3f)]
	[Header("Audiovisual")]
	public AudioSource audioSource;

	public AudioClip triggerClip;

	public AudioClip beepClip;

	public AudioClip onClip;

	public AudioClip offClip;

	public Light triggerLight;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		((Behaviour)triggerLight).enabled = false;
		int num = (Config.hostToolRebalance ? 67 : 33);
		if (((NetworkBehaviour)this).IsServer && !base.isInShipRoom && Random.Range(1, 101) < num)
		{
			ToggleActiveClientRpc(hostActivated: true);
		}
	}

	public override void Update()
	{
		((GrabbableObject)this).Update();
		if (hasExploded)
		{
			return;
		}
		if (willExplodeOnDelay && (double)(Time.realtimeSinceStartup - timeAtLastLightToggle) > 0.075)
		{
			ToggleLight();
		}
		if (activated)
		{
			if (Time.realtimeSinceStartup - timeAtLastLightToggle > 5f)
			{
				audioSource.PlayOneShot(beepClip);
				ToggleLight();
			}
			if (((Behaviour)triggerLight).enabled && Time.realtimeSinceStartup - timeAtLastLightToggle > 0.1f)
			{
				ToggleLight();
			}
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (StartOfRound.Instance.shipDoorsEnabled && !StartOfRound.Instance.inShipPhase)
		{
			ImmediateExplosionServerRpc((int)base.playerHeldBy.playerClientId);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void ImmediateExplosionServerRpc(int playerID)
	{
		//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_0071: 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)
		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(3185693378u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3185693378u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ImmediateExplosionClientRpc(playerID);
			}
		}
	}

	[ClientRpc]
	private void ImmediateExplosionClientRpc(int playerID)
	{
		//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_0071: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (net

plugins/LethalThings.dll

Decompiled a day 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 System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using LethalThings.Extensions;
using LethalThings.MonoBehaviours;
using LethalThings.NetcodePatcher;
using LethalThings.Patches;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("LethalThings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1b8b33b895284cd355a72b99cdac7d152a8c9c92")]
[assembly: AssemblyProduct("LethalThings")]
[assembly: AssemblyTitle("LethalThings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Vector3>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<Vector3>();
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<HackingTool.HackState>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<HackingTool.HackState>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalLib.Modules
{
	public class SaveData
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_ResetSavedGameValues <0>__GameNetworkManager_ResetSavedGameValues;

			public static hook_SaveItemsInShip <1>__GameNetworkManager_SaveItemsInShip;

			public static hook_LoadShipGrabbableItems <2>__StartOfRound_LoadShipGrabbableItems;
		}

		public static List<string> saveKeys = new List<string>();

		public static void Init()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			object obj = <>O.<0>__GameNetworkManager_ResetSavedGameValues;
			if (obj == null)
			{
				hook_ResetSavedGameValues val = GameNetworkManager_ResetSavedGameValues;
				<>O.<0>__GameNetworkManager_ResetSavedGameValues = val;
				obj = (object)val;
			}
			GameNetworkManager.ResetSavedGameValues += (hook_ResetSavedGameValues)obj;
			object obj2 = <>O.<1>__GameNetworkManager_SaveItemsInShip;
			if (obj2 == null)
			{
				hook_SaveItemsInShip val2 = GameNetworkManager_SaveItemsInShip;
				<>O.<1>__GameNetworkManager_SaveItemsInShip = val2;
				obj2 = (object)val2;
			}
			GameNetworkManager.SaveItemsInShip += (hook_SaveItemsInShip)obj2;
			object obj3 = <>O.<2>__StartOfRound_LoadShipGrabbableItems;
			if (obj3 == null)
			{
				hook_LoadShipGrabbableItems val3 = StartOfRound_LoadShipGrabbableItems;
				<>O.<2>__StartOfRound_LoadShipGrabbableItems = val3;
				obj3 = (object)val3;
			}
			StartOfRound.LoadShipGrabbableItems += (hook_LoadShipGrabbableItems)obj3;
		}

		private static void StartOfRound_LoadShipGrabbableItems(orig_LoadShipGrabbableItems orig, StartOfRound self)
		{
			orig.Invoke(self);
			SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>();
			SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>();
			SaveableObject[] array3 = array;
			foreach (SaveableObject saveableObject in array3)
			{
				saveableObject.LoadObjectData();
			}
			SaveableNetworkBehaviour[] array4 = array2;
			foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4)
			{
				saveableNetworkBehaviour.LoadObjectData();
			}
			if (ES3.KeyExists("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName))
			{
				saveKeys = ES3.Load<List<string>>("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName);
			}
		}

		private static void GameNetworkManager_SaveItemsInShip(orig_SaveItemsInShip orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>();
			SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>();
			SaveableObject[] array3 = array;
			foreach (SaveableObject saveableObject in array3)
			{
				saveableObject.SaveObjectData();
			}
			SaveableNetworkBehaviour[] array4 = array2;
			foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4)
			{
				saveableNetworkBehaviour.SaveObjectData();
			}
			ES3.Save<List<string>>("LethalLibItemSaveKeys", saveKeys, GameNetworkManager.Instance.currentSaveFileName);
		}

		private static void GameNetworkManager_ResetSavedGameValues(orig_ResetSavedGameValues orig, GameNetworkManager self)
		{
			orig.Invoke(self);
			foreach (string saveKey in saveKeys)
			{
				ES3.DeleteKey(saveKey, GameNetworkManager.Instance.currentSaveFileName);
			}
			saveKeys.Clear();
		}

		public static void SaveObjectData<T>(string key, T data, int objectId)
		{
			List<T> list = new List<T>();
			if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			List<int> list2 = new List<int>();
			if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			list.Add(data);
			list2.Add(objectId);
			if (!saveKeys.Contains("LethalThingsSave_" + key))
			{
				saveKeys.Add("LethalThingsSave_" + key);
			}
			if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key))
			{
				saveKeys.Add("LethalThingsSave_objectIds_" + key);
			}
			ES3.Save<List<T>>("LethalThingsSave_" + key, list, GameNetworkManager.Instance.currentSaveFileName);
			ES3.Save<List<int>>("LethalThingsSave_objectIds_" + key, list2, GameNetworkManager.Instance.currentSaveFileName);
		}

		public static T LoadObjectData<T>(string key, int objectId)
		{
			List<T> list = new List<T>();
			if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			List<int> list2 = new List<int>();
			if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName))
			{
				list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName);
			}
			if (!saveKeys.Contains("LethalThingsSave_" + key))
			{
				saveKeys.Add("LethalThingsSave_" + key);
			}
			if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key))
			{
				saveKeys.Add("LethalThingsSave_objectIds_" + key);
			}
			if (list2.Contains(objectId))
			{
				int index = list2.IndexOf(objectId);
				return list[index];
			}
			return default(T);
		}
	}
}
namespace LethalThings
{
	public class Content
	{
		public static AssetBundle MainAssets;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static ContentLoader ContentLoader;

		public static GameObject devMenuPrefab;

		public static GameObject configManagerPrefab;

		public static void Init()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Expected O, but got Unknown
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Expected O, but got Unknown
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Expected O, but got Unknown
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Expected O, but got Unknown
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Expected O, but got Unknown
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Expected O, but got Unknown
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Expected O, but got Unknown
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Expected O, but got Unknown
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Expected O, but got Unknown
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Expected O, but got Unknown
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Expected O, but got Unknown
			MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalthings"));
			configManagerPrefab = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/LTNetworkConfig.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(configManagerPrefab);
			ContentLoader = new ContentLoader(Plugin.pluginInfo, MainAssets, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab)
			{
				Prefabs.Add(content.ID, prefab);
			});
			CustomContent[] array = (CustomContent[])(object)new CustomContent[28]
			{
				(CustomContent)new ScrapItem("Arson", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlush.asset", NetworkConfig.arsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Cookie", "Assets/Custom/LethalThings/Scrap/Cookie/CookieFumo.asset", NetworkConfig.cookieSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Bilka", "Assets/Custom/LethalThings/Scrap/Toimari/ToimariPlush.asset", NetworkConfig.toimariSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Hamis", "Assets/Custom/LethalThings/Scrap/Hamis/HamisPlush.asset", NetworkConfig.hamisSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("ArsonDirty", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlushDirty.asset", NetworkConfig.dirtyArsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Maxwell", "Assets/Custom/LethalThings/Scrap/Maxwell/Dingus.asset", NetworkConfig.maxwellSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Glizzy", "Assets/Custom/LethalThings/Scrap/glizzy/glizzy.asset", NetworkConfig.glizzySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Revolver", "Assets/Custom/LethalThings/Scrap/Flaggun/Toygun.asset", NetworkConfig.revolverSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("GremlinEnergy", "Assets/Custom/LethalThings/Scrap/GremlinEnergy/GremlinEnergy.asset", NetworkConfig.gremlinSodaSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("ToyHammerScrap", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerScrapSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ScrapItem("Gnarpy", "Assets/Custom/LethalThings/Scrap/Gnarpy/GnarpyPlush.asset", NetworkConfig.gnarpySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null),
				(CustomContent)new ShopItem("RocketLauncher", "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncher.asset", NetworkConfig.rocketLauncherPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncherInfo.asset", (Action<Item>)delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<RocketLauncher>().missilePrefab);
				}),
				(CustomContent)new ShopItem("Flaregun", "Assets/Custom/LethalThings/Items/Flaregun/Flaregun.asset", NetworkConfig.flareGunPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunInfo.asset", (Action<Item>)delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<ProjectileWeapon>().projectilePrefab);
				}),
				(CustomContent)new ShopItem("FlaregunAmmo", "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmo.asset", NetworkConfig.flareGunAmmoPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmoInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("ToyHammerShop", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammerInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("RemoteRadar", "Assets/Custom/LethalThings/Items/Radar/HandheldRadar.asset", NetworkConfig.remoteRadarPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Radar/HandheldRadarInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("PouchyBelt", "Assets/Custom/LethalThings/Items/Pouch/Pouch.asset", NetworkConfig.pouchyBeltPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Pouch/PouchInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("HackingTool", "Assets/Custom/LethalThings/Items/HackingTool/HackingTool.asset", NetworkConfig.hackingToolPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/HackingTool/HackingToolInfo.asset", (Action<Item>)null),
				(CustomContent)new ShopItem("Pinger", "Assets/Custom/LethalThings/Items/PingingTool/PingTool.asset", NetworkConfig.pingerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/PingingTool/PingToolInfo.asset", (Action<Item>)delegate(Item item)
				{
					NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<Pinger>().pingMarkerPrefab);
				}),
				(CustomContent)new CustomItem("Dart", "Assets/Custom/LethalThings/Unlockables/dartboard/Dart.asset", (Action<Item>)null),
				(CustomContent)new Unlockable("SmallRug", "Assets/Custom/LethalThings/Unlockables/Rug/SmallRug.asset", NetworkConfig.smallRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new Unlockable("LargeRug", "Assets/Custom/LethalThings/Unlockables/Rug/LargeRug.asset", NetworkConfig.largeRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new Unlockable("FatalitiesSign", "Assets/Custom/LethalThings/Unlockables/Sign/Sign.asset", NetworkConfig.fatalitiesSignPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Sign/SignInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new Unlockable("Dartboard", "Assets/Custom/LethalThings/Unlockables/dartboard/Dartboard.asset", NetworkConfig.dartBoardPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/dartboard/DartboardInfo.asset", (StoreType)2, (Action<UnlockableItem>)null),
				(CustomContent)new CustomEnemy("Boomba", "Assets/Custom/LethalThings/Enemies/Roomba/Boomba.asset", NetworkConfig.boombaSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, (string[])null, "Assets/Custom/LethalThings/Enemies/Roomba/BoombaFile.asset", (string)null, (Action<EnemyType>)null),
				(CustomContent)new CustomEnemy("Maggie", "Assets/Custom/LethalThings/Enemies/Maggie/Maggie.asset", NetworkConfig.maggieSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, (string[])null, "Assets/Custom/LethalThings/Enemies/Maggie/MaggieFile.asset", (string)null, (Action<EnemyType>)delegate
				{
					GameObject val4 = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/Enemies/Maggie/PlayerRagdollGoop.prefab");
					Player.RegisterPlayerRagdoll("LTGoopRagdoll", val4);
				}),
				(CustomContent)new CustomEnemy("CrystalRay", "Assets/Custom/LethalThings/Enemies/CrystalRay/CrystalRay.asset", NetworkConfig.crystalRaySpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, (string[])null, "Assets/Custom/LethalThings/Enemies/CrystalRay/CrystalRayFile.asset", (string)null, (Action<EnemyType>)null),
				(CustomContent)new MapHazard("TeleporterTrap", "Assets/Custom/LethalThings/hazards/TeleporterTrap/TeleporterTrap.asset", (LevelTypes)(-1), (string[])null, (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 0f),
					new Keyframe(1f, 4f)
				})), (Action<SpawnableMapObjectDef>)null)
			};
			ContentLoader.RegisterAll(array);
			foreach (KeyValuePair<string, GameObject> prefab in Prefabs)
			{
				GameObject value = prefab.Value;
				string key = prefab.Key;
				AudioSource[] componentsInChildren = value.GetComponentsInChildren<AudioSource>();
				if (componentsInChildren.Length != 0)
				{
					ConfigEntry<float> val = NetworkConfig.VolumeConfig.Bind<float>("Volume", key ?? "", 100f, "Audio volume for " + key + " (0 - 100)");
					AudioSource[] array2 = componentsInChildren;
					foreach (AudioSource val2 in array2)
					{
						val2.volume *= val.Value / 100f;
					}
				}
			}
			GameObject val3 = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/DevMenu.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val3);
			devMenuPrefab = val3;
			try
			{
				IEnumerable<Type> loadableTypes = Assembly.GetExecutingAssembly().GetLoadableTypes();
				foreach (Type item in loadableTypes)
				{
					MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array3 = methods;
					foreach (MethodInfo methodInfo in array3)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
			}
			catch (Exception)
			{
			}
		}
	}
	public static class InputCompat
	{
		public static InputActionAsset Asset;

		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils");

		public static InputAction LTUtilityBeltQuick1 => Keybinds.Instance.LTUtilityBeltQuick1;

		public static InputAction LTUtilityBeltQuick2 => Keybinds.Instance.LTUtilityBeltQuick2;

		public static InputAction LTUtilityBeltQuick3 => Keybinds.Instance.LTUtilityBeltQuick3;

		public static InputAction LTUtilityBeltQuick4 => Keybinds.Instance.LTUtilityBeltQuick4;

		public static void Init()
		{
			Keybinds.Instance = new Keybinds();
			Asset = Keybinds.Instance.GetAsset();
		}
	}
	public class Keybinds : LcInputActions
	{
		public static Keybinds Instance;

		[InputAction("", Name = "[LT] Utility Belt Quick 1")]
		public InputAction LTUtilityBeltQuick1 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 2")]
		public InputAction LTUtilityBeltQuick2 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 3")]
		public InputAction LTUtilityBeltQuick3 { get; set; }

		[InputAction("", Name = "[LT] Utility Belt Quick 4")]
		public InputAction LTUtilityBeltQuick4 { get; set; }

		public InputActionAsset GetAsset()
		{
			return ((LcInputActions)this).Asset;
		}
	}
	public class Dingus : SaveableObject
	{
		public AudioSource noiseAudio;

		public AudioSource noiseAudioFar;

		public AudioSource musicAudio;

		public AudioSource musicAudioFar;

		[Space(3f)]
		public AudioClip[] noiseSFX;

		public AudioClip[] noiseSFXFar;

		public AudioClip evilNoise;

		[Space(3f)]
		public float noiseRange;

		public float maxLoudness;

		public float minLoudness;

		public float minPitch;

		public float maxPitch;

		private Random noisemakerRandom;

		public Animator triggerAnimator;

		private int timesPlayedWithoutTurningOff = 0;

		private RoundManager roundManager;

		private float noiseInterval = 1f;

		public Animator danceAnimator;

		public bool wasLoadedFromSave = false;

		public bool exploding = false;

		[HideInInspector]
		private NetworkVariable<bool> isEvil = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public GameObject evilObject;

		[HideInInspector]
		public NetworkVariable<bool> isPlayingMusic = new NetworkVariable<bool>(NetworkConfig.maxwellPlayMusicDefault.Value, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

		[HideInInspector]
		public NetworkVariable<bool> isPipebomb = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public override void SaveObjectData()
		{
			SaveData.SaveObjectData("dingusBeEvil", isEvil.Value, uniqueId);
		}

		public override void LoadObjectData()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				bool flag = SaveData.LoadObjectData<bool>("dingusBeEvil", uniqueId);
				Plugin.logger.LogInfo((object)$"Loading object[{uniqueId}] save data, evil? {flag}");
				if (flag)
				{
					isEvil.Value = flag;
				}
			}
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
			roundManager = Object.FindObjectOfType<RoundManager>();
			noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
			Debug.Log((object)"Making the dingus dance");
		}

		public override void OnNetworkSpawn()
		{
			base.OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsOwner)
			{
				isPlayingMusic.Value = NetworkConfig.Instance.maxwellPlayMusicDefaultNetVar.Value;
			}
			if (((NetworkBehaviour)this).IsHost && !StartOfRound.Instance.inShipPhase)
			{
				isEvil.Value = Random.Range(0f, 100f) <= NetworkConfig.evilMaxwellChance.Value;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
			{
				int num = noisemakerRandom.Next(0, noiseSFX.Length);
				float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
				float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
				noiseAudio.pitch = pitch;
				noiseAudio.PlayOneShot(noiseSFX[num], num2);
				if ((Object)(object)noiseAudioFar != (Object)null)
				{
					noiseAudioFar.pitch = pitch;
					noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2);
				}
				if ((Object)(object)triggerAnimator != (Object)null)
				{
					triggerAnimator.SetTrigger("playAnim");
				}
				WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
		}

		public override void DiscardItem()
		{
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
			((GrabbableObject)this).isBeingUsed = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			danceAnimator.Play("dingusIdle");
			Debug.Log((object)"Making the dingus idle");
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (!right && ((NetworkBehaviour)this).IsOwner)
			{
				isPlayingMusic.Value = !isPlayingMusic.Value;
			}
		}

		public override void InteractItem()
		{
			((GrabbableObject)this).InteractItem();
			if (isEvil.Value && !exploding && !isPipebomb.Value)
			{
				EvilMaxwellServerRpc();
			}
		}

		public void EvilMaxwellTruly()
		{
			danceAnimator.Play("dingusIdle");
			if (musicAudio.isPlaying)
			{
				musicAudio.Pause();
				musicAudioFar.Pause();
			}
			((MonoBehaviour)this).StartCoroutine(evilMaxwellMoment());
		}

		[ServerRpc(RequireOwnership = false)]
		public void EvilMaxwellServerRpc()
		{
			//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(88404199u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 88404199u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					isPipebomb.Value = true;
					EvilMaxwellClientRpc();
				}
			}
		}

		[ClientRpc]
		public void EvilMaxwellClientRpc()
		{
			//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(1120322383u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1120322383u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				EvilMaxwellTruly();
				exploding = true;
				if (((NetworkBehaviour)this).IsOwner)
				{
					isPlayingMusic.Value = false;
				}
				timesPlayedWithoutTurningOff = 0;
				danceAnimator.Play("dingusIdle");
				if (musicAudio.isPlaying)
				{
					musicAudio.Pause();
					musicAudioFar.Pause();
				}
				Plugin.logger.LogInfo((object)"Evil maxwell moment");
			}
		}

		public IEnumerator evilMaxwellMoment()
		{
			yield return (object)new WaitForSeconds(1f);
			noiseAudio.PlayOneShot(evilNoise, 1f);
			evilObject.SetActive(true);
			((Renderer)((GrabbableObject)this).mainObjectRenderer).enabled = false;
			if ((Object)(object)noiseAudioFar != (Object)null)
			{
				noiseAudioFar.PlayOneShot(evilNoise, 1f);
			}
			if ((Object)(object)triggerAnimator != (Object)null)
			{
				triggerAnimator.SetTrigger("playAnim");
			}
			WalkieTalkie.TransmitOneShotAudio(noiseAudio, evilNoise, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			yield return (object)new WaitForSeconds(1.5f);
			Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3);
			Rigidbody[] componentsInChildren = evilObject.GetComponentsInChildren<Rigidbody>();
			foreach (Rigidbody rb in componentsInChildren)
			{
				rb.isKinematic = false;
				rb.AddExplosionForce(1000f, evilObject.transform.position, 100f);
			}
			yield return (object)new WaitForSeconds(2f);
			if (((NetworkBehaviour)this).IsServer)
			{
				((Component)this).GetComponent<NetworkObject>().Despawn(true);
			}
		}

		public override void Update()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (isEvil.Value)
			{
				((GrabbableObject)this).grabbable = false;
				((GrabbableObject)this).grabbableToEnemies = false;
			}
			if (isPlayingMusic.Value && !exploding)
			{
				if (!musicAudio.isPlaying)
				{
					musicAudio.Play();
					musicAudioFar.Play();
				}
				if (!((GrabbableObject)this).isHeld)
				{
					danceAnimator.Play("dingusDance");
				}
				else
				{
					danceAnimator.Play("dingusIdle");
				}
				if (noiseInterval <= 0f)
				{
					noiseInterval = 1f;
					timesPlayedWithoutTurningOff++;
					roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5);
				}
				else
				{
					noiseInterval -= Time.deltaTime;
				}
			}
			else
			{
				timesPlayedWithoutTurningOff = 0;
				danceAnimator.Play("dingusIdle");
				if (musicAudio.isPlaying)
				{
					musicAudio.Pause();
					musicAudioFar.Pause();
				}
			}
		}

		protected override void __initializeVariables()
		{
			if (isEvil == null)
			{
				throw new Exception("Dingus.isEvil cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isEvil).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isEvil, "isEvil");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isEvil);
			if (isPlayingMusic == null)
			{
				throw new Exception("Dingus.isPlayingMusic cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isPlayingMusic).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPlayingMusic, "isPlayingMusic");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPlayingMusic);
			if (isPipebomb == null)
			{
				throw new Exception("Dingus.isPipebomb cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)isPipebomb).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPipebomb, "isPipebomb");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPipebomb);
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Dingus()
		{
			//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
			NetworkManager.__rpc_func_table.Add(88404199u, new RpcReceiveHandler(__rpc_handler_88404199));
			NetworkManager.__rpc_func_table.Add(1120322383u, new RpcReceiveHandler(__rpc_handler_1120322383));
		}

		private static void __rpc_handler_88404199(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;
				((Dingus)(object)target).EvilMaxwellServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1120322383(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;
				((Dingus)(object)target).EvilMaxwellClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Dingus";
		}
	}
	public class Missile : NetworkBehaviour
	{
		public int damage = 50;

		public float maxDistance = 10f;

		public float minDistance = 0f;

		public float gravity = 2.4f;

		public float flightDelay = 0.5f;

		public float flightForce = 150f;

		public float flightTime = 2f;

		public float autoDestroyTime = 3f;

		private float timeAlive = 0f;

		public float LobForce = 100f;

		public ParticleSystem particleSystem;

		private void OnCollisionEnter(Collision collision)
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				Boom();
				BoomClientRpc();
			}
			else
			{
				BoomServerRpc();
			}
		}

		private void Start()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).GetComponent<Rigidbody>().useGravity = false;
			if (((NetworkBehaviour)this).IsHost)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * LobForce, (ForceMode)1);
			}
		}

		[ClientRpc]
		public void BoomClientRpc()
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3331368301u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3331368301u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Boom();
				}
			}
		}

		[ServerRpc]
		public void BoomServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(452316787u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 452316787u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Boom();
				BoomClientRpc();
			}
		}

		public void CreateExplosion()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId));
			Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, damage, minDistance, maxDistance, 10, (CauseOfDeath)3, attacker);
		}

		public void Boom()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)particleSystem == (Object)null)
			{
				Debug.LogError((object)"No particle system set on missile, destruction time!!");
				CreateExplosion();
				if (((NetworkBehaviour)this).IsHost)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				return;
			}
			particleSystem.Stop(true, (ParticleSystemStopBehavior)1);
			((Component)particleSystem).transform.SetParent((Transform)null);
			((Component)particleSystem).transform.localScale = Vector3.one;
			GameObject gameObject = ((Component)particleSystem).gameObject;
			MainModule main = particleSystem.main;
			float duration = ((MainModule)(ref main)).duration;
			main = particleSystem.main;
			MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime;
			Object.Destroy((Object)(object)gameObject, duration + ((MinMaxCurve)(ref startLifetime)).constant);
			CreateExplosion();
			if (((NetworkBehaviour)this).IsHost)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void FixedUpdate()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			((Component)this).GetComponent<Rigidbody>().useGravity = false;
			((Component)this).GetComponent<Rigidbody>().AddForce(Vector3.down * gravity);
			if (timeAlive <= flightTime && timeAlive >= flightDelay)
			{
				((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * flightForce);
			}
			timeAlive += Time.fixedDeltaTime;
			if (timeAlive > autoDestroyTime)
			{
				if (((NetworkBehaviour)this).IsHost)
				{
					Boom();
					BoomClientRpc();
				}
				else
				{
					BoomServerRpc();
				}
			}
			else
			{
				Debug.Log((object)("Time alive: " + timeAlive + " / " + autoDestroyTime));
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Missile()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3331368301u, new RpcReceiveHandler(__rpc_handler_3331368301));
			NetworkManager.__rpc_func_table.Add(452316787u, new RpcReceiveHandler(__rpc_handler_452316787));
		}

		private static void __rpc_handler_3331368301(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;
				((Missile)(object)target).BoomClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_452316787(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Missile)(object)target).BoomServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Missile";
		}
	}
	public class PouchyBelt : GrabbableObject
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_BeginGrabObject <0>__PlayerControllerB_BeginGrabObject;
		}

		public Transform beltCosmetic;

		public Vector3 beltCosmeticPositionOffset = new Vector3(0f, 0f, 0f);

		public Vector3 beltCosmeticRotationOffset = new Vector3(0f, 0f, 0f);

		public int beltCapacity = 3;

		private PlayerControllerB previousPlayerHeldBy;

		public List<int> slotIndexes = new List<int>();

		public static void Initialize()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerControllerB_BeginGrabObject;
			if (obj == null)
			{
				hook_BeginGrabObject val = PlayerControllerB_BeginGrabObject;
				<>O.<0>__PlayerControllerB_BeginGrabObject = val;
				obj = (object)val;
			}
			PlayerControllerB.BeginGrabObject += (hook_BeginGrabObject)obj;
		}

		public void Awake()
		{
			if (InputCompat.Enabled)
			{
				InputCompat.LTUtilityBeltQuick1.started += InputReceived;
				InputCompat.LTUtilityBeltQuick2.started += InputReceived;
				InputCompat.LTUtilityBeltQuick3.started += InputReceived;
				InputCompat.LTUtilityBeltQuick4.started += InputReceived;
			}
		}

		private static void PlayerControllerB_BeginGrabObject(orig_BeginGrabObject orig, PlayerControllerB self)
		{
			orig.Invoke(self);
			if (self.currentlyGrabbingObject is PouchyBelt)
			{
				self.currentlyGrabbingObject.grabbable = true;
			}
		}

		public override void InteractItem()
		{
			if (GameNetworkManager.Instance.localPlayerController.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt))
			{
				GameNetworkManager.Instance.localPlayerController.currentlyGrabbingObject.grabbable = false;
			}
			((GrabbableObject)this).InteractItem();
		}

		public void InputReceived(CallbackContext context)
		{
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null && ((CallbackContext)(ref context)).started)
			{
				int num = -1;
				if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick1)
				{
					num = 0;
				}
				else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick2)
				{
					num = 1;
				}
				else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick3)
				{
					num = 2;
				}
				else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick4)
				{
					num = 3;
				}
				if (num != -1 && num < slotIndexes.Count)
				{
					base.playerHeldBy.SwitchItemSlots(slotIndexes[num]);
				}
			}
		}

		public override void LateUpdate()
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0117: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).LateUpdate();
			if (GameNetworkManager.Instance.localPlayerController.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt))
			{
				base.customGrabTooltip = "(Cannot hold more than 1 belt)";
			}
			else
			{
				base.customGrabTooltip = "Pick up belt";
			}
			if ((Object)(object)previousPlayerHeldBy != (Object)null)
			{
				((Component)beltCosmetic).gameObject.SetActive(true);
				beltCosmetic.SetParent((Transform)null);
				((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = true;
				if (((NetworkBehaviour)this).IsOwner)
				{
					((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = false;
				}
				Transform parent = previousPlayerHeldBy.lowerSpine.parent;
				beltCosmetic.position = parent.position + beltCosmeticPositionOffset;
				Quaternion rotation = parent.rotation;
				Quaternion rotation2 = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles + beltCosmeticRotationOffset);
				beltCosmetic.rotation = rotation2;
				((Renderer)base.mainObjectRenderer).enabled = false;
				((Component)this).gameObject.SetActive(true);
			}
			else
			{
				((Component)beltCosmetic).gameObject.SetActive(false);
				((Renderer)base.mainObjectRenderer).enabled = true;
				beltCosmetic.SetParent(((Component)this).transform);
			}
		}

		public void UpdateHUD(bool add)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			slotIndexes.Clear();
			HUDManager instance = HUDManager.Instance;
			if (add)
			{
				int num = 0;
				GrabbableObject[] itemSlots = GameNetworkManager.Instance.localPlayerController.ItemSlots;
				foreach (GrabbableObject val in itemSlots)
				{
					if (val is PouchyBelt)
					{
						num++;
					}
				}
				Image val2 = instance.itemSlotIconFrames[0];
				Image val3 = instance.itemSlotIcons[0];
				int num2 = instance.itemSlotIconFrames.Length;
				CanvasScaler componentInParent = ((Component)val2).GetComponentInParent<CanvasScaler>();
				AspectRatioFitter componentInParent2 = ((Component)val2).GetComponentInParent<AspectRatioFitter>();
				float x = ((Graphic)val2).rectTransform.sizeDelta.x;
				float y = ((Graphic)val2).rectTransform.sizeDelta.y;
				float num3 = ((Graphic)val2).rectTransform.anchoredPosition.y + 1.125f * y * (float)num;
				Vector3 localEulerAngles = ((Transform)((Graphic)val2).rectTransform).localEulerAngles;
				Vector3 localEulerAngles2 = ((Transform)((Graphic)val3).rectTransform).localEulerAngles;
				List<Image> list = instance.itemSlotIconFrames.ToList();
				List<Image> list2 = instance.itemSlotIcons.ToList();
				int count = list.Count;
				float num4 = (float)beltCapacity * x + (float)(beltCapacity - 1) * 15f;
				Debug.Log((object)$"Adding {beltCapacity} item slots! Surely this will go well..");
				Debug.Log((object)$"Adding after index: {count}");
				for (int j = 0; j < beltCapacity; j++)
				{
					float num5 = 0f - ((Component)((Transform)((Graphic)val2).rectTransform).parent).GetComponent<RectTransform>().sizeDelta.x / 2f - 3f;
					float num6 = num5 + (float)j * x + (float)j * 15f;
					Image val4 = list[0];
					Image val5 = Object.Instantiate<Image>(val4, ((Component)val2).transform.parent);
					((Object)val5).name = $"Slot{num2 + j}[LethalThingsBelt]";
					((Graphic)val5).rectTransform.anchoredPosition = new Vector2(num6, num3);
					((Transform)((Graphic)val5).rectTransform).eulerAngles = localEulerAngles;
					Image component = ((Component)((Component)val5).transform.GetChild(0)).GetComponent<Image>();
					((Object)component).name = "icon";
					((Behaviour)component).enabled = false;
					((Transform)((Graphic)component).rectTransform).eulerAngles = localEulerAngles2;
					((Transform)((Graphic)component).rectTransform).Rotate(new Vector3(0f, 0f, -90f));
					int num7 = count + j;
					list.Insert(num7, val5);
					list2.Insert(num7, component);
					slotIndexes.Add(num7);
					((Component)val5).transform.SetSiblingIndex(num7);
				}
				instance.itemSlotIconFrames = list.ToArray();
				instance.itemSlotIcons = list2.ToArray();
				Debug.Log((object)$"Added {beltCapacity} item slots!");
				return;
			}
			List<Image> list3 = instance.itemSlotIconFrames.ToList();
			List<Image> list4 = instance.itemSlotIcons.ToList();
			int count2 = list3.Count;
			int num8 = 0;
			for (int num9 = count2 - 1; num9 >= 0; num9--)
			{
				if (((Object)list3[num9]).name.Contains("[LethalThingsBelt]"))
				{
					num8++;
					Image val6 = list3[num9];
					list3.RemoveAt(num9);
					list4.RemoveAt(num9);
					Object.Destroy((Object)(object)((Component)val6).gameObject);
					if (num8 >= beltCapacity)
					{
						break;
					}
				}
			}
			instance.itemSlotIconFrames = list3.ToArray();
			instance.itemSlotIcons = list4.ToArray();
			Debug.Log((object)$"Removed {beltCapacity} item slots!");
		}

		public void AddItemSlots()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList();
				base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count + beltCapacity];
				for (int i = 0; i < list.Count; i++)
				{
					base.playerHeldBy.ItemSlots[i] = list[i];
				}
				if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					UpdateHUD(add: true);
				}
			}
		}

		public void RemoveItemSlots()
		{
			if (!((Object)(object)base.playerHeldBy != (Object)null))
			{
				return;
			}
			int num = base.playerHeldBy.ItemSlots.Length - beltCapacity;
			int currentItemSlot = base.playerHeldBy.currentItemSlot;
			for (int i = 0; i < beltCapacity; i++)
			{
				GrabbableObject val = base.playerHeldBy.ItemSlots[num + i];
				if ((Object)(object)val != (Object)null)
				{
					base.playerHeldBy.DropItem(val, num + i);
				}
			}
			int currentItemSlot2 = base.playerHeldBy.currentItemSlot;
			currentItemSlot2 = ((currentItemSlot < base.playerHeldBy.ItemSlots.Length) ? currentItemSlot : 0);
			List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList();
			base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count - beltCapacity];
			for (int j = 0; j < base.playerHeldBy.ItemSlots.Length; j++)
			{
				base.playerHeldBy.ItemSlots[j] = list[j];
			}
			if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				UpdateHUD(add: false);
			}
			base.playerHeldBy.SwitchItemSlots(currentItemSlot2);
		}

		public override void DiscardItem()
		{
			RemoveItemSlots();
			previousPlayerHeldBy = null;
			((GrabbableObject)this).DiscardItem();
		}

		public override void OnNetworkDespawn()
		{
			RemoveItemSlots();
			previousPlayerHeldBy = null;
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

		public void GrabItemOnClient()
		{
			((GrabbableObject)this).GrabItemOnClient();
		}

		public override void OnDestroy()
		{
			if (InputCompat.Enabled)
			{
				InputCompat.LTUtilityBeltQuick1.started -= InputReceived;
				InputCompat.LTUtilityBeltQuick2.started -= InputReceived;
				InputCompat.LTUtilityBeltQuick3.started -= InputReceived;
				InputCompat.LTUtilityBeltQuick4.started -= InputReceived;
			}
			((NetworkBehaviour)this).OnDestroy();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				if ((Object)(object)base.playerHeldBy != (Object)(object)previousPlayerHeldBy)
				{
					AddItemSlots();
				}
				previousPlayerHeldBy = base.playerHeldBy;
			}
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PouchyBelt";
		}
	}
	public class PowerOutletStun : NetworkBehaviour
	{
		private Coroutine electrocutionCoroutine;

		public AudioSource strikeAudio;

		public ParticleSystem strikeParticle;

		[HideInInspector]
		private NetworkVariable<int> damage = new NetworkVariable<int>(20, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public void Electrocute(ItemCharger socket)
		{
			Debug.Log((object)"Attempting electrocution");
			if (electrocutionCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(electrocutionCoroutine);
			}
			electrocutionCoroutine = ((MonoBehaviour)this).StartCoroutine(electrocutionDelayed(socket));
		}

		public void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			StormyWeather val = Object.FindObjectOfType<StormyWeather>(true);
			GameObject gameObject = ((Component)val.targetedStrikeAudio).gameObject;
			strikeAudio = Object.Instantiate<GameObject>(gameObject, ((Component)this).transform).GetComponent<AudioSource>();
			((Component)strikeAudio).transform.localPosition = Vector3.zero;
			((Component)strikeAudio).gameObject.SetActive(true);
			strikeParticle = Object.Instantiate<GameObject>(((Component)val.explosionEffectParticle).gameObject, ((Component)this).transform).GetComponent<ParticleSystem>();
			((Component)strikeParticle).transform.localPosition = Vector3.zero;
			((Component)strikeParticle).gameObject.SetActive(true);
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsHost)
			{
				damage.Value = NetworkConfig.itemChargerElectrocutionDamage.Value;
			}
		}

		private IEnumerator electrocutionDelayed(ItemCharger socket)
		{
			Debug.Log((object)"Electrocution started");
			socket.zapAudio.Play();
			yield return (object)new WaitForSeconds(0.75f);
			socket.chargeStationAnimator.SetTrigger("zap");
			Debug.Log((object)"Electrocution finished");
			if (((NetworkBehaviour)this).NetworkObject.IsOwner && !((NetworkBehaviour)this).NetworkObject.IsOwnedByServer)
			{
				Debug.Log((object)"Sending stun to server!!");
				ElectrocutedServerRpc(((Component)this).transform.position);
			}
			else if (((NetworkBehaviour)this).NetworkObject.IsOwner && ((NetworkBehaviour)this).NetworkObject.IsOwnedByServer)
			{
				Debug.Log((object)"Sending stun to clients!!");
				ElectrocutedClientRpc(((Component)this).transform.position);
				Electrocuted(((Component)this).transform.position);
			}
		}

		[ClientRpc]
		private void ElectrocutedClientRpc(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_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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(328188188u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 328188188u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Debug.Log((object)"Stun received!!");
					Electrocuted(position);
				}
			}
		}

		private void Electrocuted(Vector3 position)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			StormyWeather val = Object.FindObjectOfType<StormyWeather>(true);
			Utilities.CreateExplosion(position, spawnExplosionEffect: false, damage.Value, 0f, 5f, 3, (CauseOfDeath)11);
			strikeParticle.Play();
			val.PlayThunderEffects(position, strikeAudio);
		}

		[ServerRpc]
		private void ElectrocutedServerRpc(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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_0110: 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)
			//IL_00ae: 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_00cf: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2844681185u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2844681185u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ElectrocutedClientRpc(position);
			}
		}

		protected override void __initializeVariables()
		{
			if (damage == null)
			{
				throw new Exception("PowerOutletStun.damage cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)damage).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)damage, "damage");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)damage);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PowerOutletStun()
		{
			//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
			NetworkManager.__rpc_func_table.Add(328188188u, new RpcReceiveHandler(__rpc_handler_328188188));
			NetworkManager.__rpc_func_table.Add(2844681185u, new RpcReceiveHandler(__rpc_handler_2844681185));
		}

		private static void __rpc_handler_328188188(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)2;
				((PowerOutletStun)(object)target).ElectrocutedClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2844681185(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PowerOutletStun)(object)target).ElectrocutedServerRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PowerOutletStun";
		}
	}
	public class ProjectileWeapon : SaveableObject
	{
		public AudioSource mainAudio;

		public AudioClip[] activateClips;

		public AudioClip[] noAmmoSounds;

		public AudioClip[] reloadSounds;

		public Transform aimDirection;

		public int maxAmmo = 4;

		[HideInInspector]
		private NetworkVariable<int> currentAmmo = new NetworkVariable<int>(4, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public GameObject projectilePrefab;

		public float LobForce = 100f;

		private float timeSinceLastShot;

		private PlayerControllerB previousPlayerHeldBy;

		public Animator Animator;

		public ParticleSystem particleSystem;

		public Item ammoItem;

		public int ammoSlotToUse = -1;

		public override void SaveObjectData()
		{
			SaveData.SaveObjectData("projectileWeaponAmmoData", currentAmmo.Value, uniqueId);
		}

		public override void LoadObjectData()
		{
			if (((NetworkBehaviour)this).IsHost)
			{
				currentAmmo.Value = SaveData.LoadObjectData<int>("projectileWeaponAmmoData", uniqueId);
			}
		}

		public static void Init()
		{
		}

		private static bool GrabbableObject_UseItemBatteries(orig_UseItemBatteries orig, GrabbableObject self, bool isThrowable, bool buttonDown)
		{
			if (self is ProjectileWeapon)
			{
				return true;
			}
			return orig.Invoke(self, isThrowable, buttonDown);
		}

		public override void Start()
		{
			((GrabbableObject)this).Start();
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
		}

		public override void OnNetworkSpawn()
		{
			base.OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsServer)
			{
				currentAmmo.Value = maxAmmo;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (currentAmmo.Value > 0)
			{
				if (((NetworkBehaviour)this).IsHost)
				{
					NetworkVariable<int> obj = currentAmmo;
					int value = obj.Value;
					obj.Value = value - 1;
				}
				PlayRandomAudio(mainAudio, activateClips);
				Animator.Play("fire");
				particleSystem.Play();
				timeSinceLastShot = 0f;
				if (((NetworkBehaviour)this).IsOwner)
				{
					if (((NetworkBehaviour)this).IsHost)
					{
						ProjectileSpawner(aimDirection.position, aimDirection.rotation, aimDirection.forward);
					}
					else
					{
						SpawnProjectileServerRpc(aimDirection.position, aimDirection.rotation, aimDirection.forward);
					}
				}
			}
			else
			{
				PlayRandomAudio(mainAudio, noAmmoSounds);
			}
		}

		private bool ReloadedGun()
		{
			int num = FindAmmoInInventory();
			if (num == -1)
			{
				return false;
			}
			ammoSlotToUse = num;
			return true;
		}

		private int FindAmmoInInventory()
		{
			for (int i = 0; i < ((GrabbableObject)this).playerHeldBy.ItemSlots.Length; i++)
			{
				if (!((Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[i] == (Object)null) && ((GrabbableObject)this).playerHeldBy.ItemSlots[i].itemProperties.itemId == ammoItem.itemId)
				{
					return i;
				}
			}
			return -1;
		}

		[ServerRpc]
		private void FixWeightServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(43845628u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 43845628u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				FixWeightClientRpc();
			}
		}

		[ClientRpc]
		private void FixWeightClientRpc()
		{
			//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(948021082u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 948021082u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
					playerHeldBy.carryWeight -= Mathf.Clamp(ammoItem.weight - 1f, 0f, 10f);
				}
			}
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if (right || !((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			if (ReloadedGun())
			{
				if (currentAmmo.Value > 0)
				{
					HUDManager.Instance.DisplayTip("Item already loaded.", "You can reload once you use up all the ammo.", false, false, "LC_Tip1");
					return;
				}
				ReloadAmmoServerRpc();
				DestroyItemInSlotAndSync(ammoSlotToUse);
				ammoSlotToUse = -1;
			}
			else
			{
				HUDManager.Instance.DisplayTip("No ammo found.", "Buy " + ammoItem.itemName + " from the Terminal to reload.", false, false, "LC_Tip1");
			}
		}

		[ServerRpc]
		private void ReloadAmmoServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1064596822u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1064596822u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				currentAmmo.Value = maxAmmo;
				ReloadAmmoSoundClientRpc();
			}
		}

		[ClientRpc]
		private void ReloadAmmoSoundClientRpc()
		{
			//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(3520251861u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3520251861u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayRandomAudio(mainAudio, reloadSounds);
					Animator.Play("reload");
				}
			}
		}

		[ServerRpc]
		private void SpawnProjectileServerRpc(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Invalid comparison between Unknown and I4
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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)
			//IL_00ae: 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_00e9: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1043162412u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1043162412u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ProjectileSpawner(aimPosition, aimRotation, forward);
			}
		}

		private void ProjectileSpawner(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(projectilePrefab, aimPosition, aimRotation);
			val.GetComponent<NetworkObject>().SpawnWithOwnership(((NetworkBehaviour)this).OwnerClientId, false);
			ApplyProjectileForceClientRpc(NetworkObjectReference.op_Implicit(val.GetComponent<NetworkObject>()), aimPosition, aimRotation, forward);
		}

		[ClientRpc]
		public void ApplyProjectileForceClientRpc(NetworkObjectReference projectile, Vector3 aimPosition, Quaternion aimRotation, Vector3 forward)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_013c: 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(2170744407u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref projectile, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2170744407u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref projectile)).TryGet(ref val3, (NetworkManager)null))
				{
					GameObject gameObject = ((Component)val3).gameObject;
					gameObject.transform.position = aimPosition;
					gameObject.transform.rotation = aimRotation;
					gameObject.GetComponent<Rigidbody>().AddForce(forward * LobForce, (ForceMode)1);
				}
			}
		}

		private void PlayRandomAudio(AudioSource audioSource, AudioClip[] audioClips)
		{
			if (audioClips.Length != 0)
			{
				audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]);
			}
		}

		public override void Update()
		{
			((GrabbableObject)this).Update();
			timeSinceLastShot += Time.deltaTime;
		}

		private void OnEnable()
		{
		}

		private void OnDisable()
		{
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			}
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
		}

		public void DestroyItemInSlotAndSync(int itemSlot)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (itemSlot >= ((GrabbableObject)this).playerHeldBy.ItemSlots.Length || (Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] == (Object)null)
				{
					Debug.LogError((object)$"Destroy item in slot called for a slot (slot {itemSlot}) which is empty or incorrect");
				}
				DestroyItemInSlotServerRpc(itemSlot);
			}
		}

		[ServerRpc]
		public void DestroyItemInSlotServerRpc(int itemSlot)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00b7: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3656085789u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, itemSlot);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3656085789u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DestroyItemInSlotClientRpc(itemSlot);
			}
		}

		[ClientRpc]
		public void DestroyItemInSlotClientRpc(int itemSlot)
		{
			//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_0071: 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)
			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(314723133u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, itemSlot);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 314723133u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					DestroyItemInSlot(itemSlot);
				}
			}
		}

		public void DestroyItemInSlot(int itemSlot)
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.ShutdownInProgress)
			{
				return;
			}
			GrabbableObject val = ((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot];
			if ((Object)(object)val == (Object)null || (Object)(object)val.itemProperties == (Object)null)
			{
				Plugin.logger.LogError((object)"Item properties are null, cannot destroy item in slot");
				return;
			}
			PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
			playerHeldBy.carryWeight -= Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f);
			if (((GrabbableObject)this).playerHeldBy.currentItemSlot == itemSlot)
			{
				((GrabbableObject)this).playerHeldBy.isHoldingObject = false;
				((GrabbableObject)this).playerHeldBy.twoHanded = false;
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("cancelHolding", true);
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("Throw");
					((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
					HUDManager.Instance.ClearControlTips();
					((GrabbableObject)this).playerHeldBy.activatingItem = false;
				}
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false;
			}
			if ((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)(object)val)
			{
				if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner)
				{
					((GrabbableObject)this).playerHeldBy.SetSpecialGrabAnimationBool(false, ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer);
					((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer.DiscardItemOnClient();
				}
				((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer = null;
			}
			((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] = null;
			if (((NetworkBehaviour)this).IsServer)
			{
				((NetworkBehaviour)val).NetworkObject.Despawn(true);
			}
		}

		protected override void __initializeVariables()
		{
			if (currentAmmo == null)
			{
				throw new Exception("ProjectileWeapon.currentAmmo cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)currentAmmo).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentAmmo, "currentAmmo");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentAmmo);
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ProjectileWeapon()
		{
			//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
			NetworkManager.__rpc_func_table.Add(43845628u, new RpcReceiveHandler(__rpc_handler_43845628));
			NetworkManager.__rpc_func_table.Add(948021082u, new RpcReceiveHandler(__rpc_handler_948021082));
			NetworkManager.__rpc_func_table.Add(1064596822u, new RpcReceiveHandler(__rpc_handler_1064596822));
			NetworkManager.__rpc_func_table.Add(3520251861u, new RpcReceiveHandler(__rpc_handler_3520251861));
			NetworkManager.__rpc_func_table.Add(1043162412u, new RpcReceiveHandler(__rpc_handler_1043162412));
			NetworkManager.__rpc_func_table.Add(2170744407u, new RpcReceiveHandler(__rpc_handler_2170744407));
			NetworkManager.__rpc_func_table.Add(3656085789u, new RpcReceiveHandler(__rpc_handler_3656085789));
			NetworkManager.__rpc_func_table.Add(314723133u, new RpcReceiveHandler(__rpc_handler_314723133));
		}

		private static void __rpc_handler_43845628(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to

plugins/Luigi Doll Scrap.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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("Luigi Doll Scrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Luigi Doll Scrap")]
[assembly: AssemblyTitle("Luigi Doll Scrap")]
[assembly: AssemblyVersion("1.0.0.0")]
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 Luigi_Doll_Scrap
{
	[BepInPlugin("shadow.LuigiDollScrap", "Luigi Doll", "1.1.2")]
	public class Plugins : BaseUnityPlugin
	{
		private const string GUID = "shadow.LuigiDollScrap";

		private const string NAME = "Luigi Doll";

		private const string VERSION = "1.1.2";

		public static Plugins instance;

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "luigidollscrapitem");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/Luigi Doll Item.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, 50, (LevelTypes)(-1));
			Items.RemoveScrapFromLevels(val2, (LevelTypes)8, (string[])null);
			Items.RemoveScrapFromLevels(val2, (LevelTypes)16, (string[])null);
			Items.RemoveScrapFromLevels(val2, (LevelTypes)4, (string[])null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Luigi Doll");
		}
	}
}

plugins/MelanieMeliciousUtilFurniture.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class HarmonyPatches
{
	private static int[] itemIndex = new int[2];

	private static int ornament;

	[HarmonyPostfix]
	[HarmonyPatch(typeof(StartOfRound), "Start")]
	[HarmonyAfter(new string[] { "MelanieMelicious.2StoryShip" })]
	private static void StartPatch()
	{
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if (items.itemName == "Hive")
				{
					itemIndex = new int[2]
					{
						StartOfRound.Instance.allItemsList.itemsList.IndexOf(items),
						itemIndex[1]
					};
				}
				else if (items.itemName == "Gift")
				{
					itemIndex = new int[2]
					{
						itemIndex[0],
						StartOfRound.Instance.allItemsList.itemsList.IndexOf(items)
					};
				}
			}
		}
		catch
		{
		}
		if (MelanieUtilFurnitureConfig.roomEnable.Value)
		{
			Transform transform = GameObject.Find("ShipBoundsTrigger").transform;
			transform.localPosition += new Vector3(0f, 75f, 0f);
			Transform transform2 = GameObject.Find("ShipInnerRoomBoundsTrigger").transform;
			transform2.localPosition += new Vector3(0f, 75f, 0f);
			Transform transform3 = GameObject.Find("ShipBoundsTrigger").transform;
			transform3.localScale += new Vector3(0f, 150f, 0f);
			Transform transform4 = GameObject.Find("ShipInnerRoomBoundsTrigger").transform;
			transform4.localScale += new Vector3(0f, 150f, 0f);
		}
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
	private static void PreLevelPatch()
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		try
		{
			GameObject.Find("EntranceTeleportShip0").transform.parent.SetParent(GameObject.Find("Environment/Teleports").transform);
		}
		catch
		{
		}
		try
		{
			ornament = -7;
			foreach (Transform item in GameObject.Find("TreeXMAS0(Clone)").transform)
			{
				Transform val = item;
				ornament++;
			}
			ornament *= MelanieUtilFurnitureConfig.xmasLootChance.Value;
		}
		catch
		{
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(TimeOfDay), "OnHourChanged")]
	private static void HourPatch()
	{
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: 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_003b: Expected O, but got Unknown
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Expected O, but got Unknown
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		if (!GameNetworkManager.Instance.isHostingGame)
		{
			return;
		}
		try
		{
			foreach (Transform item in GameObject.Find("Tree0ItemSpawn").transform)
			{
				Transform val = item;
				if (Random.Range(0, 99) < MelanieUtilFurnitureConfig.treeLootChance.Value)
				{
					GameObject val2 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[itemIndex[0]].spawnPrefab, val.position, val.rotation);
					val2.GetComponent<NetworkObject>().Spawn(false);
					val2.GetComponent<GrabbableObject>().SetScrapValue(Random.Range(MelanieUtilFurnitureConfig.treeLootMin.Value, MelanieUtilFurnitureConfig.treeLootMax.Value));
				}
			}
		}
		catch
		{
		}
		try
		{
			foreach (Transform item2 in GameObject.Find("Tree1ItemSpawn").transform)
			{
				Transform val3 = item2;
				if (Random.Range(0, 99) < MelanieUtilFurnitureConfig.treeLootChance.Value)
				{
					GameObject val4 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[itemIndex[0]].spawnPrefab, val3.position, val3.rotation);
					val4.GetComponent<NetworkObject>().Spawn(false);
					val4.GetComponent<GrabbableObject>().SetScrapValue(Random.Range(MelanieUtilFurnitureConfig.treeLootMin.Value, MelanieUtilFurnitureConfig.treeLootMax.Value));
				}
			}
		}
		catch
		{
		}
		try
		{
			if (Random.Range(0, 99) < ornament)
			{
				GameObject val5 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[itemIndex[1]].spawnPrefab, GameObject.Find("TreeXMAS0Spawn").transform.position, new Quaternion(0f, 0f, 0f, 0f));
				Transform transform = val5.transform;
				transform.localPosition += new Vector3((float)Random.Range(-2, 2), 0f, Random.Range(-2f, 2f));
				val5.GetComponent<NetworkObject>().Spawn(false);
				val5.GetComponent<GrabbableObject>().SetScrapValue(Random.Range(10, 30));
			}
		}
		catch
		{
		}
	}
}
public static class MelanieUtilFurnitureConfig
{
	public static ConfigEntry<bool> alwaysStock;

	public static ConfigEntry<bool> fireExit0Enable;

	public static ConfigEntry<bool> wallEnable;

	public static ConfigEntry<bool> xmasEnable;

	public static ConfigEntry<bool> roomEnable;

	public static ConfigEntry<int> fireExit0Type;

	public static ConfigEntry<int> workshop0Cost;

	public static ConfigEntry<int> workTable0Cost;

	public static ConfigEntry<int> cabinetWide0Cost;

	public static ConfigEntry<int> gate0Cost;

	public static ConfigEntry<int> door0Cost;

	public static ConfigEntry<int> wall0Cost;

	public static ConfigEntry<int> fireExit0Cost;

	public static ConfigEntry<int> bedTwin0Cost;

	public static ConfigEntry<int> treeBig0Cost;

	public static ConfigEntry<int> benchTable0Cost;

	public static ConfigEntry<int> fern0Cost;

	public static ConfigEntry<int> fireplaceCost;

	public static ConfigEntry<int> room0Cost;

	public static ConfigEntry<int> treeLootChance;

	public static ConfigEntry<int> treeLootMin;

	public static ConfigEntry<int> treeLootMax;

	public static ConfigEntry<int> xmasLootChance;

	public static void SetupConfig(ConfigFile config)
	{
		alwaysStock = config.Bind<bool>("Store Toggle", "Items Always In Stock", true, "Toggle if furniture is always in stock, or put into rotation.");
		fireExit0Enable = config.Bind<bool>("Store Toggle", "Enable Fire Exit", true, "Toggle buyable fire exit.");
		wallEnable = config.Bind<bool>("Store Toggle", "Enable Walls", true, "Toggle buyable walls.");
		xmasEnable = config.Bind<bool>("Store Toggle", "Enable XMAS Decor", true, "Toggle XMAS decor.");
		roomEnable = config.Bind<bool>("Store Toggle", "Enable Pocket Rooms", true, "Toggle doors into pocket rooms.");
		fireExit0Type = config.Bind<int>("Fire Exit", "Fire Exit Type", 0, "Toggle fire exit mode. 0 for both enter and exit, 1 for only enter, 2 for only exit.");
		workshop0Cost = config.Bind<int>("Prices", "Workshop 1 Cost", 100, "Modify the price for Workshop 1.");
		workTable0Cost = config.Bind<int>("Prices", "Work Table 1 Cost", 60, "Modify the price for Work Table 1.");
		cabinetWide0Cost = config.Bind<int>("Prices", "Wide Cabinet Cost", 50, "Modify the price for Wide Cabinet.");
		gate0Cost = config.Bind<int>("Prices", "Gate Costs", 50, "Modify the price for the gates.");
		door0Cost = config.Bind<int>("Prices", "Door Costs", 50, "Modify the price for the doors.");
		wall0Cost = config.Bind<int>("Prices", "Wall Costs", 35, "Modify the price for the walls.");
		fireExit0Cost = config.Bind<int>("Prices", "Fire Exit Cost", 2000, "Modify the price for the fire exit.");
		bedTwin0Cost = config.Bind<int>("Prices", "Twin Bed Cost", 150, "Modify the price for the twin bed.");
		treeBig0Cost = config.Bind<int>("Prices", "Large Tree", 250, "Modify the price for large trees.");
		benchTable0Cost = config.Bind<int>("Prices", "Bench Table", 70, "Modify the price for bench tables.");
		fern0Cost = config.Bind<int>("Prices", "Fern", 40, "Modify the price for ferns.");
		fireplaceCost = config.Bind<int>("Prices", "Fireplace", 100, "Modify the price for the fireplace.");
		room0Cost = config.Bind<int>("Prices", "Storage Room", 500, "Modify the price for the storage room.");
		treeLootChance = config.Bind<int>("Loot", "Tree Items Chance", 2, "Modify the percent chance for beehives to fall out of buyable trees.");
		treeLootMin = config.Bind<int>("Loot", "Trees Items Minimum", 10, "Modify the minimum value of beehives from trees.");
		treeLootMax = config.Bind<int>("Loot", "Trees Items Minimum", 40, "Modify the maximum value of beehives from trees.");
		xmasLootChance = config.Bind<int>("Loot", "XMAS Tree Ornament Influence", 1, "Modify how much items placed on the tree increase the percent chance for gifts to spawn under it.");
	}
}
namespace MelanieMeliciousFurniturePack0
{
	public class ParentItems : NetworkBehaviour
	{
		public Transform oldParent;

		public Transform newParent;

		public void ParentItem()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			foreach (Transform item in oldParent)
			{
				Transform val = item;
				if (((Component)val).gameObject.layer != 26 && ((Object)val).name != "ObjectPlacements")
				{
					val.parent = newParent;
				}
			}
		}
	}
	[BepInPlugin("MelanieMelicious.furniturePack0", "Melanie Melicious - Furniture Pack 1", "0.4.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "MelanieMelicious.furniturePack0";

		private const string NAME = "Melanie Melicious - Furniture Pack 1";

		private const string VERSION = "0.4.1";

		private readonly Harmony harmony = new Harmony("MelanieMelicious.furniturePack0");

		public static ManualLogSource mls;

		public static AssetBundle bundle;

		public static Plugin instance;

		private void Awake()
		{
			instance = this;
			MelanieUtilFurnitureConfig.SetupConfig(((BaseUnityPlugin)this).Config);
			mls = Logger.CreateLogSource("MelanieMelicious - Utility Furniture");
			mls = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll(typeof(HarmonyPatches));
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melaniemeliciousfurniturepack0");
			bundle = AssetBundle.LoadFromFile(text);
			UnlockablesList val = bundle.LoadAsset<UnlockablesList>("Assets/MelanieFurniture/Asset/Furniture.asset");
			ushort num = 1;
			if (!MelanieUtilFurnitureConfig.alwaysStock.Value)
			{
				num = 2;
				foreach (UnlockableItem unlockable in val.unlockables)
				{
					unlockable.alwaysInStock = false;
				}
			}
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[0].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[0], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.workshop0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[1].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[1], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.workTable0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[2].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[2], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.cabinetWide0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[12].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[12], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.bedTwin0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[13].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[13], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.treeBig0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[14].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[14], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.treeBig0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[15].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[15], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.benchTable0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[16].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[16], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fern0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[17].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[17], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fern0Cost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[19].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[19], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fireplaceCost.Value);
			NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[20].prefabObject);
			Unlockables.RegisterUnlockable(val.unlockables[20], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.workTable0Cost.Value);
			if (MelanieUtilFurnitureConfig.fireExit0Enable.Value)
			{
				switch (MelanieUtilFurnitureConfig.fireExit0Type.Value)
				{
				case 1:
					val.unlockables[3].prefabObject = bundle.LoadAsset<GameObject>("Assets/MelanieFurniture/Prefab/FireExit0/Exit/FireExit0.prefab");
					break;
				case 2:
					val.unlockables[3].prefabObject = bundle.LoadAsset<GameObject>("Assets/MelanieFurniture/Prefab/FireExit0/Entrance/FireExit0.prefab");
					break;
				}
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[3].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[3], (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.fireExit0Cost.Value);
			}
			if (MelanieUtilFurnitureConfig.wallEnable.Value)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[4].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[4], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.gate0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[5].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[5], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.door0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[6].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[6], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.door0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[7].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[7], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.door0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[8].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[8], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[9].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[9], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[10].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[10], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[11].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[11], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.wall0Cost.Value);
			}
			if (MelanieUtilFurnitureConfig.xmasEnable.Value)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[18].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[18], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.treeBig0Cost.Value);
			}
			if (MelanieUtilFurnitureConfig.roomEnable.Value)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val.unlockables[21].prefabObject);
				Unlockables.RegisterUnlockable(val.unlockables[21], (StoreType)num, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, MelanieUtilFurnitureConfig.room0Cost.Value);
			}
		}
	}
}

plugins/SelfSortingStorage.dll

Decompiled a day 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 System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using SelfSortingStorage.Cupboard;
using SelfSortingStorage.NetcodePatcher;
using SelfSortingStorage.Utils;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("SelfSortingStorage")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ce8394e670cdb7ac0cb9927335fe66532ac15131")]
[assembly: AssemblyProduct("SelfSortingStorage")]
[assembly: AssemblyTitle("SelfSortingStorage")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 SelfSortingStorage
{
	internal class Config
	{
		public bool GeneralImprovements = false;

		public readonly ConfigEntry<bool> enableSaving;

		public readonly ConfigEntry<bool> allowScrapItems;

		public readonly ConfigEntry<string> cupboardColor;

		public readonly ConfigEntry<string> boxPosition;

		public readonly ConfigEntry<bool> rescaleItems;

		public readonly ConfigEntry<int> cupboardPrice;

		public readonly ConfigEntry<bool> verboseLogging;

		public Config(ConfigFile cfg)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			cfg.SaveOnConfigSet = false;
			enableSaving = cfg.Bind<bool>("General", "Save items", true, "Allows stored items to be saved in the host player's current save file.");
			allowScrapItems = cfg.Bind<bool>("General", "Allow Scrap items", true, "Allows scrap items to be stored in the Smart Cupboard.");
			cupboardColor = cfg.Bind<string>("General", "Cupboard Color", "#000E57", "Customize the color of the storage, default color is dark blue.");
			boxPosition = cfg.Bind<string>("Storage", "Box position", "R", new ConfigDescription("Adjust the position of the storage box, this can be 'L' for left or 'R' for right.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "L", "R" }), Array.Empty<object>()));
			rescaleItems = cfg.Bind<bool>("Storage", "Rescale big items", true, "Big items will be rescaled when stored in the Smart Cupboard.");
			cupboardPrice = cfg.Bind<int>("Shop", "Price", 20, "The price of the Smart Cupboard in the store.");
			verboseLogging = cfg.Bind<bool>("Logs", "Verbose logs", false, "Enable more explicit logs in the console (for debug reasons).");
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		public void SetupCustomConfigs()
		{
			if (Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements"))
			{
				GeneralImprovements = true;
			}
			if (!GeneralImprovements)
			{
				Plugin.logger.LogError((object)"GeneralImprovements is not installed! The mod will still work but you may notice some item rotation issues.");
			}
		}
	}
	[BepInPlugin("zigzag.SelfSortingStorage", "SelfSortingStorage", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "zigzag.SelfSortingStorage";

		private const string NAME = "SelfSortingStorage";

		private const string VERSION = "1.0.0";

		public static Plugin instance;

		public static ManualLogSource logger;

		private readonly Harmony harmony = new Harmony("zigzag.SelfSortingStorage");

		internal const string VANILLA_NAME = "LethalCompanyGame";

		internal static readonly List<(Func<PlayerControllerB, bool>, string)> spTriggerValidations = new List<(Func<PlayerControllerB, bool>, string)>();

		internal static Config config { get; private set; } = null;


		private void HarmonyPatchAll()
		{
			harmony.PatchAll();
		}

		private void Awake()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			logger = ((BaseUnityPlugin)this).Logger;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "selfsortingstorage");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			string text2 = "Assets/Data/_Misc/";
			UnlockableItemDef val2 = val.LoadAsset<UnlockableItemDef>(text2 + "SSS_Module/SSSModuleUnlockable.asset");
			config = new Config(((BaseUnityPlugin)this).Config);
			config.SetupCustomConfigs();
			Effects.SetupNetwork();
			GameObject prefabObject = val2.unlockable.prefabObject;
			Color color = default(Color);
			ColorUtility.TryParseHtmlString(config.cupboardColor.Value, ref color);
			((Renderer)prefabObject.GetComponent<MeshRenderer>()).materials[0].color = color;
			if (config.boxPosition.Value == "R")
			{
				Transform val3 = prefabObject.transform.Find("ChutePosition/ActualPos");
				Transform val4 = prefabObject.transform.Find("ChutePosition/Pos2");
				if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null)
				{
					val3.position = val4.position;
					val3.rotation = val4.rotation;
				}
			}
			NetworkPrefabs.RegisterNetworkPrefab(prefabObject);
			Utilities.FixMixerGroups(prefabObject);
			Unlockables.RegisterUnlockable(val2, config.cupboardPrice.Value, (StoreType)1);
			HarmonyPatchAll();
			logger.LogInfo((object)"SelfSortingStorage is loaded !");
		}
	}
}
namespace SelfSortingStorage.Utils
{
	internal class Effects
	{
		public class ItemNetworkReference
		{
			public NetworkObjectReference netObjectRef;

			public int value;

			public int save;

			public ItemNetworkReference(NetworkObjectReference netObjectRef, int value, int save)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.netObjectRef = netObjectRef;
				this.value = value;
				this.save = save;
			}
		}

		public static void SetupNetwork()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public static void Message(string title, string bottom, bool warning = false)
		{
			HUDManager.Instance.DisplayTip(title, bottom, warning, false, "LC_Tip1");
		}

		public static bool IsTriggerValid(PlayerControllerB player, out string notValidText)
		{
			notValidText = "[Nothing to store]";
			if (player.isHoldingObject && !player.isGrabbingObjectAnimation && (Object)(object)player.currentlyHeldObjectServer != (Object)null)
			{
				if (!StartOfRound.Instance.inShipPhase && (StartOfRound.Instance.shipIsLeaving || !StartOfRound.Instance.shipHasLanded))
				{
					notValidText = "[Wait for ship to " + (StartOfRound.Instance.shipIsLeaving ? "leave" : "land") + "]";
					return false;
				}
				if (player.currentlyHeldObjectServer.itemProperties.itemName == "Body")
				{
					notValidText = "[Bodies not allowed]";
					return false;
				}
				if (player.currentlyHeldObjectServer.itemProperties.itemName == "Belt bag")
				{
					notValidText = "[Belt bags not compatible]";
					return false;
				}
				if (!Plugin.config.allowScrapItems.Value && player.currentlyHeldObjectServer.itemProperties.isScrap)
				{
					notValidText = "[Scraps not allowed]";
					return false;
				}
				foreach (var spTriggerValidation in Plugin.spTriggerValidations)
				{
					if (!spTriggerValidation.Item1(player))
					{
						notValidText = spTriggerValidation.Item2;
						return false;
					}
				}
				return true;
			}
			return false;
		}

		public static Item? GetItem(string id)
		{
			string[] idParts = id.Split('/');
			if (idParts == null || idParts.Length <= 1)
			{
				return null;
			}
			if (idParts[0] == "LethalCompanyGame")
			{
				return ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item i) => i.itemName.Equals(idParts[1])));
			}
			return SmartMemory.CacheItems.GetValueOrDefault(id);
		}

		public static ItemNetworkReference SpawnItem(Item item, SmartCupboard cupboard, int spawnIndex, int value = 0, int save = 0)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			cupboard.GetPlacePosition(spawnIndex, out Transform parent, out Vector3 position, out Quaternion rotation);
			GameObject val = Object.Instantiate<GameObject>(item.spawnPrefab, position, rotation, parent ?? StartOfRound.Instance.elevatorTransform);
			GrabbableObject component = val.GetComponent<GrabbableObject>();
			((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
			((Component)component).transform.localRotation = rotation;
			component.fallTime = 1f;
			component.hasHitGround = true;
			component.reachedFloorTarget = true;
			component.isInElevator = true;
			component.isInShipRoom = true;
			if (component.itemProperties.isScrap)
			{
				component.SetScrapValue(value);
			}
			if (component.itemProperties.saveItemVariable)
			{
				component.LoadItemSaveData(save);
			}
			((NetworkBehaviour)component).NetworkObject.Spawn(false);
			return new ItemNetworkReference(NetworkObjectReference.op_Implicit(val.GetComponent<NetworkObject>()), value, component.itemProperties.saveItemVariable ? component.GetItemDataToSave() : save);
		}

		public static IEnumerator SyncItem(NetworkObjectReference itemRef, SmartCupboard cupboard, int spawnIndex, int value, int save)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject itemNetObject = null;
			float startTime = Time.realtimeSinceStartup;
			while (Time.realtimeSinceStartup - startTime < 8f && !((NetworkObjectReference)(ref itemRef)).TryGet(ref itemNetObject, (NetworkManager)null))
			{
				yield return (object)new WaitForSeconds(0.03f);
			}
			if ((Object)(object)itemNetObject == (Object)null)
			{
				Plugin.logger.LogError((object)"Error while trying to sync the item.");
				yield break;
			}
			yield return (object)new WaitForEndOfFrame();
			GrabbableObject component = ((Component)itemNetObject).GetComponent<GrabbableObject>();
			if (!((NetworkBehaviour)component).IsServer)
			{
				cupboard.GetPlacePosition(spawnIndex, out Transform parent, out Vector3 _, out Quaternion _);
				Vector3 targetPosition = Vector3.zero + component.itemProperties.verticalOffset * new Vector3(0f, 0f, 1f);
				component.parentObject = null;
				((Component)component).transform.SetParent(parent ?? StartOfRound.Instance.elevatorTransform, true);
				component.startFallingPosition = ((Component)component).transform.localPosition;
				((Component)component).transform.localPosition = targetPosition;
				component.targetFloorPosition = targetPosition;
				component.reachedFloorTarget = false;
				component.hasHitGround = false;
			}
			component.isInElevator = true;
			component.isInShipRoom = true;
			component.fallTime = 0f;
			if (component.itemProperties.isScrap)
			{
				component.SetScrapValue(value);
			}
			if (component.itemProperties.saveItemVariable)
			{
				component.LoadItemSaveData(save);
			}
		}

		public static void RescaleItemIfTooBig(GrabbableObject component)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			BoxCollider component2 = ((Component)component).GetComponent<BoxCollider>();
			if (!((Object)(object)component2 == (Object)null))
			{
				Bounds bounds = ((Collider)component2).bounds;
				RescaleItemIfTooBig(component, ((Bounds)(ref bounds)).extents);
			}
		}

		public static void RescaleItemIfTooBig(GrabbableObject component, Vector3 size)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0073: 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)
			BoxCollider component2 = ((Component)component).GetComponent<BoxCollider>();
			if ((Object)(object)component2 == (Object)null)
			{
				return;
			}
			float num = size.x * 2f * (size.y * 2f) * (size.z * 2f);
			if (num > 0.08f)
			{
				((Component)component).transform.localScale = ((num < 1f) ? (7f / num) : 20f) * ((Component)component).transform.localScale / 100f;
				if (Plugin.config.verboseLogging.Value)
				{
					Plugin.logger.LogInfo((object)"Item was rescaled");
				}
			}
		}

		public static void ScaleBackItem(GrabbableObject component)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((Component)component).transform.localScale = component.originalScale;
		}

		public static void OverrideOriginalScale(GrabbableObject component, Vector3 value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			component.originalScale = value;
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("SaveItemsInShip")]
		public static void SaveSmartCupboard()
		{
			if (Plugin.config.enableSaving.Value && !((Object)(object)StartOfRound.Instance == (Object)null) && ((NetworkBehaviour)StartOfRound.Instance).IsServer)
			{
				string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
				SavingModule.Save(currentSaveFileName);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("LoadShipGrabbableItems")]
		public static void LoadSmartCupboard()
		{
			if (Plugin.config.enableSaving.Value && !((Object)(object)StartOfRound.Instance == (Object)null) && ((NetworkBehaviour)StartOfRound.Instance).IsServer)
			{
				string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
				SavingModule.Load(currentSaveFileName);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ResetShip")]
		public static void ResetSmartCupboard()
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null || !((NetworkBehaviour)StartOfRound.Instance).IsServer || SmartMemory.Instance == null || SmartMemory.Instance.Size == 0)
			{
				return;
			}
			SmartCupboard smartCupboard = Object.FindObjectOfType<SmartCupboard>();
			if (!((Object)(object)smartCupboard == (Object)null))
			{
				SmartMemory.Instance.ClearAll();
				smartCupboard.placedItems.Clear();
				if (Plugin.config.verboseLogging.Value)
				{
					Plugin.logger.LogInfo((object)"Smart Cupboard was reseted due to a game over.");
				}
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("DespawnPropsAtEndOfRound")]
		public static void ResetSmartCupboardIfAllDeads()
		{
			if ((Object)(object)RoundManager.Instance == (Object)null || !((NetworkBehaviour)RoundManager.Instance).IsServer || SmartMemory.Instance == null || SmartMemory.Instance.Size == 0 || (Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			int num = 0;
			SmartCupboard smartCupboard = Object.FindObjectOfType<SmartCupboard>();
			if ((Object)(object)smartCupboard == (Object)null)
			{
				return;
			}
			foreach (List<SmartMemory.Data> item in SmartMemory.Instance.ItemList)
			{
				foreach (SmartMemory.Data item2 in item)
				{
					if (item2.IsValid() && item2.Values[0] != 0)
					{
						item2.Id = "INVALID";
						SmartMemory.Instance.Size--;
						smartCupboard.placedItems.Remove(num);
					}
					num++;
				}
			}
			if (Plugin.config.verboseLogging.Value)
			{
				Plugin.logger.LogInfo((object)"Smart Cupboard stored scraps were removed due to all players being dead.");
			}
		}
	}
	[HarmonyPatch(typeof(BeltBagItem))]
	internal class BeltBagItemPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("TryAddObjectToBagServerRpc")]
		public static bool TryAddObjectToBagServerRpcPatch(BeltBagItem __instance, NetworkObjectReference netObjectRef, int playerWhoAdded)
		{
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null || !((NetworkBehaviour)StartOfRound.Instance).IsServer || SmartMemory.Instance == null || SmartMemory.Instance.Size == 0)
			{
				return true;
			}
			SmartCupboard smartCupboard = Object.FindObjectOfType<SmartCupboard>();
			if ((Object)(object)smartCupboard == (Object)null || smartCupboard.placedItems.Count == 0)
			{
				return true;
			}
			NetworkObject val = default(NetworkObject);
			if (((NetworkObjectReference)(ref netObjectRef)).TryGet(ref val, (NetworkManager)null))
			{
				GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>();
				if ((Object)(object)component != (Object)null && !component.isHeld && !component.heldByPlayerOnServer && !component.isHeldByEnemy)
				{
					foreach (var (_, val3) in smartCupboard.placedItems)
					{
						if (component.itemProperties.itemName == val3.itemProperties.itemName && ((Component)component).transform.position == ((Component)val3).transform.position)
						{
							__instance.CancelAddObjectToBagClientRpc(playerWhoAdded);
							return false;
						}
					}
				}
			}
			return true;
		}
	}
}
namespace SelfSortingStorage.Cupboard
{
	internal class SavingModule
	{
		public const string SaveKey = "SmartCupboardItems";

		public static void Save(string saveFile)
		{
			if (!GetItems(out SmartMemory.Data[] items))
			{
				ES3.DeleteKey("SmartCupboardItems", saveFile);
				return;
			}
			ES3.Save<string>("SmartCupboardItems", JsonConvert.SerializeObject((object)items), saveFile);
			Plugin.logger.LogInfo((object)"SmartCupboard items saved.");
		}

		public static void Load(string saveFile)
		{
			if (!ES3.KeyExists("SmartCupboardItems", saveFile) || SmartMemory.Instance == null)
			{
				return;
			}
			SmartCupboard smartCupboard = Object.FindObjectOfType<SmartCupboard>();
			string text = ES3.Load<string>("SmartCupboardItems", saveFile);
			IEnumerable<SmartMemory.Data> enumerable = JsonConvert.DeserializeObject<IEnumerable<SmartMemory.Data>>(text);
			if (enumerable == null || (Object)(object)smartCupboard == (Object)null)
			{
				Plugin.logger.LogError((object)"Items from SmartCupboard could not be loaded.");
				return;
			}
			int num = 0;
			SmartMemory.Data[] array = enumerable.ToArray();
			SmartMemory.Data[] array2 = array;
			foreach (SmartMemory.Data data in array2)
			{
				if (data.IsValid())
				{
					SmartMemory.Instance.StoreData(data, out var _, freeSpaceOnly: true);
				}
				else
				{
					SmartMemory.Instance.IgnoreSpaces.Add(num);
				}
				num++;
			}
			SmartMemory.Instance.IgnoreSpaces.Clear();
			((MonoBehaviour)smartCupboard).StartCoroutine(smartCupboard.ReloadPlacedItems());
			Plugin.logger.LogInfo((object)"SmartCupboard items loaded.");
		}

		private static bool GetItems(out SmartMemory.Data[]? items)
		{
			items = null;
			if (SmartMemory.Instance == null || SmartMemory.Instance.Size == 0)
			{
				return false;
			}
			int count = SmartMemory.Instance.ItemList.Count;
			List<SmartMemory.Data> list = new List<SmartMemory.Data>();
			for (int i = 0; i < count; i++)
			{
				for (int j = 0; j < count; j++)
				{
					SmartMemory.Data item = SmartMemory.Instance.ItemList[i][j];
					list.Add(item);
				}
			}
			items = list.ToArray();
			return true;
		}
	}
	public class SmartCupboard : NetworkBehaviour
	{
		public NetworkObject parentObject;

		public InteractTrigger triggerScript;

		public Transform[] placePositions;

		public SmartMemory memory = new SmartMemory();

		public readonly Dictionary<int, GrabbableObject> placedItems = new Dictionary<int, GrabbableObject>();

		private readonly List<int> indexToRemove = new List<int>();

		private GrabbableObject? awaitingObject = null;

		private bool responseOnAwaiting = false;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (((NetworkBehaviour)this).IsServer)
			{
				memory.Initialize();
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(SyncCupboard());
			}
		}

		public void Update()
		{
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				if (CheckIsFull(GameNetworkManager.Instance.localPlayerController))
				{
					triggerScript.interactable = false;
					triggerScript.disabledHoverTip = "[Full!]";
				}
				else
				{
					triggerScript.interactable = Effects.IsTriggerValid(GameNetworkManager.Instance.localPlayerController, out string notValidText);
					if (!triggerScript.interactable)
					{
						triggerScript.disabledHoverTip = notValidText;
					}
				}
				if (!((NetworkBehaviour)this).IsServer && (Object)(object)awaitingObject != (Object)null && ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)(object)awaitingObject))
				{
					responseOnAwaiting = false;
					awaitingObject = null;
				}
			}
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			foreach (var (num2, val2) in placedItems)
			{
				if (val2.isHeld || val2.isHeldByEnemy)
				{
					if (Plugin.config.rescaleItems.Value)
					{
						ScaleItemClientRpc(NetworkObjectReference.op_Implicit(((Component)val2).gameObject.GetComponent<NetworkObject>()), scaleMode: false);
					}
					SmartMemory.Data data = memory.RetrieveData(num2);
					if (!memory.IsFull())
					{
						SetSizeClientRpc(memory.Size);
					}
					indexToRemove.Add(num2);
					if (data != null && data.Quantity >= 1)
					{
						SpawnItem(data, num2, isStacked: true);
					}
				}
			}
			if (indexToRemove.Count == 0)
			{
				return;
			}
			foreach (int item in indexToRemove)
			{
				placedItems.Remove(item);
			}
			indexToRemove.Clear();
		}

		public static void AddTriggerValidation(Func<PlayerControllerB, bool> func, string notValidText)
		{
			Plugin.spTriggerValidations.Add((func, notValidText));
		}

		public IEnumerator ReloadPlacedItems()
		{
			yield return (object)new WaitForSeconds(1f);
			int spawnIndex = 0;
			float distanceSearch = 1f;
			GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0);
			foreach (List<SmartMemory.Data> list in memory.ItemList)
			{
				foreach (SmartMemory.Data item in list)
				{
					if (item.IsValid())
					{
						for (int i = 0; i < array.Length; i++)
						{
							if (array[i].itemProperties.itemName == item.Id.Split('/')[1] && Vector3.Distance(placePositions[spawnIndex].position, ((Component)array[i]).transform.position) <= distanceSearch)
							{
								if (Plugin.config.rescaleItems.Value)
								{
									Effects.RescaleItemIfTooBig(array[i]);
								}
								placedItems[spawnIndex] = array[i];
							}
						}
					}
					spawnIndex++;
				}
			}
		}

		public void StoreObject(PlayerControllerB player)
		{
			if (!((Object)(object)player == (Object)null) && player.isHoldingObject && !player.isGrabbingObjectAnimation && !((Object)(object)player.currentlyHeldObjectServer == (Object)null))
			{
				StoreDataServerRpc(player.playerClientId);
				player.DestroyItemInSlotAndSync(player.currentItemSlot);
			}
		}

		public void GetPlacePosition(int spawnIndex, out Transform parent, out Vector3 position, out Quaternion rotation)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			parent = placePositions[spawnIndex];
			position = parent.position;
			rotation = parent.rotation * Quaternion.Euler(0f, 0f, 180f);
		}

		[ServerRpc(RequireOwnership = false)]
		private void StoreDataServerRpc(ulong playerId)
		{
			//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_0071: 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_0173: 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(3359588108u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3359588108u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
			if ((Object)(object)val3 == (Object)null)
			{
				return;
			}
			GrabbableObject currentlyHeldObjectServer = val3.currentlyHeldObjectServer;
			if (!((Object)(object)currentlyHeldObjectServer == (Object)null))
			{
				SmartMemory.Data data = new SmartMemory.Data(currentlyHeldObjectServer);
				int spawnIndex;
				bool flag = memory.StoreData(data, out spawnIndex);
				if (memory.IsFull())
				{
					SetSizeClientRpc(memory.Size);
				}
				GrabbableObject value;
				if (flag)
				{
					SpawnItem(data, spawnIndex);
				}
				else if (placedItems.TryGetValue(spawnIndex, out value))
				{
					PlayDropSFXClientRpc(NetworkObjectReference.op_Implicit(((Component)value).gameObject.GetComponent<NetworkObject>()));
				}
				if (Plugin.config.verboseLogging.Value)
				{
					Plugin.logger.LogWarning((object)memory.ToString());
				}
			}
		}

		private void SpawnItem(SmartMemory.Data itemData, int spawnIndex, bool isStacked = false)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (itemData.IsValid())
			{
				Item item = Effects.GetItem(itemData.Id);
				if ((Object)(object)item != (Object)null)
				{
					Effects.ItemNetworkReference itemNetworkReference = Effects.SpawnItem(item, this, spawnIndex, itemData.Values[0], itemData.Saves[0]);
					SyncItemClientRpc(itemNetworkReference.netObjectRef, itemNetworkReference.value, itemNetworkReference.save, spawnIndex, isStacked);
				}
			}
		}

		[ClientRpc]
		private void SyncItemClientRpc(NetworkObjectReference itemRef, int value, int save, int spawnIndex, bool isStacked)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(52998418u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, value);
					BytePacker.WriteValueBitPacked(val2, save);
					BytePacker.WriteValueBitPacked(val2, spawnIndex);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isStacked, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 52998418u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(SyncItem(itemRef, value, save, spawnIndex, isStacked));
				}
			}
		}

		private IEnumerator SyncItem(NetworkObjectReference itemRef, int value, int save, int spawnIndex, bool isStacked)
		{
			//IL_000e: 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)
			yield return Effects.SyncItem(itemRef, this, spawnIndex, value, save);
			NetworkObject itemNetObject = default(NetworkObject);
			if (!((NetworkObjectReference)(ref itemRef)).TryGet(ref itemNetObject, (NetworkManager)null))
			{
				yield break;
			}
			GrabbableObject component = ((Component)itemNetObject).GetComponent<GrabbableObject>();
			if (!isStacked)
			{
				component.PlayDropSFX();
			}
			if (!((NetworkBehaviour)this).IsServer)
			{
				yield break;
			}
			placedItems[spawnIndex] = component;
			if (Plugin.config.rescaleItems.Value)
			{
				BoxCollider collider = ((Component)component).GetComponent<BoxCollider>();
				if (!((Object)(object)collider == (Object)null))
				{
					SmartCupboard smartCupboard = this;
					NetworkObjectReference itemRef2 = itemRef;
					Bounds bounds = ((Collider)collider).bounds;
					smartCupboard.ScaleItemClientRpc(itemRef2, scaleMode: true, ((Bounds)(ref bounds)).extents);
				}
			}
		}

		[ClientRpc]
		private void PlayDropSFXClientRpc(NetworkObjectReference itemRef)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4245719167u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4245719167u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref itemRef)).TryGet(ref val3, (NetworkManager)null))
				{
					((Component)val3).GetComponent<GrabbableObject>().PlayDropSFX();
				}
			}
		}

		[ClientRpc]
		private void ScaleItemClientRpc(NetworkObjectReference itemRef, bool scaleMode, Vector3 size = default(Vector3), bool overrideOriginalScale = false, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0131: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4123351311u, clientRpcParams, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref scaleMode, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe(ref size);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref overrideOriginalScale, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 4123351311u, clientRpcParams, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && Plugin.config.rescaleItems.Value)
				{
					((MonoBehaviour)this).StartCoroutine(ScaleItem(itemRef, scaleMode, size, overrideOriginalScale));
				}
			}
		}

		private IEnumerator ScaleItem(NetworkObjectReference itemRef, bool scaleMode, Vector3 size, bool overrideOriginalScale)
		{
			//IL_000e: 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)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			NetworkObject itemNetObject = default(NetworkObject);
			if (scaleMode)
			{
				NetworkObject itemNetObject2 = default(NetworkObject);
				while (!((NetworkObjectReference)(ref itemRef)).TryGet(ref itemNetObject2, (NetworkManager)null))
				{
					yield return (object)new WaitForSeconds(0.03f);
				}
				GrabbableObject component = ((Component)itemNetObject2).GetComponent<GrabbableObject>();
				while (component.originalScale == Vector3.zero)
				{
					yield return (object)new WaitForSeconds(0.03f);
				}
				if (!overrideOriginalScale)
				{
					Effects.RescaleItemIfTooBig(component, size);
				}
				else
				{
					Effects.OverrideOriginalScale(component, size);
				}
			}
			else if (((NetworkObjectReference)(ref itemRef)).TryGet(ref itemNetObject, (NetworkManager)null))
			{
				Effects.ScaleBackItem(((Component)itemNetObject).GetComponent<GrabbableObject>());
			}
		}

		private bool CheckIsFull(PlayerControllerB player)
		{
			if (!memory.IsFull())
			{
				return false;
			}
			if (!player.isHoldingObject || player.isGrabbingObjectAnimation || (Object)(object)player.currentlyHeldObjectServer == (Object)null)
			{
				return true;
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				return ServerCheckingIsFull(player);
			}
			if (responseOnAwaiting)
			{
				return false;
			}
			if ((Object)(object)awaitingObject != (Object)null)
			{
				return true;
			}
			awaitingObject = player.currentlyHeldObjectServer;
			AskServerCheckIsFullServerRpc(player.playerClientId, ((NetworkBehaviour)player).OwnerClientId);
			return true;
		}

		[ServerRpc(RequireOwnership = false)]
		private void AskServerCheckIsFullServerRpc(ulong playerId, ulong clientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3104039900u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3104039900u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
					bool response = (Object)(object)val3 == (Object)null || (Object)(object)val3.currentlyHeldObjectServer == (Object)null || ServerCheckingIsFull(val3);
					ClientRpcParams val4 = default(ClientRpcParams);
					val4.Send = new ClientRpcSendParams
					{
						TargetClientIds = new ulong[1] { clientId }
					};
					ClientRpcParams clientRpcParams = val4;
					ServerResponseCheckIsFullClientRpc(response, clientRpcParams);
				}
			}
		}

		private bool ServerCheckingIsFull(PlayerControllerB player)
		{
			foreach (var (_, val2) in placedItems)
			{
				if (player.currentlyHeldObjectServer.itemProperties.itemName == val2.itemProperties.itemName && ((Object)player.currentlyHeldObjectServer.itemProperties).name == ((Object)val2.itemProperties).name)
				{
					return false;
				}
			}
			return true;
		}

		[ClientRpc]
		private void ServerResponseCheckIsFullClientRpc(bool response, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2155821034u, clientRpcParams, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref response, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2155821034u, clientRpcParams, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !response)
				{
					responseOnAwaiting = true;
				}
			}
		}

		private IEnumerator SyncCupboard()
		{
			if (Plugin.config.verboseLogging.Value)
			{
				Plugin.logger.LogInfo((object)"Syncing Cupboard from host player");
			}
			while ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				yield return (object)new WaitForSeconds(0.03f);
			}
			SyncServerRpc(((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).OwnerClientId);
		}

		[ServerRpc(RequireOwnership = false)]
		private void SyncServerRpc(ulong clientId)
		{
			//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_0071: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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(2989470694u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2989470694u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			if (memory.IsFull())
			{
				SetSizeClientRpc(memory.Size);
			}
			if (placedItems.Count == 0 || !Plugin.config.rescaleItems.Value)
			{
				return;
			}
			ClientRpcParams val3 = default(ClientRpcParams);
			val3.Send = new ClientRpcSendParams
			{
				TargetClientIds = new ulong[1] { clientId }
			};
			ClientRpcParams clientRpcParams = val3;
			foreach (var (_, val5) in placedItems)
			{
				if (!val5.isHeld && !val5.isHeldByEnemy)
				{
					ScaleItemClientRpc(NetworkObjectReference.op_Implicit(((Component)val5).gameObject.GetComponent<NetworkObject>()), scaleMode: true, val5.originalScale, overrideOriginalScale: true, clientRpcParams);
				}
			}
		}

		[ClientRpc]
		private void SetSizeClientRpc(int size)
		{
			//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_0071: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1820484504u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, size);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1820484504u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					memory.Size = size;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SmartCupboard()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3359588108u, new RpcReceiveHandler(__rpc_handler_3359588108));
			NetworkManager.__rpc_func_table.Add(52998418u, new RpcReceiveHandler(__rpc_handler_52998418));
			NetworkManager.__rpc_func_table.Add(4245719167u, new RpcReceiveHandler(__rpc_handler_4245719167));
			NetworkManager.__rpc_func_table.Add(4123351311u, new RpcReceiveHandler(__rpc_handler_4123351311));
			NetworkManager.__rpc_func_table.Add(3104039900u, new RpcReceiveHandler(__rpc_handler_3104039900));
			NetworkManager.__rpc_func_table.Add(2155821034u, new RpcReceiveHandler(__rpc_handler_2155821034));
			NetworkManager.__rpc_func_table.Add(2989470694u, new RpcReceiveHandler(__rpc_handler_2989470694));
			NetworkManager.__rpc_func_table.Add(1820484504u, new RpcReceiveHandler(__rpc_handler_1820484504));
		}

		private static void __rpc_handler_3359588108(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SmartCupboard)(object)target).StoreDataServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_52998418(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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference itemRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				int save = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref save);
				int spawnIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref spawnIndex);
				bool isStacked = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isStacked, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SmartCupboard)(object)target).SyncItemClientRpc(itemRef, value, save, spawnIndex, isStacked);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4245719167(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 itemRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SmartCupboard)(object)target).PlayDropSFXClientRpc(itemRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4123351311(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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference itemRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemRef, default(ForNetworkSerializable));
				bool scaleMode = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref scaleMode, default(ForPrimitives));
				Vector3 size = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref size);
				bool overrideOriginalScale = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref overrideOriginalScale, default(ForPrimitives));
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SmartCupboard)(object)target).ScaleItemClientRpc(itemRef, scaleMode, size, overrideOriginalScale, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3104039900(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SmartCupboard)(object)target).AskServerCheckIsFullServerRpc(playerId, clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2155821034(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_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool response = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref response, default(ForPrimitives));
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SmartCupboard)(object)target).ServerResponseCheckIsFullClientRpc(response, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2989470694(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SmartCupboard)(object)target).SyncServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1820484504(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int sizeClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref sizeClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SmartCupboard)(object)target).SetSizeClientRpc(sizeClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "SmartCupboard";
		}
	}
	public class SmartMemory
	{
		[Serializable]
		public class Data
		{
			public string Id = "INVALID";

			public List<int> Values = new List<int>();

			public List<int> Saves = new List<int>();

			public int Quantity = 1;

			public Data()
			{
			}

			public Data(GrabbableObject item)
			{
				Id = ConvertID(item.itemProperties);
				Values.Add(item.itemProperties.isScrap ? item.scrapValue : 0);
				Saves.Add(item.itemProperties.saveItemVariable ? item.GetItemDataToSave() : 0);
			}

			public bool IsValid()
			{
				return Id != "INVALID";
			}

			public void Update(Data data)
			{
				Id = data.Id;
				Values.Clear();
				Values.AddRange(data.Values);
				Saves.Clear();
				Saves.AddRange(data.Saves);
				Quantity = data.Quantity;
			}

			private string ConvertID(Item sourceItem)
			{
				foreach (var (result, val2) in CacheItems)
				{
					if ((Object)(object)val2 == (Object)(object)sourceItem)
					{
						return result;
					}
				}
				return "LethalCompanyGame/" + sourceItem.itemName;
			}

			public unsafe void NetworkerSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: 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_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_009e: 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_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				serializer.SerializeValue(ref Id, false);
				if (serializer.IsWriter)
				{
					FastBufferWriter fastBufferWriter = serializer.GetFastBufferWriter();
					int count = Values.Count;
					((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref count, default(ForPrimitives));
					foreach (int value in Values)
					{
						int current = value;
						((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref current, default(ForPrimitives));
					}
					count = Saves.Count;
					((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref count, default(ForPrimitives));
					foreach (int safe in Saves)
					{
						int current2 = safe;
						((FastBufferWriter)(ref fastBufferWriter)).WriteValueSafe<int>(ref current2, default(ForPrimitives));
					}
				}
				if (serializer.IsReader)
				{
					FastBufferReader fastBufferReader = serializer.GetFastBufferReader();
					int num = default(int);
					((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
					int item = default(int);
					for (int i = 0; i < num; i++)
					{
						((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref item, default(ForPrimitives));
						Values.Add(item);
					}
					((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
					int item2 = default(int);
					for (int j = 0; j < num; j++)
					{
						((FastBufferReader)(ref fastBufferReader)).ReadValueSafe<int>(ref item2, default(ForPrimitives));
						Saves.Add(item2);
					}
				}
				((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref Quantity, default(ForPrimitives));
			}
		}

		public static SmartMemory? Instance;

		public readonly int Capacity = 16;

		public int Size = 0;

		public readonly List<int> IgnoreSpaces = new List<int>();

		public readonly List<List<Data>> ItemList = new List<List<Data>>(4);

		public static readonly Dictionary<string, Item> CacheItems = new Dictionary<string, Item>();

		public SmartMemory()
		{
			ClearAll(resetData: false);
		}

		public bool IsFull()
		{
			return Size == Capacity;
		}

		public void ClearAll(bool resetData = true)
		{
			if (resetData)
			{
				ItemList.ForEach(delegate(List<Data> x)
				{
					x.Clear();
				});
				ItemList.Clear();
				Size = 0;
			}
			for (int i = 0; i < 4; i++)
			{
				List<Data> list = new List<Data>(4);
				for (int j = 0; j < 4; j++)
				{
					list.Add(new Data());
				}
				ItemList.Add(list);
			}
		}

		public void Initialize()
		{
			Instance = this;
			foreach (ScrapItem scrapItem in Items.scrapItems)
			{
				CacheItems.TryAdd(scrapItem.modName + "/" + scrapItem.item.itemName, scrapItem.item);
			}
			foreach (ShopItem shopItem in Items.shopItems)
			{
				CacheItems.TryAdd(shopItem.modName + "/" + shopItem.item.itemName, shopItem.item);
			}
			foreach (PlainItem plainItem in Items.plainItems)
			{
				CacheItems.TryAdd(plainItem.modName + "/" + plainItem.item.itemName, plainItem.item);
			}
		}

		public bool StoreData(Data data, out int spawnIndex, bool freeSpaceOnly = false)
		{
			if (Plugin.config.verboseLogging.Value)
			{
				Plugin.logger.LogWarning((object)ToString());
				Plugin.logger.LogWarning((object)("Storing: " + data.Id));
			}
			spawnIndex = 0;
			int lastFreeSpaceId = -1;
			foreach (List<Data> item in ItemList)
			{
				foreach (Data item2 in item)
				{
					if (!item2.IsValid() && lastFreeSpaceId == -1)
					{
						lastFreeSpaceId = spawnIndex;
						if (IgnoreSpaces.Count > 0 && IgnoreSpaces.Exists((int e) => e == lastFreeSpaceId))
						{
							lastFreeSpaceId = -1;
						}
						else if (freeSpaceOnly)
						{
							break;
						}
					}
					else if (!freeSpaceOnly && item2.IsValid() && item2.Id == data.Id)
					{
						if (Plugin.config.verboseLogging.Value)
						{
							Plugin.logger.LogWarning((object)"Found a similar item");
						}
						item2.Values.Add(data.Values[0]);
						item2.Saves.Add(data.Saves[0]);
						item2.Quantity++;
						return false;
					}
					spawnIndex++;
				}
				if (freeSpaceOnly && lastFreeSpaceId != -1)
				{
					break;
				}
			}
			if (lastFreeSpaceId != -1)
			{
				if (Plugin.config.verboseLogging.Value)
				{
					Plugin.logger.LogWarning((object)"Found 1 free space");
				}
				spawnIndex = lastFreeSpaceId;
				int num = (int)((float)lastFreeSpaceId / 4f);
				int index = lastFreeSpaceId - num * 4;
				ItemList[num][index].Update(data);
				Size++;
				return true;
			}
			Plugin.logger.LogError((object)("SmartCupboard was full when " + data.Id + " tried to be stored."));
			return false;
		}

		public Data? RetrieveData(int spawnIndex, bool updateQuantity = true)
		{
			if (Plugin.config.verboseLogging.Value)
			{
				Plugin.logger.LogWarning((object)ToString());
				Plugin.logger.LogWarning((object)("Retrieving item at position: " + spawnIndex));
			}
			int num = (int)((float)spawnIndex / 4f);
			int num2 = spawnIndex - num * 4;
			if (num >= 4 || num2 >= 4)
			{
				return null;
			}
			Data data = ItemList[num][num2];
			if (!data.IsValid())
			{
				return null;
			}
			if (updateQuantity)
			{
				data.Values.RemoveAt(0);
				data.Saves.RemoveAt(0);
				data.Quantity--;
				if (data.Quantity <= 0)
				{
					Size--;
					ItemList[num][num2] = new Data();
				}
			}
			if (Plugin.config.verboseLogging.Value)
			{
				Plugin.logger.LogWarning((object)ToString());
			}
			return data;
		}

		public override string ToString()
		{
			int num = 0;
			StringBuilder stringBuilder = new StringBuilder().Append("Stored items:\n");
			if (Size == 0)
			{
				return stringBuilder.Append("None\n").ToString();
			}
			foreach (List<Data> item in ItemList)
			{
				foreach (Data item2 in item)
				{
					if (item2.IsValid())
					{
						stringBuilder.Append(num + ": " + item2.Id + " x" + item2.Quantity + "\n");
					}
					num++;
				}
			}
			return stringBuilder.ToString();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace SelfSortingStorage.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

plugins/ShoppingCart.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using CustomItemBehaviourLibrary.AbstractItems;
using CustomItemBehaviourLibrary.Misc;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ShoppingCart.Behaviour;
using ShoppingCart.Compat;
using ShoppingCart.Input;
using ShoppingCart.Misc;
using ShoppingCart.NetcodePatcher;
using ShoppingCart.Util;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;

[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ShoppingCart
{
	[BepInPlugin("com.github.WhiteSpike.ShoppingCart", "Shopping Cart", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static readonly Harmony harmony = new Harmony("com.github.WhiteSpike.ShoppingCart");

		internal static readonly ManualLogSource mls = Logger.CreateLogSource("Shopping Cart");

		internal static readonly List<AudioClip> wheelsNoise = new List<AudioClip>();

		public static PluginConfig Config;

		private void Awake()
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_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_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Expected O, but got Unknown
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Expected O, but got Unknown
			Config = new PluginConfig(((BaseUnityPlugin)this).Config);
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shoppingcart");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			string text2 = "Assets/Shopping Cart/";
			Item val2 = ScriptableObject.CreateInstance<Item>();
			((Object)val2).name = "ShoppingCartItemProperties";
			val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.DROP_AHEAD_PLAYER);
			val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.GRABBED_BEFORE_START);
			val2.canBeInspected = false;
			val2.isScrap = true;
			val2.minValue = SyncedEntry<int>.op_Implicit(Config.MINIMUM_VALUE);
			val2.maxValue = SyncedEntry<int>.op_Implicit(Config.MAXIMUM_VALUE);
			val2.floorYOffset = -90;
			val2.restingRotation = new Vector3(0f, 0f, 0f);
			val2.rotationOffset = new Vector3(0f, 0f, 0f);
			val2.positionOffset = new Vector3(0f, -1.7f, 0.35f);
			val2.weight = 0.99f + (float)SyncedEntry<int>.op_Implicit(Config.WEIGHT) / 100f;
			val2.twoHanded = true;
			val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png");
			val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "ShoppingCart.prefab");
			val2.dropSFX = val.LoadAsset<AudioClip>(text2 + "Drop.ogg");
			val2.grabSFX = val.LoadAsset<AudioClip>(text2 + "Grab.ogg");
			val2.pocketSFX = val.LoadAsset<AudioClip>(text2 + "Pocket.ogg");
			val2.throwSFX = val.LoadAsset<AudioClip>(text2 + "Throw.ogg");
			wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_1.ogg"));
			wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_2.ogg"));
			wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_3.ogg"));
			wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_4.ogg"));
			val2.highestSalePercentage = 0;
			val2.itemName = "Shopping Cart";
			val2.itemSpawnsOnGround = true;
			val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE);
			val2.requiresBattery = false;
			val2.batteryUsage = 0f;
			val2.twoHandedAnimation = true;
			val2.grabAnim = "HoldJetpack";
			ShoppingCartBehaviour shoppingCartBehaviour = val2.spawnPrefab.AddComponent<ShoppingCartBehaviour>();
			((GrabbableObject)shoppingCartBehaviour).itemProperties = val2;
			((GrabbableObject)shoppingCartBehaviour).grabbable = true;
			((GrabbableObject)shoppingCartBehaviour).grabbableToEnemies = true;
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterItem(val2);
			AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
			{
				new Keyframe(0f, 0f),
				new Keyframe(1f - Config.RARITY.Value, 1f),
				new Keyframe(1f, 1f)
			});
			SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
			val3.spawnableMapObject = new SpawnableMapObject
			{
				prefabToSpawn = val2.spawnPrefab
			};
			MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => curve));
			InputUtilsCompat.Init();
			harmony.PatchAll(typeof(Keybinds));
			mls.LogInfo((object)"Shopping Cart 1.0.2 has been loaded successfully.");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShoppingCart";

		public const string PLUGIN_NAME = "ShoppingCart";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ShoppingCart.Util
{
	internal static class Constants
	{
		internal const string ITEM_SCAN_NODE_KEY_FORMAT = "Enable scan node of {0}";

		internal const bool ITEM_SCAN_NODE_DEFAULT = true;

		internal const string ITEM_SCAN_NODE_DESCRIPTION = "Shows a scan node on the item when scanning";

		internal const string SHOPPING_CART_RARITY_KEY = "Spawn Chance of the Shopping Cart Item";

		internal const float SHOPPING_CART_RARITY_DEFAULT = 0.1f;

		internal const string SHOPPING_CART_RARITY_DESCRIPTION = "How likely it is for a Shopping Cart item to spawn when landing on a moon. (0.1 = 10%)";

		internal const string SHOPPING_CART_WEIGHT_KEY = "Weight of the Shopping Cart Item";

		internal const int SHOPPING_CART_WEIGHT_DEFAULT = 25;

		internal const string SHOPPING_CART_WEIGHT_DESCRIPTION = "Weight of the Shopping Cart without any items in lbs";

		internal const string SHOPPING_CART_CONDUCTIVE_KEY = "Conductive";

		internal const bool SHOPPING_CART_CONDUCTIVE_DEFAULT = true;

		internal const string SHOPPING_CART_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";

		internal const string SHOPPING_CART_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";

		internal const bool SHOPPING_CART_DROP_AHEAD_PLAYER_DEFAULT = true;

		internal const string SHOPPING_CART_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";

		internal const string SHOPPING_CART_GRABBED_BEFORE_START_KEY = "Grabbable before game start";

		internal const bool SHOPPING_CART_GRABBED_BEFORE_START_DEFAULT = true;

		internal const string SHOPPING_CART_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";

		internal const string SHOPPING_CART_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";

		internal const int SHOPPING_CART_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;

		internal const string SHOPPING_CART_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";

		internal const string SHOPPING_CART_RESTRICTION_MODE_KEY = "Restrictions on the Shopping Cart Item";

		internal const Restrictions SHOPPING_CART_RESTRICTION_MODE_DEFAULT = 2;

		internal const string SHOPPING_CART_RESTRICTION_MODE_DESCRIPTION = "Restriction applied when trying to insert an item on the Shopping Cart.\nSupported values: None, ItemCount, TotalWeight, All";

		internal const string SHOPPING_CART_MINIMUM_VALUE_KEY = "Minimum scrap value of Shopping Cart";

		internal const int SHOPPING_CART_MINIMUM_VALUE_DEFAULT = 50;

		internal const string SHOPPING_CART_MINIMUM_VALUE_DESCRIPTION = "Lower boundary of the scrap's possible value";

		internal const string SHOPPING_CART_MAXIMUM_VALUE_KEY = "Maximum scrap value of Shopping Cart";

		internal const int SHOPPING_CART_MAXIMUM_VALUE_DEFAULT = 100;

		internal const string SHOPPING_CART_MAXIMUM_VALUE_DESCRIPTION = "Higher boundary of the scrap's possible value";

		internal const string SHOPPING_CART_MAXIMUM_WEIGHT_ALLOWED_KEY = "Maximum amount of weight for Shopping Cart";

		internal const float SHOPPING_CART_MAXIMUM_WEIGHT_ALLOWED_DEFAULT = 100f;

		internal const string SHOPPING_CART_MAXIMUM_WEIGHT_ALLOWED_DESCRIPTION = "How much weight (in lbs and after weight reduction multiplier is applied on the stored items) a Shopping Cart can carry in items before it is considered full.";

		internal const string SHOPPING_CART_MAXIMUM_AMOUNT_ITEMS_KEY = "Maximum amount of items for Shopping Cart";

		internal const int SHOPPING_CART_MAXIMUM_AMOUNT_ITEMS_DEFAULT = 6;

		internal const string SHOPPING_CART_MAXIMUM_AMOUNT_ITEMS_DESCRIPTION = "Amount of items allowed before the Shopping Cart is considered full";

		internal const string SHOPPING_CART_WEIGHT_REDUCTION_MULTIPLIER_KEY = "Weight reduction multiplier for Shopping Cart";

		internal const float SHOPPING_CART_WEIGHT_REDUCTION_MULTIPLIER_DEFAULT = 0.5f;

		internal const string SHOPPING_CART_WEIGHT_REDUCTION_MUTLIPLIER_DESCRIPTION = "How much an item's weight will be ignored to the Shopping Cart's total weight";

		internal const string SHOPPING_CART_NOISE_RANGE_KEY = "Noise range of the Shopping Cart Item";

		internal const float SHOPPING_CART_NOISE_RANGE_DEFAULT = 14f;

		internal const string SHOPPING_CART_NOISE_RANGE_DESCRIPTION = "How far the Shopping Cart sound propagates to nearby enemies when in movement";

		internal const string SHOPPING_CART_LOOK_SENSITIVITY_DRAWBACK_KEY = "Look sensitivity drawback of the Shopping Cart Item";

		internal const float SHOPPING_CART_LOOK_SENSITIVITY_DRAWBACK_DEFAULT = 0.4f;

		internal const string SHOPPING_CART_LOOK_SENSITIVITY_DRAWBACK_DESCRIPTION = "Value multiplied on the player's look sensitivity when moving with the Shopping Cart Item";

		internal const string SHOPPING_CART_MOVEMENT_SLOPPY_KEY = "Sloppiness of the Shopping Cart Item";

		internal const float SHOPPING_CART_MOVEMENT_SLOPPY_DEFAULT = 5f;

		internal const string SHOPPING_CART_MOVEMENT_SLOPPY_DESCRIPTION = "Value multiplied on the player's movement to give the feeling of drifting while carrying the Shopping Cart Item";

		internal const string SHOPPING_CART_PLAY_NOISE_KEY = "Plays noises for players with Shopping Cart Item";

		internal const bool SHOPPING_CART_PLAY_NOISE_DEFAULT = true;

		internal const string SHOPPING_CART_PLAY_NOISE_DESCRIPTION = "If false, it will just not play the sounds, it will still attract monsters to noise";

		internal const string DROP_ALL_ITEMS_SHOPPING_CART_KEYBIND_NAME = "Drop all items from wheelbarrow";

		internal const string DROP_ALL_ITEMS_SHOPPING_CART_DEFAULT_KEYBIND = "<Mouse>/middleButton";

		internal static readonly string SHOPPING_CART_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Shopping Cart");
	}
}
namespace ShoppingCart.Misc
{
	[DataContract]
	public class PluginConfig : SyncedConfig2<PluginConfig>
	{
		[field: SyncedEntryField]
		public SyncedEntry<float> RARITY { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> SCAN_NODE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> MINIMUM_VALUE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> MAXIMUM_VALUE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> WEIGHT { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> DROP_AHEAD_PLAYER { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> GRABBED_BEFORE_START { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> CONDUCTIVE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<Restrictions> RESTRICTION_MODE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> MAXIMUM_AMOUNT_ITEMS { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> MAXIMUM_WEIGHT_ALLOWED { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> WEIGHT_REDUCTION_MULTIPLIER { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> LOOK_SENSITIVITY_DRAWBACK { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> MOVEMENT_SLOPPY { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> NOISE_RANGE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> PLAY_NOISE { get; set; }

		public PluginConfig(ConfigFile cfg)
			: base("com.github.WhiteSpike.ShoppingCart")
		{
			string text = "Shopping Cart";
			MINIMUM_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Minimum scrap value of Shopping Cart", 50, "Lower boundary of the scrap's possible value");
			MAXIMUM_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum scrap value of Shopping Cart", 100, "Higher boundary of the scrap's possible value");
			RARITY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Spawn Chance of the Shopping Cart Item", 0.1f, "How likely it is for a Shopping Cart item to spawn when landing on a moon. (0.1 = 10%)");
			WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Weight of the Shopping Cart Item", 25, "Weight of the Shopping Cart without any items in lbs");
			SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.SHOPPING_CART_SCAN_NODE_KEY, true, "Shows a scan node on the item when scanning");
			DROP_AHEAD_PLAYER = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Drop ahead of player when dropping", true, "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.");
			CONDUCTIVE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Conductive", true, "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)");
			GRABBED_BEFORE_START = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Grabbable before game start", true, "Allows wether the item can be grabbed before hand or not");
			RESTRICTION_MODE = SyncedBindingExtensions.BindSyncedEntry<Restrictions>(cfg, text, "Restrictions on the Shopping Cart Item", (Restrictions)2, "Restriction applied when trying to insert an item on the Shopping Cart.\nSupported values: None, ItemCount, TotalWeight, All");
			MAXIMUM_WEIGHT_ALLOWED = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Maximum amount of weight for Shopping Cart", 100f, "How much weight (in lbs and after weight reduction multiplier is applied on the stored items) a Shopping Cart can carry in items before it is considered full.");
			MAXIMUM_AMOUNT_ITEMS = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum amount of items for Shopping Cart", 6, "Amount of items allowed before the Shopping Cart is considered full");
			WEIGHT_REDUCTION_MULTIPLIER = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Weight reduction multiplier for Shopping Cart", 0.5f, "How much an item's weight will be ignored to the Shopping Cart's total weight");
			NOISE_RANGE = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Noise range of the Shopping Cart Item", 14f, "How far the Shopping Cart sound propagates to nearby enemies when in movement");
			LOOK_SENSITIVITY_DRAWBACK = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Look sensitivity drawback of the Shopping Cart Item", 0.4f, "Value multiplied on the player's look sensitivity when moving with the Shopping Cart Item");
			MOVEMENT_SLOPPY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Sloppiness of the Shopping Cart Item", 5f, "Value multiplied on the player's movement to give the feeling of drifting while carrying the Shopping Cart Item");
			PLAY_NOISE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Plays noises for players with Shopping Cart Item", true, "If false, it will just not play the sounds, it will still attract monsters to noise");
			ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
		}
	}
	internal static class Metadata
	{
		public const string GUID = "com.github.WhiteSpike.ShoppingCart";

		public const string NAME = "Shopping Cart";

		public const string VERSION = "1.0.2";
	}
	internal static class Tools
	{
		internal enum NodeType
		{
			GENERAL,
			DANGER,
			SCRAP
		}

		private static GameObject CreateCanvasScanNode(ref GameObject objectToAddScanNode)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3), objectToAddScanNode.transform.position, Quaternion.Euler(Vector3.zero), objectToAddScanNode.transform);
			((Object)val).name = "ScanNode";
			val.layer = LayerMask.NameToLayer("ScanNode");
			Object.Destroy((Object)(object)val.GetComponent<MeshRenderer>());
			Object.Destroy((Object)(object)val.GetComponent<MeshFilter>());
			return val;
		}

		private static void AddScanNode(GameObject objectToAddScanNode, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7)
		{
			GameObject val = CreateCanvasScanNode(ref objectToAddScanNode);
			ScanNodeProperties scanNodeProperties = val.AddComponent<ScanNodeProperties>();
			ChangeScanNode(ref scanNodeProperties, nodeType, header, subText, creatureScanID, 0, minRange, maxRange);
		}

		public static void AddScrapScanNode(GameObject objectToAddScanNode, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7)
		{
			AddScanNode(objectToAddScanNode, NodeType.SCRAP, header, subText, creatureScanID, minRange, maxRange);
		}

		public static void ChangeScanNode(ref ScanNodeProperties scanNodeProperties, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int scrapValue = 0, int minRange = 2, int maxRange = 7)
		{
			scanNodeProperties.headerText = header;
			scanNodeProperties.subText = subText;
			scanNodeProperties.nodeType = (int)nodeType;
			scanNodeProperties.creatureScanID = creatureScanID;
			scanNodeProperties.scrapValue = scrapValue;
			scanNodeProperties.minRange = minRange;
			scanNodeProperties.maxRange = maxRange;
		}
	}
}
namespace ShoppingCart.Input
{
	internal class IngameKeybinds : LcInputActions
	{
		public static IngameKeybinds Instance;

		[InputAction("<Mouse>/middleButton", Name = "Drop all items from wheelbarrow")]
		public InputAction ShoppingCartKey { get; set; }

		internal static InputActionAsset GetAsset()
		{
			return ((LcInputActions)Instance).Asset;
		}
	}
	[HarmonyPatch]
	internal static class Keybinds
	{
		public static InputActionAsset Asset;

		public static InputActionMap ActionMap;

		public static InputAction ShoppingCartAction;

		public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController;

		[HarmonyPatch(typeof(PreInitSceneScript), "Awake")]
		[HarmonyPrefix]
		public static void AddToKeybindMenu()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Asset = InputUtilsCompat.Asset;
			ActionMap = Asset.actionMaps[0];
			ShoppingCartAction = InputUtilsCompat.ShoppingCartKey;
		}

		[HarmonyPatch(typeof(StartOfRound), "OnEnable")]
		[HarmonyPostfix]
		public static void OnEnable()
		{
			Asset.Enable();
			ShoppingCartAction.performed += OnShoppingCartActionPerformed;
		}

		[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
		[HarmonyPostfix]
		public static void OnDisable()
		{
			Asset.Disable();
			ShoppingCartAction.performed -= OnShoppingCartActionPerformed;
		}

		private static void OnShoppingCartActionPerformed(CallbackContext context)
		{
			if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && Object.op_Implicit((Object)(object)localPlayerController.currentlyHeldObjectServer))
			{
				ShoppingCartBehaviour component = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent<ShoppingCartBehaviour>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((ContainerBehaviour)component).UpdateContainerDrop();
				}
			}
		}
	}
}
namespace ShoppingCart.Compat
{
	public static class InputUtilsCompat
	{
		internal static InputActionAsset Asset => IngameKeybinds.GetAsset();

		public static InputAction ShoppingCartKey => IngameKeybinds.Instance.ShoppingCartKey;

		internal static void Init()
		{
			IngameKeybinds.Instance = new IngameKeybinds();
		}
	}
}
namespace ShoppingCart.Behaviour
{
	internal class ShoppingCartBehaviour : ContainerBehaviour
	{
		internal const string ITEM_NAME = "Shopping Cart";

		protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE);

		public override void Start()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			((ContainerBehaviour)this).Start();
			PluginConfig config = Plugin.Config;
			base.maximumAmountItems = config.MAXIMUM_AMOUNT_ITEMS.Value;
			base.weightReduceMultiplier = config.WEIGHT_REDUCTION_MULTIPLIER.Value;
			base.restriction = SyncedEntry<Restrictions>.op_Implicit(config.RESTRICTION_MODE);
			base.maximumWeightAllowed = config.MAXIMUM_WEIGHT_ALLOWED.Value;
			base.noiseRange = config.NOISE_RANGE.Value;
			base.sloppiness = config.MOVEMENT_SLOPPY.Value;
			base.lookSensitivityDrawback = config.LOOK_SENSITIVITY_DRAWBACK.Value;
			base.playSounds = config.PLAY_NOISE.Value;
			base.wheelsClip = Plugin.wheelsNoise.ToArray();
			if (((GrabbableObject)this).scrapValue <= 0)
			{
				Random random = new Random(StartOfRound.Instance.randomMapSeed + 45);
				((GrabbableObject)this).SetScrapValue(random.Next(config.MINIMUM_VALUE.Value, config.MAXIMUM_VALUE.Value));
			}
			if (!KeepScanNode)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
			}
		}

		protected override void SetupScanNodeProperties()
		{
			ScanNodeProperties scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)scanNodeProperties != (Object)null)
			{
				Tools.ChangeScanNode(ref scanNodeProperties, (Tools.NodeType)scanNodeProperties.nodeType, "Shopping Cart");
			}
			else
			{
				Tools.AddScrapScanNode(((Component)this).gameObject, "Shopping Cart");
			}
		}

		protected override string[] SetupContainerTooltips()
		{
			string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngameKeybinds.Instance.ShoppingCartKey, (DisplayStringOptions)0, (string)null);
			return new string[1] { "Drop all items: [" + bindingDisplayString + "]" };
		}

		protected override bool ShowDepositPrompts()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			return localPlayerController.isHoldingObject && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)localPlayerController;
		}

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

		protected internal override string __getTypeName()
		{
			return "ShoppingCartBehaviour";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ShoppingCart.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

plugins/TerrasScrap.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TerrasScrap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A small collection of vanilla styled scrap.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+e01cea7a61e58729b4695f7a34df66cf1ac416f8")]
[assembly: AssemblyProduct("TerrasScrap")]
[assembly: AssemblyTitle("Terra's Scrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TerrasScrap
{
	[BepInPlugin("terraformer9x.TerrasScrap", "Terra's Scrap", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		private const string pluginGUID = "terraformer9x.TerrasScrap";

		private const string pluginName = "Terra's Scrap";

		private const string pluginVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("terraformer9x.TerrasScrap");

		public static Plugin Instance;

		private void Awake()
		{
			if (Instance == null)
			{
				Instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Terra's Scrap 1.0.2  is loaded!");
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}

		public static void Log(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
		}

		public static void LogError(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogError((object)msg);
		}

		public static void LogDebug(string msg)
		{
			((BaseUnityPlugin)Instance).Logger.LogDebug((object)msg);
		}
	}
	internal class StartOfRoundPatch
	{
		private static bool executed;

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void StartOfRoundPostfix(ref StartOfRound __instance)
		{
			if (executed)
			{
				return;
			}
			executed = true;
			Dictionary<string, List<ItemGroup>> dictionary = new Dictionary<string, List<ItemGroup>>();
			ItemGroup[] array = Resources.FindObjectsOfTypeAll<ItemGroup>();
			foreach (ItemGroup val in array)
			{
				if (!dictionary.ContainsKey(((Object)val).name))
				{
					List<ItemGroup> value = new List<ItemGroup>(1) { val };
					dictionary.Add(((Object)val).name, value);
				}
				else
				{
					dictionary[((Object)val).name].Add(val);
				}
			}
			List<ExtendedItem> list = PatchedContent.ExtendedItems.Where((ExtendedItem x) => ((ExtendedContent)x).ModName == "Terra's Scrap").ToList();
			Dictionary<string, Item> dictionary2 = new Dictionary<string, Item>();
			foreach (ExtendedItem item in list)
			{
				if ((Object)(object)item.Item != (Object)null && !dictionary2.ContainsKey(((Object)item.Item).name) && !dictionary2.ContainsValue(item.Item))
				{
					dictionary2.Add(((Object)item.Item).name, item.Item);
				}
			}
			dictionary2["TrafficCone"].spawnPositionTypes.AddRange(dictionary["GeneralItemClass"]);
			dictionary2["Tuba"].spawnPositionTypes.AddRange(dictionary["GeneralItemClass"]);
			dictionary2["WineBottle"].spawnPositionTypes.AddRange(dictionary["TabletopItems"]);
			dictionary2["Fan"].spawnPositionTypes.AddRange(dictionary["GeneralItemClass"]);
			dictionary2["Fan"].spawnPositionTypes.AddRange(dictionary["TabletopItems"]);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TerrasScrap";

		public const string PLUGIN_NAME = "TerrasScrap";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}