Decompiled source of CruiserDelivery v1.0.3

CruiserCost.dll

Decompiled 4 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using CruiserCost.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("CruiserCost")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CruiserCost")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("93a04828-5360-44ca-ad20-acfcb8978c85")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CruiserCost
{
	[BepInPlugin("rogan.CruiserDelivery", "Cruiser Delivery", "1.0.0")]
	public class CruiserCostBase : BaseUnityPlugin
	{
		private const string modGUID = "rogan.CruiserDelivery";

		private const string modName = "Cruiser Delivery";

		private const string modVersion = "1.0.0";

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

		private static CruiserCostBase Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("rogan.CruiserDelivery");
			mls.LogInfo((object)"CruiserDelivery Started!");
			harmony.PatchAll(typeof(CruiserCostBase));
			harmony.PatchAll(typeof(TimeScalarPatch));
			harmony.PatchAll(typeof(DropshipVehiclePatch));
		}
	}
}
namespace CruiserCost.Patches
{
	[HarmonyPatch(typeof(Terminal))]
	internal class DropshipVehiclePatch
	{
		public static bool delivered;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void cruiserCostPatch(ref int ___orderedVehicleFromTerminal)
		{
			if (!delivered)
			{
				delivered = true;
				___orderedVehicleFromTerminal = 0;
			}
			else if (TimeScalarPatch.hour == 1)
			{
				delivered = false;
			}
			CruiserCostBase.mls.LogInfo((object)delivered);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void vehicleDropPatch(ref int ___vehicleInDropship)
		{
			if (!delivered)
			{
				delivered = true;
				___vehicleInDropship = 1;
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal class TimeScalarPatch
	{
		public static int hour;

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