Decompiled source of BCME ExternalModule v0.1.9

BepInEx/plugins/BrutalCompanyMinusExtra - ExternalModule.dll

Decompiled 2 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.Logging;
using BrutalCompanyMinus.Minus;
using BrutalCompanyMinus.Minus.Events;
using ExternalModule;
using ExternalModule.Events;
using ExternalModule.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BrutalCompanyMinusExtra - ExternalModule")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BrutalCompanyMinusExtra - ExternalModule")]
[assembly: AssemblyTitle("BrutalCompanyMinusExtra - ExternalModule")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BrutalCompanyMinus.Minus.Events
{
	public class TakeyPlush : MEvent
	{
		public static TakeyPlush Instance;

		public override string Name()
		{
			return "TakeyPlush";
		}

		public override void Initalize()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0090: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			base.Weight = 1;
			base.Descriptions = new List<string> { "TakeySit", "I know this guy...", "Streamer?" };
			base.ColorHex = "#008000";
			base.Type = (EventType)3;
			base.scrapTransmutationEvent = new ScrapTransmutationEvent(new Scale(0.5f, 0.008f, 0.5f, 0.9f), (SpawnableItemWithRarity[])(object)new SpawnableItemWithRarity[1]
			{
				new SpawnableItemWithRarity
				{
					spawnableItem = Helper.GetItemByName("Smol Takey", matchCase: false),
					rarity = 100
				}
			});
			base.EventsToRemove = new List<string> { "RealityShift", "Pickles" };
			base.ScaleList.Add((ScaleType)8, new Scale(1f, 0.005f, 1f, 1.5f));
		}

		public override bool AddEventIfOnly()
		{
			if (!Manager.transmuteScrap)
			{
				Manager.transmuteScrap = true;
				return true;
			}
			return false;
		}

		public override void Execute()
		{
			Manager.scrapAmountMultiplier *= ((MEvent)this).Getf((ScaleType)8);
			base.scrapTransmutationEvent.Execute();
		}
	}
	internal class TakeyGokuPlushBig : MEvent
	{
		public static TakeyGokuPlushBig Instance;

		public override string Name()
		{
			return "TakeyGokuPlushBig";
		}

		public override void Initalize()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			base.Weight = 1;
			base.Descriptions = new List<string> { "TakeyGoku... but harmless", "Big plushie" };
			base.ColorHex = "#A0DB8E";
			base.Type = (EventType)2;
			base.scrapTransmutationEvent = new ScrapTransmutationEvent(new Scale(0.5f, 0.008f, 0.5f, 0.9f), (SpawnableItemWithRarity[])(object)new SpawnableItemWithRarity[1]
			{
				new SpawnableItemWithRarity
				{
					spawnableItem = Helper.GetItemByName("Takey Goku", matchCase: false),
					rarity = 100
				}
			});
			base.EventsToRemove = new List<string> { "RealityShift", "Pickles", "TakeyPlush", "SussyPaintings", "TakeyGokuPlush", "Dustpans", "Clock" };
			base.ScaleList.Add((ScaleType)8, new Scale(1f, 0.005f, 1f, 1.5f));
		}

		public override bool AddEventIfOnly()
		{
			if (!Manager.transmuteScrap)
			{
				Manager.transmuteScrap = true;
				return true;
			}
			return false;
		}

		public override void Execute()
		{
			Manager.scrapAmountMultiplier *= ((MEvent)this).Getf((ScaleType)8);
			base.scrapTransmutationEvent.Execute();
		}
	}
}
namespace ExternalModule
{
	internal class Helper
	{
		public static Item GetItemByName(string itemName, bool matchCase = true)
		{
			StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture);
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if (items.itemName.Equals(itemName, comparisonType))
				{
					return items;
				}
			}
			return null;
		}
	}
	internal class Log
	{
		internal static ManualLogSource logSource;

		internal static void Initalize(ManualLogSource LogSource)
		{
			logSource = LogSource;
		}

		internal static void LogDebug(object data)
		{
			logSource.LogDebug(data);
		}

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

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

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

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

		internal static void LogWarning(object data)
		{
			logSource.LogWarning(data);
		}
	}
	[HarmonyPatch]
	[BepInPlugin("BCME-ExternalModule", "BCME-ExternalModule-UnloadedHangar", "0.1.9")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class ExternalModule : BaseUnityPlugin
	{
		private const string GUID = "BCME-ExternalModule";

		private const string NAME = "BCME-ExternalModule-UnloadedHangar";

		private const string VERSION = "0.1.9";

		private static readonly Harmony harmony = new Harmony("BCME-ExternalModule");

		private void Awake()
		{
			Log.Initalize(((BaseUnityPlugin)this).Logger);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"BCME-ExternalModule loaded");
			try
			{
				Manager.EventAddition();
			}
			catch
			{
				Log.LogFatal(new DllNotFoundException("BrutalCompanyMinusExtra not found, BCME-ExternalModule can not continue... Abotring!"));
				harmony.UnpatchSelf();
			}
			harmony.PatchAll();
		}
	}
}
namespace ExternalModule.Patches
{
	public class Manager
	{
		public static void EventAddition()
		{
			EventManager.moddedEvents.Add((MEvent)(object)new TakeyGokuPlush());
			Log.LogWarning("Addidng TakeyGokuPlush event");
			EventManager.moddedEvents.Add((MEvent)(object)new ZombiesPlush());
			Log.LogWarning("Addidng ZombiesPlush event");
			EventManager.moddedEvents.Add((MEvent)(object)new TakeyGokuPlushBig());
			Log.LogWarning("Addidng TakeyGokuPlushBig event");
			EventManager.moddedEvents.Add((MEvent)(object)new TakeyPlush());
			Log.LogWarning("Addidng TakeyPlush event");
		}
	}
}
namespace ExternalModule.Events
{
	public class TakeyGokuPlush : MEvent
	{
		public static TakeyGokuPlush Instance;

