Decompiled source of DropItem v2.2.1

dropitem.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dolso;
using HG;
using HG.GeneralSerializer;
using HG.Reflection;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using Rewired.Integration.UnityUI;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Networking;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: OptIn]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Dolso
{
	internal static class log
	{
		private static readonly ManualLogSource logger = Logger.CreateLogSource(Assembly.GetExecutingAssembly().GetName().Name);

		internal static void info(object data)
		{
			logger.LogInfo(data);
		}

		internal static void message(object data)
		{
			logger.LogMessage(data);
		}

		internal static void warning(object data)
		{
			logger.LogWarning(data);
		}

		internal static void error(object data)
		{
			logger.LogError(data);
		}

		internal static void fatal(object data)
		{
			logger.LogFatal(data);
		}

		internal static void LogError(this ILCursor c, object data)
		{
			logger.LogError((object)$"ILCursor failure, skipping: {data}\n{c}");
		}

		internal static void LogErrorCaller(this ILCursor c, object data)
		{
			logger.LogError((object)$"ILCursor failed in {new StackFrame(1).GetMethod().Name}, skipping: {data}\n{c}");
		}
	}
	internal static class HookManager
	{
		internal delegate bool ConfigEnabled<T>(T configValue);

		private class HookedConfig<T>
		{
			private readonly ConfigEnabled<T> enabled;

			private readonly IDetour detour;

			internal HookedConfig(ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, IDetour detour)
			{
				this.enabled = enabled;
				this.detour = detour;
				configEntry.SettingChanged += ConfigChanged;
				ConfigChanged(configEntry, null);
			}

			private void ConfigChanged(object sender, EventArgs args)
			{
				if (enabled(((ConfigEntry<T>)sender).Value))
				{
					if (!detour.IsApplied)
					{
						detour.Apply();
					}
				}
				else if (detour.IsApplied)
				{
					detour.Undo();
				}
			}
		}

		internal const BindingFlags allFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly ConfigEnabled<bool> boolConfigEnabled = BoolEnabled;

		private static ILHookConfig ilHookConfig = new ILHookConfig
		{
			ManualApply = true
		};

		private static HookConfig onHookConfig = new HookConfig
		{
			ManualApply = true
		};

		internal static void Hook(Type typeFrom, string fromMethod, Manipulator ilHook)
		{
			Hook(GetMethod(typeFrom, fromMethod), ilHook);
		}

		internal static void Hook(Delegate fromMethod, Manipulator ilHook)
		{
			Hook(fromMethod.Method, ilHook);
		}

		internal static void Hook(MethodBase fromMethod, Manipulator ilHook)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				new ILHook(fromMethod, ilHook, ref ilHookConfig).Apply();
			}
			catch (Exception e)
			{
				e.LogHookError(fromMethod, ((Delegate)(object)ilHook).Method);
			}
		}

		internal static void Hook(Type typeFrom, string fromMethod, Delegate onHook)
		{
			Hook(GetMethod(typeFrom, fromMethod), onHook.Method, onHook.Target);
		}

		internal static void Hook(Delegate fromMethod, Delegate onHook)
		{
			Hook(fromMethod.Method, onHook.Method, onHook.Target);
		}

		internal static void Hook(MethodBase fromMethod, Delegate onHook)
		{
			Hook(fromMethod, onHook.Method, onHook.Target);
		}

		internal static void Hook(MethodBase fromMethod, MethodInfo onHook, object target = null)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				new Hook(fromMethod, onHook, target, ref onHookConfig).Apply();
			}
			catch (Exception e)
			{
				e.LogHookError(fromMethod, onHook);
			}
		}

		internal static void HookConfig(this ConfigEntry<bool> configEntry, Type typeFrom, string fromMethod, Delegate hook)
		{
			configEntry.HookConfig(boolConfigEnabled, GetMethod(typeFrom, fromMethod), hook.Method, hook.Target);
		}

		internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase fromMethod, Delegate hook)
		{
			configEntry.HookConfig(boolConfigEnabled, fromMethod, hook.Method, hook.Target);
		}

		internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase fromMethod, MethodInfo hook)
		{
			configEntry.HookConfig(boolConfigEnabled, fromMethod, hook);
		}

		internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, Type typeFrom, string fromMethod, Delegate hook)
		{
			configEntry.HookConfig(enabled, GetMethod(typeFrom, fromMethod), hook.Method, hook.Target);
		}

		internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase fromMethod, Delegate hook)
		{
			configEntry.HookConfig(enabled, fromMethod, hook.Method, hook.Target);
		}

		internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase fromMethod, MethodInfo hook, object target = null)
		{
			try
			{
				new HookedConfig<T>(configEntry, enabled, ManualDetour(fromMethod, hook, target));
			}
			catch (Exception e)
			{
				e.LogHookError(fromMethod, hook);
			}
		}

		internal static IDetour ManualDetour(Type typeFrom, string fromMethod, Delegate hook)
		{
			return ManualDetour(GetMethod(typeFrom, fromMethod), hook.Method, hook.Target);
		}

		internal static IDetour ManualDetour(MethodBase fromMethod, Delegate hook)
		{
			return ManualDetour(fromMethod, hook.Method, hook.Target);
		}

		internal static IDetour ManualDetour(MethodBase fromMethod, MethodInfo hook, object target = null)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			try
			{
				ParameterInfo[] parameters = hook.GetParameters();
				if (parameters.Length == 1 && parameters[0].ParameterType == typeof(ILContext))
				{
					return (IDetour)new ILHook(fromMethod, (Manipulator)hook.CreateDelegate(typeof(Manipulator)), ref ilHookConfig);
				}
				return (IDetour)new Hook(fromMethod, hook, target, ref onHookConfig);
			}
			catch (Exception e)
			{
				e.LogHookError(fromMethod, hook);
				return null;
			}
		}

		internal static MethodInfo GetMethod(Type typeFrom, string methodName)
		{
			if (typeFrom == null || methodName == null)
			{
				log.error($"Null argument in GetMethod: type={typeFrom}, name={methodName}");
				return null;
			}
			MethodInfo[] array = (from a in typeFrom.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
				where a.Name == methodName
				select a).ToArray();
			switch (array.Length)
			{
			case 1:
				return array[0];
			case 0:
				log.error($"Failed to find method: {typeFrom}::{methodName}");
				return null;
			default:
			{
				string text = $"{array.Length} ambiguous matches found for: {typeFrom}::{methodName}, may be incorrect";
				MethodInfo[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					text = text + "\n" + array2[i];
				}
				log.warning(text);
				return array[0];
			}
			}
		}

		internal static MethodInfo GetMethod(Type typeFrom, string methodName, params Type[] parameters)
		{
			if (typeFrom == null || methodName == null)
			{
				log.error($"Null argument in GetMethod: type={typeFrom}, name={methodName}");
				return null;
			}
			MethodInfo? method = typeFrom.GetMethod(methodName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, parameters, null);
			if (method == null)
			{
				log.error($"Failed to find method: {typeFrom}::{methodName}_{parameters.Length}");
			}
			return method;
		}

		internal static void SetPriority(string[] beforeIL = null, string[] beforeOn = null, string[] afterIL = null, string[] afterOn = null)
		{
			ilHookConfig.Before = beforeIL;
			onHookConfig.Before = beforeOn;
			ilHookConfig.After = afterIL;
			onHookConfig.After = afterOn;
		}

		internal static void LogHookError(this Exception e, MethodBase fromMethod, MethodInfo hook)
		{
			log.error((fromMethod == null) ? $"null from-method for hook: {hook.Name}\n{e}" : $"Failed to hook: {fromMethod.DeclaringType}::{fromMethod.Name} - {hook.Name}\n{e}");
		}

		private static bool BoolEnabled(bool configValue)
		{
			return configValue;
		}
	}
	internal static class Utilities
	{
		private static GameObject _prefabParent;

		internal static GameObject CreatePrefab(GameObject gameObject, string name = null)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)_prefabParent))
			{
				_prefabParent = new GameObject("DolsoPrefabs");
				Object.DontDestroyOnLoad((Object)(object)_prefabParent);
				((Object)_prefabParent).hideFlags = (HideFlags)61;
				_prefabParent.SetActive(false);
			}
			GameObject val = Object.Instantiate<GameObject>(gameObject, _prefabParent.transform);
			if (name != null)
			{
				((Object)val).name = name;
			}
			return val;
		}

		internal static Task<TObj> GetAddressableAsync<TObj>(string addressable) where TObj : Object
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Addressables.LoadAssetAsync<TObj>((object)addressable).Task;
		}

		internal static Task<GameObject> GetAddressableAsync(string addressable)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return Addressables.LoadAssetAsync<GameObject>((object)addressable).Task;
		}

		internal static void DoAddressable<TObj>(string addressable, Action<TObj> callback) where TObj : Object
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<TObj> val = Addressables.LoadAssetAsync<TObj>((object)addressable);
			val.Completed += delegate(AsyncOperationHandle<TObj> a)
			{
				callback(a.Result);
			};
		}

		internal static void DoAddressable(string addressable, Action<GameObject> callback)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
			val.Completed += delegate(AsyncOperationHandle<GameObject> a)
			{
				callback(a.Result);
			};
		}

		internal static void AddressableAddComp<TComp>(string addressable, Action<TComp> callback = null) where TComp : Component
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
			val.Completed += delegate(AsyncOperationHandle<GameObject> a)
			{
				TComp obj = a.Result.AddComponent<TComp>();
				callback?.Invoke(obj);
			};
		}

		internal static void AddressableAddCompSingle<Comp>(string addressable) where Comp : Component
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)addressable);
			val.Completed += delegate(AsyncOperationHandle<GameObject> a)
			{
				if (!Object.op_Implicit((Object)(object)a.Result.GetComponent<Comp>()))
				{
					a.Result.AddComponent<Comp>();
				}
			};
		}

		internal static void ModifyStateConfig(this EntityStateConfiguration stateConfig, string fieldName, object newValue)
		{
			SerializedField[] serializedFields = stateConfig.serializedFieldsCollection.serializedFields;
			for (int i = 0; i < serializedFields.Length; i++)
			{
				if (serializedFields[i].fieldName == fieldName)
				{
					Object val = (Object)((newValue is Object) ? newValue : null);
					if (val != null)
					{
						serializedFields[i].fieldValue.objectValue = val;
					}
					else if (newValue != null && StringSerializer.CanSerializeType(newValue.GetType()))
					{
						serializedFields[i].fieldValue.stringValue = StringSerializer.Serialize(newValue.GetType(), newValue);
					}
					else
					{
						log.error("Invalid value for SerializedField: " + newValue);
					}
					return;
				}
			}
			log.error("Failed to find " + fieldName + " for " + ((Object)stateConfig).name);
		}

		internal static bool IsKeyDown(this KeyboardShortcut key, bool onlyJustPressed)
		{
			//IL_0005: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if ((onlyJustPressed && !Input.GetKeyDown(((KeyboardShortcut)(ref key)).MainKey)) || (!onlyJustPressed && !Input.GetKey(((KeyboardShortcut)(ref key)).MainKey)))
			{
				return false;
			}
			foreach (KeyCode modifier in ((KeyboardShortcut)(ref key)).Modifiers)
			{
				if (!Input.GetKey(modifier))
				{
					return false;
				}
			}
			return true;
		}
	}
	internal static class RiskofOptions
	{
		internal const string RooGuid = "com.rune580.riskofoptions";

		internal static bool enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		internal static void SetSprite(Sprite sprite)
		{
			ModSettingsManager.SetModIcon(sprite);
		}

		internal static void SetSpriteDefaultIcon()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				string fullName = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName;
				Texture2D val = new Texture2D(256, 256);
				if (ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(fullName, "icon.png"))))
				{
					ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)));
				}
				else
				{
					log.error("Failed to load icon.png");
				}
			}
			catch (Exception ex)
			{
				log.error("Failed to load icon.png\n" + ex);
			}
		}

		internal static void AddOption(ConfigEntryBase entry)
		{
			AddOption(entry, string.Empty, string.Empty);
		}

		internal static void AddOption(ConfigEntryBase entry, string categoryName = "", string name = "", bool restartRequired = false)
		{
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_010c: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00e4: 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_00d4: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00ba: 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_00aa: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Type settingType = entry.SettingType;
			object obj;
			if (!(settingType == typeof(float)))
			{
				obj = ((!(settingType == typeof(string))) ? ((!(settingType == typeof(bool))) ? ((!(settingType == typeof(int))) ? ((!(settingType == typeof(Color))) ? ((!(settingType == typeof(KeyboardShortcut))) ? ((object)((!settingType.IsEnum) ? ((ChoiceOption)null) : new ChoiceOption(entry, new ChoiceConfig()))) : ((object)new KeyBindOption((ConfigEntry<KeyboardShortcut>)(object)entry, new KeyBindConfig()))) : ((object)new ColorOption((ConfigEntry<Color>)(object)entry, new ColorOptionConfig()))) : ((object)new IntFieldOption((ConfigEntry<int>)(object)entry, new IntFieldConfig()))) : ((object)new CheckBoxOption((ConfigEntry<bool>)(object)entry, new CheckBoxConfig()))) : ((object)new StringInputFieldOption((ConfigEntry<string>)(object)entry, new InputFieldConfig
				{
					submitOn = (SubmitEnum)6,
					lineType = (LineType)0
				})));
			}
			else if (entry.Description.AcceptableValues is AcceptableValueRange<float>)
			{
				obj = (object)new SliderOption((ConfigEntry<float>)(object)entry, new SliderConfig
				{
					min = ((AcceptableValueRange<float>)(object)entry.Description.AcceptableValues).MinValue,
					max = ((AcceptableValueRange<float>)(object)entry.Description.AcceptableValues).MaxValue,
					FormatString = "{0:f2}",
					description = entry.DescWithDefault("{0:f2}")
				});
			}
			else
			{
				ConfigEntry<float> obj2 = (ConfigEntry<float>)(object)entry;
				FloatFieldConfig val = new FloatFieldConfig();
				((NumericFieldConfig<float>)val).FormatString = "{0:f2}";
				((BaseOptionConfig)val).description = entry.DescWithDefault("{0:f2}");
				obj = (object)new FloatFieldOption(obj2, val);
			}
			BaseOption val2 = (BaseOption)obj;
			if (val2 == null)
			{
				return;
			}
			BaseOptionConfig config = val2.GetConfig();
			config.category = categoryName;
			config.name = name;
			config.restartRequired = restartRequired;
			if (config.description == "")
			{
				config.description = entry.DescWithDefault();
			}
			try
			{
				ModSettingsManager.AddOption(val2);
			}
			catch (Exception arg)
			{
				log.error($"AddOption {entry.Definition} failed\n{arg}");
			}
		}

		internal static void AddOption(ConfigEntry<float> entry, float min, float max, string format = "{0:f2}", string categoryName = "")
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig
			{
				min = min,
				max = max,
				FormatString = format,
				category = categoryName,
				description = ((ConfigEntryBase)(object)entry).DescWithDefault(format)
			}));
		}

		internal static void AddIntSlider(ConfigEntry<int> entry, int min, int max, string categoryName = "")
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig
			{
				min = min,
				max = max,
				category = categoryName,
				description = ((ConfigEntryBase)(object)entry).DescWithDefault()
			}));
		}

		private static string DescWithDefault(this ConfigEntryBase entry, string format = "{0}")
		{
			return string.Format("{1}\n[Default: " + format + "]", entry.DefaultValue, entry.Description.Description);
		}
	}
}
namespace Dropitem
{
	internal static class ChatCommands
	{
		internal class Command
		{
			internal Func<NetworkUser, string[], string> method;

