Decompiled source of KookehsDropItem Fork v2.4.2

KookehsDropItemMod_Fork.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using IL.RoR2;
using IL.RoR2.UI;
using KookehsDropItemMod_Fork;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("KookehsDropItemMod_Fork")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5289049221cb391a22cd86a2d407ff678db2f348")]
[assembly: AssemblyProduct("KookehsDropItemMod_Fork")]
[assembly: AssemblyTitle("KookehsDropItemMod_Fork")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace KookehsDropItemMod_Fork
{
	public class MarkNonRecyclableComponent : MonoBehaviour
	{
		public void Start()
		{
			GenericPickupController component = ((Component)this).GetComponent<GenericPickupController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.Recycled = true;
				Object.Destroy((Object)(object)this);
			}
		}
	}
}
namespace DropItems_Fork
{
	public class DropItemHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		private Func<CharacterMaster> getMaster;

		private Func<PickupIndex> getPickupIndex;

		public void SetData(Func<CharacterMaster> getMaster, Func<PickupIndex> getPickupIndex)
		{
			this.getMaster = getMaster;
			this.getPickupIndex = getPickupIndex;
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			KookehsDropItemMod.Logger.LogDebug((object)"KDI: Pointer click, trying to send network message");
			CharacterMaster val = getMaster();
			if (((NetworkBehaviour)val.inventory).hasAuthority)
			{
				PickupIndex pickupIndex = getPickupIndex();
				NetworkIdentity component = ((Component)val.GetBody()).gameObject.GetComponent<NetworkIdentity>();
				if (VerifyIsDroppable(pickupIndex))
				{
					KookehsDropItemMod.Logger.LogDebug((object)"KDI: Sending network message");
					DropItemMessage dropItemMessage = new DropItemMessage(component.netId, pickupIndex);
					NetMessageExtensions.Send((INetMessage)(object)dropItemMessage, (NetworkDestination)2);
				}
			}
		}

		public static void DropItem(Vector3 position, Vector3 direction, Inventory inventory, PickupIndex pickupIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Invalid comparison between Unknown and I4
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			if (!VerifyIsDroppable(pickupIndex))
			{
				return;
			}
			ManualLogSource logger = KookehsDropItemMod.Logger;
			Vector3 val = position;
			logger.LogDebug((object)("Position: " + ((object)(Vector3)(ref val)).ToString()));
			ManualLogSource logger2 = KookehsDropItemMod.Logger;
			val = direction;
			logger2.LogDebug((object)("Direction: " + ((object)(Vector3)(ref val)).ToString()));
			KookehsDropItemMod.Logger.LogDebug((object)("Inventory: " + ((Object)inventory).name));
			ManualLogSource logger3 = KookehsDropItemMod.Logger;
			PickupIndex val2 = pickupIndex;
			logger3.LogDebug((object)("Pickup Index: " + ((object)(PickupIndex)(ref val2)).ToString()));
			if ((int)PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex != -1)
			{
				if (inventory.GetEquipmentIndex() != PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex)
				{
					return;
				}
				inventory.SetEquipmentIndex((EquipmentIndex)(-1));
			}
			else
			{
				if (inventory.GetItemCount(PickupCatalog.GetPickupDef(pickupIndex).itemIndex) <= 0)
				{
					return;
				}
				inventory.RemoveItem(PickupCatalog.GetPickupDef(pickupIndex).itemIndex, 1);
			}
			CreatePickupInfo val3 = default(CreatePickupInfo);
			((CreatePickupInfo)(ref val3)).pickupIndex = pickupIndex;
			val3.position = position;
			CreatePickupInfo pickupInfo = val3;
			CreatePickupDroplet(pickupInfo, Vector3.up * 20f + direction * 10f);
		}

