Decompiled source of Eject Callouts v1.1.2

EjectCallouts.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CG;
using CG.Game.SpaceObjects;
using CG.Ship;
using Gameplay.Carryables;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.Chat.Router;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("EjectCallouts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2")]
[assembly: AssemblyProduct("EjectCallouts")]
[assembly: AssemblyTitle("Calls out to your allies when you drop an item. Also can tells which item you dropped.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EjectCallouts
{
	internal class Commands : ChatCommand
	{
		public enum CommandMode
		{
			NULL,
			NOTIFICATIONSONLY,
			ITEMSONLY
		}

		public enum communicationShip
		{
			INSIDEONLY,
			OUTSIDEONLY,
			BOTH
		}

		private static readonly string[] omitArguments = new string[11]
		{
			"nano", "bio", "generic", "ammo", "weapons", "mods", "crates", "shards", "class", "relic",
			"homun"
		};

		public static bool debugEjectCallouts = false;

		private static readonly string[] helpPage1 = new string[6] { "==============[Eject Callouts: Help Page 1/10]===========", "!{NOTICE: It's far easier to use the F5 menu GUI}!", "/ejc help [number] to visit pages                     ", "You could also use {ejectcallouts}                    ", "Example: /ejectcallouts help [number]                 ", "=[End Help]=================={Next: Callout Commands}=" };

		private static readonly string[] helpPage2 = new string[7] { "============[Eject Callouts: Help Page 2/10]===========", "/ejc [item/note/null]                                 ", "[Item] sets to Only Display Items in Callouts         ", "[Note] sets to Only Display Player in Callouts        ", "[Null] sets to not display anything                   ", "Example: \"/ejc item\"                                ", "=[End Help]=========================={Next: Locality}=" };

		private static readonly string[] helpPage3 = new string[6] { "============[Eject Callouts: Help Page 3/10]============", "/ejc local [number] to change which players hear it.  ", "[1], allows only you to hear callouts.                ", "[0], tells everyone the callouts.                     ", "Example: \"/ejc local 1\"                             ", "=[End Help]========{Next: Alternate Command Notation}=" };

		private static readonly string[] helpPage4 = new string[7] { "============[Eject Callouts: Help Page 4/10]===========", "Alternate Command Keywords: Wherever [] is you can use", "[item]:  \"i\",   \"itemsonly\",    \"2\"             ", "[note]:  \"n\",   \"notification\", \"1\"             ", "[null]:  \"off\",                   \"0\"             ", "[local]: \"l\",   \"locality\",     \"onlyme\"        ", "=[End Help]===================={Next: Funny Callouts}=" };

		private static readonly string[] helpPage5 = new string[6] { "============[Eject Callouts: Help Page 5/10]=========", "/ejc funny [number] to change to funny callouts       ", "[1]: Funny Callouts (Random Lines)                    ", "[0]: Serious Callouts (Set Lines)                     ", "Example: \"/ejc funny 1\"                             ", "=[End Help]========================={Next: Omissions}=" };

		private static readonly string[] helpPage6 = new string[7] { "============[Eject Callouts: Help Page 6/10]===========", "/ejc omit [text] [number] to change whether you want", "that group of items to be called out when you drop", "them.", "Example: \"/ejc omit nano 1\", makes sure not to call", "out when you drop nano alloy chunks.", "=[End Help]================{Next: Omission Types pt.1}=" };

		private static readonly string[] helpPage7 = new string[7] { "============[Eject Callouts: Help Page 7/10]===========", "Omission Types: Pt. 1", "/ejc omit nano [0/1], changes nano alloy callouts", "/ejc omit bio [0/1], changes biomass callouts", "/ejc omit generic [0/1], changes generic items callouts", "Generic = Hull repair plates / Beacons", "=[End Help]================{Next: Omission Types pt.2}=" };

		private static readonly string[] helpPage8 = new string[7] { "============[Eject Callouts: Help Page 8/10]===========", "Omission Types: Pt. 2", "/ejc omit ammo [0/1], changes ammo callouts", "/ejc omit weapons [0/1], changes weapon crate callouts", "/ejc omit mods [0/1], changes weapon mod callouts", "/ejc omit crates [0/1], changes animus crate callouts", "=[End Help]================{Next: Omission Types pt.3}=" };

		private static readonly string[] helpPage9 = new string[7] { "============[Eject Callouts: Help Page 9/10]===========", "Omission Types: Pt. 3", "/ejc omit shards [0/1], changes data shard callouts", " -Only works on data shards", "/ejc omit class [0/1], changes class specific item callouts", " -Only applies to ship system upgrader/oxygen infusor", "=[End Help]================{Next: Omission Types pt.4}=" };

		private static readonly string[] helpPage10 = new string[7] { "============[Eject Callouts: Help Page 10/10]==========", "Omission Types: Pt. 4", "/ejc omit homun [0/1], changes homunculus callouts", " -Only works on the homunculus", "/ejc omit relic [0/1], changes relic callouts", " -Only applies to relics", "=====================[End Help]========================" };

		public override string[] CommandAliases()
		{
			return new string[2] { "ejc", "ejectcallouts" };
		}

		public override string Description()
		{
			return "Changes Eject Callout Status.";
		}

		public override List<Argument> Arguments()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			List<Argument> list = new List<Argument>(5);
			list.Add(new Argument(new string[3] { "item", "note", "null" }));
			list.Add(new Argument("local", new Argument(new string[2] { "false", "true" })));
			list.Add(new Argument("funny", new Argument(new string[2] { "false", "true" })));
			list.Add(new Argument("help", new Argument(new string[1] { "%integer" })));
			list.Add(new Argument("omit", new Argument(omitArguments, new Argument(new string[1] { "%integer" }))));
			return list;
		}

		public override void Execute(string arguments)
		{
			string[] array = arguments.ToLower().Split(new char[1] { ' ' });
			switch (array[0])
			{
			case "item":
				Configs.commandsOn.Value = CommandMode.ITEMSONLY;
				Messaging.Echo("Callouts Set to Items Only.", true);
				break;
			case "note":
				Configs.commandsOn.Value = CommandMode.NOTIFICATIONSONLY;
				Messaging.Echo("Callouts Set to Notifications Only.", true);
				break;
			case "null":
				Configs.commandsOn.Value = CommandMode.NULL;
				Messaging.Echo("Callouts Set to No Callouts.", true);
				break;
			case "local":
				if (array.Length < 2)
				{
					if (!Configs.sendToAll.Value)
					{
						Messaging.Echo("Locality Currenty Set to: Only you can hear.", true);
					}
					else
					{
						Messaging.Echo("Locality Currenty Set to: Everyone can hear.", true);
					}
				}
				else if (array[1].Equals("true"))
				{
					Configs.sendToAll.Value = false;
					Messaging.Echo("Callouts Set to Only you hear.", true);
				}
				else if (array[1].Equals("false"))
				{
					Configs.sendToAll.Value = true;
					Messaging.Echo("Callouts Set to Everyone hear.", true);
				}
				else
				{
					Messaging.Echo("[Invalid Command]: type \"/ejc help 3\", for more information", true);
				}
				break;
			case "funny":
				if (array.Length < 2)
				{
					if (Configs.funnyMessages.Value)
					{
						Messaging.Echo("Callout Type: Funny :)", true);
					}
					else
					{
						Messaging.Echo("Callout Type: Serious", true);
					}
				}
				else if (array[1].Equals("true"))
				{
					Configs.funnyMessages.Value = true;
					Messaging.Echo("Set Callouts to Funny :)", true);
				}
				else if (array[1].Equals("false"))
				{
					Configs.funnyMessages.Value = false;
					Messaging.Echo("Set Callouts to Serious", true);
				}
				else
				{
					Messaging.Echo("[Invalid Command]: Invalid Callout Type number.", true);
				}
				break;
			case "help":
				if (array.Length < 2 || array[1].Equals("1"))
				{
					printHelpPage(helpPage1);
				}
				else if (array[1].Equals("2"))
				{
					printHelpPage(helpPage2);
				}
				else if (array[1].Equals("3"))
				{
					printHelpPage(helpPage3);
				}
				else if (array[1].Equals("4"))
				{
					printHelpPage(helpPage4);
				}
				else if (array[1].Equals("5"))
				{
					printHelpPage(helpPage5);
				}
				else if (array[1].Equals("6"))
				{
					printHelpPage(helpPage6);
				}
				else if (array[1].Equals("7"))
				{
					printHelpPage(helpPage7);
				}
				else if (array[1].Equals("8"))
				{
					printHelpPage(helpPage8);
				}
				else if (array[1].Equals("9"))
				{
					printHelpPage(helpPage9);
				}
				else if (array[1].Equals("10"))
				{
					printHelpPage(helpPage10);
				}
				else
				{
					Messaging.Echo("[Invalid Command]: Invalid Help page number. [Max 10]", true);
				}
				break;
			case "omit":
			{
				if (array.Length < 2)
				{
					Messaging.Echo("[Invalid Command]: Requires Additional arguments.", true);
					break;
				}
				string text = "";
				switch (array[1])
				{
				case "nano":
				case "alloy":
				case "nanoalloy":
					text = "Nano Alloy";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.nanoOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.nanoOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.nanoOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "biomass":
				case "mass":
				case "bio":
					text = "Biomass";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.bioOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.bioOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.bioOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "genericitems":
				case "generic":
					text = "Generic Items";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.genericOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.genericOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.genericOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "ammo":
				case "weaponammo":
					text = "Weapon Ammo";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.ammoOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.ammoOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.ammoOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "weapons":
				case "composite":
					text = "Composite Weapons";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.weaponOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.weaponOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.weaponOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "mods":
				case "weaponmods":
					text = "Weapon Mods";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.modOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.modOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.modOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "crates":
				case "animus":
				case "animuscrates":
					text = "Animus Crates";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.crateOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.crateOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.crateOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "datashards":
				case "shards":
				case "data":
					text = "Data Shards";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.shardOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.shardOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.shardOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "classitems":
				case "class":
					text = "Class Items";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.classOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.classOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.classOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "homunculus":
				case "homun":
					text = "Homunculus";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.homunculusOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.homunculusOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.homunculusOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				case "relic":
					text = "Relics";
					if (array.Length < 3)
					{
						Messaging.Echo("Omission [" + text + "]: " + boolToString(Configs.relicOmit.Value), true);
					}
					else if (array[2].Equals("1"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to True", true);
						Configs.relicOmit.Value = true;
					}
					else if (array[2].Equals("0"))
					{
						Messaging.Echo("Omission [" + text + "]: Set to False", true);
						Configs.relicOmit.Value = false;
					}
					else
					{
						Messaging.Echo("[Invalid Command]: Omissions [" + text + "] only allows 0 or 1", true);
					}
					break;
				}
				break;
			}
			case "debug":
				if (array.Length < 2)
				{
					Messaging.Echo($"Debug Status: {debugEjectCallouts}", true);
				}
				else if (array[1].Equals("1"))
				{
					debugEjectCallouts = true;
					Messaging.Echo($"Debug Status: {debugEjectCallouts}", true);
				}
				else if (array[1].Equals("0"))
				{
					debugEjectCallouts = false;
					Messaging.Echo($"Debug Status: {debugEjectCallouts}", true);
				}
				else
				{
					Messaging.Echo("[Invalid Command]: Input only 1 or 0 for Debug.", true);
				}
				break;
			default:
				Messaging.Echo("[Invalid Command]: type \"/ejc help\", for more information", true);
				break;
			}
		}

		public static string boolToString(bool b)
		{
			if (b)
			{
				return "True";
			}
			return "False";
		}

		public static void printHelpPage(string[] helpPage)
		{
			foreach (string text in helpPage)
			{
				Messaging.Echo(text, true);
			}
		}
	}
	internal class Configs
	{
		internal static ConfigEntry<bool> funnyMessages;

		internal static ConfigEntry<bool> sendToAll;

		internal static ConfigEntry<Commands.CommandMode> commandsOn;

		internal static ConfigEntry<Commands.communicationShip> communicationShip;

		internal static ConfigEntry<bool> nanoOmit;

		internal static ConfigEntry<bool> bioOmit;

		internal static ConfigEntry<bool> genericOmit;

		internal static ConfigEntry<bool> ammoOmit;

		internal static ConfigEntry<bool> weaponOmit;

		internal static ConfigEntry<bool> crateOmit;

		internal static ConfigEntry<bool> modOmit;

		internal static ConfigEntry<bool> shardOmit;

		internal static ConfigEntry<bool> classOmit;

		internal static ConfigEntry<bool> relicOmit;

		internal static ConfigEntry<bool> homunculusOmit;

		internal static void Load(Plugin plugin)
		{
			funnyMessages = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "funnyMessages", false, (ConfigDescription)null);
			sendToAll = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "sendToAll", true, (ConfigDescription)null);
			commandsOn = ((BaseUnityPlugin)plugin).Config.Bind<Commands.CommandMode>("EjectCallouts", "commandMode", Commands.CommandMode.ITEMSONLY, (ConfigDescription)null);
			nanoOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "nanoOmit", false, (ConfigDescription)null);
			bioOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "bioOmit", false, (ConfigDescription)null);
			genericOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "genericOmit", false, (ConfigDescription)null);
			ammoOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "ammoOmit", false, (ConfigDescription)null);
			weaponOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "weaponOmit", false, (ConfigDescription)null);
			crateOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "crateOmit", false, (ConfigDescription)null);
			modOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "modOmit", false, (ConfigDescription)null);
			shardOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "shardOmit", false, (ConfigDescription)null);
			classOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "classOmit", false, (ConfigDescription)null);
			relicOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "relicOmit", false, (ConfigDescription)null);
			homunculusOmit = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EjectCallouts", "homunculusOmit", false, (ConfigDescription)null);
			communicationShip = ((BaseUnityPlugin)plugin).Config.Bind<Commands.communicationShip>("EjectCallouts", "communucationShip", Commands.communicationShip.BOTH, (ConfigDescription)null);
		}
	}
	[HarmonyPatch(typeof(Carrier), "TryEjectCarryable")]
	internal class EjectPatch
	{
		private static string itemName = "";

		private static int itemTier = -1;

		internal static string[] funnyMessagesItem = new string[9] { "What is *? Well, its over here.", "I FOUND *! Why was it over there anyway?", "OMG *, I definitely needed this.", "*, who are you to tell me I needed you.", "BEGONE, *", "I wonder how they got * to be so heavy.", "I'd love to fight a Hollow Reclaimer with *.", "METEM PRESERVE *.", "I tried to eat *, it was too spicy for my taste." };

		internal static string[] funnyMessages = new string[9] { "I dropped some of my biomass, I mean an Item.", "HEY YOU, GET THAT ITEM PLEASE. I dropped it...", "Idk why I had this... better in your hands, I guess.", "Are you wanting this? Cause I don't need it.", "Oh god, I need to wash my hands.", "Do you need to hear the word of METEM?", "Maybe this item goes here. Hmm...", "A beauty this is to behold. An Item!", "This item is gonna solo the Reclaimer, I can feel it!" };

		private static readonly Random rand = new Random();

		private static readonly string[] animusCrateNames = new string[8] { "Power Generator", "Gravity Scoop", "Arc Shield", "Kinetic Point Defense", "Life Support", "Thurster Booster Station", "Charge Station", "Blank Animus Crate" };

		private static readonly string[] genericItemNames = new string[2] { "Hull Repair Plate", "Decoy Signature Lure" };

		private static readonly string[] ammoNames = new string[3] { "Power Cell", "Light Caliber", "Heavy Caliber" };

		private static readonly string[] relicNames = new string[21]
		{
			"The Lone Ectype", "Starboard Blessing", "Port Blessing", "Sacred Power Conduit", "Void-powered Shell", "Forward Emissary", "Aftshock Rebuke", "Blessed Bossters", "Energy Ascension", "Kinetic Ascension",
			"Astral Gravity Well", "Point Defence Ascension", "Benediction Fury", "Carronade Psalm", "Litany Bullet Hymn", "Recusers Lament", "Heat Tempered Aegis", "Close-quarters", "Bullet Storm", "Energy Overload",
			"Drive By Shooting"
		};

		private static readonly string[] biomassNames = new string[1] { "Biomass Canister" };

		private static readonly string[] nanoAlloyNames = new string[1] { "Nano Alloy Cluster" };

		private static readonly string[] modNames = new string[11]
		{
			"Heatsink", "Reload Optimizer", "Accuracy", "Damage", "Power Optimizer", "Zoom", "Fire Rate", "Close Quarter", "Sniper Protocol", "Relentless Assault",
			"High Damage"
		};

		private static readonly string[] shardNames = new string[4] { "Ancient Data Shard", "Minefield", "Escort", "Quantum Data Shard" };

		private static readonly string[] weaponNames = new string[1] { "Composite Weapon" };

		private static readonly string[] classItemNames = new string[2] { "Ship System Upgrader MkI", "Oxygenated Blood Pack" };

		private static void Prefix(Carrier __instance)
		{
			itemName = ((AbstractCloneStarObject)__instance.Payload).DisplayName;
			if (itemName.Contains("Animus Crate:") || itemName.Contains("Data Shard:"))
			{
				removePrefix(ref itemName);
			}
			itemName.TrimStart(Array.Empty<char>());
			itemName.TrimEnd(Array.Empty<char>());
			itemTier = itemNameToTier(itemName);
		}

		private static void Postfix(Carrier __instance)
		{
			if (Commands.debugEjectCallouts)
			{
				printDebugInfo(__instance);
				return;
			}
			if (needsOmission(itemName, nanoAlloyNames, Configs.nanoOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, biomassNames, Configs.bioOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, genericItemNames, Configs.genericOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, ammoNames, Configs.ammoOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, animusCrateNames, Configs.crateOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, weaponNames, Configs.weaponOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, modNames, Configs.modOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, classItemNames, Configs.classOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, shardNames, Configs.shardOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, relicNames, Configs.relicOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (needsOmission(itemName, "Homunculus", Configs.homunculusOmit.Value))
			{
				resetItemNameTier();
				return;
			}
			if (Configs.communicationShip.Value == Commands.communicationShip.INSIDEONLY && ((IEnvironmentalObject)__instance.Owner).IsInSpace)
			{
				resetItemNameTier();
				return;
			}
			if (Configs.communicationShip.Value == Commands.communicationShip.OUTSIDEONLY && !((IEnvironmentalObject)__instance.Owner).IsInSpace)
			{
				resetItemNameTier();
				return;
			}
			switch (Configs.commandsOn.Value)
			{
			case Commands.CommandMode.ITEMSONLY:
				if (Configs.funnyMessages.Value)
				{
					int num = rand.Next(funnyMessagesItem.Length);
					string text = combinePhrase(splitPhrase(funnyMessagesItem[num]), itemName);
					Messaging.Echo(text, !Configs.sendToAll.Value || !VoidManagerPlugin.sessionFeaturesEnabled);
				}
				else
				{
					Messaging.Echo("Dropped: " + itemName, !Configs.sendToAll.Value || !VoidManagerPlugin.sessionFeaturesEnabled);
				}
				break;
			case Commands.CommandMode.NOTIFICATIONSONLY:
				if (Configs.funnyMessages.Value)
				{
					Messaging.Echo(funnyMessages[rand.Next(funnyMessages.Length)], !Configs.sendToAll.Value || !VoidManagerPlugin.sessionFeaturesEnabled);
				}
				else
				{
					Messaging.Echo("Hey, I dropped an Item!", !Configs.sendToAll.Value || !VoidManagerPlugin.sessionFeaturesEnabled);
				}
				break;
			}
			resetItemNameTier();
		}

		private static bool isInList(string name, string[] list)
		{
			foreach (string value in list)
			{
				if (name.Contains(value))
				{
					return true;
				}
			}
			return false;
		}

		private static bool needsOmission(string name, string[] list, bool b)
		{
			if (b && isInList(name, list))
			{
				return true;
			}
			return false;
		}

		private static bool needsOmission(string name, string list, bool b)
		{
			if (b && name.Contains(list))
			{
				return true;
			}
			return false;
		}

		private static void resetItemNameTier()
		{
			itemName = "";
			itemTier = -1;
		}

		private static void printPrivately(string text)
		{
			Messaging.Echo(text, true);
		}

		private static void printDebugInfo(Carrier instance)
		{
			Messaging.Echo("===================================", true);
			Messaging.Echo("Player Name: " + ((IOrbitObject)instance.Owner).DisplayName, true);
			Messaging.Echo("Item Name: " + itemName, true);
			Messaging.Echo($"Send To All Value: {Configs.sendToAll.Value}", true);
			Messaging.Echo($"Funny Message Value: {Configs.funnyMessages.Value}", true);
			Messaging.Echo($"Command Type: {Configs.commandsOn.Value}", true);
			Messaging.Echo($"Ship Setting: {Configs.communicationShip.Value}", true);
			Messaging.Echo($"Host Permission / Payload in Space: {VoidManagerPlugin.sessionFeaturesEnabled} / {Commands.boolToString(((IEnvironmentalObject)instance.Owner).IsInSpace)}", true);
			Messaging.Echo("===================================", true);
		}

		private static int itemNameToTier(string itemN)
		{
			if (itemN == null || itemN.Length < 4)
			{
				return -1;
			}
			if (itemN.Contains("MkIII"))
			{
				return 3;
			}
			if (itemN.Contains("MkII"))
			{
				return 2;
			}
			if (itemN.Contains("MkI"))
			{
				return 1;
			}
			return -1;
		}

		private static void removePrefix(ref string itemN)
		{
			string[] array = itemName.Split(new char[1] { ':' });
			itemN = array[1];
		}

		private static string[] splitPhrase(string phrase)
		{
			return phrase.Split(new char[1] { '*' });
		}

		private static string combinePhrase(string[] phrase, string ItemName)
		{
			string text = "";
			int num = 0;
			for (int i = 0; i < phrase.Length * 2 - 1; i++)
			{
				if (i % 2 == 0)
				{
					text += phrase[num];
					num++;
				}
				else
				{
					text += ItemName;
				}
			}
			return text;
		}
	}
	internal class GUI : ModSettingsMenu
	{
		public override string Name()
		{
			return "Eject Callouts";
		}

		public override void Draw()
		{
			GUILayout.Label("Eject Callout Settings: ", Array.Empty<GUILayoutOption>());
			bool flag = Configs.commandsOn.Value == Commands.CommandMode.ITEMSONLY;
			if (GUITools.DrawCheckbox("Set Callouts to Name + Items", ref flag) && Configs.commandsOn.Value != Commands.CommandMode.ITEMSONLY)
			{
				Configs.commandsOn.Value = Commands.CommandMode.ITEMSONLY;
			}
			bool flag2 = Configs.commandsOn.Value == Commands.CommandMode.NOTIFICATIONSONLY;
			if (GUITools.DrawCheckbox("Set Callouts to Name Only", ref flag2) && Configs.commandsOn.Value != Commands.CommandMode.NOTIFICATIONSONLY)
			{
				Configs.commandsOn.Value = Commands.CommandMode.NOTIFICATIONSONLY;
			}
			bool flag3 = Configs.commandsOn.Value == Commands.CommandMode.NULL;
			if (GUITools.DrawCheckbox("Set Callouts to off", ref flag3) && Configs.commandsOn.Value != 0)
			{
				Configs.commandsOn.Value = Commands.CommandMode.NULL;
			}
			GUILayout.Label("", Array.Empty<GUILayoutOption>());
			bool flag4 = Configs.communicationShip.Value == Commands.communicationShip.INSIDEONLY;
			if (GUITools.DrawCheckbox("Callouts Reserved for inside ship", ref flag4) && Configs.communicationShip.Value != 0)
			{
				Configs.communicationShip.Value = Commands.communicationShip.INSIDEONLY;
			}
			bool flag5 = Configs.communicationShip.Value == Commands.communicationShip.OUTSIDEONLY;
			if (GUITools.DrawCheckbox("Callouts Reserved for outside ship", ref flag5) && Configs.communicationShip.Value != Commands.communicationShip.OUTSIDEONLY)
			{
				Configs.communicationShip.Value = Commands.communicationShip.OUTSIDEONLY;
			}
			bool flag6 = Configs.communicationShip.Value == Commands.communicationShip.BOTH;
			if (GUITools.DrawCheckbox("Callouts Reserved for inside & outside ship", ref flag6) && Configs.communicationShip.Value != Commands.communicationShip.BOTH)
			{
				Configs.communicationShip.Value = Commands.communicationShip.BOTH;
			}
			GUILayout.Label("", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Omission Settings: ", Array.Empty<GUILayoutOption>());
			GUITools.DrawCheckbox(": Omit Nano Alloy", ref Configs.nanoOmit);
			GUITools.DrawCheckbox(": Omit Biomass", ref Configs.bioOmit);
			GUITools.DrawCheckbox(": Omit Generic Items", ref Configs.genericOmit);
			GUITools.DrawCheckbox(": Omit Weapon Ammo", ref Configs.ammoOmit);
			GUITools.DrawCheckbox(": Omit Composite Weapons", ref Configs.weaponOmit);
			GUITools.DrawCheckbox(": Omit Animus Crates", ref Configs.crateOmit);
			GUITools.DrawCheckbox(": Omit Weapon Mods", ref Configs.modOmit);
			GUITools.DrawCheckbox(": Omit Data Shards", ref Configs.shardOmit);
			GUITools.DrawCheckbox(": Omit Class Specific Items", ref Configs.classOmit);
			GUITools.DrawCheckbox(": Omit Relics", ref Configs.relicOmit);
			GUITools.DrawCheckbox(": Omit Homunculus", ref Configs.homunculusOmit);
			GUILayout.Label("", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Additional Settings: ", Array.Empty<GUILayoutOption>());
			GUITools.DrawCheckbox("Messages are shown to only self", ref Configs.sendToAll);
			GUITools.DrawCheckbox("Messages are funny", ref Configs.funnyMessages);
		}
	}
	public class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Gruncle_Chuck.EjectCallouts";

		public const string PLUGIN_NAME = "EjectCallouts";

		public const string USERS_PLUGIN_NAME = "Eject Callouts";

		public const string PLUGIN_VERSION = "1.1.2";

		public const string PLUGIN_DESCRIPTION = "Calls out to your allies when you drop an item. Also can tells which item you dropped.";

		public const string PLUGIN_ORIGINAL_AUTHOR = "Gruncle_Chuck";

		public const string PLUGIN_AUTHORS = "Gruncle Chuck";

		public const string PLUGIN_THUNDERSTORE_ID = "";
	}
	[BepInPlugin("Gruncle_Chuck.EjectCallouts", "Eject Callouts", "1.1.2")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource log;

		private void Awake()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			Configs.Load(this);
			log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Gruncle_Chuck.EjectCallouts is loaded!");
		}
	}
	internal class VoidManagerPlugin : VoidPlugin
	{
		internal static bool sessionFeaturesEnabled;

		public override string Author => "Gruncle Chuck";

		public override string Description => "Calls out to your allies when you drop an item. Also can tells which item you dropped.";

		public override MultiplayerType MPType => (MultiplayerType)8;

		public override SessionChangedReturn OnSessionChange(SessionChangedInput input)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (input.IsHost || input.IsMod_Session)
			{
				sessionFeaturesEnabled = true;
			}
			SessionChangedReturn result = default(SessionChangedReturn);
			result.SetMod_Session = true;
			return result;
		}
	}
}