Decompiled source of WesleyMoonsAltProgression v1.0.1

BepInEx/plugins/WesleyMoonsAltProgression/com.github.xuuxiaolan.wesleymoonsaltprogression.dll

Decompiled 16 hours ago
using System;
using System.Collections.Generic;
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 Dawn;
using Dawn.Utils;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On;
using UnityEngine;
using WesleyMoonsAltProgression.Patches;
using com.github.xuuxiaolan.wesleymoonsaltprogression.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib")]
[assembly: AssemblyCompany("com.github.xuuxiaolan.wesleymoonsaltprogression")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("WesleyMoonsAltProgression")]
[assembly: AssemblyTitle("com.github.xuuxiaolan.wesleymoonsaltprogression")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 WesleyMoonsAltProgression
{
	[BepInPlugin("com.github.xuuxiaolan.wesleymoonsaltprogression", "WesleyMoonsAltProgression", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WesleyMoonsAltProgression : BaseUnityPlugin
	{
		private static List<NamespacedKey> wesleyMoons = new List<NamespacedKey>
		{
			NamespacedKey.From("descentlethalbundle", "descent"),
			NamespacedKey.From("extortlethalbundle", "extort"),
			NamespacedKey.From("magicwesleysmod", "acidir"),
			NamespacedKey.From("magicwesleysmod", "alcatras"),
			NamespacedKey.From("magicwesleysmod", "galetry"),
			NamespacedKey.From("magicwesleysmod", "asteroidonethree"),
			NamespacedKey.From("magicwesleysmod", "hyve"),
			NamespacedKey.From("magicwesleysmod", "atlantica"),
			NamespacedKey.From("magicwesleysmod", "berunah"),
			NamespacedKey.From("magicwesleysmod", "calist"),
			NamespacedKey.From("magicwesleysmod", "core"),
			NamespacedKey.From("magicwesleysmod", "cosmocos"),
			NamespacedKey.From("magicwesleysmod", "crowd"),
			NamespacedKey.From("magicwesleysmod", "cubatres"),
			NamespacedKey.From("magicwesleysmod", "demetriaca"),
			NamespacedKey.From("magicwesleysmod", "desolation"),
			NamespacedKey.From("magicwesleysmod", "dreck"),
			NamespacedKey.From("magicwesleysmod", "empra"),
			NamespacedKey.From("magicwesleysmod", "end"),
			NamespacedKey.From("magicwesleysmod", "etern"),
			NamespacedKey.From("magicwesleysmod", "faith"),
			NamespacedKey.From("magicwesleysmod", "filitrios"),
			NamespacedKey.From("magicwesleysmod", "gissionc"),
			NamespacedKey.From("magicwesleysmod", "gloom"),
			NamespacedKey.From("magicwesleysmod", "gratar"),
			NamespacedKey.From("magicwesleysmod", "thalasso"),
			NamespacedKey.From("magicwesleysmod", "hyx"),
			NamespacedKey.From("magicwesleysmod", "infernis"),
			NamespacedKey.From("magicwesleysmod", "junic"),
			NamespacedKey.From("magicwesleysmod", "lecaro"),
			NamespacedKey.From("magicwesleysmod", "motra"),
			NamespacedKey.From("magicwesleysmod", "narcotic"),
			NamespacedKey.From("magicwesleysmod", "oldred"),
			NamespacedKey.From("magicwesleysmod", "polarus"),
			NamespacedKey.From("magicwesleysmod", "release"),
			NamespacedKey.From("magicwesleysmod", "repress"),
			NamespacedKey.From("magicwesleysmod", "roart"),
			NamespacedKey.From("magicwesleysmod", "trite"),
			NamespacedKey.From("magicwesleysmod", "utril")
		};

		internal static ManualLogSource Logger { get; private set; } = null;


		internal static PersistentDataContainer PersistentData { get; private set; } = null;


		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.github.xuuxiaolan.wesleymoonsaltprogression");
			PersistentData = BepInPluginExtensions.GetPersistentDataContainer((BaseUnityPlugin)(object)this);
			((DataContainer)PersistentData).Set<string>(WesleyMoonsAltProgressionKeys.LastVersion, "1.0.1");
			ScenePatches.Init();
			((Registry<DawnMoonInfo>)(object)LethalContent.Moons).OnFreeze += OnMoonsFreeze;
			Logger.LogInfo((object)"com.github.xuuxiaolan.wesleymoonsaltprogression v1.0.1 has loaded!");
		}

		private static void OnMoonsFreeze()
		{
			foreach (DawnMoonInfo value in ((Registry<DawnMoonInfo>)(object)LethalContent.Moons).Values)
			{
				if (!((NamespacedKey)((DawnBaseInfo<DawnMoonInfo>)(object)value).TypedKey).IsVanilla() && wesleyMoons.Contains(((DawnBaseInfo<DawnMoonInfo>)(object)value).Key))
				{
					if (((DawnBaseInfo<DawnMoonInfo>)(object)value).Key.Key == "galetry")
					{
						value.DawnPurchaseInfo.PurchasePredicate = ITerminalPurchasePredicate.AlwaysHide();
						continue;
					}
					Logger.LogInfo((object)$"Freezing moon: {((DawnBaseInfo<DawnMoonInfo>)(object)value).Key}");
					value.DawnPurchaseInfo.PurchasePredicate = ITerminalPurchasePredicate.AlwaysSuccess();
				}
			}
		}
	}
	public static class WesleyMoonsAltProgressionKeys
	{
		public const string Namespace = "wesley_moons_alt_progression";

		internal static NamespacedKey LastVersion = NamespacedKey.From("wesley_moons_alt_progression", "last_version");
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.xuuxiaolan.wesleymoonsaltprogression";

		public const string PLUGIN_NAME = "WesleyMoonsAltProgression";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace WesleyMoonsAltProgression.Patches
{
	internal static class ScenePatches
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_RefreshLightsList <0>__RoundManager_RefreshLightsList;
		}

		internal static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__RoundManager_RefreshLightsList;
			if (obj == null)
			{
				hook_RefreshLightsList val = RoundManager_RefreshLightsList;
				<>O.<0>__RoundManager_RefreshLightsList = val;
				obj = (object)val;
			}
			RoundManager.RefreshLightsList += (hook_RefreshLightsList)obj;
		}

		private static void RoundManager_RefreshLightsList(orig_RefreshLightsList orig, RoundManager self)
		{
			if (!RoundManager.Instance.currentLevel.sceneName.Equals("RepressScene"))
			{
				orig.Invoke(self);
				return;
			}
			GameObject.Find("Environment/ApparatusSlot").SetActive(false);
			GameObject.Find("Environment/ShipInteractions/ApparatusInsertTrigger").SetActive(false);
			orig.Invoke(self);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace com.github.xuuxiaolan.wesleymoonsaltprogression.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}