Decompiled source of SellBodiesFixed v1.14.1

BepInEx/plugins/SellBodies/SellBodies.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using CleaningCompany.Misc;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SellBodies;
using SellBodies.Monos;
using SellBodies.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.Video;

[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("SellBodies")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eac99c740b2f44169a545a1405225cb9c2a77920")]
[assembly: AssemblyProduct("SellBodies")]
[assembly: AssemblyTitle("SellBodies")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 GameBoyCartridgeScript : GrabbableObject
{
	public Material cartrigeMat;

	public VideoClip videoClip;

	public string URL;

	public bool isURLCartridge = false;

	private bool isEnteringURL = false;

	private string urlInput = "";

	public override void Start()
	{
		((GrabbableObject)this).Start();
		base.scrapValue = 378;
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (buttonDown && (Object)(object)base.playerHeldBy != (Object)null && isURLCartridge && !isEnteringURL)
		{
			OpenURLInput();
		}
	}

	private void OnGUI()
	{
		//IL_005b: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Invalid comparison between Unknown and I4
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Invalid comparison between Unknown and I4
		if (isEnteringURL)
		{
			float num = 500f;
			float num2 = 30f;
			float num3 = ((float)Screen.width - num) / 2f;
			float num4 = ((float)Screen.height - num2) / 2f;
			GUI.Box(new Rect(num3 - 10f, num4 - 40f, num + 20f, num2 + 60f), "Insert URL");
			GUI.SetNextControlName("URLField");
			urlInput = GUI.TextField(new Rect(num3, num4, num, num2), urlInput);
			GUI.FocusControl("URLField");
			if (Event.current.isKey && (int)Event.current.keyCode == 13 && urlInput.Length > 0)
			{
				URL = urlInput;
				CloseURLInput();
			}
			else if (Event.current.isKey && (int)Event.current.keyCode == 27)
			{
				CloseURLInput();
			}
		}
	}

	private void OpenURLInput()
	{
		isEnteringURL = true;
		urlInput = URL ?? "";
		base.playerHeldBy.isTypingChat = true;
		base.playerHeldBy.disableLookInput = true;
		Cursor.visible = true;
		Cursor.lockState = (CursorLockMode)0;
	}

	private void CloseURLInput()
	{
		isEnteringURL = false;
		urlInput = "";
		if ((Object)(object)base.playerHeldBy != (Object)null)
		{
			base.playerHeldBy.isTypingChat = false;
			base.playerHeldBy.disableLookInput = false;
		}
		Cursor.visible = false;
		Cursor.lockState = (CursorLockMode)1;
	}

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

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

	[MethodImpl(MethodImplOptions.NoInlining)]
	protected internal override string __getTypeName()
	{
		return "GameBoyCartridgeScript";
	}
}
public class GameBoyInput : LcInputActions
{
	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction LoadCartridgeKey { get; set; }

	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction VolumeUpKey { get; set; }

	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction VolumeDownKey { get; set; }
}
public class GameBoyScript : GrabbableObject
{
	public GameObject gameboyCartrige;

	public GameObject gameboyBackground;

	public VideoPlayer gameboyVideoPlayer;

	public AudioClip errorSFX;

	public AudioSource audio;

	private Item cartridgeItem;

	private GameBoyCartridgeScript cartridge;

	private string gameboyURL = "";

	private bool isResolvingURL = false;

	private const string YT_API_URL = "https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&hl=en";

	private const string YT_USER_AGENT = "com.google.android.youtube/20.10.38 (Linux; U; Android 11) gzip";

	private const string YT_SOCS_COOKIE = "SOCS=CAISEwgDEgk4MTM4MzYzNTIaAmVuIAEaBgiApPzGBg";

	public override void Start()
	{
		((GrabbableObject)this).Start();
		SetCartridge(cartridgeItem, gameboyURL);
	}

	public override void Update()
	{
		((GrabbableObject)this).Update();
		if (CanUseKeys())
		{
			SetupKeyCallbacks();
		}
		else
		{
			StopKeyCallbacks();
		}
	}

	private bool CanUseKeys()
	{
		if (!((NetworkBehaviour)this).IsOwner || (Object)(object)base.playerHeldBy == (Object)null || base.isPocketed)
		{
			return false;
		}
		if (base.playerHeldBy.isGrabbingObjectAnimation || base.playerHeldBy.isTypingChat || base.playerHeldBy.inTerminalMenu)
		{
			return false;
		}
		if (base.playerHeldBy.inSpecialInteractAnimation || (Object)(object)base.playerHeldBy.hoveringOverTrigger != (Object)null)
		{
			return false;
		}
		return true;
	}

	public override void OnDestroy()
	{
		StopKeyCallbacks();
		((GrabbableObject)this).OnDestroy();
	}

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

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

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

	public override void PocketItem()
	{
		base.playerHeldBy.equippedUsableItemQE = false;
		((GrabbableObject)this).PocketItem();
	}

	public override int GetItemDataToSave()
	{
		((GrabbableObject)this).GetItemDataToSave();
		if ((Object)(object)cartridgeItem == (Object)null)
		{
			return 0;
		}
		return cartridgeItem.itemId;
	}

	public override void LoadItemSaveData(int saveData)
	{
		((GrabbableObject)this).LoadItemSaveData(saveData);
		Item[] gameboyCartridges = Plugin.instance.GameboyCartridges;
		foreach (Item val in gameboyCartridges)
		{
			if (val.itemId == saveData)
			{
				SetCartridge(val, "");
				return;
			}
		}
		SetCartridge(null, "");
	}

	private void SetupKeyCallbacks()
	{
		Plugin.InputActionsInstance.LoadCartridgeKey.performed += LoadCartridge;
		Plugin.InputActionsInstance.VolumeUpKey.performed += VolumeUp;
		Plugin.InputActionsInstance.VolumeDownKey.performed += VolumeDown;
	}

	private void StopKeyCallbacks()
	{
		Plugin.InputActionsInstance.LoadCartridgeKey.performed -= LoadCartridge;
		Plugin.InputActionsInstance.VolumeUpKey.performed -= VolumeUp;
		Plugin.InputActionsInstance.VolumeDownKey.performed -= VolumeDown;
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (!buttonDown || (Object)(object)base.playerHeldBy == (Object)null || (Object)(object)cartridgeItem == (Object)null)
		{
			return;
		}
		if (gameboyVideoPlayer.isPlaying)
		{
			gameboyBackground.SetActive(false);
			gameboyVideoPlayer.Pause();
		}
		else if (gameboyVideoPlayer.frame > 0)
		{
			gameboyBackground.SetActive(true);
			gameboyVideoPlayer.Play();
		}
		else if (cartridge.isURLCartridge)
		{
			if (string.IsNullOrEmpty(gameboyURL))
			{
				audio.PlayOneShot(errorSFX);
			}
			else if (!isResolvingURL)
			{
				((MonoBehaviour)this).StartCoroutine(ResolveAndPlay(gameboyURL));
			}
		}
		else
		{
			gameboyVideoPlayer.clip = cartridge.videoClip;
			gameboyVideoPlayer.frame = 0L;
			gameboyVideoPlayer.Play();
			gameboyBackground.SetActive(true);
		}
	}

	private void VolumeUp(CallbackContext context)
	{
		SetVolumeServerRpc(audio.volume + 0.1f);
	}

	private void VolumeDown(CallbackContext context)
	{
		SetVolumeServerRpc(audio.volume - 0.1f);
	}

	[ServerRpc(RequireOwnership = false)]
	private void SetVolumeServerRpc(float volume)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2718021421u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref volume, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2718021421u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				SetVolumeClientRpc(Mathf.Clamp01(volume));
			}
		}
	}

	[ClientRpc]
	private void SetVolumeClientRpc(float volume)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(11928496u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref volume, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 11928496u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				audio.volume = volume;
			}
		}
	}

	private void LoadCartridge(CallbackContext context)
	{
		if (!CanUseKeys())
		{
			return;
		}
		if ((Object)(object)cartridgeItem != (Object)null)
		{
			EjectCartridgeServerRpc(cartridgeItem.itemName, gameboyURL, (int)base.playerHeldBy.playerClientId, GetFreeSlot());
			SetCartridge(null, "");
			return;
		}
		int cartridgeSlot = GetCartridgeSlot();
		if (cartridgeSlot != -1)
		{
			GameBoyCartridgeScript component = ((Component)base.playerHeldBy.ItemSlots[cartridgeSlot]).GetComponent<GameBoyCartridgeScript>();
			Item itemProperties = ((GrabbableObject)component).itemProperties;
			string uRL = component.URL;
			base.playerHeldBy.DestroyItemInSlotAndSync(cartridgeSlot);
			SetCartridge(itemProperties, uRL);
			SetCartridgeServerRpc(itemProperties.itemName, uRL);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	private void SetCartridgeServerRpc(string cartridgeName, string url)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: 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_013d: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4150844155u, val2, (RpcDelivery)0);
			bool flag = cartridgeName != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(cartridgeName, false);
			}
			bool flag2 = url != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
			if (flag2)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(url, false);
			}
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 4150844155u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			SetCartridgeClientRpc(cartridgeName, url);
		}
	}

	[ClientRpc]
	private void SetCartridgeClientRpc(string cartridgeName, string url)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: 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_013d: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val2 = default(ClientRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(981047000u, val2, (RpcDelivery)0);
			bool flag = cartridgeName != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(cartridgeName, false);
			}
			bool flag2 = url != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
			if (flag2)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(url, false);
			}
			((NetworkBehaviour)this).__endSendClientRpc(ref val, 981047000u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				SetCartridge(FindCartridge(cartridgeName), url);
			}
		}
	}

	private void SetCartridge(Item item, string url)
	{
		cartridgeItem = item;
		cartridge = null;
		if ((Object)(object)item != (Object)null)
		{
			cartridge = item.spawnPrefab.GetComponent<GameBoyCartridgeScript>();
		}
		gameboyURL = url;
		gameboyVideoPlayer.Stop();
		gameboyBackground.SetActive(false);
		gameboyCartrige.SetActive((Object)(object)item != (Object)null);
		if (!((Object)(object)item == (Object)null))
		{
			if (cartridge.isURLCartridge)
			{
				gameboyVideoPlayer.source = (VideoSource)1;
			}
			else
			{
				gameboyVideoPlayer.source = (VideoSource)0;
			}
			MeshRenderer[] componentsInChildren = gameboyCartrige.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val in componentsInChildren)
			{
				((Renderer)val).material = cartridge.cartrigeMat;
			}
		}
	}

	private Item FindCartridge(string cartridgeName)
	{
		Item[] gameboyCartridges = Plugin.instance.GameboyCartridges;
		foreach (Item val in gameboyCartridges)
		{
			if (val.itemName == cartridgeName)
			{
				return val;
			}
		}
		return null;
	}

	private int GetCartridgeSlot()
	{
		for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++)
		{
			if ((Object)(object)base.playerHeldBy.ItemSlots[i] != (Object)null && (Object)(object)((Component)base.playerHeldBy.ItemSlots[i]).GetComponent<GameBoyCartridgeScript>() != (Object)null)
			{
				return i;
			}
		}
		return -1;
	}

	private int GetFreeSlot()
	{
		for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++)
		{
			if ((Object)(object)base.playerHeldBy.ItemSlots[i] == (Object)null)
			{
				return i;
			}
		}
		return -1;
	}

	[ServerRpc(RequireOwnership = false)]
	private void EjectCartridgeServerRpc(string cartridgeName, string url, int playerId, int slot)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: 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_0157: 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_0174: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_0112: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val2 = default(ServerRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1539012735u, val2, (RpcDelivery)0);
			bool flag = cartridgeName != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(cartridgeName, false);
			}
			bool flag2 = url != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
			if (flag2)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(url, false);
			}
			BytePacker.WriteValueBitPacked(val, playerId);
			BytePacker.WriteValueBitPacked(val, slot);
			((NetworkBehaviour)this).__endSendServerRpc(ref val, 1539012735u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			GameObject val3 = Object.Instantiate<GameObject>(FindCartridge(cartridgeName).spawnPrefab, ((Component)this).transform.position, Quaternion.identity);
			NetworkObject component = val3.GetComponent<NetworkObject>();
			component.Spawn(false);
			if (slot != -1)
			{
				component.ChangeOwnership(StartOfRound.Instance.allPlayerScripts[playerId].actualClientId);
			}
			EjectCartridgeClientRpc(NetworkObjectReference.op_Implicit(component), url, playerId, slot);
		}
	}

	[ClientRpc]
	private void EjectCartridgeClientRpc(NetworkObjectReference ejectedRef, string url, int playerId, int slot)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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_00a3: 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_0134: 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_00d7: 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_0158: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val2 = default(ClientRpcParams);
			FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4082470024u, val2, (RpcDelivery)0);
			((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref ejectedRef, default(ForNetworkSerializable));
			bool flag = url != null;
			((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val)).WriteValueSafe(url, false);
			}
			BytePacker.WriteValueBitPacked(val, playerId);
			BytePacker.WriteValueBitPacked(val, slot);
			((NetworkBehaviour)this).__endSendClientRpc(ref val, 4082470024u, val2, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsOwner)
			{
				SetCartridge(null, "");
			}
			((MonoBehaviour)this).StartCoroutine(PlaceEjectedCartridge(ejectedRef, url, StartOfRound.Instance.allPlayerScripts[playerId], slot));
		}
	}

	private IEnumerator PlaceEjectedCartridge(NetworkObjectReference ejectedRef, string url, PlayerControllerB player, int slot)
	{
		//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 null;
		NetworkObject networkObject = default(NetworkObject);
		if (((NetworkObjectReference)(ref ejectedRef)).TryGet(ref networkObject, (NetworkManager)null))
		{
			GameBoyCartridgeScript ejected = ((Component)networkObject).GetComponent<GameBoyCartridgeScript>();
			ejected.URL = url;
			((GrabbableObject)ejected).isInElevator = base.isInElevator;
			((GrabbableObject)ejected).isInShipRoom = base.isInShipRoom;
			((GrabbableObject)ejected).isInFactory = base.isInFactory;
			if (slot == -1 || (Object)(object)player.ItemSlots[slot] != (Object)null)
			{
				DropEjectedCartridge(ejected);
			}
			else
			{
				PutEjectedCartridgeInSlot(ejected, player, slot);
			}
		}
	}

	private void DropEjectedCartridge(GameBoyCartridgeScript ejected)
	{
		//IL_0046: 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: 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)
		if (base.isInElevator)
		{
			((Component)ejected).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
		}
		else
		{
			((Component)ejected).transform.SetParent(StartOfRound.Instance.propsContainer, true);
		}
		((GrabbableObject)ejected).startFallingPosition = ((Component)ejected).transform.localPosition;
		((GrabbableObject)ejected).FallToGround(false, false, default(Vector3));
	}

	private void PutEjectedCartridgeInSlot(GameBoyCartridgeScript ejected, PlayerControllerB player, int slot)
	{
		((GrabbableObject)ejected).playerHeldBy = player;
		if (((NetworkBehaviour)player).IsOwner)
		{
			((GrabbableObject)ejected).parentObject = player.localItemHolder;
		}
		else
		{
			((GrabbableObject)ejected).parentObject = player.serverItemHolder;
		}
		((GrabbableObject)ejected).heldByPlayerOnServer = true;
		((GrabbableObject)ejected).isHeld = true;
		((GrabbableObject)ejected).isPocketed = true;
		((GrabbableObject)ejected).EnablePhysics(false);
		((GrabbableObject)ejected).EnableItemMeshes(false);
		player.ItemSlots[slot] = (GrabbableObject)(object)ejected;
		if (((NetworkBehaviour)player).IsOwner)
		{
			HUDManager.Instance.itemSlotIcons[slot].sprite = ((GrabbableObject)ejected).itemProperties.itemIcon;
			((Behaviour)HUDManager.Instance.itemSlotIcons[slot]).enabled = true;
		}
	}

	private IEnumerator ResolveAndPlay(string url)
	{
		isResolvingURL = true;
		string directUrl = url;
		if (IsYouTubeURL(url))
		{
			string videoId = ExtractYouTubeVideoId(url);
			if (videoId == null)
			{
				Debug.LogError((object)("[GameBoy] Could not extract YouTube video ID from: " + url));
				audio.PlayOneShot(errorSFX);
				isResolvingURL = false;
				yield break;
			}
			directUrl = null;
			UnityWebRequest request = CreateYouTubeRequest(videoId);
			try
			{
				yield return request.SendWebRequest();
				if ((int)request.result == 1)
				{
					directUrl = ExtractStreamURL(request.downloadHandler.text);
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
			if (directUrl == null)
			{
				Debug.LogError((object)("[GameBoy] Could not resolve YouTube video: " + videoId));
				audio.PlayOneShot(errorSFX);
				isResolvingURL = false;
				yield break;
			}
		}
		isResolvingURL = false;
		if ((Object)(object)cartridge == (Object)null || !cartridge.isURLCartridge)
		{
			yield break;
		}
		gameboyVideoPlayer.url = directUrl;
		gameboyVideoPlayer.frame = 0L;
		gameboyVideoPlayer.Prepare();
		while (true)
		{
			if (!gameboyVideoPlayer.isPrepared)
			{
				if (!((Object)(object)cartridge == (Object)null))
				{
					yield return null;
					continue;
				}
				break;
			}
			gameboyVideoPlayer.Play();
			gameboyBackground.SetActive(true);
			break;
		}
	}

	private static UnityWebRequest CreateYouTubeRequest(string videoId)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		string s = "{\"videoId\":\"" + videoId + "\",\"context\":{\"client\":{\"clientName\":\"ANDROID\",\"clientVersion\":\"20.10.38\",\"androidSdkVersion\":30,\"osName\":\"Android\",\"osVersion\":\"11\",\"hl\":\"en\",\"gl\":\"US\"}},\"contentCheckOk\":true,\"racyCheckOk\":true}";
		UnityWebRequest val = new UnityWebRequest("https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&hl=en", "POST");
		val.uploadHandler = (UploadHandler)new UploadHandlerRaw(Encoding.UTF8.GetBytes(s));
		val.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
		val.SetRequestHeader("Content-Type", "application/json");
		val.SetRequestHeader("User-Agent", "com.google.android.youtube/20.10.38 (Linux; U; Android 11) gzip");
		val.SetRequestHeader("Cookie", "SOCS=CAISEwgDEgk4MTM4MzYzNTIaAmVuIAEaBgiApPzGBg");
		val.timeout = 15;
		return val;
	}

	private static bool IsYouTubeURL(string url)
	{
		return url.Contains("youtube.com") || url.Contains("youtu.be");
	}

	private static string ExtractYouTubeVideoId(string url)
	{
		Match match = Regex.Match(url, "[?&]v=([a-zA-Z0-9_-]{11})");
		if (match.Success)
		{
			return match.Groups[1].Value;
		}
		match = Regex.Match(url, "youtu\\.be/([a-zA-Z0-9_-]{11})");
		if (match.Success)
		{
			return match.Groups[1].Value;
		}
		match = Regex.Match(url, "youtube\\.com/embed/([a-zA-Z0-9_-]{11})");
		if (match.Success)
		{
			return match.Groups[1].Value;
		}
		return null;
	}

	private static string ExtractStreamURL(string json)
	{
		MatchCollection matchCollection = Regex.Matches(json, "\"url\"\\s*:\\s*\"(https://[^\"]*googlevideo\\.com/videoplayback[^\"]+)\"");
		string text = null;
		int num = int.MaxValue;
		foreach (Match item in matchCollection)
		{
			string str = item.Groups[1].Value.Replace("\\u0026", "&");
			str = Regex.Unescape(str);
			if (str.Contains("mime=video%2Fmp4") || str.Contains("mime=video/mp4"))
			{
				Match match2 = Regex.Match(str, "itag=(\\d+)");
				int num2 = (match2.Success ? int.Parse(match2.Groups[1].Value) : 0) switch
				{
					22 => 1, 
					18 => 0, 
					_ => 2, 
				};
				if (num2 < num)
				{
					text = str;
					num = num2;
				}
			}
		}
		if (text != null)
		{
			return text;
		}
		if (matchCollection.Count > 0)
		{
			string str2 = matchCollection[0].Groups[1].Value.Replace("\\u0026", "&");
			return Regex.Unescape(str2);
		}
		return null;
	}

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

	protected override void __initializeRpcs()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		((NetworkBehaviour)this).__registerRpc(2718021421u, new RpcReceiveHandler(__rpc_handler_2718021421), "SetVolumeServerRpc");
		((NetworkBehaviour)this).__registerRpc(11928496u, new RpcReceiveHandler(__rpc_handler_11928496), "SetVolumeClientRpc");
		((NetworkBehaviour)this).__registerRpc(4150844155u, new RpcReceiveHandler(__rpc_handler_4150844155), "SetCartridgeServerRpc");
		((NetworkBehaviour)this).__registerRpc(981047000u, new RpcReceiveHandler(__rpc_handler_981047000), "SetCartridgeClientRpc");
		((NetworkBehaviour)this).__registerRpc(1539012735u, new RpcReceiveHandler(__rpc_handler_1539012735), "EjectCartridgeServerRpc");
		((NetworkBehaviour)this).__registerRpc(4082470024u, new RpcReceiveHandler(__rpc_handler_4082470024), "EjectCartridgeClientRpc");
		((GrabbableObject)this).__initializeRpcs();
	}

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

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

	private static void __rpc_handler_4150844155(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_0067: 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_0099: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string cartridgeName = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref cartridgeName, false);
			}
			bool flag2 = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
			string url = null;
			if (flag2)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref url, false);
			}
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GameBoyScript)(object)target).SetCartridgeServerRpc(cartridgeName, url);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_981047000(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_0067: 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_0099: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string cartridgeName = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref cartridgeName, false);
			}
			bool flag2 = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
			string url = null;
			if (flag2)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref url, false);
			}
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GameBoyScript)(object)target).SetCartridgeClientRpc(cartridgeName, url);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1539012735(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_0067: 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_0093: 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_00b3: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string cartridgeName = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref cartridgeName, false);
			}
			bool flag2 = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
			string url = null;
			if (flag2)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref url, false);
			}
			int playerId = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
			int slot = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref slot);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GameBoyScript)(object)target).EjectCartridgeServerRpc(cartridgeName, url, playerId, slot);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_4082470024(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_0076: 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_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: 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)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			NetworkObjectReference ejectedRef = default(NetworkObjectReference);
			((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref ejectedRef, default(ForNetworkSerializable));
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string url = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref url, false);
			}
			int playerId = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
			int slot = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref slot);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((GameBoyScript)(object)target).EjectCartridgeClientRpc(ejectedRef, url, playerId, slot);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	protected internal override string __getTypeName()
	{
		return "GameBoyScript";
	}
}
namespace SellBodies
{
	[BepInPlugin("Entity378.sellbodies", "Sell Bodies", "1.14.1")]
	[BepInDependency("evaisa.lethallib", "0.16.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Entity378.sellbodies");

		private const string GUID = "Entity378.sellbodies";

		private const string NAME = "Sell Bodies";

		private const string VERSION = "1.14.1";

		private static string bodiesRoot = "Assets/LethalCompany/SellBodies/Items/";

		private static string mainRoot = "Assets/LethalCompany/SellBodies/";

		public Dictionary<string, Item> BodySpawns = new Dictionary<string, Item>();

		public List<string> VanillaBody = new List<string>
		{
			"Flowerman", "Crawler", "Hoarding bug", "Centipede", "Bunker Spider", "Puffer", "Jester", "Blob", "Girl", "Spring",
			"Nutcracker", "Masked", "Butler", "MouthDog", "Earth Leviathan", "ForestGiant", "Baboon hawk", "RadMech", "Red Locust Bees", "Docile Locust Bees",
			"Manticoil", "Tulip Snake", "Clay Surgeon", "Bush Wolf", "Maneater", "GiantKiwi", "Stingray", "Cadaver Growths", "Cadaver Bloom", "Feiopar"
		};

		public List<string> BlackListed = new List<string>();

		private AssetBundle bundle;

		public static Plugin instance;

		public static GameObject ConfettiPrefab;

		public Item Gameboy;

		public Item[] GameboyCartridges;

		public static GameBoyInput InputActionsInstance;

		public static PluginConfig cfg { get; private set; }

		private void Awake()
		{
			instance = this;
			InputActionsInstance = new GameBoyInput();
			cfg = new PluginConfig(((BaseUnityPlugin)this).Config);
			cfg.InitBindings();
			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);
					}
				}
			}
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "sellbodies");
			bundle = AssetBundle.LoadFromFile(text);
			ConfettiPrefab = bundle.LoadAsset<GameObject>(mainRoot + "KillEffects/ConfettiParticle.prefab");
			AudioClip clip = bundle.LoadAsset<AudioClip>(mainRoot + "KillEffects/Cheer.ogg");
			AudioClip clip2 = bundle.LoadAsset<AudioClip>(mainRoot + "KillEffects/Yippee.ogg");
			if (cfg.YIPPEE)
			{
				ConfettiPrefab.AddComponent<AudioSource>().clip = clip2;
			}
			else
			{
				ConfettiPrefab.AddComponent<AudioSource>().clip = clip;
			}
			ConfettiPrefab.GetComponent<AudioSource>().playOnAwake = true;
			Gameboy = bundle.LoadAsset<Item>(mainRoot + "Gameboy/Gameboy.asset");
			Utilities.FixMixerGroups(Gameboy.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(Gameboy.spawnPrefab);
			Items.RegisterShopItem(Gameboy, 20);
			GameboyCartridges = (Item[])(object)new Item[3]
			{
				bundle.LoadAsset<Item>(mainRoot + "Gameboy/CartridgeRITN/CartridgeRITN.asset"),
				bundle.LoadAsset<Item>(mainRoot + "Gameboy/CartridgeRDA/CartridgeRDA.asset"),
				bundle.LoadAsset<Item>(mainRoot + "Gameboy/CartridgeURL/CartridgeURL.asset")
			};
			Item[] gameboyCartridges = GameboyCartridges;
			foreach (Item val in gameboyCartridges)
			{
				Utilities.FixMixerGroups(val.spawnPrefab);
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Items.RegisterItem(val);
			}
			ApplyConfig();
			RegisterDefaultBodies();
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Sell Bodies is patched!");
		}

		private void ApplyConfig()
		{
			BlackListed.Clear();
			string[] array = cfg.BLACKLISTED.Split(',');
			string[] array2 = array;
			foreach (string text in array2)
			{
				string text2 = text.Trim();
				if (text2.Length > 0)
				{
					BlackListed.Add(text2);
				}
			}
		}

		private void RegisterDefaultBodies()
		{
			RegisterBody("Hoarding bug", bodiesRoot + "HoarderingBugBody.asset", cfg.HOARDER_MIN, cfg.HOARDER_MAX, cfg.HOARDER_WEIGHT, cfg.HOARDER_TWOHANDED, cfg.HOARDER);
			RegisterBody("Bunker Spider", bodiesRoot + "BunkerSpiderBody.asset", cfg.SPIDER_MIN, cfg.SPIDER_MAX, cfg.SPIDER_WEIGHT, cfg.SPIDER_TWOHANDED, cfg.SPIDER);
			RegisterBody("Crawler", bodiesRoot + "CrawlerBody.asset", cfg.THUMPER_MIN, cfg.THUMPER_MAX, cfg.THUMPER_WEIGHT, cfg.THUMPER_TWOHANDED, cfg.THUMPER);
			RegisterBody("Centipede", bodiesRoot + "CentipedeBody.asset", cfg.CENTIPEDE_MIN, cfg.CENTIPEDE_MAX, cfg.CENTIPEDE_WEIGHT, cfg.CENTIPEDE_TWOHANDED, cfg.CENTIPEDE);
			RegisterBody("Nutcracker", bodiesRoot + "NutcrackerBody.asset", cfg.NUTCRACKER_MIN, cfg.NUTCRACKER_MAX, cfg.NUTCRACKER_WEIGHT, cfg.NUTCRACKER_TWOHANDED, cfg.NUTCRACKER);
			RegisterBody("Flowerman", bodiesRoot + "FlowerManBody.asset", cfg.BRACKEN_MIN, cfg.BRACKEN_MAX, cfg.BRACKEN_WEIGHT, cfg.BRACKEN_TWOHANDED, cfg.BRACKEN);
			RegisterBody("Baboon hawk", bodiesRoot + "BaboonHawkBody.asset", cfg.BABOON_MIN, cfg.BABOON_MAX, cfg.BABOON_WEIGHT, cfg.BABOON_TWOHANDED, cfg.BABOON);
			RegisterBody("MouthDog", bodiesRoot + "MouthDogBody.asset", cfg.MOUTHDOG_MIN, cfg.MOUTHDOG_MAX, cfg.MOUTHDOG_WEIGHT, cfg.MOUTHDOG_TWOHANDED, cfg.MOUTHDOG);
			RegisterBody("Spring", bodiesRoot + "SpringBody.asset", cfg.COILHEAD_MIN, cfg.COILHEAD_MAX, cfg.COILHEAD_WEIGHT, cfg.COILHEAD_TWOHANDED, cfg.COILHEAD);
			RegisterBody("Girl", bodiesRoot + "GirlBody.asset", cfg.GHOSTGIRL_MIN, cfg.GHOSTGIRL_MAX, cfg.GHOSTGIRL_WEIGHT, cfg.GHOSTGIRL_TWOHANDED, cfg.GHOSTGIRL);
			RegisterBody("ForestGiant", bodiesRoot + "ForestGiantBody.asset", cfg.FORESTKEEPER_MIN, cfg.FORESTKEEPER_MAX, cfg.FORESTKEEPER_WEIGHT, cfg.FORESTKEEPER_TWOHANDED, cfg.FORESTKEEPER);
			RegisterBody("Jester", bodiesRoot + "JesterBody.asset", cfg.JESTER_MIN, cfg.JESTER_MAX, cfg.JESTER_WEIGHT, cfg.JESTER_TWOHANDED, cfg.JESTER);
			RegisterBody("Blob", bodiesRoot + "BlobBody.asset", cfg.HYGRODORE_MIN, cfg.HYGRODORE_MAX, cfg.HYGRODORE_WEIGHT, cfg.HYGRODORE_TWOHANDED, cfg.HYGRODORE);
			RegisterBody("Puffer", bodiesRoot + "PufferBody.asset", cfg.SPORELIZARD_MIN, cfg.SPORELIZARD_MAX, cfg.SPORELIZARD_WEIGHT, cfg.SPORELIZARD_TWOHANDED, cfg.SPORELIZARD);
			RegisterBody("Manticoil", bodiesRoot + "ManticoilBody.asset", cfg.MANTICOIL_MIN, cfg.MANTICOIL_MAX, cfg.MANTICOIL_WEIGHT, cfg.MANTICOIL_TWOHANDED, cfg.MANTICOIL);
			RegisterBody("RadMech", bodiesRoot + "RadMechBody.asset", cfg.RADMECH_MIN, cfg.RADMECH_MAX, cfg.RADMECH_WEIGHT, cfg.RADMECH_TWOHANDED, cfg.RADMECH);
			RegisterBody("Tulip Snake", bodiesRoot + "TulipSnakeBody.asset", cfg.TULIPSNAKE_MIN, cfg.TULIPSNAKE_MAX, cfg.TULIPSNAKE_WEIGHT, cfg.TULIPSNAKE_TWOHANDED, cfg.TULIPSNAKE);
			RegisterBody("Clay Surgeon", bodiesRoot + "ClaySurgeonBody.asset", cfg.CLAYSURGEON_MIN, cfg.CLAYSURGEON_MAX, cfg.CLAYSURGEON_WEIGHT, cfg.CLAYSURGEON_TWOHANDED, cfg.CLAYSURGEON);
			RegisterBody("Bush Wolf", bodiesRoot + "BushWolfBody.asset", cfg.BUSHWOLF_MIN, cfg.BUSHWOLF_MAX, cfg.BUSHWOLF_WEIGHT, cfg.BUSHWOLF_TWOHANDED, cfg.BUSHWOLF);
			RegisterBody("Maneater", bodiesRoot + "CaveDwellerBody.asset", cfg.MANEATER_MIN, cfg.MANEATER_MAX, cfg.MANEATER_WEIGHT, cfg.MANEATER_TWOHANDED, cfg.MANEATER);
			RegisterBody("Stingray", bodiesRoot + "StingrayBody.asset", cfg.STINGRAY_MIN, cfg.STINGRAY_MAX, cfg.STINGRAY_WEIGHT, cfg.STINGRAY_TWOHANDED, cfg.STINGRAY);
			RegisterBody("Cadaver Bloom", bodiesRoot + "CadaverBody.asset", cfg.CADAVER_MIN, cfg.CADAVER_MAX, cfg.CADAVER_WEIGHT, cfg.CADAVER_TWOHANDED, cfg.CADAVER);
			RegisterBody("Feiopar", bodiesRoot + "PumaBody.asset", cfg.PUMA_MIN, cfg.PUMA_MAX, cfg.PUMA_WEIGHT, cfg.PUMA_TWOHANDED, cfg.PUMA);
			RegisterBody("ModdedEnemyPowerLevel1", bodiesRoot + "ModdedEnemyPowerLevel1Body.asset", cfg.MODDEDENEMYPOWERLEVEL1_MIN, cfg.MODDEDENEMYPOWERLEVEL1_MAX, cfg.MODDEDENEMYPOWERLEVEL1_WEIGHT, cfg.MODDEDENEMYPOWERLEVEL1_TWOHANDED, cfg.MODDEDENEMY);
			RegisterBody("ModdedEnemyPowerLevel2", bodiesRoot + "ModdedEnemyPowerLevel2Body.asset", cfg.MODDEDENEMYPOWERLEVEL2_MIN, cfg.MODDEDENEMYPOWERLEVEL2_MAX, cfg.MODDEDENEMYPOWERLEVEL2_WEIGHT, cfg.MODDEDENEMYPOWERLEVEL2_TWOHANDED, cfg.MODDEDENEMY);
			RegisterBody("ModdedEnemyPowerLevel3", bodiesRoot + "ModdedEnemyPowerLevel3Body.asset", cfg.MODDEDENEMYPOWERLEVEL3_MIN, cfg.MODDEDENEMYPOWERLEVEL3_MAX, cfg.MODDEDENEMYPOWERLEVEL3_WEIGHT, cfg.MODDEDENEMYPOWERLEVEL3_TWOHANDED, cfg.MODDEDENEMY);
		}

		public void RegisterBody(string enemyName, string assetPath, int minValue, int maxValue, float weight, bool twoHanded, bool enabled = true)
		{
			if (string.IsNullOrWhiteSpace(enemyName) || string.IsNullOrWhiteSpace(assetPath))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Invalid body definition provided. Skipping.");
				return;
			}
			Item val = bundle.LoadAsset<Item>(assetPath);
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not load body asset at path: " + assetPath));
				return;
			}
			Utilities.FixMixerGroups(val.spawnPrefab);
			val.spawnPrefab.AddComponent<BodySyncer>();
			val.twoHanded = twoHanded;
			val.maxValue = maxValue;
			val.minValue = minValue;
			val.weight = weight;
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterItem(val);
			if (enabled && !BlackListed.Contains(enemyName))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Set " + enemyName + " to drop " + val.itemName));
				BodySpawns[enemyName] = val;
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Disregarding " + val.itemName + " - disabled in config"));
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SellBodies";

		public const string PLUGIN_NAME = "SellBodies";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SellBodies.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("LateUpdate")]
		private static void LateUpdatePatch(ref GrabbableObject __instance)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			SyncScript component = ((Component)__instance).GetComponent<SyncScript>();
			if ((Object)(object)component != (Object)null)
			{
				GrabbableObject component2 = ((Component)__instance).GetComponent<GrabbableObject>();
				if (component.justSpawned && component2.hasHitGround)
				{
					((Component)component2).gameObject.transform.rotation = component.spawnRotation;
					component.justSpawned = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class ItemsPatcher
	{
		public static Item tragedyMask;

		public static Item comedyMask;

		public static Item shotgun;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void PatchAwake(StartOfRound __instance)
		{
			try
			{
				tragedyMask = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "TragedyMask");
				comedyMask = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "ComedyMask");
				shotgun = StartOfRound.Instance.allItemsList.itemsList.First((Item i) => ((Object)i).name == "Shotgun");
				shotgun.spawnPrefab.AddComponent<ShotgunSyncer>();
				tragedyMask.spawnPrefab.AddComponent<MaskSyncer>();
				comedyMask.spawnPrefab.AddComponent<MaskSyncer>();
			}
			catch
			{
				Debug.LogError((object)"ItemScripts not applied correctly");
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class KillEnemyPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("KillEnemy")]
		private static void MoveBody(EnemyAI __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				string enemyName = __instance.enemyType.enemyName;
				if (Plugin.instance.BodySpawns.ContainsKey(enemyName))
				{
					((MonoBehaviour)__instance).StartCoroutine(MoveOldBody(__instance));
				}
				else if (Plugin.cfg.MODDEDENEMY && !Plugin.instance.VanillaBody.Contains(enemyName) && !Plugin.instance.BlackListed.Contains(enemyName))
				{
					((MonoBehaviour)__instance).StartCoroutine(MoveOldBody(__instance));
				}
				if (Plugin.cfg.CONFETTI)
				{
					SpawnConfetti(__instance);
				}
			}
		}

		private static IEnumerator MoveOldBody(EnemyAI __instance)
		{
			yield return (object)new WaitForSeconds(Plugin.cfg.BODY_SPAWN_DELAY);
			if ((Object)(object)__instance != (Object)null)
			{
				Vector3 newBodyPos = new Vector3(-10000f, -10000f, -10000f);
				((Component)__instance).transform.position = newBodyPos;
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"__instance is null in MoveOldBody() inside KillEnemy()");
			}
		}

		private static void SpawnConfetti(EnemyAI __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)null)
			{
				Object.Instantiate<GameObject>(Plugin.ConfettiPrefab, ((Component)__instance).transform.position, Quaternion.Euler(0f, 0f, 0f)).SetActive(true);
			}
			else
			{
				Debug.LogError((object)"__instance is null in SpawnConfetti() inside KillEnemy()");
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class KillEnemyServerRpcPatcher
	{
		private static ulong currentEnemy = 9999999uL;

		[HarmonyPrefix]
		[HarmonyPatch("KillEnemyServerRpc")]
		private static void SpawnScrapBody(EnemyAI __instance)
		{
			//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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e5: 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_00d1: 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)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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)
			if (currentEnemy == ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId || !((NetworkBehaviour)__instance).IsHost || Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInChildren<PlayerControllerB>()))
			{
				return;
			}
			currentEnemy = ((NetworkBehaviour)__instance).NetworkObject.NetworkObjectId;
			string enemyName = __instance.enemyType.enemyName;
			Vector3 position = ((Component)__instance).transform.position;
			Quaternion rotation = ((Component)__instance).transform.rotation;
			if (Random.Range(0, 150) == 78)
			{
				((MonoBehaviour)__instance).StartCoroutine(SpawnEE(__instance, enemyName, position, rotation));
			}
			else if (Plugin.instance.BodySpawns.ContainsKey(enemyName))
			{
				if (enemyName == "Nutcracker")
				{
					((MonoBehaviour)__instance).StartCoroutine(SpawnNutcrackerBody(__instance, enemyName, position, rotation));
				}
				else
				{
					((MonoBehaviour)__instance).StartCoroutine(SpawnGenericBody(__instance, enemyName, position, rotation));
				}
			}
			else if (enemyName == "Masked" && Plugin.cfg.MASKED)
			{
				((MonoBehaviour)__instance).StartCoroutine(SpawnMask(__instance, position, rotation));
			}
			else if (Plugin.cfg.MODDEDENEMY && !Plugin.instance.VanillaBody.Contains(enemyName) && !Plugin.instance.BlackListed.Contains(enemyName))
			{
				((MonoBehaviour)__instance).StartCoroutine(SpawnModdedBody(__instance, position, rotation));
			}
		}

		private static IEnumerator SpawnGenericBody(EnemyAI __instance, string name, Vector3 propBodyPos, Quaternion propBodyRot)
		{
			//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_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)
			Vector3 spawnPos = propBodyPos + new Vector3(0f, 1f, 0f);
			yield return (object)new WaitForSeconds(Plugin.cfg.BODY_SPAWN_DELAY);
			GameObject gameObjectCreated = Object.Instantiate<GameObject>(Plugin.instance.BodySpawns[name].spawnPrefab, spawnPos, propBodyRot);
			gameObjectCreated.GetComponent<NetworkObject>().Spawn(false);
			if (name == "Blob")
			{
				((Component)__instance).GetComponent<NetworkObject>().Despawn(true);
			}
		}

		private static IEnumerator SpawnNutcrackerBody(EnemyAI __instance, string name, Vector3 propBodyPos, Quaternion propBodyRot)
		{
			//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_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)
			Vector3 spawnPos = propBodyPos + new Vector3(0f, 1f, 0f);
			((Component)((Component)__instance).GetComponent<NutcrackerEnemyAI>().gun).GetComponent<NetworkObject>().Despawn(true);
			List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList;
			foreach (Item item in itemsList)
			{
				string itemName = item.itemName;
				if (itemName == "Shotgun")
				{
					GameObject shotgunItem = Object.Instantiate<GameObject>(item.spawnPrefab, spawnPos, propBodyRot);
					shotgunItem.GetComponent<NetworkObject>().Spawn(false);
					break;
				}
			}
			yield return (object)new WaitForSeconds(Plugin.cfg.BODY_SPAWN_DELAY);
			GameObject gameObjectCreated = Object.Instantiate<GameObject>(Plugin.instance.BodySpawns[name].spawnPrefab, spawnPos, propBodyRot);
			gameObjectCreated.GetComponent<NetworkObject>().Spawn(false);
		}

		private static IEnumerator SpawnMask(EnemyAI __instance, Vector3 propBodyPos, Quaternion propBodyRot)
		{
			//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_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)
			yield return (object)new WaitForSeconds(0.1f);
			MaskedPlayerEnemy masked = ((Component)__instance).GetComponent<MaskedPlayerEnemy>();
			Item maskToSpawn = (masked.maskTypes[0].activeSelf ? ItemsPatcher.comedyMask : ItemsPatcher.tragedyMask);
			if ((Object)(object)maskToSpawn != (Object)(object)ItemsPatcher.comedyMask && (Object)(object)maskToSpawn != (Object)(object)ItemsPatcher.tragedyMask)
			{
				maskToSpawn = ((Random.Range(0, 2) != 0) ? ItemsPatcher.comedyMask : ItemsPatcher.tragedyMask);
			}
			Vector3 spawnPos = propBodyPos + new Vector3(0f, 2.5f, 0f);
			GameObject gameObjectCreated = Object.Instantiate<GameObject>(maskToSpawn.spawnPrefab, spawnPos, propBodyRot);
			gameObjectCreated.GetComponent<NetworkObject>().Spawn(false);
		}

		private static IEnumerator SpawnModdedBody(EnemyAI __instance, Vector3 propBodyPos, Quaternion propBodyRot)
		{
			//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_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)
			Vector3 spawnPos = propBodyPos + new Vector3(0f, 2f, 0f);
			yield return (object)new WaitForSeconds(Plugin.cfg.BODY_SPAWN_DELAY);
			GameObject gameObjectCreated = ((((Component)__instance).GetComponent<EnemyAI>().enemyType.PowerLevel <= 1f) ? Object.Instantiate<GameObject>(Plugin.instance.BodySpawns["ModdedEnemyPowerLevel1"].spawnPrefab, spawnPos, propBodyRot) : ((((Component)__instance).GetComponent<EnemyAI>().enemyType.PowerLevel != 2f) ? Object.Instantiate<GameObject>(Plugin.instance.BodySpawns["ModdedEnemyPowerLevel3"].spawnPrefab, spawnPos, propBodyRot) : Object.Instantiate<GameObject>(Plugin.instance.BodySpawns["ModdedEnemyPowerLevel2"].spawnPrefab, spawnPos, propBodyRot)));
			gameObjectCreated.GetComponent<NetworkObject>().Spawn(false);
		}

		private static IEnumerator SpawnEE(EnemyAI __instance, string name, Vector3 propBodyPos, Quaternion propBodyRot)
		{
			//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_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)
			Vector3 spawnPos = propBodyPos + new Vector3(0f, 1f, 0f);
			yield return (object)new WaitForSeconds(Plugin.cfg.BODY_SPAWN_DELAY);
			Item[] cartridges = Plugin.instance.GameboyCartridges;
			Item picked = cartridges[Random.Range(0, cartridges.Length)];
			GameObject gameObjectCreated = Object.Instantiate<GameObject>(picked.spawnPrefab, spawnPos, propBodyRot);
			gameObjectCreated.GetComponent<NetworkObject>().Spawn(false);
			if (name == "Blob")
			{
				((Component)__instance).GetComponent<NetworkObject>().Despawn(true);
			}
		}
	}
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	internal class KillMaskedPatcher
	{
		[HarmonyPostfix]
		[HarmonyPatch("KillEnemy")]
		private static void DropMaskOnDeath(MaskedPlayerEnemy __instance)
		{
			if (!Plugin.cfg.MASKED || !((Object)(object)__instance != (Object)null))
			{
				return;
			}
			try
			{
				if ((Object)(object)__instance.mimickingPlayer != (Object)null && __instance.mimickingPlayer.isPlayerDead)
				{
					DeadBodyInfo deadBody = __instance.mimickingPlayer.deadBody;
					((Component)((Component)deadBody).transform.Find("spine.001/spine.002/spine.003/spine.004/HeadMask")).gameObject.SetActive(false);
				}
				((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false);
				((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false);
			}
			catch
			{
				Debug.LogError((object)"Tried to remove mask from masked error");
			}
		}
	}
}
namespace SellBodies.Monos
{
	internal class BodySyncer : SyncScript
	{
		public override void OnNetworkSpawn()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//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)
			((NetworkBehaviour)this).OnNetworkSpawn();
			prop = (GrabbableObject)(object)((Component)this).GetComponent<PhysicsProp>();
			Quaternion rotation = ((Component)this).transform.rotation;
			spawnRotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			((Component)this).transform.rotation = spawnRotation;
			if ((!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) || prop.scrapPersistedThroughRounds)
			{
				return;
			}
			int num = Random.Range(prop.itemProperties.minValue, prop.itemProperties.maxValue);
			int price;
			if (Plugin.cfg.MULTIPLIER)
			{
				float num2 = 1f;
				float num3 = 1f;
				float mULTIPLIER_VALUE = Plugin.cfg.MULTIPLIER_VALUE;
				if (Plugin.cfg.ENEMY_MULTIPLIER)
				{
					SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
					int num4 = currentLevel.maxEnemyPowerCount + currentLevel.maxOutsideEnemyPowerCount;
					num2 = 1f + (float)(num4 - 10) / 100f;
				}
				if (Plugin.cfg.VANILLA_MULTIPLIER)
				{
					float scrapValueMultiplier = RoundManager.Instance.scrapValueMultiplier;
					num3 = scrapValueMultiplier * 2.5f;
				}
				float num5 = num2 * num3 * mULTIPLIER_VALUE;
				price = (int)((float)num * num5);
			}
			else
			{
				price = num;
			}
			SyncDetailsClientRpc(price);
			Debug.Log((object)"End of OnNetworkSpawn body override");
		}

		[ClientRpc]
		private void SyncDetailsClientRpc(int price)
		{
			//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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2771853362u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, price);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2771853362u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)prop != (Object)null)
				{
					prop.scrapValue = price;
					prop.itemProperties.creditsWorth = price;
					((Component)prop).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: ${price}";
					Debug.Log((object)"Successfully synced body values");
				}
				else
				{
					Debug.LogError((object)"Failed to resolve network reference!");
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2771853362u, new RpcReceiveHandler(__rpc_handler_2771853362), "SyncDetailsClientRpc");
			base.__initializeRpcs();
		}

		private static void __rpc_handler_2771853362(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 price = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref price);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BodySyncer)(object)target).SyncDetailsClientRpc(price);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BodySyncer";
		}
	}
	internal class MaskSyncer : SyncScript
	{
		public override void OnNetworkSpawn()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//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)
			((NetworkBehaviour)this).OnNetworkSpawn();
			prop = (GrabbableObject)(object)((Component)this).GetComponent<HauntedMaskItem>();
			Quaternion rotation = ((Component)this).transform.rotation;
			spawnRotation = Quaternion.Euler(270f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			((Component)this).transform.rotation = spawnRotation;
			if ((!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) || prop.scrapPersistedThroughRounds)
			{
				return;
			}
			int num = Random.Range(prop.itemProperties.minValue, prop.itemProperties.maxValue);
			int price;
			if (Plugin.cfg.MULTIPLIER)
			{
				float num2 = 1f;
				float num3 = 1f;
				float mULTIPLIER_VALUE = Plugin.cfg.MULTIPLIER_VALUE;
				if (Plugin.cfg.ENEMY_MULTIPLIER)
				{
					SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
					int num4 = currentLevel.maxEnemyPowerCount + currentLevel.maxOutsideEnemyPowerCount;
					num2 = 1f + (float)(num4 - 10) / 100f;
				}
				if (Plugin.cfg.VANILLA_MULTIPLIER)
				{
					float scrapValueMultiplier = RoundManager.Instance.scrapValueMultiplier;
					num3 = scrapValueMultiplier * 2.5f;
				}
				float num5 = num2 * num3 * mULTIPLIER_VALUE;
				price = (int)((float)num * num5);
			}
			else
			{
				price = num;
			}
			SyncDetailsClientRpc(price);
			Debug.Log((object)"End of OnNetworkSpawn mask override");
		}

		[ClientRpc]
		private void SyncDetailsClientRpc(int price)
		{
			//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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2962681150u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, price);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2962681150u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)prop != (Object)null)
				{
					prop.scrapValue = price;
					prop.itemProperties.creditsWorth = price;
					((Component)prop).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: ${price}";
					RoundManager instance = RoundManager.Instance;
					instance.totalScrapValueInLevel += (float)price;
					Debug.Log((object)"Successfully synced mask values");
				}
				else
				{
					Debug.LogError((object)"Failed to resolve network reference!");
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2962681150u, new RpcReceiveHandler(__rpc_handler_2962681150), "SyncDetailsClientRpc");
			base.__initializeRpcs();
		}

		private static void __rpc_handler_2962681150(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 price = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref price);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MaskSyncer)(object)target).SyncDetailsClientRpc(price);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "MaskSyncer";
		}
	}
	internal class ShotgunSyncer : SyncScript
	{
		public override void OnNetworkSpawn()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//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)
			((NetworkBehaviour)this).OnNetworkSpawn();
			prop = (GrabbableObject)(object)((Component)this).GetComponent<ShotgunItem>();
			Quaternion rotation = ((Component)this).transform.rotation;
			spawnRotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 90f);
			((Component)this).transform.rotation = spawnRotation;
			if ((!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) || prop.scrapPersistedThroughRounds)
			{
				return;
			}
			int num = 60;
			int price;
			if (Plugin.cfg.MULTIPLIER)
			{
				float num2 = 1f;
				float num3 = 1f;
				float mULTIPLIER_VALUE = Plugin.cfg.MULTIPLIER_VALUE;
				if (Plugin.cfg.ENEMY_MULTIPLIER)
				{
					SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
					int num4 = currentLevel.maxEnemyPowerCount + currentLevel.maxOutsideEnemyPowerCount;
					num2 = 1f + (float)(num4 - 10) / 100f;
				}
				if (Plugin.cfg.VANILLA_MULTIPLIER)
				{
					float scrapValueMultiplier = RoundManager.Instance.scrapValueMultiplier;
					num3 = scrapValueMultiplier * 2.5f;
				}
				float num5 = num2 * num3 * mULTIPLIER_VALUE;
				price = (int)((float)num * num5);
			}
			else
			{
				price = num;
			}
			int ammo = 2;
			SyncDetailsClientRpc(price, ammo);
			Debug.Log((object)"End of OnNetworkSpawn shotgun override");
		}

		[ClientRpc]
		private void SyncDetailsClientRpc(int price, int ammo)
		{
			//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_00db: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2037725870u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, price);
				BytePacker.WriteValueBitPacked(val, ammo);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2037725870u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((Object)(object)prop != (Object)null)
				{
					((Component)prop).GetComponent<ShotgunItem>().shellsLoaded = ammo;
					prop.scrapValue = price;
					prop.itemProperties.creditsWorth = price;
					((Component)prop).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: ${price}";
					RoundManager instance = RoundManager.Instance;
					instance.totalScrapValueInLevel += (float)price;
					Debug.Log((object)"Successfully synced shotgun values");
				}
				else
				{
					Debug.LogError((object)"Failed to resolve network reference!");
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2037725870u, new RpcReceiveHandler(__rpc_handler_2037725870), "SyncDetailsClientRpc");
			base.__initializeRpcs();
		}

		private static void __rpc_handler_2037725870(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)
			{
				int price = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref price);
				int ammo = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref ammo);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShotgunSyncer)(object)target).SyncDetailsClientRpc(price, ammo);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ShotgunSyncer";
		}
	}
	public abstract class SyncScript : NetworkBehaviour
	{
		public GrabbableObject prop;

		public bool justSpawned = true;

		public Quaternion spawnRotation;

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SyncScript";
		}
	}
}
namespace CleaningCompany.Misc
{
	public class PluginConfig
	{
		private readonly ConfigFile configFile;

