Decompiled source of CruiserCourier v1.0.5

CruiserCourier.dll

Decompiled 2 days 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 CruiserCourier.Patches;
using HarmonyLib;
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("CruiserCourier")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CruiserCourier")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("04db65a9-a0d5-4ffd-a53b-1c22f862d268")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CruiserCourier
{
	[BepInPlugin("rogan.CruiserCourier", "Cruiser Courier", "1.0.4")]
	public class CruiserCourierBase : BaseUnityPlugin
	{
		private const string modGUID = "rogan.CruiserCourier";

		private const string modName = "Cruiser Courier";

		private const string modVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("rogan.CruiserCourier");

		private static CruiserCourierBase Instance;

		internal static ManualLogSource mls;

		public static ConfigEntry<int> Interval;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			LoadConfigs();
			mls = Logger.CreateLogSource("rogan.CruiserCourier");
			mls.LogInfo((object)"CruiserDelivery Started!");
			harmony.PatchAll(typeof(CruiserCourierBase));
			harmony.PatchAll(typeof(TimeScalarPatch));
			harmony.PatchAll(typeof(StartRoundPatch));
			harmony.PatchAll(typeof(DropshipVehiclePatch));
		}

		private void LoadConfigs()
		{
			Interval = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "interval", 0, "This isn't used anywhere yet; check again soon!");
		}
	}
}
namespace CruiserCourier.Patches
{
	[HarmonyPatch(typeof(Terminal))]
	internal class DropshipVehiclePatch
	{
		public static bool ordered;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void cruiserCostPatch(ref int ___orderedVehicleFromTerminal)
		{
			if (TimeScalarPatch.hour == 1)
			{
				ordered = false;
			}
			if (!StartRoundPatch.magnet && TimeScalarPatch.hour == 3 && ___orderedVehicleFromTerminal == -1 && !ordered)
			{
				ordered = true;
				___orderedVehicleFromTerminal = 0;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void vehicleDropPatch(ref int ___vehicleInDropship)
		{
			if (!StartRoundPatch.magnet && TimeScalarPatch.hour == 3 && ___vehicleInDropship == 0 && !ordered)
			{
				ordered = true;
				___vehicleInDropship = 1;
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartRoundPatch
	{
		public static bool magnet;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void magnetPatch(ref bool ___magnetOn)
		{
			if (TimeScalarPatch.hour == 1)
			{
				magnet = ___magnetOn;
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeScalarPatch
	{
		public static int hour;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void timeScalarPatch(ref int ___hour)
		{
			hour = ___hour;
		}
	}
}