Decompiled source of SuperiorSelling v1.0.3

SuperiorSelling.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Lib;
using CSync.Util;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("SuperiorSelling")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod that removes the cap on the number of items on the sell counter on the company moon")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+b752d64c16bdbaf1e6c81f3b18f7884b06440f15")]
[assembly: AssemblyProduct("SuperiorSelling")]
[assembly: AssemblyTitle("SuperiorSelling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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 SuperiorSelling
{
	[DataContract]
	public class Config : SyncedConfig<Config>
	{
		[DataMember]
		public SyncedEntry<int> MaximumItems { get; private set; }

		public Config(ConfigFile cfg)
			: base("SuperiorSelling")
		{
			ConfigManager.Register<Config>(this);
			MaximumItems = Extensions.BindSyncedEntry<int>(cfg, "General", "MaximumItemsToSell", 0, "Maximum amount of items that can be sold at once (Infinite = 0, Vanilla Lethal Company = 12)");
		}
	}
	[BepInPlugin("SuperiorSelling", "SuperiorSelling", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("SuperiorSelling");

		public static Config Config { get; private set; }

		public static Plugin Instance { get; internal set; }

		public static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			Config = new Config(((BaseUnityPlugin)this).Config);
			harmony.PatchAll(Assembly.GetExecutingAssembly());
			Logger.LogInfo((object)"Plugin SuperiorSelling is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SuperiorSelling";

		public const string PLUGIN_NAME = "SuperiorSelling";

		public const string PLUGIN_VERSION = "1.0.3";
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SuperiorSelling";

		public const string PLUGIN_NAME = "SuperiorSelling";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}
namespace SuperiorSelling.Patches
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	internal class DepositItemsPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("PlaceItemOnCounter")]
		private static IEnumerable<CodeInstruction> PlaceItemOnCounterTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			for (int i = 0; i < list.Count - 1; i++)
			{
				if (!(list[i].opcode != OpCodes.Ldc_I4_S))
				{
					if (SyncedInstance<Config>.Instance.MaximumItems.Value <= 0)
					{
						list[i] = new CodeInstruction(OpCodes.Ldc_I4, (object)int.MaxValue);
					}
					else
					{
						list[i] = new CodeInstruction(OpCodes.Ldc_I4, (object)SyncedInstance<Config>.Instance.MaximumItems.Value);
					}
				}
			}
			return list;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}