using System;
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")]
[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.0")]
public class Plugin : BaseUnityPlugin
{
public const string PluginGUID = "com.fiufki.orbits";
public const string PluginName = "Orbits";
public const string PluginVersion = "1.0.0";
internal static ManualLogSource Log;
private void Awake()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Orbits v1.0.0 loaded.");
try
{
Harmony val = new Harmony("com.fiufki.orbits");
val.PatchAll();
}
catch (Exception arg)
{
Log.LogError((object)$"Failed to initialize Harmony patches: {arg}");
}
}
}
[HarmonyPatch(typeof(RoundManager), "Start")]
public class RoundManager_Start_Patch
{
private static void Postfix(RoundManager __instance)
{
try
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "orbits");
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogError((object)("Failed to load AssetBundle from " + text));
return;
}
SelectableLevel[] array = StartOfRound.Instance?.levels;
if (array == null)
{
Plugin.Log.LogWarning((object)"No levels found in StartOfRound.Instance.levels");
return;
}
SelectableLevel[] array2 = array;
foreach (SelectableLevel val2 in array2)
{
if (val2.levelID == 0)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: Arid. Thick haze, worsened by industrial artifacts.\nFAUNA: Dominated by a few species.";
Plugin.Log.LogInfo((object)"Updated the description of Experimentation.");
}
if (val2.levelID == 1)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: Jagged and weathered terrain with great foundation. \nFAUNA: Ecosystem supports territorial behaviour.";
Plugin.Log.LogInfo((object)"Updated the description of Assurance.");
}
if (val2.levelID == 2)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: Humid. Rough terrain. Teeming with plant-life.\nFAUNA: A competitive ecosystem supports aggressive lifeforms.";
Plugin.Log.LogInfo((object)"Updated the description of Vow.");
VideoClip val3 = val.LoadAsset<VideoClip>("MapView56Vow");
if ((Object)(object)val3 != (Object)null)
{
val2.videoReel = val3;
Plugin.Log.LogInfo((object)"Updated the video reel for Vow.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView56Vow' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 3)
{
val2.LevelDescription = "POPULATION: Unknown.\nCONDITIONS: Continual storms. A complete water mass without any land masses. This is where The Company resides.\nFAUNA: Unknown.";
Plugin.Log.LogInfo((object)"Updated the description of The Company Building.");
VideoClip val4 = val.LoadAsset<VideoClip>("MapView71Gor");
if ((Object)(object)val4 != (Object)null)
{
val2.videoReel = val4;
Plugin.Log.LogInfo((object)"Updated the video reel for The Company Building.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView71Gor' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 4)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: Dense holt, expansive terrain. Persistent rain.\nFAUNA: Manifold of danger and valid ecosystem.";
Plugin.Log.LogInfo((object)"Updated the description of March.");
VideoClip val5 = val.LoadAsset<VideoClip>("MapView61Mar");
if ((Object)(object)val5 != (Object)null)
{
val2.videoReel = val5;
Plugin.Log.LogInfo((object)"Updated the video reel for March.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView61Mar' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 5)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: A landscape of deep valleys and mountains.\nFAUNA: Home to a lively, diverse ecosystem of smaller-sized omnivores.";
Plugin.Log.LogInfo((object)"Updated the description of Adamance.");
VideoClip val6 = val.LoadAsset<VideoClip>("MapView20Ada");
if ((Object)(object)val6 != (Object)null)
{
val2.videoReel = val6;
Plugin.Log.LogInfo((object)"Updated the video reel for Adamance.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView20Ada' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 6)
{
val2.LevelDescription = "POPULATION: None.\nCONDITIONS: Frozen, rocky. Deep mist causes adrift, hard to navigate.\nFAUNA: Orbiting a forlorn ecosystem.";
Plugin.Log.LogInfo((object)"Updated the description of Rend.");
VideoClip val7 = val.LoadAsset<VideoClip>("MapView85Ren");
if ((Object)(object)val7 != (Object)null)
{
val2.videoReel = val7;
Plugin.Log.LogInfo((object)"Updated the video reel for Rend.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView85Ren' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 7)
{
val2.LevelDescription = "POPULATION: None.\nCONDITIONS: Orbits a white dwarf star. Prior monitoring, for security measures.\nFAUNA: Unlikely for complex life to exist.";
Plugin.Log.LogInfo((object)"Updated the description of Dine.");
VideoClip val8 = val.LoadAsset<VideoClip>("MapView7Din");
if ((Object)(object)val8 != (Object)null)
{
val2.videoReel = val8;
Plugin.Log.LogInfo((object)"Updated the video reel for Dine.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView7Din' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 8)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: Rocky, bare foundry. With a ragged countryside. \nFAUNA: A ecosystem, gazes for survival.";
Plugin.Log.LogInfo((object)"Updated the description of Offense.");
VideoClip val9 = val.LoadAsset<VideoClip>("MapView21Off");
if ((Object)(object)val9 != (Object)null)
{
val2.videoReel = val9;
Plugin.Log.LogInfo((object)"Updated the video reel for Offense.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView21Off' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 9)
{
val2.LevelDescription = "POPULATION: None.\nCONDITIONS: Recent constant snow and hot temperatures underground. Thick smog.\nFAUNA: Danger upon every corner.";
Plugin.Log.LogInfo((object)"Updated the description of Titan.");
VideoClip val10 = val.LoadAsset<VideoClip>("MapView8Tit");
if ((Object)(object)val10 != (Object)null)
{
val2.videoReel = val10;
Plugin.Log.LogInfo((object)"Updated the video reel for Titan.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView8Tit' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 10)
{
val2.LevelDescription = "POPULATION: None.\nCONDITIONS: Waning forests. Abandoned facilities littered across the landscape.\nFAUNA: Rumored active machinery left behind.";
Plugin.Log.LogInfo((object)"Updated the description of Artifice.");
VideoClip val11 = val.LoadAsset<VideoClip>("MapView68Art");
if ((Object)(object)val11 != (Object)null)
{
val2.videoReel = val11;
Plugin.Log.LogInfo((object)"Updated the video reel for Artifice.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView58Art' in the 'orbits' asset bundle.");
}
}
if (val2.levelID == 12)
{
val2.LevelDescription = "POPULATION: Abandoned.\nCONDITIONS: Desolate, mostly made out of amethyst and similar crystals.\nFAUNA: Devoided of biological life.";
Plugin.Log.LogInfo((object)"Updated the description of Embrion.");
VideoClip val12 = val.LoadAsset<VideoClip>("MapView5Emb");
if ((Object)(object)val12 != (Object)null)
{
val2.videoReel = val12;
Plugin.Log.LogInfo((object)"Updated the video reel for Embrion.");
}
else
{
Plugin.Log.LogWarning((object)"Could not find 'MapView5Emb' in the 'orbits' asset bundle.");
}
}
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Error in RoundManager_Start_Patch Postfix: {arg}");
}
}
}
}