Decompiled source of AnnounceMoonChange v1.0.1

AnnounceMoonChange.dll

Decompiled 11 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("AnnounceMoonChange")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AnnounceMoonChange")]
[assembly: AssemblyTitle("AnnounceMoonChange")]
[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 AnnounceMoonChange
{
	[BepInPlugin("AnnounceMoonChange", "AnnounceMoonChange", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource log;

		public static Plugin Instance;

		public static string lastMoon;

		private void Awake()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AnnounceMoonChange (1.0.0) is real!");
			new Harmony("AnnounceMoonChange").PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class SwitchLevelPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("ChangeLevel")]
		public static void AnnounceMoonChange(StartOfRound __instance, int levelID)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Invalid comparison between Unknown and I4
			if (!(Plugin.lastMoon == __instance.currentLevel.PlanetName))
			{
				Plugin.lastMoon = __instance.currentLevel.PlanetName;
				Plugin.log.LogInfo((object)"Announcing moon change!");
				((TMP_Text)HUDManager.Instance.deviceChangeText).text = "Navigated to " + __instance.currentLevel.PlanetName;
				HUDManager.Instance.deviceChangeAnimator.SetTrigger("display");
				if ((int)__instance.currentLevel.currentWeather != -1)
				{
					HUDManager.Instance.DisplayTip("Weather Alert!", __instance.currentLevel.PlanetName + " is currently " + ((object)(LevelWeatherType)(ref __instance.currentLevel.currentWeather)).ToString() + "!", true, false, "LC_Tip1");
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AnnounceMoonChange";

		public const string PLUGIN_NAME = "AnnounceMoonChange";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}