Decompiled source of Infinite Ship Boombox v1.1.1

BepInEx/Plugins/Infinite_Ship_Boombox.dll

Decompiled 4 months ago
using System;
using System.CodeDom.Compiler;
using System.Configuration;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
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("Infinite_Ship_Boombox")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Infinite_Ship_Boombox")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e0a916cc-8fd9-4509-a7f3-4c2f13ede14e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Infinite_Ship_Boombox
{
	[BepInPlugin("Hackattack242.Infinite_Ship_Boombox", "Infinite_Ship_Boombox", "1.1.1")]
	public class Infinite_ship_boombox_base : BaseUnityPlugin
	{
		private const string mod_GUID = "Hackattack242.Infinite_Ship_Boombox";

		private const string mod_name = "Infinite_Ship_Boombox";

		private const string mod_version = "1.1.1";

		private readonly Harmony harmony = new Harmony("Hackattack242.Infinite_Ship_Boombox");

		private static Infinite_ship_boombox_base Instance;

		private ManualLogSource logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("Infinite_Ship_Boombox");
			logger.LogInfo((object)"Infinite Ship Boombox has awoken");
			harmony.PatchAll();
			logger.LogInfo((object)"Patches Complete");
		}

		internal static void LogDebug(string message)
		{
			Instance.Log(message, (LogLevel)32);
		}

		internal static void LogInfo(string message)
		{
			Instance.Log(message, (LogLevel)16);
		}

		internal static void LogWarning(string message)
		{
			Instance.Log(message, (LogLevel)4);
		}

		internal static void LogError(string message)
		{
			Instance.Log(message, (LogLevel)2);
		}

		internal static void LogError(Exception ex)
		{
			Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2);
		}

		private void Log(string message, LogLevel logLevel)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			logger.Log(logLevel, (object)message);
		}
	}
}
namespace Infinite_Ship_Boombox.Properties
{
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}
namespace Infinite_Ship_Boombox.Patches
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class Infinite_ship_boombox
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void patch_func(ref bool ___isInShipRoom, ref Item ___itemProperties, ref PlayerControllerB ___playerHeldBy)
		{
			if (___isInShipRoom || ((Object)(object)___playerHeldBy != (Object)null && ___playerHeldBy.isInHangarShipRoom))
			{
				___itemProperties.requiresBattery = false;
			}
			else
			{
				___itemProperties.requiresBattery = true;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void patch_func(ref Item ___itemProperties)
		{
			___itemProperties.requiresBattery = true;
		}
	}
}