		private static void CreatePickupDroplet(CreatePickupInfo pickupInfo, Vector3 velocity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, pickupInfo.position, Quaternion.identity);
			PickupDropletController component = val.GetComponent<PickupDropletController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.createPickupInfo = pickupInfo;
				component.NetworkpickupIndex = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex;
			}
			Rigidbody component2 = val.GetComponent<Rigidbody>();
			component2.velocity = velocity;
			component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
			if (KookehsDropItemMod.preventRecycle.Value)
			{
				val.AddComponent<MarkNonRecyclableComponent>();
			}
			NetworkServer.Spawn(val);
		}

		private static bool VerifyIsDroppable(PickupIndex pickupIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0035: 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_00a7: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Invalid comparison between Unknown and I4
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Invalid comparison between Unknown and I4
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Invalid comparison between Unknown and I4
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Invalid comparison between Unknown and I4
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Invalid comparison between Unknown and I4
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Invalid comparison between Unknown and I4
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
			if (pickupDef == null)
			{
				return false;
			}
			if ((int)pickupDef.equipmentIndex != -1)
			{
				return true;
			}
			bool result = true;
			ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(pickupDef.itemTier);
			if ((Object)(object)itemTierDef != (Object)null)
			{
				if (!KookehsDropItemMod.allowInBazaar.Value)
				{
					SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene();
					if (Object.op_Implicit((Object)(object)sceneDefForCurrentScene) && sceneDefForCurrentScene.baseSceneName == "bazaar")
					{
						return false;
					}
				}
				result = itemTierDef.isDroppable;
				if ((int)itemTierDef.tier == 3)
				{
					result = KookehsDropItemMod.allowDropLunar.Value || (int)pickupDef.equipmentIndex != -1;
				}
				else if ((int)itemTierDef.tier == 5)
				{
					result = false;
				}
				else if ((int)itemTierDef.tier == 9 || (int)itemTierDef.tier == 6 || (int)itemTierDef.tier == 7 || (int)itemTierDef.tier == 8)
				{
					result = KookehsDropItemMod.allowDropVoid.Value;
				}
			}
			return result;
		}

		public static void CreateNotification(CharacterBody character, PickupIndex pickupIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if ((int)PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex != -1)
			{
				CreateNotification(character, character.transform, PickupCatalog.GetPickupDef(pickupIndex).equipmentIndex);
			}
			else
			{
				CreateNotification(character, character.transform, PickupCatalog.GetPickupDef(pickupIndex).itemIndex);
			}
		}

		private static void CreateNotification(CharacterBody character, Transform transform, EquipmentIndex equipmentIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex);
			string @string = Language.GetString(equipmentDef.nameToken);
			Texture pickupIconTexture = equipmentDef.pickupIconTexture;
			CreateNotification(character, transform, "Equipment dropped", @string, pickupIconTexture);
		}

		private static void CreateNotification(CharacterBody character, Transform transform, ItemIndex itemIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex);
			string @string = Language.GetString(itemDef.nameToken);
			Texture pickupIconTexture = itemDef.pickupIconTexture;
			CreateNotification(character, transform, "Item dropped", @string, pickupIconTexture);
		}

		private static void CreateNotification(CharacterBody character, Transform transform, string title, string description, Texture texture)
		{
			DropItemNotification dropItemNotification = ((Component)character).gameObject.GetComponent<DropItemNotification>();
			if ((Object)(object)dropItemNotification == (Object)null)
			{
				dropItemNotification = ((Component)character).gameObject.AddComponent<DropItemNotification>();
				((Component)dropItemNotification).transform.SetParent(transform);
			}
			dropItemNotification.SetNotification(title, description, texture);
		}
	}
	public class DropItemMessage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId netId;

		private PickupIndex pickupIndex;

		public DropItemMessage()
		{
		}

		public DropItemMessage(NetworkInstanceId netId, PickupIndex pickupIndex)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			this.netId = netId;
			this.pickupIndex = pickupIndex;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(netId);
			PickupIndex.WriteToNetworkWriter(writer, pickupIndex);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			netId = reader.ReadNetworkId();
			pickupIndex = NetworkExtensions.ReadPickupIndex(reader);
		}

		public override string ToString()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return $"DropItemMessage: {pickupIndex}";
		}

		private void Log(string message)
		{
			KookehsDropItemMod.Logger.LogDebug((object)message);
		}

		public void OnReceived()
		{
			//IL_0066: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			Log("Received kookeh drop message");
			Log("NetworkID" + ((object)(NetworkInstanceId)(ref netId)).ToString());
			Log("PickupIndex" + ((object)(PickupIndex)(ref pickupIndex)).ToString());
			GameObject val = Util.FindNetworkObject(netId);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			CharacterBody component = val.GetComponent<CharacterBody>();
			Log("Body is null: " + ((Object)(object)component == (Object)null));
			if (Object.op_Implicit((Object)(object)component))
			{
				Inventory inventory = component.master.inventory;
				Transform transform = component.transform;
				Vector3 corePosition = component.corePosition;
				Vector3 direction = (Object.op_Implicit((Object)(object)component.characterDirection) ? component.characterDirection.forward : component.transform.forward);
				DropItemHandler.DropItem(corePosition, direction, inventory, pickupIndex);
				if (KookehsDropItemMod.enableNotifications.Value)
				{
					DropItemHandler.CreateNotification(component, pickupIndex);
				}
			}
		}
	}
	public class DropItemNotification : MonoBehaviour
	{
		private Notification notification;

		private float startTime = 0f;

		private float duration = 3f;

		private void Update()
		{
			if ((Object)(object)notification != (Object)null && Run.instance.fixedTime - startTime > duration)
			{
				Object.Destroy((Object)(object)notification);
				Object.Destroy((Object)(object)this);
			}
			float notificationT = (Run.instance.fixedTime - startTime) / duration;
			notification.GenericNotification.SetNotificationT(notificationT);
		}

		private void OnDestroy()
		{
			if ((Object)(object)notification != (Object)null)
			{
				Object.Destroy((Object)(object)notification);
			}
		}

		public void SetNotification(string title, string description, Texture texture)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)notification == (Object)null)
			{
				notification = ((Component)this).gameObject.AddComponent<Notification>();
				((Component)notification).transform.SetParent(((Component)this).transform);
				notification.SetPosition(new Vector3((float)((double)Screen.width * 0.8), (float)((double)Screen.height * 0.25), 0f));
			}
			startTime = Run.instance.fixedTime;
			notification.SetIcon(texture);
			notification.GetTitle = () => title;
			notification.GetDescription = () => description;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("KookehsDropItemMod_Fork", "Kookeh's Drop Item Mod (Fork)", "2.4.2")]
	[R2APISubmoduleDependency(new string[] { "NetworkingAPI", "CommandHelper" })]
	public class KookehsDropItemMod : BaseUnityPlugin
	{
		private const string ModGuid = "KookehsDropItemMod_Fork";

		private const string ModName = "Kookeh's Drop Item Mod (Fork)";

		private const string ModVersion = "2.4.2";

		public static ConfigEntry<bool> allowDropLunar;

		public static ConfigEntry<bool> allowDropVoid;

		public static ConfigEntry<bool> enableNotifications;

		public static ConfigEntry<bool> allowInBazaar;

		public static ConfigEntry<bool> preventRecycle;

		public static GameObject RootObject { get; set; }

		public static DropItemHandler DropItemHandler { get; set; }

		internal static ManualLogSource Logger { get; set; }

		public static event Action<ItemIcon> OnItemIconAdded;

		public static event Action<EquipmentIcon> OnEquipmentIconAdded;

		public void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			ReadConfig();
			Logger = ((BaseUnityPlugin)this).Logger;
			NetworkingAPI.RegisterMessageType<DropItemMessage>();
			ItemInventoryDisplay.AllocateIcons += new Manipulator(OnItemIconAddedHook);
			ScoreboardStrip.SetMaster += new Manipulator(OnEquipmentIconAddedHook);
			RootObject = new GameObject("DropItemsMod");
			Object.DontDestroyOnLoad((Object)(object)RootObject);
			DropItemHandler = RootObject.AddComponent<DropItemHandler>();
			CommandHelper.AddToConsoleWhenReady();
			OnItemIconAdded += delegate(ItemIcon itemIcon)
			{
				if (!((Object)(object)((Component)itemIcon).GetComponent<DropItemHandler>() != (Object)null))
				{
					Func<CharacterMaster> getMaster = () => ((Component)Reflection.GetFieldValue<Inventory>((object)((Component)((Transform)itemIcon.rectTransform).parent).GetComponent<ItemInventoryDisplay>(), "inventory")).GetComponent<CharacterMaster>();
					DropItemHandler dropItemHandler2 = ((Component)((Component)itemIcon).transform).gameObject.AddComponent<DropItemHandler>();
					dropItemHandler2.SetData(getMaster, () => PickupCatalog.FindPickupIndex(Reflection.GetFieldValue<ItemIndex>((object)itemIcon, "itemIndex")));
				}
			};
			OnEquipmentIconAdded += delegate(EquipmentIcon equipmentIcon)
			{
				if (!((Object)(object)((Component)equipmentIcon).GetComponent<DropItemHandler>() != (Object)null))
				{
					DropItemHandler dropItemHandler = ((Component)((Component)equipmentIcon).transform).gameObject.AddComponent<DropItemHandler>();
					dropItemHandler.SetData(() => ((Component)equipmentIcon.targetInventory).GetComponent<CharacterMaster>(), () => PickupCatalog.FindPickupIndex(equipmentIcon.targetInventory.GetEquipmentIndex()));
				}
			};
			PickupDropletController.CreatePickup += new Manipulator(PickupDropletController_CreatePickup);
		}

		private void PickupDropletController_CreatePickup(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(GenericPickupController), "CreatePickup")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<GenericPickupController, PickupDropletController, GenericPickupController>>((Func<GenericPickupController, PickupDropletController, GenericPickupController>)delegate(GenericPickupController pickup, PickupDropletController self)
			{
				MarkNonRecyclableComponent component = ((Component)self).GetComponent<MarkNonRecyclableComponent>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((Component)pickup).gameObject.AddComponent<MarkNonRecyclableComponent>();
				}
				return pickup;
			});
		}

		private void ReadConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_005c: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_008c: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			//IL_00bc: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_00ec: Expected O, but got Unknown
			enableNotifications = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "Enable Notifications"), true, new ConfigDescription("Display a notification when an item is dropped.", (AcceptableValueBase)null, Array.Empty<object>()));
			allowInBazaar = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "Allow in Bazaar (Server-Side)"), true, new ConfigDescription("Allow items to be dropped while in the Bazaar.", (AcceptableValueBase)null, Array.Empty<object>()));
			preventRecycle = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("General", "Prevent Recycle (Server-Side)"), true, new ConfigDescription("Dropped items cannot be recycled.", (AcceptableValueBase)null, Array.Empty<object>()));
			allowDropLunar = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tiers (Server-Side)", "Allow Lunar"), false, new ConfigDescription("Allow items of this tier to be dropped.", (AcceptableValueBase)null, Array.Empty<object>()));
			allowDropVoid = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Tiers (Server-Side)", "Allow Void"), false, new ConfigDescription("Allow items of this tier to be dropped.", (AcceptableValueBase)null, Array.Empty<object>()));
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				RiskOfOptionsCompat();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void RiskOfOptionsCompat()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableNotifications));
		}

		private static void OnItemIconAddedHook(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false);
			int num = default(int);
			val.GotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemInventoryDisplay>(x, "itemIcons")
			});
			val.Emit(OpCodes.Dup);
			val.EmitDelegate<Action<ItemIcon>>((Action<ItemIcon>)delegate(ItemIcon i)
			{
				KookehsDropItemMod.OnItemIconAdded?.Invoke(i);
			});
		}

		private static void OnEquipmentIconAddedHook(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false);
			MethodInfo setSubscribedInventory = Reflection.GetMethodCached(typeof(ItemInventoryDisplay), "SetSubscribedInventory");
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)setSubscribedInventory)
			});
			val.Index += 1;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<ScoreboardStrip>>((Action<ScoreboardStrip>)delegate(ScoreboardStrip eq)
			{
				if ((Object)(object)eq != (Object)null && (Object)(object)eq.equipmentIcon != (Object)null)
				{
					KookehsDropItemMod.OnEquipmentIconAdded?.Invoke(eq.equipmentIcon);
				}
			});
		}
	}
}