			internal string helpText;

			internal byte minArgs;

			internal Command(Func<NetworkUser, string[], string> method, byte minArgs, string helpText)
			{
				this.method = method;
				this.minArgs = minArgs;
				this.helpText = helpText;
			}
		}

		internal static Dictionary<string, Command> chatCommands;

		static ChatCommands()
		{
			Command value = new Command(Drop.Drop_item, 1, "<color=#AAE6F0>/d itemname playername\nItems with spaces need to be typed without them:\nScrap, Green -> scrapgre</color>");
			Command value2 = new Command(Give.Give_Item, 2, "<color=#AAE6F0>/g itemname playername\nWill transfer items from sender's inventory into playername's inventory</color>");
			Command value3 = new Command(Users.Block_User, 1, "<color=#AAE6F0>/block playername\nPrevents the targeted player from dropping items</color>");
			Command value4 = new Command(Users.Lock_Inventory, 0, "<color=#AAE6F0>/lock 0 or 1\n Prevents other players from accessing your inventory</color>");
			chatCommands = new Dictionary<string, Command>
			{
				["d"] = value,
				["drop"] = value,
				["dropitem"] = value,
				["g"] = value2,
				["give"] = value2,
				["giveitem"] = value2,
				["b"] = value3,
				["block"] = value3,
				["blockuser"] = value3,
				["ub"] = value3,
				["unblock"] = value3,
				["unblockuser"] = value3,
				["lock"] = value4,
				["lockinventory"] = value4
			};
		}
	}
	internal static class Config
	{
		private static ConfigFile configFile;

