Decompiled source of Orbits v1.0.6

orbits.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Video;

[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("orbits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fc2453f5df23219d2822c132dd9eb1e94d1973f7")]
[assembly: AssemblyProduct("orbits")]
[assembly: AssemblyTitle("orbits")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 orbits
{
	[BepInPlugin("com.fiufki.orbits", "Orbits", "1.0.6")]
	public class plugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.fiufki.orbits";

		public const string PluginName = "Orbits";

		public const string PluginVersion = "1.0.6";

		internal static ManualLogSource Logger;

		internal static AssetBundle orbitsAssets;

		internal static Dictionary<int, (string ClipName, string Description)> LevelPatches = new Dictionary<int, (string, string)>
		{
			[0] = (null, "POPULATION: Abandoned.\nCONDITIONS: Arid. Thick haze, worsened by industrial artifacts.\nFAUNA: Dominated by a few species."),
			[1] = (null, "POPULATION: Abandoned.\nCONDITIONS: Jagged and weathered terrain with great foundation.\nFAUNA: Ecosystem supports territorial behaviour."),
			[2] = ("MapView56Vow", "POPULATION: Abandoned.\nCONDITIONS: Humid. Rough terrain. Teeming with plant-life.\nFAUNA: A competitive ecosystem supports aggressive lifeforms."),
			[3] = ("MapView71Gor", "POPULATION: Unknown.\nCONDITIONS: Continual storms. A complete water mass without any land masses. This is where The Company resides.\nFAUNA: Unknown."),
			[4] = ("MapView61Mar", "POPULATION: Abandoned.\nCONDITIONS: Dense holt, expansive terrain. Persistent rain.\nFAUNA: Manifold of danger and valid ecosystem."),
			[5] = ("MapView20Ada", "POPULATION: Abandoned.\nCONDITIONS: A landscape of deep valleys and mountains.\nFAUNA: Home to a lively, diverse ecosystem of smaller-sized omnivores."),
			[6] = ("MapView85Ren", "POPULATION: None.\nCONDITIONS: Frozen, rocky. Deep mist causes adrift, hard to navigate.\nFAUNA: Orbiting a forlorn ecosystem."),
			[7] = ("MapView7Din", "POPULATION: None.\nCONDITIONS: Orbits a white dwarf star. Prior monitoring, for security measures.\nFAUNA: Unlikely for complex life to exist."),
			[8] = ("MapView21Off", "POPULATION: Abandoned.\nCONDITIONS: Rocky, bare foundry. With a ragged countryside.\nFAUNA: A ecosystem, gazes for survival."),
			[9] = ("MapView8Tit", "POPULATION: None.\nCONDITIONS: Recent constant snow and hot temperatures underground. Thick smog.\nFAUNA: Danger upon every corner."),
			[10] = ("MapView68Art", "POPULATION: None.\nCONDITIONS: Waning forests. Abandoned facilities littered across the landscape.\nFAUNA: Rumored active machinery left behind."),
			[12] = ("MapView5Emb", "POPULATION: Abandoned.\nCONDITIONS: Desolate, mostly made out of amethyst and similar crystals.\nFAUNA: Devoided of biological life.")
		};

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.fiufki.orbits").PatchAll();
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "orbits");
			orbitsAssets = AssetBundle.LoadFromFile(text);
			if ((Object)(object)orbitsAssets == (Object)null)
			{
				Logger.LogError((object)"No assets for Orbits found. Not loading Orbits.");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				Logger.LogInfo((object)"Orbits is loaded.");
			}
		}
	}
	public class LevelPatchData
	{
		public string Description;

		public string ClipName;
	}
	[HarmonyPatch(typeof(RoundManager), "Start")]
	public class RoundManager_Start_Patch
	{
		private static Dictionary<string, VideoClip> _cachedVideoClips = new Dictionary<string, VideoClip>();

		private static void Postfix(RoundManager __instance)
		{
			SelectableLevel[] array = StartOfRound.Instance?.levels;
			SelectableLevel[] array2 = array;
			foreach (SelectableLevel val in array2)
			{
				if (!plugin.LevelPatches.TryGetValue(val.levelID, out (string, string) value))
				{
					continue;
				}
				val.LevelDescription = value.Item2;
				if (string.IsNullOrEmpty(value.Item1))
				{
					continue;
				}
				if (!_cachedVideoClips.TryGetValue(value.Item1, out var value2))
				{
					value2 = plugin.orbitsAssets.LoadAsset<VideoClip>(value.Item1);
					if ((Object)(object)value2 != (Object)null)
					{
						_cachedVideoClips[value.Item1] = value2;
					}
				}
				val.videoReel = value2;
			}
			plugin.Logger.LogInfo((object)"Finished Orbits operations.");
		}
	}
}