		public override string Name()
		{
			return "TakeyGokuPlush";
		}

		public override void Initalize()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			base.Weight = 1;
			base.Descriptions = new List<string> { "TakeyGoku... but small", "TakeyGoku plushie" };
			base.ColorHex = "#008000";
			base.Type = (EventType)3;
			base.scrapTransmutationEvent = new ScrapTransmutationEvent(new Scale(0.5f, 0.008f, 0.5f, 0.9f), (SpawnableItemWithRarity[])(object)new SpawnableItemWithRarity[1]
			{
				new SpawnableItemWithRarity
				{
					spawnableItem = Helper.GetItemByName("Smol Takey Goku", matchCase: false),
					rarity = 100
				}
			});
			base.EventsToRemove = new List<string> { "RealityShift", "Pickles", "TakeyPlush", "SussyPaintings", "TakeyGokuPlushBig", "Dustpans", "Clock" };
			base.ScaleList.Add((ScaleType)8, new Scale(1f, 0.005f, 1f, 1.5f));
		}

		public override bool AddEventIfOnly()
		{
			if (!Manager.transmuteScrap)
			{
				Manager.transmuteScrap = true;
				return true;
			}
			return false;
		}

		public override void Execute()
		{
			Manager.scrapAmountMultiplier *= ((MEvent)this).Getf((ScaleType)8);
			base.scrapTransmutationEvent.Execute();
		}
	}
	internal class ZombiesPlush : MEvent
	{
		public static ZombiesPlush Instance;

		public override string Name()
		{
			return "ZombiesPlush";
		}

		public override void Initalize()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			base.Weight = 1;
			base.Descriptions = new List<string> { "Apocalypse... but better", "Zombies plush" };
			base.ColorHex = "#008000";
			base.Type = (EventType)3;
			base.scrapTransmutationEvent = new ScrapTransmutationEvent(new Scale(0.5f, 0.008f, 0.5f, 0.9f), (SpawnableItemWithRarity[])(object)new SpawnableItemWithRarity[1]
			{
				new SpawnableItemWithRarity
				{
					spawnableItem = Helper.GetItemByName("Smol Zombies", matchCase: false),
					rarity = 100
				}
			});
			base.EventsToRemove = new List<string> { "RealityShift", "Pickles", "TakeyPlush", "SussyPaintings", "TakeyGokuPlushBig", "Dustpans", "Clock" };
			base.ScaleList.Add((ScaleType)8, new Scale(1f, 0.005f, 1f, 1.5f));
		}

		public override bool AddEventIfOnly()
		{
			if (!Manager.transmuteScrap)
			{
				Manager.transmuteScrap = true;
				return true;
			}
			return false;
		}

		public override void Execute()
		{
			Manager.scrapAmountMultiplier *= ((MEvent)this).Getf((ScaleType)8);
			base.scrapTransmutationEvent.Execute();
		}
	}
}