Decompiled source of SetCompanySellTime v1.0.0

SetCompanySellTime.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using SetCompanySellTime.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SetCompanySellTime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SetCompanySellTime")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3c35b1b0-2bbf-4865-8b43-19ecefa1e2a2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SetCompanySellTime
{
	[BepInPlugin("com.peter.lethalcompany.deposititemsdeskmod", "Set Company Sell Time", "1.0.0")]
	public class DepositItemsDeskModBase : BaseUnityPlugin
	{
		private const string modGUID = "com.peter.lethalcompany.deposititemsdeskmod";

		private const string modName = "Set Company Sell Time";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("com.peter.lethalcompany.deposititemsdeskmod");

		public static DepositItemsDeskModBase instance;

		internal ManualLogSource log;

		public static ConfigEntry<float> configSellTime;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			log = Logger.CreateLogSource("com.peter.lethalcompany.deposititemsdeskmod");
			configSellTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "sellTime", 2f, "Time in seconds to sell items (min 1 sec max 10 sec)");
			if (configSellTime.Value < 1f)
			{
				configSellTime.Value = 1f;
			}
			if (configSellTime.Value > 10f)
			{
				configSellTime.Value = 10f;
			}
			log.LogInfo((object)"Set Company Sell Time loaded");
			harmony.PatchAll(typeof(DepositItemsDeskModBase));
			harmony.PatchAll(typeof(DepositItemsDeskPatch));
		}
	}
}
namespace SetCompanySellTime.Patches
{
	[HarmonyPatch(typeof(DepositItemsDesk))]
	internal class DepositItemsDeskPatch
	{
		[HarmonyPatch("AddObjectToDeskServerRpc")]
		[HarmonyPostfix]
		private static void patchAddObjectToDeskServerRpc(ref float ___grabObjectsTimer)
		{
			___grabObjectsTimer = DepositItemsDeskModBase.configSellTime.Value;
		}

		[HarmonyPatch("SetPatienceServerRpc")]
		[HarmonyPostfix]
		private static void patchSetPatienceServerRpc(ref CompanyMood ___currentMood)
		{
			___currentMood.judgementSpeed = 0f;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void patchDoorShutAfterSell(ref float ___waitingWithDoorOpenTimer)
		{
			___waitingWithDoorOpenTimer = 20f;
		}
	}
}