Decompiled source of ShipBuilder v1.0.4

ShipBuilder.dll

Decompiled 3 months ago
using System;
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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using WildSkies.Gameplay.ShipBuilding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ShipBuilder")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("ShipBuilder")]
[assembly: AssemblyTitle("ShipBuilder")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[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 ShipBuilder
{
	[BepInPlugin("ShipBuilder", "ShipBuilder", "1.0.4")]
	public class Plugin : BasePlugin
	{
		private class ShipBuilderSimpleChatCommands
		{
			public static string ShipyardMaxSections(int maxSections)
			{
				maxSections = Math.Max(maxSections, -1);
				ShipBuilderController_ShipyardMaxSections.Value = maxSections;
				DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(41, 1);
				defaultInterpolatedStringHandler.AppendLiteral("Maximum shipyard sections is now set to ");
				defaultInterpolatedStringHandler.AppendFormatted((maxSections == -1) ? "default" : ((object)maxSections));
				defaultInterpolatedStringHandler.AppendLiteral(".");
				return defaultInterpolatedStringHandler.ToStringAndClear();
			}

			public static string ShipyardBubbleRadius(float radius)
			{
				radius = Math.Max(radius, -1f);
				ShipBuilderController_ShipyardBubbleRadius.Value = radius;
				DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(38, 1);
				defaultInterpolatedStringHandler.AppendLiteral("Shipyard bubble radius is now set to ");
				defaultInterpolatedStringHandler.AppendFormatted((radius == -1f) ? "default" : ((object)radius));
				defaultInterpolatedStringHandler.AppendLiteral(".");
				return defaultInterpolatedStringHandler.ToStringAndClear();
			}
		}

		internal static ManualLogSource Log;

		internal static Harmony harmonyInstance;

		private static ConfigEntry<float> ShipBuilderController_ShipyardBubbleRadius;

		private static ConfigEntry<int> ShipBuilderController_ShipyardMaxSections;

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ShipBuilder");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			ShipBuilderController_ShipyardMaxSections = ((BasePlugin)this).Config.Bind<int>("ShipBuilder", "ShipyardMaxSections", -1, "ShipBuilder.ShipyardMaxSections");
			ShipBuilderController_ShipyardBubbleRadius = ((BasePlugin)this).Config.Bind<float>("ShipBuilder", "ShipyardBubbleRadius", 150f, "ShipBuilder.ShipyardBubbleRadius");
			harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		}

		public override bool Unload()
		{
			Harmony obj = harmonyInstance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			return true;
		}

		[HarmonyPatch(typeof(ShipBuilderController), "SetBuildingParameters")]
		[HarmonyPrefix]
		public static void ShipBuilderController_SetBuildingParameters(int level, ref int maxSections, ref float radius)
		{
			if (ShipBuilderController_ShipyardMaxSections.Value >= 0)
			{
				maxSections = ShipBuilderController_ShipyardMaxSections.Value;
			}
			if (ShipBuilderController_ShipyardBubbleRadius.Value >= 0f)
			{
				radius = ShipBuilderController_ShipyardBubbleRadius.Value;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ShipBuilder";

		public const string PLUGIN_NAME = "ShipBuilder";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}