Decompiled source of ConcordScrap v1.0.0

ConcordScrap.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ConcordScrap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ConcordScrap")]
[assembly: AssemblyTitle("ConcordScrap")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ConcordScrap
{
	[BepInPlugin("ConcordScrap", "ConcordScrap", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private ConfigEntry<bool> configEnabled;

		private ConfigEntry<int> configRarity;

		private ConfigEntry<int> configMinValue;

		private ConfigEntry<int> configMaxValue;

		private void LogInfo(string message)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[email protected]: " + message));
		}

		private void LogError(string message)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[email protected]: " + message));
		}

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			LogInfo("Initializing plugin");
			configEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, new ConfigDescription("Spawn Concord cases in the facility", (AcceptableValueBase)null, Array.Empty<object>()));
			configRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Rarity weight", 120, new ConfigDescription("How likely Concord cases are able to spawn", (AcceptableValueBase)null, Array.Empty<object>()));
			configMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Min value", 5, new ConfigDescription("Minimum value, must be > 0", (AcceptableValueBase)null, Array.Empty<object>()));
			configMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max value", 10, new ConfigDescription("Maximum value, must be > minimum value", (AcceptableValueBase)null, Array.Empty<object>()));
			Item val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "concordscrap")).LoadAsset<Item>("Assets/ConcordScrap/ConcordScrapItem.asset");
			if ((Object)(object)val == (Object)null)
			{
				LogError("ConcordScrapItem could not be loaded");
				return;
			}
			if (!configEnabled.Value)
			{
				LogInfo("Spawning disabled in config");
				return;
			}
			if (configMinValue.Value <= 0 || configMaxValue.Value <= configMinValue.Value)
			{
				LogError("Incorrect min/max value, check your config, default values will be used");
				val.minValue = 5;
				val.maxValue = 10;
			}
			else
			{
				val.minValue = configMinValue.Value;
				val.maxValue = configMaxValue.Value;
			}
			Items.RegisterScrap(val, configRarity.Value, (LevelTypes)(-1));
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			LogInfo("Plugin successfully loaded");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ConcordScrap";

		public const string PLUGIN_NAME = "ConcordScrap";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}