		public bool SPIDER { get; set; }

		public bool THUMPER { get; set; }

		public bool NUTCRACKER { get; set; }

		public bool CENTIPEDE { get; set; }

		public bool HOARDER { get; set; }

		public bool BRACKEN { get; set; }

		public bool MOUTHDOG { get; set; }

		public bool BABOON { get; set; }

		public bool COILHEAD { get; set; }

		public bool GHOSTGIRL { get; set; }

		public bool FORESTKEEPER { get; set; }

		public bool JESTER { get; set; }

		public bool HYGRODORE { get; set; }

		public bool SPORELIZARD { get; set; }

		public bool MANTICOIL { get; set; }

		public bool RADMECH { get; set; }

		public bool TULIPSNAKE { get; set; }

		public bool CLAYSURGEON { get; set; }

		public bool BUSHWOLF { get; set; }

		public bool MANEATER { get; set; }

		public bool STINGRAY { get; set; }

		public bool CADAVER { get; set; }

		public bool PUMA { get; set; }

		public bool MASKED { get; set; }

		public bool MODDEDENEMY { get; set; }

		public bool SPIDER_TWOHANDED { get; set; }

		public bool THUMPER_TWOHANDED { get; set; }

		public bool NUTCRACKER_TWOHANDED { get; set; }