		internal static ConfigEntry<bool> lockInventory;

		internal static ConfigEntry<bool> allowVoidDrop;

		internal static ConfigEntry<bool> allowLunarDrop;

		internal static ConfigEntry<InputButton> dropButton;

		internal static ConfigEntry<KeyboardShortcut> dropSingleButton;

		internal static ConfigEntry<string> dropBlacklist;

		internal static ConfigEntry<bool> applyBlacklistToAll;

		internal static ConfigEntry<bool> applyAllowToGive;

		internal static ConfigEntry<bool> allowRecycle;

		internal static ConfigEntry<bool> hostOnly;

		internal static ConfigEntry<bool> dropFromDisconnected;

		internal static void DoConfig(ConfigFile bepConfigFile)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			configFile = bepConfigFile;
			lockInventory = configFile.Bind<bool>("", "Lock Inventory", false, "Prevent other players from dropping items from your inventory");
			allowVoidDrop = configFile.Bind<bool>("", "Allow Void Drops", false, "Allow dropping of void corrupted items");
			allowLunarDrop = configFile.Bind<bool>("", "Allow Lunar Drops", true, "Allow dropping of lunar items");
			dropButton = configFile.Bind<InputButton>("", "Drop button", (InputButton)0, "Mouse button to drop the currently hovered item");
			dropSingleButton = configFile.Bind<KeyboardShortcut>("", "Drop single key", new KeyboardShortcut((KeyCode)323, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Key to drop a single of the currently hovered item");
			dropBlacklist = configFile.Bind<string>("", "Drop blacklist", "ExtraStatsOnLevelUp, OnLevelUpFreeUnlock, CloverVoid", "Items and equipment listed here will not be dropped. Enable 'Apply Blacklist To dropall' if you want it to apply to that\nCase insensitive, partial names allowed, seperated by commas, and engligh only.\nIf using internal item names they must match fully, use debugtoolkit's list_item or list_equip command to view them.");
			applyBlacklistToAll = configFile.Bind<bool>("", "Apply blacklist to dropall", false, "If '/drop all' should respect 'Drop blacklist', 'Allow Void Drops', and 'Allow Lunar Drops'");
			applyAllowToGive = configFile.Bind<bool>("", "Apply allow toggle to give", false, "If '/give' should use 'Allow Void Drops' and 'Allow Lunar Drops'. When disabled, will allow directly giving void and lunars to other players");
			allowRecycle = configFile.Bind<bool>("", "Allow recycle", false, "Allow recycling of dropped items");
			hostOnly = configFile.Bind<bool>("", "Host only", false, "If only host should be able to use the mod");
			dropFromDisconnected = configFile.Bind<bool>("", "Drop from disconnected", true, "Allow dropping from disconnected players");
			if (RiskofOptions.enabled)
			{
				DoRiskofOptions();
			}
		}

		private static void DoRiskofOptions()
		{
			RiskofOptions.SetSpriteDefaultIcon();
			RiskofOptions.AddOption((ConfigEntryBase)(object)allowVoidDrop);
			RiskofOptions.AddOption((ConfigEntryBase)(object)allowLunarDrop);
			RiskofOptions.AddOption((ConfigEntryBase)(object)lockInventory);
			RiskofOptions.AddOption((ConfigEntryBase)(object)applyBlacklistToAll);
			RiskofOptions.AddOption((ConfigEntryBase)(object)applyAllowToGive);
			RiskofOptions.AddOption((ConfigEntryBase)(object)allowRecycle);
			RiskofOptions.AddOption((ConfigEntryBase)(object)hostOnly);
			RiskofOptions.AddOption((ConfigEntryBase)(object)dropFromDisconnected);
			RiskofOptions.AddOption((ConfigEntryBase)(object)dropButton);
			RiskofOptions.AddOption((ConfigEntryBase)(object)dropSingleButton);
			RiskofOptions.AddOption((ConfigEntryBase)(object)dropBlacklist);
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void ReloadConfig(ConCommandArgs args)
		{
			configFile.Reload();
			Debug.Log((object)"DropItem config reloaded");
		}

		internal static KeyCode ToKey(this InputButton button)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected I4, but got Unknown
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			return (KeyCode)((int)button switch
			{
				0 => 323, 
				1 => 324, 
				2 => 325, 
				_ => 324, 
			});
		}
	}
	internal class DragItem : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler, IInitializePotentialDragHandler, IPointerClickHandler
	{
		public enum ItemType : byte
		{
			None,
			Item,
			Equipment
		}

		public ItemType type;

		private static GameObject draggedIcon;

		private static RectTransform m_DraggingPlane;

		public static bool InvalidButton(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (eventData.button == Config.dropButton.Value)
			{
				return Main.singlePressed > 0;
			}
			return true;
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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)
			if (!InvalidButton(eventData))
			{
				HUD val = HUD.instancesList[0];
				if (Object.op_Implicit((Object)(object)draggedIcon))
				{
					Object.Destroy((Object)(object)draggedIcon);
				}
				draggedIcon = new GameObject("dragged icon");
				draggedIcon.transform.SetParent(val.mainContainer.transform);
				draggedIcon.transform.SetAsLastSibling();
				RawImage val2 = draggedIcon.AddComponent<RawImage>();
				if (type == ItemType.Item)
				{
					val2.texture = ((Component)this).GetComponent<RawImage>().texture;
				}
				if (type == ItemType.Equipment)
				{
					val2.texture = ((Component)this).GetComponent<EquipmentIcon>().iconImage.texture;
				}
				((Graphic)val2).raycastTarget = false;
				((Graphic)val2).color = new Color(1f, 1f, 1f, 0.6f);
				RectTransform component = draggedIcon.GetComponent<RectTransform>();
				((Transform)component).localScale = ((Transform)component).localScale / 128f;
				Transform transform = ((Component)val.canvas).transform;
				m_DraggingPlane = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			}
		}

