Decompiled source of HiddenWeather v1.0.1

HiddenWeather.dll

Decompiled a year 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 System.Text.RegularExpressions;
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("HiddenWeather")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HiddenWeather")]
[assembly: AssemblyTitle("HiddenWeather")]
[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 HiddenWeather
{
	[BepInPlugin("HiddenWeather", "HiddenWeather", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("LC_API");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HiddenWeather is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "HiddenWeather";

		public const string PLUGIN_NAME = "HiddenWeather";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace HiddenWeather.Patches
{
	[HarmonyPatch(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel")]
	public class SetMapScreenInfoToCurrentLevel
	{
		private static bool Prefix(StartOfRound __instance)
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			((Behaviour)__instance.screenLevelVideoReel).enabled = false;
			((Component)__instance.screenLevelVideoReel).gameObject.SetActive(false);
			__instance.screenLevelVideoReel.clip = __instance.currentLevel.videoReel;
			TimeOfDay val = Object.FindObjectOfType<TimeOfDay>();
			if (val.totalTime == 0f)
			{
				val.totalTime = (float)val.numberOfHours * val.lengthOfHours;
			}
			string text = "";
			string levelDescription = __instance.currentLevel.LevelDescription;
			((TMP_Text)__instance.screenLevelDescription).SetText("Orbiting: " + __instance.currentLevel.PlanetName + "\n" + levelDescription + "\n" + text, true);
			__instance.mapScreen.overrideCameraForOtherUse = true;
			((Component)__instance.mapScreen.cam).transform.position = new Vector3(0f, 100f, 0f);
			((Behaviour)__instance.screenLevelDescription).enabled = true;
			if ((Object)(object)__instance.currentLevel.videoReel != (Object)null)
			{
				((Behaviour)__instance.screenLevelVideoReel).enabled = true;
				((Component)__instance.screenLevelVideoReel).gameObject.SetActive(true);
				__instance.screenLevelVideoReel.Play();
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Terminal), "TextPostProcess")]
	public class TextPostProcess
	{
		private static bool Prefix(Terminal __instance, ref string modifiedDisplayText, ref TerminalNode node)
		{
			ManualLogSource val = Logger.CreateLogSource("TextPostProcess_Prefix");
			val.LogInfo((object)modifiedDisplayText);
			int num = modifiedDisplayText.Split("[planetTime]").Length - 1;
			if (num > 0)
			{
				Regex regex = new Regex(Regex.Escape("[planetTime]"));
				for (int i = 0; i < num && __instance.moonsCatalogueList.Length > i; i++)
				{
					string replacement = "";
					modifiedDisplayText = regex.Replace(modifiedDisplayText, replacement, 1);
				}
			}
			if (node.displayPlanetInfo != -1)
			{
				string newValue = "mild weather";
				modifiedDisplayText = modifiedDisplayText.Replace("[currentPlanetTime]", newValue);
			}
			return true;
		}
	}
}