		public bool CENTIPEDE_TWOHANDED { get; set; }

		public bool HOARDER_TWOHANDED { get; set; }

		public bool BRACKEN_TWOHANDED { get; set; }

		public bool MOUTHDOG_TWOHANDED { get; set; }

		public bool BABOON_TWOHANDED { get; set; }

		public bool COILHEAD_TWOHANDED { get; set; }

		public bool GHOSTGIRL_TWOHANDED { get; set; }

		public bool FORESTKEEPER_TWOHANDED { get; set; }

		public bool JESTER_TWOHANDED { get; set; }

		public bool HYGRODORE_TWOHANDED { get; set; }

		public bool SPORELIZARD_TWOHANDED { get; set; }

		public bool MANTICOIL_TWOHANDED { get; set; }

		public bool RADMECH_TWOHANDED { get; set; }

		public bool TULIPSNAKE_TWOHANDED { get; set; }

		public bool CLAYSURGEON_TWOHANDED { get; set; }

		public bool BUSHWOLF_TWOHANDED { get; set; }

		public bool MANEATER_TWOHANDED { get; set; }

		public bool STINGRAY_TWOHANDED { get; set; }

		public bool CADAVER_TWOHANDED { get; set; }

		public bool PUMA_TWOHANDED { get; set; }

