Decompiled source of Buy Any Ship Decoration v1.0.0

ShipDecorations.dll

Decompiled a year ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ShipDecorations.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShipDecorations")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipDecorations")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("752b4a5e-d779-490a-a540-e85dd73f2bd2")]
[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 ShipDecorations
{
	public static class ConfigSettings
	{
		public static ConfigEntry<bool> makeShipDecorationsFree;

		public static void BindConfigSettings()
		{
		}

		public static string GetDisplayName(string key)
		{
			key = key.Replace("<Keyboard>/", "");
			key = key.Replace("<Mouse>/", "");
			string text = key;
			text = text.Replace("leftAlt", "Alt");
			text = text.Replace("rightAlt", "Alt");
			text = text.Replace("leftCtrl", "Ctrl");
			text = text.Replace("rightCtrl", "Ctrl");
			text = text.Replace("leftShift", "Shift");
			text = text.Replace("rightShift", "Shift");
			text = text.Replace("leftButton", "LMB");
			text = text.Replace("rightButton", "RMB");
			return text.Replace("middleButton", "MMB");
		}
	}
	[BepInPlugin("Sant.ShipDecorationsUnlock", "Unlock Ship Decorations", "1.0.0.0")]
	public class ShipDecorationsUnlockedModBase : BaseUnityPlugin
	{
		private const string modGUID = "Sant.ShipDecorationsUnlock";

		private const string modName = "Unlock Ship Decorations";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Sant.ShipDecorationsUnlock");

		public static ShipDecorationsUnlockedModBase instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("Sant.ShipDecorationsUnlock");
			mls.LogInfo((object)"The Ship Decorations Unlock mod has awaken");
			harmony.PatchAll(typeof(ShipDecorationsUnlockedModBase));
			harmony.PatchAll(typeof(ShipDecorationsUnlockedPatch));
		}

		public static void Log(string message)
		{
			Log(message);
		}
	}
}
namespace ShipDecorations.Patches
{
	[HarmonyPatch(typeof(Terminal))]
	internal class ShipDecorationsUnlockedPatch
	{
		[HarmonyPatch("RotateShipDecorSelection")]
		[HarmonyPostfix]
		private static void unlockAllShipDecorations(ref List<TerminalNode> ___ShipDecorSelection)
		{
			___ShipDecorSelection.Clear();
			List<TerminalNode> list = new List<TerminalNode>();
			for (int i = 0; i < StartOfRound.Instance.unlockablesList.unlockables.Count; i++)
			{
				if ((Object)(object)StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode != (Object)null && !StartOfRound.Instance.unlockablesList.unlockables[i].alwaysInStock)
				{
					list.Add(StartOfRound.Instance.unlockablesList.unlockables[i].shopSelectionNode);
				}
			}
			for (int j = 0; j < list.Count; j++)
			{
				TerminalNode item = list[j];
				___ShipDecorSelection.Add(item);
			}
		}
	}
}