Decompiled source of Hidden Weather Warnings v1.0.0

Mods/HiddenWeather.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using HarmonyLib;
using HiddenWeather;
using MelonLoader;
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: MelonInfo(typeof(squidypal), "HiddenWeather", "1.0.0", "squidypal", null)]
[assembly: MelonGame("ZeekerssRBLX", "Lethal Company")]
[assembly: AssemblyTitle("HiddenWeather")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HiddenWeather")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b0bff8c2-582b-4f88-8b06-2d3046726abe")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HiddenWeather
{
	public class squidypal : MelonMod
	{
		public override void OnApplicationStart()
		{
			//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("com.squidypal.HiddenWeather");
			val.PatchAll();
			MelonLogger.Msg("Patched successfully!");
		}
	}
}
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)
		{
			MelonLogger.Msg(modifiedDisplayText);
			int num = modifiedDisplayText.Split(new string[1] { "[planetTime]" }, StringSplitOptions.None).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;
		}
	}
}