		public bool MODDEDENEMYPOWERLEVEL1_TWOHANDED { get; set; }

		public bool MODDEDENEMYPOWERLEVEL2_TWOHANDED { get; set; }

		public bool MODDEDENEMYPOWERLEVEL3_TWOHANDED { get; set; }

		public int SPIDER_MIN { get; set; }

		public int THUMPER_MIN { get; set; }

		public int NUTCRACKER_MIN { get; set; }

		public int CENTIPEDE_MIN { get; set; }

		public int HOARDER_MIN { get; set; }

		public int BRACKEN_MIN { get; set; }

		public int MOUTHDOG_MIN { get; set; }

		public int BABOON_MIN { get; set; }

		public int COILHEAD_MIN { get; set; }

		public int GHOSTGIRL_MIN { get; set; }

		public int FORESTKEEPER_MIN { get; set; }

		public int JESTER_MIN { get; set; }

		public int HYGRODORE_MIN { get; set; }

		public int SPORELIZARD_MIN { get; set; }

		public int MANTICOIL_MIN { get; set; }

		public int RADMECH_MIN { get; set; }

		public int TULIPSNAKE_MIN { get; set; }

		public int CLAYSURGEON_MIN { get; set; }

		public int BUSHWOLF_MIN { get; set; }

		public int MANEATER_MIN { get; set; }

