Decompiled source of RandomMoon v1.0.0

RandomMoon.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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: AssemblyCompany("RandomMoon")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RandomMoon")]
[assembly: AssemblyTitle("RandomMoon")]
[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 RandomMoon
{
	[BepInPlugin("RandomMoon", "RandomMoon", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		private void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RandomMoon is loaded!");
			new Harmony("RandomMoon").PatchAll(Assembly.GetExecutingAssembly());
		}

		public void RouteToRandomPlanet()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Attempting to route to random moon!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Days left on deadline: {TimeOfDay.Instance.daysUntilDeadline}");
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Quota: {TimeOfDay.Instance.profitQuota}/{TimeOfDay.Instance.quotaFulfilled}");
			if (TimeOfDay.Instance.daysUntilDeadline == 0 && TimeOfDay.Instance.profitQuota > TimeOfDay.Instance.quotaFulfilled)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Forcing Company Building (Quota not met yet)");
				StartOfRound.Instance.ChangeLevel(3);
				StartOfRound.Instance.ChangePlanet();
				StartOfRound.Instance.ArriveAtLevel();
				return;
			}
			SelectableLevel val = TimeOfDay.Instance.currentLevel;
			while (val.PlanetName == TimeOfDay.Instance.currentLevel.PlanetName)
			{
				val = StartOfRound.Instance.levels[Random.Range(0, StartOfRound.Instance.levels.Length)];
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Rolled Level: " + val.PlanetName));
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Navigating To: " + val.PlanetName + " (" + ((object)(LevelWeatherType)(ref val.currentWeather)).ToString() + ")"));
			StartOfRound.Instance.ChangeLevel(val.levelID);
			StartOfRound.Instance.ChangePlanet();
			StartOfRound.Instance.ArriveAtLevel();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("StartGame")]
		public static void RandomizeMoonPatch(StartOfRound __instance)
		{
			Plugin.Instance.RouteToRandomPlanet();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "RandomMoon";

		public const string PLUGIN_NAME = "RandomMoon";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}