		public void OnDrag(PointerEventData data)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)draggedIcon))
			{
				RectTransform component = draggedIcon.GetComponent<RectTransform>();
				Vector3 position = default(Vector3);
				if (RectTransformUtility.ScreenPointToWorldPointInRectangle(m_DraggingPlane, data.position, data.pressEventCamera, ref position))
				{
					((Transform)component).position = position;
					((Transform)component).rotation = ((Transform)m_DraggingPlane).rotation;
				}
			}
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			if (Object.op_Implicit((Object)(object)draggedIcon))
			{
				Object.Destroy((Object)(object)draggedIcon);
			}
		}

		public void OnInitializePotentialDrag(PointerEventData eventData)
		{
			eventData.useDragThreshold = false;
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (!InvalidButton(eventData) && GetPlayerAndItem(out var player, out var args))
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null);
				if ((Object)(object)player.networkUser != (Object)(object)val)
				{
					Users.AddPlayerStringArg(player, args);
				}
				Console.instance.RunCmd(new CmdSender(val), "dropitem", args);
			}
		}

		public bool GetPlayerAndItem(out PlayerCharacterMasterController player, out List<string> args)
		{
			switch (type)
			{
			case ItemType.Item:
				return FromItem(out player, out args);
			case ItemType.Equipment:
				return FromEquip(out player, out args);
			default:
				log.warning("unknown type of clicked object");
				player = null;
				args = null;
				return false;
			}
		}

		private bool FromItem(out PlayerCharacterMasterController player, out List<string> args)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			args = new List<string>();
			ItemInventoryDisplay componentInParent = ((Component)this).GetComponentInParent<ItemInventoryDisplay>();
			object obj;
			if (componentInParent == null)
			{
				obj = null;
			}
			else
			{
				Inventory inventory = componentInParent.inventory;
				obj = ((inventory != null) ? ((Component)inventory).GetComponent<PlayerCharacterMasterController>() : null);
			}
			player = (PlayerCharacterMasterController)obj;
			if (!Object.op_Implicit((Object)(object)player))
			{
				log.warning("null player item");
				return false;
			}
			List<ItemIndex> itemAcquisitionOrder = player.master.inventory.itemAcquisitionOrder;
			args.Add((itemAcquisitionOrder.Count - itemAcquisitionOrder.IndexOf(((Component)this).GetComponent<ItemIcon>().itemIndex)).ToString());
			return true;
		}

		private bool FromEquip(out PlayerCharacterMasterController player, out List<string> args)
		{
			args = new List<string> { "e" };
			Inventory targetInventory = ((Component)this).GetComponent<EquipmentIcon>().targetInventory;
			player = ((targetInventory != null) ? ((Component)targetInventory).GetComponent<PlayerCharacterMasterController>() : null);
			if (!Object.op_Implicit((Object)(object)player))
			{
				log.warning("null player equip");
				return false;
			}
			return true;
		}
	}
	internal static class Drop
	{
		public const string green = "<color=#96EBAA>";

		public const string player = "<color=#AAE6F0>";

		public const string error = "<color=#FF8282>";

		public const string bold = "<color=#ff4646>";

		private static bool isNegative;

		public static string Drop_item(NetworkUser sender, string[] args)
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Invalid comparison between Unknown and I4
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Invalid comparison between Unknown and I4
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Invalid comparison between Unknown and I4
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Invalid comparison between Unknown and I4
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			if (!Users.CheckUserPerms(sender, out var errorMessage))
			{
				return errorMessage;
			}
			PlayerCharacterMasterController val = sender.masterController;
			Inventory inventory = sender.master.inventory;
			if (args.Length >= 2)
			{
				val = StringParsers.GetNetUserFromString(args[1]);
				if (!Object.op_Implicit((Object)(object)val))
				{
					return "<color=#FF8282>Could not find specified </color>player<color=#FF8282> '<color=#ff4646>" + args[1] + "</color>'</color>";
				}
				inventory = val.master.inventory;
			}
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return "<color=#ff4646>ERROR: null inventory</color>";
			}
			CharacterBody currentBody = sender.GetCurrentBody();
			Transform val2 = ((currentBody != null) ? currentBody.coreTransform : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return "<color=#FF8282>Must be alive to drop items</color>";
			}
			string value;
			if (Object.op_Implicit((Object)(object)val.networkUser))
			{
				value = val.networkUser.userName;
			}
			else
			{
				if (!Config.dropFromDisconnected.Value)
				{
					return "<color=#FF8282>Dropping from disconnected players is disabled</color>";
				}
				Users.cachedPlayerNames.TryGetValue(val, out value);
			}
			value = "<color=#AAE6F0>" + value + "</color>";
			string text = "<color=#AAE6F0>" + sender.masterController.GetDisplayName() + "</color>";
			if (Object.op_Implicit((Object)(object)val.networkUser) && (Object)(object)val.networkUser != (Object)(object)sender && Users.lockedUserIds.Contains(val.networkUser.id))
			{
				return "<color=#FF8282>" + value + " has their inventory locked</color>";
			}
			Vector3 velocity = sender.GetCurrentBody().inputBank.aimDirection;
			velocity.y = 0f;
			velocity = ((Vector3)(ref velocity)).normalized * 8f + Vector3.up * 15f;
			EquipmentIndex val3 = (EquipmentIndex)(-1);
			ItemIndex val4 = (ItemIndex)(-1);
			if (args[0].Equals("all", StringComparison.InvariantCultureIgnoreCase))
			{
				new GameObject("DropAll").AddComponent<DropAll>().Assign(inventory, sender, val2);
				if ((Object)(object)val.networkUser == (Object)(object)sender)
				{
					return "<color=#96EBAA>Dropping all items from </color>" + value;
				}
				return "<color=#96EBAA>" + text + " is dropping all items from </color>" + value;
			}
			if (args[0].Equals("e", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("equip", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("equipment", StringComparison.InvariantCultureIgnoreCase))
			{
				val3 = inventory.GetEquipmentIndex();
				if ((int)val3 == -1)
				{
					return "<color=#FF8282>Target does not have an </color><color=#ff7d00>equipment</color>";
				}
			}
			else
			{
				val4 = StringParsers.FindItemInInventroy(args[0], inventory);
			}
			PickupIndex val5;
			string text2;
			if ((int)val4 == -1)
			{
				if ((int)val3 == -1)
				{
					val3 = inventory.GetEquipmentIndex();
					if ((int)val3 == -1 || !StringParsers.ContainsString(StringParsers.ReformatString(Language.GetString(EquipmentCatalog.GetEquipmentDef(val3).nameToken)), StringParsers.ReformatString(args[0])))
					{
						return "<color=#FF8282>Could not find item '<color=#ff4646>" + args[0] + "</color>' in " + value + "<color=#AAE6F0>'s</color> inventory</color>";
					}
				}
				val5 = PickupCatalog.FindPickupIndex(val3);
				text2 = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(val3).nameToken), Color32.op_Implicit(PickupCatalog.GetPickupDef(val5).baseColor));
				if (val3 != inventory.GetEquipmentIndex())
				{
					return "<color=#FF8282>Target does not have </color><color=#ff4646>" + text2 + "</color>";
				}
				if (IsBlacklisted(EquipmentCatalog.GetEquipmentDef(val3), ignoreLunar: false, isFromAll: false))
				{
					return text2 + "<color=#FF8282> is not dropable</color>";
				}
				MakePickupDroplets(val5, val2.position, velocity);
				inventory.SetEquipmentIndex((EquipmentIndex)(-1));
				if ((Object)(object)val.networkUser == (Object)(object)sender)
				{
					return "<color=#96EBAA>Dropped " + text2 + " from </color>" + value;
				}
				return "<color=#96EBAA>" + text + " is dropping " + text2 + " from </color>" + value;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef(val4);
			val5 = PickupCatalog.FindPickupIndex(val4);
			text2 = Util.GenerateColoredString(Language.GetString(itemDef.nameToken), Color32.op_Implicit(PickupCatalog.GetPickupDef(val5).baseColor));
			if (IsBlacklisted(itemDef, ignoreVoidAndLunarAllow: false, allowTrash: true, isFromAll: false))
			{
				return text2 + "<color=#FF8282> is not dropable</color>";
			}
			int num = Math.Min(inventory.GetItemCount(val4), 20);
			if (args.Length > 2 && int.TryParse(args[2], out var result))
			{
				num = Math.Min(num, result);
			}
			if (num == 0)
			{
				return "<color=#FF8282>Target does not have </color>" + text2;
			}
			if (num > 1)
			{
				text2 += Util.GenerateColoredString("s", Color32.op_Implicit(PickupCatalog.GetPickupDef(val5).baseColor));
			}
			MakePickupDroplets(val5, val2.position, velocity, num);
			inventory.RemoveItem(val4, num);
			if ((Object)(object)val.networkUser == (Object)(object)sender)
			{
				return string.Format("{0}{1} dropped {2} {3}</color>", "<color=#96EBAA>", value, num, text2);
			}
			return string.Format("{0}{1} is dropping {2} {3} from </color>{4}", "<color=#96EBAA>", text, num, text2, value);
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCDropItem(ConCommandArgs args)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.LogError((object)"Requires at least 1 argument: dropitem {itemname} ({PlayerID:self}|{Playername})");
				return;
			}
			if ((Object)(object)args.sender == (Object)null && ((ConCommandArgs)(ref args)).Count < 2)
			{
				Debug.LogError((object)"Command must be fully qualified on dedicated servers.");
				return;
			}
			if (((ConCommandArgs)(ref args))[0].ToUpperInvariant() == "HELP")
			{
				Debug.Log((object)"<color=#AAE6F0>/d itemname playername\nItems with spaces need to be typed without them:\nScrap, Green -> scrapg</color>");
				return;
			}
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = Drop_item(args.sender, args.userArgs.ToArray())
			});
		}

		internal static void MakePickupDroplets(PickupIndex pickupIndex, Vector3 position, Vector3 velocity, int amount = 1)
		{
			//IL_0002: 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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			CreatePickupInfo val = default(CreatePickupInfo);
			val.position = position;
			val.artifactFlag = (PickupArtifactFlag)2;
			((CreatePickupInfo)(ref val)).pickupIndex = pickupIndex;
			val.prefabOverride = Main.pickupPrefab;
			CreatePickupInfo val2 = val;
			for (int i = 0; i < amount; i++)
			{
				val2.rotation = Quaternion.Euler(0f, 180f * (float)i / (float)amount + DoIsNegative(), 0f);
				PickupDropletController.CreatePickupDroplet(val2, position, velocity * (1f + (float)i / 60f));
			}
		}

		private static float DoIsNegative()
		{
			isNegative = !isNegative;
			return isNegative ? 180 : 0;
		}

		internal static bool IsBlacklisted(ItemDef itemDef, bool ignoreVoidAndLunarAllow, bool allowTrash, bool isFromAll)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			//IL_0079: 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_0026: 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)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0098: Invalid comparison between Unknown and I4
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Invalid comparison between Unknown and I4
			ItemIndex itemIndex = itemDef.itemIndex;
			if (itemIndex != Items.CaptainDefenseMatrix.itemIndex && ((int)itemDef.tier != 5 || (allowTrash && (itemIndex == Items.ExtraLifeConsumed.itemIndex || itemIndex == Items.ExtraLifeVoidConsumed.itemIndex || itemIndex == Items.FragileDamageBonusConsumed.itemIndex || itemIndex == Items.HealingPotionConsumed.itemIndex || itemIndex == Items.RegeneratingScrapConsumed.itemIndex))))
			{
				if (isFromAll && !Config.applyBlacklistToAll.Value)
				{
					return false;
				}
				ItemTier tier = itemDef.tier;
				if ((ignoreVoidAndLunarAllow || Config.allowVoidDrop.Value || ((int)tier != 6 && (int)tier != 7 && (int)tier != 8 && (int)tier != 9)) && (ignoreVoidAndLunarAllow || Config.allowLunarDrop.Value || (int)tier != 3) && !Main.dropBlacklist.Contains(PickupCatalog.FindPickupIndex(itemIndex)))
				{
					return false;
				}
			}
			return true;
		}

		internal static bool IsBlacklisted(EquipmentDef equipDef, bool ignoreLunar, bool isFromAll)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (isFromAll && !Config.applyBlacklistToAll.Value)
			{
				return false;
			}
			if (!ignoreLunar && !Config.allowLunarDrop.Value && equipDef.isLunar)
			{
				return true;
			}
			if (Main.dropBlacklist.Contains(PickupCatalog.FindPickupIndex(equipDef.equipmentIndex)))
			{
				return true;
			}
			return false;
		}
	}
	internal class DropAll : MonoBehaviour
	{
		private const float period = 0.2f;

		private Transform targetTransform;

		private NetworkUser sender;

		private Inventory inventory;

		private List<ItemIndex> items;

		private float timer = 0.2f - Time.fixedDeltaTime;

		private Vector3 currentDirection;

		private Quaternion rotation;

		public void Assign(Inventory inventory, NetworkUser sender, Transform transform)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			this.inventory = inventory;
			this.sender = sender;
			targetTransform = transform;
			items = inventory.itemAcquisitionOrder;
			int num = items.Count + inventory.GetEquipmentSlotCount();
			if (num <= 0)
			{
				log.warning("Empty inventory");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			else
			{
				currentDirection = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 15f + Vector3.forward * 8f * (0.8f + (float)num / 80f));
				rotation = Quaternion.AngleAxis(360f / (float)num, Vector3.up);
			}
		}

		private void FixedUpdate()
		{
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Invalid comparison between Unknown and I4
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)sender) || !Object.op_Implicit((Object)(object)sender.GetCurrentBody()) || !Object.op_Implicit((Object)(object)inventory) || !Object.op_Implicit((Object)(object)targetTransform))
			{
				log.warning("Lost sender, aborting drop all");
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			timer += Time.fixedDeltaTime;
			if (!(timer >= 0.2f))
			{
				return;
			}
			timer -= 0.2f;
			for (int num = items.Count - 1; num >= -1; num--)
			{
				if (num == -1)
				{
					for (uint num2 = 0u; num2 < inventory.GetEquipmentSlotCount(); num2++)
					{
						EquipmentIndex equipmentIndex = inventory.GetEquipment(num2).equipmentIndex;
						if ((int)equipmentIndex != -1 && !Drop.IsBlacklisted(EquipmentCatalog.GetEquipmentDef(equipmentIndex), ignoreLunar: false, isFromAll: true))
						{
							Drop.MakePickupDroplets(PickupCatalog.FindPickupIndex(equipmentIndex), targetTransform.position, currentDirection);
							inventory.SetEquipmentIndexForSlot((EquipmentIndex)(-1), num2);
							currentDirection = rotation * currentDirection;
							return;
						}
					}
					log.info("Drop all complete");
					Object.Destroy((Object)(object)((Component)this).gameObject);
					break;
				}
				ItemDef itemDef = ItemCatalog.GetItemDef(items[num]);
				if (!Drop.IsBlacklisted(itemDef, ignoreVoidAndLunarAllow: false, allowTrash: false, isFromAll: true))
				{
					int num3 = inventory.GetItemCount(items[num]);
					if (num3 > 15)
					{
						num3 = 15;
					}
					timer -= (float)num3 * 0.02f;
					Drop.MakePickupDroplets(PickupCatalog.FindPickupIndex(items[num]), targetTransform.position, currentDirection, num3);
					inventory.RemoveItem(items[num], num3);
					if (inventory.GetItemCount(itemDef) == 0)
					{
						currentDirection = rotation * currentDirection;
					}
					break;
				}
			}
		}
	}
	internal class DropNetworkComponent : NetworkBehaviour
	{
		private static int kCmdCmdLockInventory;

		static DropNetworkComponent()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			Config.lockInventory.SettingChanged += delegate
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null);
				DropNetworkComponent dropNetworkComponent = default(DropNetworkComponent);
				if (Object.op_Implicit((Object)(object)val) && ((Component)val).TryGetComponent<DropNetworkComponent>(ref dropNetworkComponent) && Util.HasEffectiveAuthority(((NetworkBehaviour)dropNetworkComponent).netIdentity))
				{
					dropNetworkComponent.CallCmdLockInventory(Config.lockInventory.Value);
				}
			};
			kCmdCmdLockInventory = -1225425357;
			NetworkBehaviour.RegisterCommandDelegate(typeof(DropNetworkComponent), kCmdCmdLockInventory, new CmdDelegate(InvokeCmdCmdLockInventory));
			NetworkCRC.RegisterBehaviour("DropNetworkComponent", 0);
		}

		private void Start()
		{
			if (Config.lockInventory.Value && Util.HasEffectiveAuthority(((NetworkBehaviour)this).netIdentity))
			{
				CallCmdLockInventory(enable: true);
			}
		}

		[Command]
		public void CmdLockInventory(bool enable)
		{
			Debug.Log((object)Users.Lock_Inventory(((Component)this).GetComponent<NetworkUser>(), enable));
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeCmdCmdLockInventory(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"Command CmdLockInventory called on client.");
			}
			else
			{
				((DropNetworkComponent)(object)obj).CmdLockInventory(reader.ReadBoolean());
			}
		}

		public void CallCmdLockInventory(bool enable)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"Command function CmdLockInventory called on server.");
				return;
			}
			if (((NetworkBehaviour)this).isServer)
			{
				CmdLockInventory(enable);
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)5);
			val.WritePackedUInt32((uint)kCmdCmdLockInventory);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			val.Write(enable);
			((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdLockInventory");
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
	internal static class Give
	{
		public const string green = "<color=#96EBAA>";

		public const string player = "<color=#AAE6F0>";

		public const string error = "<color=#FF8282>";

		public const string bold = "<color=#ff4646>";

		public static string Give_Item(NetworkUser sender, string[] args)
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Invalid comparison between Unknown and I4
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Invalid comparison between Unknown and I4
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Invalid comparison between Unknown and I4
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Invalid comparison between Unknown and I4
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Invalid comparison between Unknown and I4
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			if (!Users.CheckUserPerms(sender, out var errorMessage))
			{
				return errorMessage;
			}
			Inventory inventory = sender.master.inventory;
			PlayerCharacterMasterController netUserFromString = StringParsers.GetNetUserFromString(args[1]);
			if (!Object.op_Implicit((Object)(object)netUserFromString))
			{
				return "<color=#FF8282>Could not find specified </color>player<color=#FF8282> '<color=#ff4646>" + args[1] + "</color>'</color>";
			}
			Inventory inventory2 = netUserFromString.master.inventory;
			if (!Object.op_Implicit((Object)(object)inventory) || !Object.op_Implicit((Object)(object)inventory2))
			{
				return "<color=#ff4646>ERROR: null inventory</color>";
			}
			if ((Object)(object)inventory == (Object)(object)inventory2)
			{
				return "<color=#FF8282>Target can not be the sender</color>";
			}
			string value;
			if (Object.op_Implicit((Object)(object)netUserFromString.networkUser))
			{
				value = netUserFromString.networkUser.userName;
			}
			else
			{
				if (!Config.dropFromDisconnected.Value)
				{
					return "<color=#FF8282>Giving to disconnected players is disabled</color>";
				}
				Users.cachedPlayerNames.TryGetValue(netUserFromString, out value);
			}
			value = "<color=#AAE6F0>" + value + "</color>";
			string text = "<color=#AAE6F0>" + sender.masterController.GetDisplayName() + "</color>";
			if (Object.op_Implicit((Object)(object)netUserFromString.networkUser) && Users.lockedUserIds.Contains(netUserFromString.networkUser.id))
			{
				return "<color=#FF8282>" + value + " has their inventory locked, failed to give item</color>";
			}
			EquipmentIndex val = (EquipmentIndex)(-1);
			ItemIndex val2 = (ItemIndex)(-1);
			if (args[0].ToLower() == "e" || args[0].ToLower() == "equip" || args[0].ToLower() == "equipment")
			{
				val = inventory.GetEquipmentIndex();
				if ((int)val == -1)
				{
					return "<color=#FF8282>Sender does not have an </color><color=#ff7d00>equipment</color>";
				}
			}
			else
			{
				val2 = StringParsers.FindItemInInventroy(args[0], inventory);
			}
			PickupIndex val3;
			string text2;
			if ((int)val2 == -1)
			{
				if ((int)val == -1)
				{
					val = inventory.GetEquipmentIndex();
					if ((int)val == -1 || !StringParsers.ReformatString(Language.GetString(EquipmentCatalog.GetEquipmentDef(val).nameToken)).Contains(StringParsers.ReformatString(args[0])))
					{
						return "<color=#FF8282>Could not find item '<color=#ff4646>" + args[0] + "</color>' in " + text + "<color=#AAE6F0>'s</color> inventory</color>";
					}
				}
				if ((int)inventory2.GetEquipmentIndex() != -1)
				{
					return "<color=#FF8282>Target already has an equipment</color>";
				}
				val3 = PickupCatalog.FindPickupIndex(val);
				text2 = Util.GenerateColoredString(Language.GetString(EquipmentCatalog.GetEquipmentDef(val).nameToken), Color32.op_Implicit(PickupCatalog.GetPickupDef(val3).baseColor));
				if (val != inventory.GetEquipmentIndex())
				{
					return "<color=#FF8282>Sender does not have </color><color=#ff4646>" + text2 + "</color>";
				}
				if (Drop.IsBlacklisted(EquipmentCatalog.GetEquipmentDef(val), !Config.applyAllowToGive.Value, isFromAll: false))
				{
					return text2 + "<color=#FF8282> is not dropable</color>";
				}
				inventory2.SetEquipmentIndex(val);
				inventory.SetEquipmentIndex((EquipmentIndex)(-1));
				return "<color=#96EBAA>" + text + " gave " + text2 + " to </color>" + value;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef(val2);
			val3 = PickupCatalog.FindPickupIndex(val2);
			text2 = Util.GenerateColoredString(Language.GetString(itemDef.nameToken), Color32.op_Implicit(PickupCatalog.GetPickupDef(val3).baseColor));
			if (Drop.IsBlacklisted(itemDef, !Config.applyAllowToGive.Value, allowTrash: true, isFromAll: false))
			{
				return text2 + "<color=#FF8282> is not dropable</color>";
			}
			int num = inventory.GetItemCount(val2);
			if (num == 0)
			{
				return "<color=#FF8282>Sender does not have </color>" + text2;
			}
			if (num > 1)
			{
				text2 += Util.GenerateColoredString("s", Color32.op_Implicit(PickupCatalog.GetPickupDef(val3).baseColor));
			}
			if (num > 30)
			{
				num = 30;
			}
			inventory2.GiveItem(val2, num);
			inventory.RemoveItem(val2, num);
			return string.Format("{0}{1} gave {2} {3} to </color>{4}", "<color=#96EBAA>", text, num, text2, value);
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCGiveItem(ConCommandArgs args)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if (((ConCommandArgs)(ref args)).Count < 2)
			{
				Debug.LogError((object)"Requires at least 2 arguments: giveitem {Itemname} {{Playername}");
				return;
			}
			if ((Object)(object)args.sender == (Object)null)
			{
				Debug.LogError((object)"Command cannot be used by dedicated servers.");
				return;
			}
			string[] args2 = new string[2]
			{
				((ConCommandArgs)(ref args))[0],
				((ConCommandArgs)(ref args))[1]
			};
			if (((ConCommandArgs)(ref args))[0].ToUpperInvariant() == "HELP")
			{
				Debug.Log((object)"<color=#AAE6F0>/g itemname playername\nWill transfer items from sender's inventory into playername's inventory");
				return;
			}
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = Give_Item(args.sender, args2)
			});
		}
	}
	internal static class Hooks
	{
		private delegate GenericPickupController FuncCreatePickup<T1>(in T1 a1);

		internal static void DoSetup()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			HookManager.Hook(typeof(Chat), "CCSay", (Delegate)new Action<Action<ConCommandArgs>, ConCommandArgs>(CheckForCommands_On_Chat_CCSay));
			HookManager.Hook(typeof(GenericPickupController), "CreatePickup", (Delegate)new <>F{00000008}<FuncCreatePickup<CreatePickupInfo>, CreatePickupInfo, GenericPickupController>(DetectDropped_On_GenericPickupController_CreatePickup));
			HookManager.Hook(typeof(NetworkManagerSystem), "Init", (Delegate)new Action<Action<NetworkManagerSystem, NetworkManagerConfiguration>, NetworkManagerSystem, NetworkManagerConfiguration>(AddComponent_On_NetworkManagerSystem_Init));
			HookManager.Hook(typeof(ItemIcon), "ItemClicked", (Delegate)new Action<Action<ItemIcon>, ItemIcon>(BlockDropKey_On_ItemIcon_ItemClicked));
			HookManager.Hook(typeof(MPInputModule), "GetMousePointerEventData", (Delegate)new Func<Func<MPInputModule, int, int, MouseState>, MPInputModule, int, int, MouseState>(CheckResetKey_On_MPInputModule_GetMousePointerEventData));
			NetworkUser.onNetworkUserLost += new NetworkUserGenericDelegate(CacherUsername_NetworkUser_onNetworkUserLost);
			PlayerCharacterMasterController.onPlayerRemoved += PlayerCMC_onPlayerRemoved;
			if (Chainloader.PluginInfos.TryGetValue("com.niwith.DropInMultiplayer", out var value))
			{
				HookManager.Hook(((object)value.Instance).GetType(), "Console_RunCmd", new Manipulator(FixNullAndMute_IL_DropInMultiplayer_Console_RunCmd));
			}
		}

		private static void CheckForCommands_On_Chat_CCSay(Action<ConCommandArgs> orig, ConCommandArgs args)
		{
			//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_00ad: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			orig(args);
			string text = args.userArgs.FirstOrDefault();
			if (!NetworkServer.active || string.IsNullOrWhiteSpace(text) || !text.StartsWith("/"))
			{
				return;
			}
			string[] source = text.Split(new char[1] { ' ' });
			string key = source.FirstOrDefault().Substring(1).ToLower();
			string[] array = source.Skip(1).ToArray();
			if (ChatCommands.chatCommands.TryGetValue(key, out var value))
			{
				string text2 = ((array.Length >= value.minArgs && (array.Length == 0 || (!(array[0] == "") && !array[0].Equals("help", StringComparison.InvariantCultureIgnoreCase)))) ? value.method(args.sender, array) : value.helpText);
				if (text2 == null)
				{
					text2 = "<color=#ff4646>ERROR: null output</color>";
				}
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = text2
				});
			}
		}

		private static GenericPickupController DetectDropped_On_GenericPickupController_CreatePickup(FuncCreatePickup<CreatePickupInfo> orig, ref CreatePickupInfo createPickupInfo)
		{
			if ((Object)(object)createPickupInfo.prefabOverride == (Object)(object)Main.pickupPrefab)
			{
				createPickupInfo.prefabOverride = GenericPickupController.pickupPrefab;
				GenericPickupController val = orig(in createPickupInfo);
				if (!Config.allowRecycle.Value)
				{
					val.NetworkRecycled = true;
				}
				return val;
			}
			return orig(in createPickupInfo);
		}

		private static void AddComponent_On_NetworkManagerSystem_Init(Action<NetworkManagerSystem, NetworkManagerConfiguration> orig, NetworkManagerSystem self, NetworkManagerConfiguration config)
		{
			config.PlayerPrefab.AddComponent<DropNetworkComponent>();
			orig(self, config);
		}

		private static void BlockDropKey_On_ItemIcon_ItemClicked(Action<ItemIcon> orig, ItemIcon self)
		{
			//IL_0005: 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_000f: 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_0018: 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)
			KeyCode val = Config.dropButton.Value.ToKey();
			if (!Input.GetKey(val) && !Input.GetKeyUp(val) && !Config.dropSingleButton.Value.IsKeyDown(onlyJustPressed: false) && Main.singlePressed == 0)
			{
				orig(self);
			}
		}

		private static MouseState CheckResetKey_On_MPInputModule_GetMousePointerEventData(Func<MPInputModule, int, int, MouseState> orig, MPInputModule self, int playerid, int mouseIndex)
		{
			//IL_0015: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			MouseState val = orig(self, playerid, mouseIndex);
			if (val != null && Config.dropSingleButton.Value.IsKeyDown(onlyJustPressed: true))
			{
				RaycastResult pointerCurrentRaycast = ((PointerEventData)val.GetButtonState(0).eventData.buttonData).pointerCurrentRaycast;
				ExecuteEvents.GetEventChain(((RaycastResult)(ref pointerCurrentRaycast)).gameObject, (IList<Transform>)ExecuteEvents.s_InternalTransformList);
				foreach (Transform s_InternalTransform in ExecuteEvents.s_InternalTransformList)
				{
					DragItem component = ((Component)s_InternalTransform).gameObject.GetComponent<DragItem>();
					if (Object.op_Implicit((Object)(object)component) && component.GetPlayerAndItem(out var player, out var args))
					{
						Users.AddPlayerStringArg(player, args);
						args.Add("1");
						Console.instance.RunCmd(new CmdSender(LocalUserManager.GetFirstLocalUser().currentNetworkUser), "dropitem", args);
					}
				}
			}
			return val;
		}

		private static void CacherUsername_NetworkUser_onNetworkUserLost(NetworkUser self)
		{
			if (Object.op_Implicit((Object)(object)self.masterController) && !string.IsNullOrWhiteSpace(self.userName))
			{
				Users.cachedPlayerNames[self.masterController] = self.userName;
			}
		}

		private static void PlayerCMC_onPlayerRemoved(PlayerCharacterMasterController self)
		{
			Users.cachedPlayerNames.Remove(self);
		}

		private static void FixNullAndMute_IL_DropInMultiplayer_Console_RunCmd(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction a) => ILPatternMatchingExt.MatchLdstr(a, "Unable to find command, try /help")
			}))
			{
				val.Emit(OpCodes.Ret);
			}
			else
			{
				log.warning("Failed DropInMultiplayer chat compatibility");
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("dolso.dropitem", "Dropitem", "2.2.1")]
	public class Main : BaseUnityPlugin
	{
		internal const string DropInMultiplayerGuid = "com.niwith.DropInMultiplayer";

		internal static GameObject pickupPrefab;

		internal static int singlePressed;

		internal static readonly List<PickupIndex> dropBlacklist = new List<PickupIndex>();

		private void Awake()
		{
			//IL_00ea: 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_00fa: Expected O, but got Unknown
			//IL_0104: Expected O, but got Unknown
			Config.DoConfig(((BaseUnityPlugin)this).Config);
			Hooks.DoSetup();
			Config.dropBlacklist.SettingChanged += DropBlacklist_SettingChanged;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ApplyConfig));
			Utilities.DoAddressable("RoR2/Base/UI/ScoreboardStrip.prefab", delegate(GameObject scoreboard)
			{
				scoreboard.AddComponent<ScoreboardDrop>();
				((Component)scoreboard.GetComponentInChildren<EquipmentIcon>()).gameObject.AddComponent<DragItem>().type = DragItem.ItemType.Equipment;
			});
			Utilities.DoAddressable("RoR2/Base/UI/HUDSimple.prefab", delegate(GameObject hudSimple)
			{
				Transform val2 = hudSimple.transform.Find("MainContainer/MainUIArea/SpringCanvas/TopCenterCluster/ItemInventoryDisplayRoot/ItemInventoryDisplay");
				if (Object.op_Implicit((Object)(object)val2))
				{
					((Component)val2).gameObject.AddComponent<ScoreboardDrop>();
				}
				else
				{
					log.error("failed to find ItemInventoryDisplay");
				}
				EquipmentIcon[] componentsInChildren = hudSimple.GetComponentsInChildren<EquipmentIcon>();
				foreach (EquipmentIcon val3 in componentsInChildren)
				{
					if (((Object)val3).name == "EquipmentSlot")
					{
						((Component)val3).gameObject.AddComponent<DragItem>().type = DragItem.ItemType.Equipment;
					}
				}
			});
			Utilities.AddressableAddComp<DragItem>("RoR2/Base/UI/ItemIcon.prefab", (Action<DragItem>)delegate(DragItem a)
			{
				a.type = DragItem.ItemType.Item;
			});
			Utilities.AddressableAddComp<DragItem>("RoR2/Base/UI/ItemIconScoreboard_InGame.prefab", (Action<DragItem>)delegate(DragItem a)
			{
				a.type = DragItem.ItemType.Item;
			});
			GameObject val = new GameObject();
			pickupPrefab = Utilities.CreatePrefab(val, "DropItemPickup");
			Object.Destroy((Object)val);
		}

		private static void SetBlacklisted()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			string[] array = Config.dropBlacklist.Value.Split(new string[2] { ", ", "," }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = StringParsers.ReformatString(array[i]);
			}
			dropBlacklist.Clear();
			bool flag = false;
			for (int j = 0; j < array.Length; j++)
			{
				if (string.IsNullOrEmpty(array[j]))
				{
					continue;
				}
				ScriptableObject def;
				PickupIndex item = StringParsers.FindPickup(array[j], out def);
				if (!((PickupIndex)(ref item)).isValid)
				{
					log.error("Failed to find a match \"" + array[j] + "\"");
					continue;
				}
				dropBlacklist.Add(item);
				if (!string.IsNullOrEmpty((def != null) ? ((Object)def).name : null))
				{
					log.info("Renaming \"" + array[j] + "\" to its internal name \"" + ((Object)def).name + "\"");
					array[j] = ((Object)def).name;
					flag = true;
				}
			}
			if (flag)
			{
				Config.dropBlacklist.SettingChanged -= DropBlacklist_SettingChanged;
				Config.dropBlacklist.Value = string.Join(", ", array);
				Config.dropBlacklist.SettingChanged += DropBlacklist_SettingChanged;
			}
		}

		private static void DropBlacklist_SettingChanged(object sender, EventArgs e)
		{
			SetBlacklisted();
		}

		private static void ApplyConfig()
		{
			try
			{
				SetBlacklisted();
			}
			catch (Exception data)
			{
				log.error(data);
			}
		}

		private void Update()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (Config.dropSingleButton.Value.IsKeyDown(onlyJustPressed: false))
			{
				singlePressed = 2;
			}
			else if (singlePressed > 0)
			{
				singlePressed--;
			}
		}
	}
	internal class ScoreboardDrop : MonoBehaviour, IDropHandler, IEventSystemHandler
	{
		public void OnDrop(PointerEventData eventData)
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			if (DragItem.InvalidButton(eventData))
			{
				return;
			}
			object obj;
			if (eventData == null)
			{
				obj = null;
			}
			else
			{
				GameObject pointerDrag = eventData.pointerDrag;
				obj = ((pointerDrag != null) ? pointerDrag.GetComponent<DragItem>() : null);
			}
			DragItem dragItem = (DragItem)obj;
			if (!Object.op_Implicit((Object)(object)dragItem))
			{
				log.warning("Dragged object does not have DragItem component");
			}
			else
			{
				if (!dragItem.GetPlayerAndItem(out var player, out var args))
				{
					return;
				}
				PlayerCharacterMasterController val = ((Component)this).GetComponent<ScoreboardStrip>()?.userPlayerCharacterMasterController;
				if (!Object.op_Implicit((Object)(object)val))
				{
					ItemInventoryDisplay component = ((Component)this).GetComponent<ItemInventoryDisplay>();
					object obj2;
					if (component == null)
					{
						obj2 = null;
					}
					else
					{
						Inventory inventory = component.inventory;
						obj2 = ((inventory != null) ? ((Component)inventory).GetComponent<PlayerCharacterMasterController>() : null);
					}
					val = (PlayerCharacterMasterController)obj2;
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					log.warning("null target player");
					return;
				}
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				NetworkUser val2 = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null);
				string text;
				if ((Object)(object)player != (Object)(object)val)
				{
					if ((Object)(object)player.networkUser != (Object)(object)val2)
					{
						Chat.AddMessage((ChatMessageBase)new SimpleChatMessage
						{
							baseToken = "<color=#FF8282>Can only give items from your own inventory</color>"
						});
						return;
					}
					text = "giveitem";
					Users.AddPlayerStringArg(val, args);
				}
				else
				{
					text = "dropitem";
					if ((Object)(object)player.networkUser != (Object)(object)val2)
					{
						Users.AddPlayerStringArg(player, args);
					}
				}
				Console.instance.RunCmd(new CmdSender(val2), text, args);
			}
		}
	}
	internal static class StringParsers
	{
		internal static ItemIndex FindItemInInventroy(string input, Inventory inventory)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			List<ItemIndex> itemAcquisitionOrder = inventory.itemAcquisitionOrder;
			if (itemAcquisitionOrder.Count == 0)
			{
				return (ItemIndex)(-1);
			}
			input = ReformatString(input);
			if (int.TryParse(input, out var result))
			{
				if (result > itemAcquisitionOrder.Count || result < 0)
				{
					return (ItemIndex)(-1);
				}
				if (result == 0)
				{
					return itemAcquisitionOrder[itemAcquisitionOrder.Count - 1];
				}
				return itemAcquisitionOrder[itemAcquisitionOrder.Count - result];
			}
			for (int num = itemAcquisitionOrder.Count - 1; num >= 0; num--)
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(itemAcquisitionOrder[num]);
				if (ContainsString(ReformatString(Language.GetString(itemDef.nameToken)), input))
				{
					return itemDef.itemIndex;
				}
			}
			if (Language.currentLanguageName != "en")
			{
				for (int num2 = itemAcquisitionOrder.Count - 1; num2 >= 0; num2--)
				{
					ItemDef itemDef2 = ItemCatalog.GetItemDef(itemAcquisitionOrder[num2]);
					if (ContainsString(ReformatString(Language.GetString(itemDef2.nameToken, "en")), input))
					{
						return itemDef2.itemIndex;
					}
				}
			}
			return (ItemIndex)(-1);
		}

		public static PickupIndex FindPickup(string inputText, out ScriptableObject def)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			string text = ReformatString(inputText);
			def = null;
			if (ItemCatalog.itemNameToIndex.TryGetValue(text, out var value))
			{
				return PickupCatalog.FindPickupIndex(value);
			}
			if (EquipmentCatalog.equipmentNameToIndex.TryGetValue(text, out var value2))
			{
				return PickupCatalog.FindPickupIndex(value2);
			}
			Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ItemDef current = enumerator.Current;
					if (current.nameToken != null && ContainsString(ReformatString(Language.GetString(current.nameToken, "en")), text))
					{
						def = (ScriptableObject)(object)current;
						return PickupCatalog.FindPickupIndex(current.itemIndex);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			EquipmentDef[] equipmentDefs = EquipmentCatalog.equipmentDefs;
			foreach (EquipmentDef val in equipmentDefs)
			{
				if (val.nameToken != null && ContainsString(ReformatString(Language.GetString(val.nameToken, "en")), text))
				{
					def = (ScriptableObject)(object)val;
					return PickupCatalog.FindPickupIndex(val.equipmentIndex);
				}
			}
			return PickupIndex.none;
		}

		internal static PlayerCharacterMasterController GetNetUserFromString(string name)
		{
			if (int.TryParse(name, out var result) && result < NetworkUser.readOnlyInstancesList.Count && result >= 0)
			{
				return NetworkUser.readOnlyInstancesList[result].masterController;
			}
			name = ReformatString(name);
			foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList)
			{
				if (ReformatString(readOnlyInstances.userName).StartsWith(name, StringComparison.InvariantCultureIgnoreCase))
				{
					return readOnlyInstances.masterController;
				}
			}
			foreach (NetworkUser readOnlyInstances2 in NetworkUser.readOnlyInstancesList)
			{
				if (ContainsString(ReformatString(readOnlyInstances2.userName), name))
				{
					return readOnlyInstances2.masterController;
				}
			}
			foreach (KeyValuePair<PlayerCharacterMasterController, string> cachedPlayerName in Users.cachedPlayerNames)
			{
				if (ContainsString(ReformatString(cachedPlayerName.Value), name))
				{
					return cachedPlayerName.Key;
				}
			}
			return null;
		}

		internal static string ReformatString(string input)
		{
			return Regex.Replace(input, "[\n '_.,-]", string.Empty);
		}

		internal static bool ContainsString(string source, string value)
		{
			return CultureInfo.InvariantCulture.CompareInfo.IndexOf(source, value, CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols) >= 0;
		}
	}
	internal static class Users
	{
		internal static readonly HashSet<NetworkUserId> lockedUserIds = new HashSet<NetworkUserId>();

		internal static readonly HashSet<NetworkUserId> blockedUserIds = new HashSet<NetworkUserId>();

		internal static readonly Dictionary<PlayerCharacterMasterController, string> cachedPlayerNames = new Dictionary<PlayerCharacterMasterController, string>();

		internal static void AddPlayerStringArg(PlayerCharacterMasterController player, List<string> args)
		{
			int num = NetworkUser.readOnlyInstancesList.IndexOf(player.networkUser);
			string value;
			if (num >= 0)
			{
				args.Add(num.ToString());
			}
			else if (cachedPlayerNames.TryGetValue(player, out value))
			{
				args.Add(value);
			}
		}

		internal static bool CheckUserPerms(NetworkUser sender, out string errorMessage)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)sender))
			{
				errorMessage = "<color=#ff4646>ERROR: null sender</color>";
			}
			else
			{
				if (!blockedUserIds.Contains(sender.id))
				{
					if (Config.hostOnly.Value)
					{
						LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
						if ((Object)(object)((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null) != (Object)(object)sender)
						{
							errorMessage = "<color=#FF8282>Host has prohibited clients from dropping</color>";
							goto IL_005f;
						}
					}
					errorMessage = null;
					return true;
				}
				errorMessage = "<color=#FF8282>You are blocked from dropping items</color>";
			}
			goto IL_005f;
			IL_005f:
			return false;
		}

		internal static string Lock_Inventory(NetworkUser user, string[] args)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			bool shouldLock = ((args.Length == 0) ? (!lockedUserIds.Contains(user.id)) : (args[0] != "0"));
			return Lock_Inventory(user, shouldLock);
		}

		internal static string Lock_Inventory(NetworkUser user, bool shouldLock)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			NetworkUserId id = user.id;
			string text = "<color=#AAE6F0>" + user.userName + "</color>";
			if (shouldLock)
			{
				if (!lockedUserIds.Contains(id))
				{
					lockedUserIds.Add(id);
					return "<color=#96EBAA>Locking " + text + "'s inventory</color>";
				}
				return "<color=#FF8282>Locked list already contains " + text + ", do '/lock 0' to unlock</color>";
			}
			if (lockedUserIds.Contains(id))
			{
				lockedUserIds.Remove(id);
				return "<color=#96EBAA>Unlocking " + text + "'s inventory</color>";
			}
			return "<color=#FF8282>Locked list does not contain " + text + ", do '/lock 1' to lock</color>";
		}

		internal static string Block_User(NetworkUser sender, string[] args)
		{
			//IL_007c: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if ((Object)(object)((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null) != (Object)(object)sender)
			{
				return "<color=#FF8282>Sender is not host</color>";
			}
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				return "<color=#FF8282>Can only be done during a run";
			}
			PlayerCharacterMasterController netUserFromString = StringParsers.GetNetUserFromString(args[0]);
			if (!Object.op_Implicit((Object)(object)netUserFromString) || !Object.op_Implicit((Object)(object)netUserFromString.networkUser))
			{
				return "<color=#FF8282>Could not find specified </color>player<color=#FF8282> '<color=#ff4646>" + args[0] + "</color>'</color>";
			}
			if ((Object)(object)netUserFromString.networkUser == (Object)(object)sender)
			{
				return "<color=#FF8282>Can not block self</color>";
			}
			NetworkUserId id = netUserFromString.networkUser.id;
			if (blockedUserIds.Remove(id))
			{
				return "<color=#96EBAA>Unblocked <color=#AAE6F0>" + netUserFromString.networkUser.userName + "</color></color>";
			}
			blockedUserIds.Add(id);
			return "<color=#96EBAA>Blocked <color=#AAE6F0>" + netUserFromString.networkUser.userName + "</color></color>";
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCBlockUser(ConCommandArgs args)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (((ConCommandArgs)(ref args)).Count == 0)
			{
				Debug.LogError((object)"Requires at least 1 argument: blockuser {Playername}");
				return;
			}
			Debug.Log((object)Block_User(args.sender, new string[1] { ((ConCommandArgs)(ref args))[0] }));
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCLockInventory(ConCommandArgs args)
		{
			//IL_0060: 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)
			if (((ConCommandArgs)(ref args)).Count > 0)
			{
				Config.lockInventory.Value = ((ConCommandArgs)(ref args))[0] != "0";
			}
			else
			{
				Config.lockInventory.Value = !Config.lockInventory.Value;
			}
			Debug.Log((object)("Set Lock Inventory to: " + Config.lockInventory.Value));
			if (Object.op_Implicit((Object)(object)args.sender))
			{
				((Component)args.sender).GetComponent<DropNetworkComponent>().CallCmdLockInventory(Config.lockInventory.Value);
			}
		}
	}
}