		public int STINGRAY_MIN { get; set; }

		public int CADAVER_MIN { get; set; }

		public int PUMA_MIN { get; set; }

		public int MODDEDENEMYPOWERLEVEL1_MIN { get; set; }

		public int MODDEDENEMYPOWERLEVEL2_MIN { get; set; }

		public int MODDEDENEMYPOWERLEVEL3_MIN { get; set; }

		public int NUTCRACKER_MAX { get; set; }

		public int SPIDER_MAX { get; set; }

		public int THUMPER_MAX { get; set; }

		public int CENTIPEDE_MAX { get; set; }

		public int HOARDER_MAX { get; set; }

		public int BRACKEN_MAX { get; set; }

		public int MOUTHDOG_MAX { get; set; }

		public int BABOON_MAX { get; set; }

		public int COILHEAD_MAX { get; set; }

		public int GHOSTGIRL_MAX { get; set; }

		public int FORESTKEEPER_MAX { get; set; }

		public int JESTER_MAX { get; set; }

		public int HYGRODORE_MAX { get; set; }

		public int SPORELIZARD_MAX { get; set; }

		public int MANTICOIL_MAX { get; set; }

		public int RADMECH_MAX { get; set; }

		public int TULIPSNAKE_MAX { get; set; }

		public int CLAYSURGEON_MAX { get; set; }

