Decompiled source of SuperEclipse v0.1.0

Millie.SuperEclipse.dll

Decompiled 3 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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
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("Millie.SuperEclipse")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("Super Eclipse")]
[assembly: AssemblyTitle("Millie.SuperEclipse")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 Super_Eclipse
{
	[BepInPlugin("Millie.SuperEclipse", "Super Eclipse", "0.0.1")]
	public class Super_Eclipse : BaseUnityPlugin
	{
		public static Super_Eclipse Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"Millie.SuperEclipse v0.0.1 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("Millie.SuperEclipse");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Millie.SuperEclipse";

		public const string PLUGIN_NAME = "Super Eclipse";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}
namespace Super_Eclipse.Patches
{
	[HarmonyPatch(typeof(RoundManager), "RefreshEnemiesList")]
	internal class EclipseBuffPatch
	{
		[HarmonyPostfix]
		private static void increasePower(RoundManager __instance)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			int num = 1;
			if ((int)StartOfRound.Instance.currentLevel.currentWeather == 5)
			{
				Debug.Log((object)"Eclipse detected, power x3");
				num = 3;
			}
			if (StartOfRound.Instance.isChallengeFile)
			{
				Random random = new Random(StartOfRound.Instance.randomMapSeed + 5781);
				__instance.currentMaxInsidePower = (__instance.currentLevel.maxEnemyPowerCount + random.Next(0, 8)) * num;
				__instance.currentMaxOutsidePower = (__instance.currentLevel.maxOutsideEnemyPowerCount + random.Next(0, 8)) * num;
			}
			else
			{
				__instance.currentMaxInsidePower = __instance.currentLevel.maxEnemyPowerCount * num;
				__instance.currentMaxOutsidePower = __instance.currentLevel.maxOutsideEnemyPowerCount * num;
			}
			Debug.Log((object)"Power has been set");
		}
	}
	[HarmonyPatch(typeof(EnemyAI), "CheckTimeOfDayToLeave")]
	internal class EnemyLeavePatch
	{
		private static bool Prefix(EnemyAI __instance)
		{
			if (__instance.daytimeEnemyLeaving)
			{
				__instance.daytimeEnemyLeaving = false;
				Debug.Log((object)$"daytimeEnemyLeaving set to {__instance.daytimeEnemyLeaving}");
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(TimeOfDay), "Update")]
	internal class PreventShipLeave
	{
		[HarmonyPostfix]
		private static void StopShipLeave(TimeOfDay __instance)
		{
			if (__instance.shipLeaveAutomaticallyTime != 1.1f)
			{
				__instance.shipLeaveAutomaticallyTime = 1.1f;
				Debug.Log((object)"Ship leave time updated");
			}
			if (__instance.currentDayTime / __instance.totalTime < 1f && __instance.globalTimeSpeedMultiplier != 1000f)
			{
				__instance.globalTimeSpeedMultiplier = 1000f;
				Debug.Log((object)"Time speed updated to 1000");
			}
			else if (__instance.currentDayTime / __instance.totalTime >= 1f && __instance.globalTimeSpeedMultiplier != 1f)
			{
				__instance.globalTimeSpeedMultiplier = 1f;
				Debug.Log((object)"Time speed updated to 1");
			}
			if (!__instance.shipLeavingAlertCalled)
			{
				__instance.shipLeavingAlertCalled = true;
				Debug.Log((object)"Ship leaving alert disabled");
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager), "Update")]
	internal class VoteTextPatch
	{
		[HarmonyPostfix]
		private static void textPatch(HUDManager __instance)
		{
			((TMP_Text)__instance.holdButtonToEndGameEarlyText).text = "Ship is not leaving";
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel")]
	internal class WeatherDisplayPatch
	{
		[HarmonyPostfix]
		private static void updateScreenInfo(StartOfRound __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			string text = (((int)__instance.currentLevel.currentWeather == -1) ? "Weather: Super Eclipsed" : ("Weather: Super Eclipsed, " + ((object)(LevelWeatherType)(ref __instance.currentLevel.currentWeather)).ToString()));
			string levelDescription = __instance.currentLevel.LevelDescription;
			if (__instance.isChallengeFile)
			{
				((TMP_Text)__instance.screenLevelDescription).text = "Orbiting: " + GameNetworkManager.Instance.GetNameForWeekNumber(-1) + "\n" + levelDescription + "\n" + text;
			}
			else
			{
				((TMP_Text)__instance.screenLevelDescription).text = "Orbiting: " + __instance.currentLevel.PlanetName + "\n" + levelDescription + "\n" + text;
			}
		}
	}
	[HarmonyPatch(typeof(TimeOfDay), "SetWeatherEffects")]
	internal class WeatherEffectPatch
	{
		[HarmonyPostfix]
		private static void weatherPatch(TimeOfDay __instance)
		{
			__instance.effects[5].effectEnabled = true;
			__instance.effects[5].effectObject.SetActive(true);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}