		public int BUSHWOLF_MAX { get; set; }

		public int MANEATER_MAX { get; set; }

		public int STINGRAY_MAX { get; set; }

		public int CADAVER_MAX { get; set; }

		public int PUMA_MAX { get; set; }

		public int MODDEDENEMYPOWERLEVEL1_MAX { get; set; }

		public int MODDEDENEMYPOWERLEVEL2_MAX { get; set; }

		public int MODDEDENEMYPOWERLEVEL3_MAX { get; set; }

		public float NUTCRACKER_WEIGHT { get; set; }

		public float SPIDER_WEIGHT { get; set; }

		public float THUMPER_WEIGHT { get; set; }

		public float CENTIPEDE_WEIGHT { get; set; }

		public float HOARDER_WEIGHT { get; set; }

		public float BRACKEN_WEIGHT { get; set; }

		public float MOUTHDOG_WEIGHT { get; set; }

		public float BABOON_WEIGHT { get; set; }

		public float COILHEAD_WEIGHT { get; set; }

		public float GHOSTGIRL_WEIGHT { get; set; }

		public float FORESTKEEPER_WEIGHT { get; set; }

		public float JESTER_WEIGHT { get; set; }

		public float HYGRODORE_WEIGHT { get; set; }

		public float SPORELIZARD_WEIGHT { get; set; }

		public float MANTICOIL_WEIGHT { get; set; }

		public float RADMECH_WEIGHT { get; set; }

		public float TULIPSNAKE_WEIGHT { get; set; }

		public float CLAYSURGEON_WEIGHT { get; set; }

		public float BUSHWOLF_WEIGHT { get; set; }

		public float MANEATER_WEIGHT { get; set; }

		public float STINGRAY_WEIGHT { get; set; }

		public float CADAVER_WEIGHT { get; set; }

		public float PUMA_WEIGHT { get; set; }

		public float MODDEDENEMYPOWERLEVEL1_WEIGHT { get; set; }

		public float MODDEDENEMYPOWERLEVEL2_WEIGHT { get; set; }

		public float MODDEDENEMYPOWERLEVEL3_WEIGHT { get; set; }

		public bool MULTIPLIER { get; set; }

		public float MULTIPLIER_VALUE { get; set; }

		public bool ENEMY_MULTIPLIER { get; set; }

		public bool VANILLA_MULTIPLIER { get; set; }

		public bool CONFETTI { get; set; }

		public bool YIPPEE { get; set; }

		public float BODY_SPAWN_DELAY { get; set; }

		public string BLACKLISTED { get; set; }

		public PluginConfig(ConfigFile cfg)
		{
			configFile = cfg;
		}

		private T ConfigEntry<T>(string section, string key, T defaultVal, string description)
		{
			return configFile.Bind<T>(section, key, defaultVal, description).Value;
		}

		public void InitBindings()
		{
			CENTIPEDE_MAX = ConfigEntry("Body Values", "Max price of Centipede Bodies", 70, "");
			CENTIPEDE_MIN = ConfigEntry("Body Values", "Min price of Centipede Bodies", 45, "");
			HOARDER_MAX = ConfigEntry("Body Values", "Max price of Hoarding Bug Bodies", 90, "");
			HOARDER_MIN = ConfigEntry("Body Values", "Min price of Hoarding Bug Bodies", 55, "");
			SPIDER_MAX = ConfigEntry("Body Values", "Max price of Spider Bodies", 110, "");
			SPIDER_MIN = ConfigEntry("Body Values", "Min price of Spider Bodies", 70, "");
			THUMPER_MAX = ConfigEntry("Body Values", "Max price of Thumper Bodies", 160, "");
			THUMPER_MIN = ConfigEntry("Body Values", "Min price of Thumper Bodies", 120, "");
			NUTCRACKER_MAX = ConfigEntry("Body Values", "Max price of Nutcracker Bodies", 150, "");
			NUTCRACKER_MIN = ConfigEntry("Body Values", "Min price of Nutcracker Bodies", 125, "");
			BRACKEN_MAX = ConfigEntry("Body Values", "Max price of Bracken Bodies", 140, "");
			BRACKEN_MIN = ConfigEntry("Body Values", "Min price of Bracken Bodies", 100, "");
			BABOON_MAX = ConfigEntry("Body Values", "Max price of Baboon Hawk Bodies", 155, "");
			BABOON_MIN = ConfigEntry("Body Values", "Min price of Baboon Hawk Bodies", 105, "");
			MOUTHDOG_MAX = ConfigEntry("Body Values", "Max price of Eyeless Dog Bodies", 200, "");
			MOUTHDOG_MIN = ConfigEntry("Body Values", "Min price of Eyeless Dog Bodies", 175, "");
			COILHEAD_MAX = ConfigEntry("Body Values", "Max price of Coil-Head Bodies", 195, "");
			COILHEAD_MIN = ConfigEntry("Body Values", "Min price of Coil-Head Bodies", 145, "");
			GHOSTGIRL_MAX = ConfigEntry("Body Values", "Max price of Ghost Girl Bodies", 250, "");
			GHOSTGIRL_MIN = ConfigEntry("Body Values", "Min price of Ghost Girl Bodies", 200, "");
			FORESTKEEPER_MAX = ConfigEntry("Body Values", "Max price of Forest Keeper Bodies", 275, "");
			FORESTKEEPER_MIN = ConfigEntry("Body Values", "Min price of Forest Keeper Bodies", 225, "");
			JESTER_MAX = ConfigEntry("Body Values", "Max price of Jester Bodies", 245, "");
			JESTER_MIN = ConfigEntry("Body Values", "Min price of Jester Bodies", 215, "");
			HYGRODORE_MAX = ConfigEntry("Body Values", "Max price of Hygrodere Bodies", 120, "");
			HYGRODORE_MIN = ConfigEntry("Body Values", "Min price of Hygrodere Bodies", 75, "");
			SPORELIZARD_MAX = ConfigEntry("Body Values", "Max price of Spore Lizard Bodies", 105, "");
			SPORELIZARD_MIN = ConfigEntry("Body Values", "Min price of Spore Lizard Bodies", 85, "");
			MANTICOIL_MAX = ConfigEntry("Body Values", "Max price of Manticoil Bodies", 15, "");
			MANTICOIL_MIN = ConfigEntry("Body Values", "Min price of Manticoil Bodies", 10, "");
			RADMECH_MAX = ConfigEntry("Body Values", "Max price of Old Bird Bodies", 300, "");
			RADMECH_MIN = ConfigEntry("Body Values", "Min price of Old Bird Bodies", 250, "");
			TULIPSNAKE_MAX = ConfigEntry("Body Values", "Max price of Tulip Snake Bodies", 40, "");
			TULIPSNAKE_MIN = ConfigEntry("Body Values", "Min price of Tulip Snake Bodies", 25, "");
			CLAYSURGEON_MAX = ConfigEntry("Body Values", "Max price of Barber Bodies", 200, "");
			CLAYSURGEON_MIN = ConfigEntry("Body Values", "Min price of Barber Bodies", 150, "");
			BUSHWOLF_MAX = ConfigEntry("Body Values", "Max price of Kidnapper Fox Bodies", 150, "");
			BUSHWOLF_MIN = ConfigEntry("Body Values", "Min price of Kidnapper Fox Bodies", 125, "");
			MANEATER_MAX = ConfigEntry("Body Values", "Max price of Maneater Bodies", 145, "");
			MANEATER_MIN = ConfigEntry("Body Values", "Min price of Maneater Bodies", 120, "");
			STINGRAY_MAX = ConfigEntry("Body Values", "Max price of Backwater Gunkfish Bodies", 60, "");
			STINGRAY_MIN = ConfigEntry("Body Values", "Min price of Backwater Gunkfish Bodies", 45, "");
			CADAVER_MAX = ConfigEntry("Body Values", "Max price of Cadaver Bloom Bodies", 130, "");
			CADAVER_MIN = ConfigEntry("Body Values", "Min price of Cadaver Bloom Bodies", 115, "");
			PUMA_MAX = ConfigEntry("Body Values", "Max price of Feiopar Bodies", 160, "");
			PUMA_MIN = ConfigEntry("Body Values", "Min price of Feiopar Bodies", 145, "");
			MODDEDENEMYPOWERLEVEL1_MAX = ConfigEntry("Body Values", "Max price of Modded Enemy Bodies With 1 Or Less PowerLevel", 100, "");
			MODDEDENEMYPOWERLEVEL1_MIN = ConfigEntry("Body Values", "Min price of Modded Enemy Bodies With 1 Or Less PowerLevel", 75, "");
			MODDEDENEMYPOWERLEVEL2_MAX = ConfigEntry("Body Values", "Max price of Modded Enemy Bodies With 2 PowerLevel", 150, "");
			MODDEDENEMYPOWERLEVEL2_MIN = ConfigEntry("Body Values", "Min price of Modded Enemy Bodies With 2 PowerLevel", 125, "");
			MODDEDENEMYPOWERLEVEL3_MAX = ConfigEntry("Body Values", "Max price of Modded Enemy Bodies With 3 Or Higher PowerLevel", 200, "");
			MODDEDENEMYPOWERLEVEL3_MIN = ConfigEntry("Body Values", "Min price of Modded Enemy Bodies With 3 Or Higher PowerLevel", 175, "");
			CENTIPEDE = ConfigEntry("Body Enabler", "Enable selling of Centipede Bodies", defaultVal: true, "");
			HOARDER = ConfigEntry("Body Enabler", "Enable selling of Hoarder Bodies", defaultVal: true, "");
			SPIDER = ConfigEntry("Body Enabler", "Enable selling of Spider Bodies", defaultVal: true, "");
			THUMPER = ConfigEntry("Body Enabler", "Enable selling of Thumper Bodies", defaultVal: true, "");
			NUTCRACKER = ConfigEntry("Body Enabler", "Enable selling of Nutcracker Bodies", defaultVal: true, "");
			MOUTHDOG = ConfigEntry("Body Enabler", "Enable selling of Eyeless Dog Bodies", defaultVal: true, "");
			BABOON = ConfigEntry("Body Enabler", "Enable selling of Baboon Hawk Bodies", defaultVal: true, "");
			BRACKEN = ConfigEntry("Body Enabler", "Enable selling of Bracken Bodies", defaultVal: true, "");
			COILHEAD = ConfigEntry("Body Enabler", "Enable selling of Coil-Head Bodies", defaultVal: true, "");
			GHOSTGIRL = ConfigEntry("Body Enabler", "Enable selling of Ghost Girl Bodies", defaultVal: true, "");
			FORESTKEEPER = ConfigEntry("Body Enabler", "Enable selling Forest Keeper Bodies", defaultVal: true, "");
			JESTER = ConfigEntry("Body Enabler", "Enable selling of Jester Bodies", defaultVal: true, "");
			HYGRODORE = ConfigEntry("Body Enabler", "Enable selling of Hygrodere Bodies", defaultVal: true, "");
			SPORELIZARD = ConfigEntry("Body Enabler", "Enable selling of Spore Lizard Bodies", defaultVal: true, "");
			MANTICOIL = ConfigEntry("Body Enabler", "Enable selling of Manticoil Bodies", defaultVal: true, "");
			RADMECH = ConfigEntry("Body Enabler", "Enable selling of Old Bird Bodies", defaultVal: true, "");
			TULIPSNAKE = ConfigEntry("Body Enabler", "Enable selling of Tulip Snake Bodies", defaultVal: true, "");
			CLAYSURGEON = ConfigEntry("Body Enabler", "Enable selling of Barber Bodies", defaultVal: true, "");
			BUSHWOLF = ConfigEntry("Body Enabler", "Enable selling of Kidnapper Fox Bodies", defaultVal: true, "");
			MANEATER = ConfigEntry("Body Enabler", "Enable selling of Maneater Bodies", defaultVal: true, "");
			STINGRAY = ConfigEntry("Body Enabler", "Enable selling of Backwater Gunkfish Bodies", defaultVal: true, "");
			CADAVER = ConfigEntry("Body Enabler", "Enable selling of Cadaver Bloom Bodies", defaultVal: true, "");
			PUMA = ConfigEntry("Body Enabler", "Enable selling of Feiopar Bodies", defaultVal: true, "");
			MASKED = ConfigEntry("Body Enabler", "Enable selling of Masked Masks", defaultVal: true, "");
			MODDEDENEMY = ConfigEntry("Body Enabler", "Enable selling of Modded Enemy Bodies", defaultVal: true, "");
			CENTIPEDE_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Centipede Bodies", defaultVal: false, "");
			HOARDER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Hoarder Bodies", defaultVal: true, "");
			SPIDER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Spider Bodies", defaultVal: true, "");
			THUMPER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Thumper Bodies", defaultVal: true, "");
			NUTCRACKER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Nutcracker Bodies", defaultVal: true, "");
			MOUTHDOG_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Eyeless Dog Bodies", defaultVal: true, "");
			BABOON_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Baboon Hawk Bodies", defaultVal: true, "");
			BRACKEN_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Bracken Bodies", defaultVal: true, "");
			COILHEAD_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Coil-Head Bodies", defaultVal: true, "");
			GHOSTGIRL_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Ghost Girl Bodies", defaultVal: false, "");
			FORESTKEEPER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Forest Keeper Bodies", defaultVal: false, "");
			JESTER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Jester Bodies", defaultVal: true, "");
			HYGRODORE_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Hygrodere Bodies", defaultVal: true, "");
			SPORELIZARD_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Spore Lizard Bodies", defaultVal: true, "");
			MANTICOIL_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Manticoil Bodies", defaultVal: false, "");
			RADMECH_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Old Bird Bodies", defaultVal: false, "");
			TULIPSNAKE_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Tulip Snake Bodies", defaultVal: false, "");
			CLAYSURGEON_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Barber Bodies", defaultVal: true, "");
			BUSHWOLF_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Kidnapper Fox Bodies", defaultVal: false, "");
			MANEATER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Maneater Bodies", defaultVal: false, "");
			STINGRAY_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Backwater Gunkfish Bodies", defaultVal: false, "");
			CADAVER_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Cadaver Bloom Bodies", defaultVal: false, "");
			PUMA_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Feiopar Bodies", defaultVal: true, "");
			MODDEDENEMYPOWERLEVEL1_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Modded Enemy Bodies With 1 Or Less PowerLevel", defaultVal: false, "");
			MODDEDENEMYPOWERLEVEL2_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Modded Enemy Bodies With 2 PowerLevel", defaultVal: false, "");
			MODDEDENEMYPOWERLEVEL3_TWOHANDED = ConfigEntry("Body Two-Handed", "Enable Two-Handed Modded Enemy Bodies With 3 Or Higher PowerLevel", defaultVal: false, "");
			CENTIPEDE_WEIGHT = ConfigEntry("Body Weights", "Weight of Centipede Bodies", 1.33f, "");
			HOARDER_WEIGHT = ConfigEntry("Body Weights", "Weight of Hoarding Bug Bodies", 1.48f, "");
			SPIDER_WEIGHT = ConfigEntry("Body Weights", "Weight of Spider Bodies", 1.66f, "");
			THUMPER_WEIGHT = ConfigEntry("Body Weights", "Weight of Thumper Bodies", 1.81f, "");
			NUTCRACKER_WEIGHT = ConfigEntry("Body Weights", "Weight of Nutcracker Bodies", 1.86f, "");
			MOUTHDOG_WEIGHT = ConfigEntry("Body Weights", "Weight of Eyeless Dog Bodies", 2.24f, "");
			BABOON_WEIGHT = ConfigEntry("Body Weights", "Weight of Baboon Hawk Bodies", 2f, "");
			BRACKEN_WEIGHT = ConfigEntry("Body Weights", "Weight of Bracken Bodies", 1.76f, "");
			COILHEAD_WEIGHT = ConfigEntry("Body Weights", "Weight of Coil-Head Bodies", 1.95f, "");
			GHOSTGIRL_WEIGHT = ConfigEntry("Body Weights", "Weight of Ghost Girl Bodies", 1.07f, "");
			FORESTKEEPER_WEIGHT = ConfigEntry("Body Weights", "Weight of Forest Keeper Bodies", 1.86f, "");
			JESTER_WEIGHT = ConfigEntry("Body Weights", "Weight of Jester Bodies", 1.95f, "");
			HYGRODORE_WEIGHT = ConfigEntry("Body Weights", "Weight of Hygrodere Bodies", 1.52f, "");
			SPORELIZARD_WEIGHT = ConfigEntry("Body Weights", "Weight of Spore Lizard Bodies", 1.71f, "");
			MANTICOIL_WEIGHT = ConfigEntry("Body Weights", "Weight of Manticoil Bodies", 1.11f, "");
			RADMECH_WEIGHT = ConfigEntry("Body Weights", "Weight of Old Bird Bodies", 1.62f, "");
			TULIPSNAKE_WEIGHT = ConfigEntry("Body Weights", "Weight of Tulip Snake Bodies", 1.07f, "");
			CLAYSURGEON_WEIGHT = ConfigEntry("Body Weights", "Weight of Barber Bodies", 1.76f, "");
			BUSHWOLF_WEIGHT = ConfigEntry("Body Weights", "Weight of Kidnapper Fox Bodies", 1.33f, "");
			MANEATER_WEIGHT = ConfigEntry("Body Weights", "Weight of Maneater Bodies", 1.33f, "");
			STINGRAY_WEIGHT = ConfigEntry("Body Weights", "Weight of Backwater Gunkfish Bodies", 1.33f, "");
			CADAVER_WEIGHT = ConfigEntry("Body Weights", "Weight of Cadaver Bloom Bodies", 1.25f, "");
			PUMA_WEIGHT = ConfigEntry("Body Weights", "Weight of Feiopar Bodies", 1.45f, "");
			MODDEDENEMYPOWERLEVEL1_WEIGHT = ConfigEntry("Body Weights", "Weight of Modded Ene