Decompiled source of BellHomeColourChanger v1.0.1

BellHomeColourChanger.dll

Decompiled 3 weeks 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.Logging;
using GlobalEnums;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BellHomeColourChanger")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("BellHomeColourChanger")]
[assembly: AssemblyTitle("BellHomeColourChanger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.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.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 BellHomeColourChanger
{
	[BepInPlugin("BellHomeColourChanger", "BellHomeColourChanger", "0.1.0")]
	public class BellHomeColourChanger : BaseUnityPlugin
	{
		private Harmony harmony;

		public ConfigUI configUI;

		private static FieldInfo? _belltownHouseColourField;

		public ManualLogSource Logger => ((BaseUnityPlugin)this).Logger;

		public static BellHomeColourChanger Instance { get; private set; }

		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			try
			{
				Logger.LogInfo((object)"=== BellHomeColourChanger v0.1.0 Starting ===");
				Logger.LogInfo((object)"Plugin GUID: BellHomeColourChanger");
				harmony = new Harmony("BellHomeColourChanger");
				Logger.LogInfo((object)"Harmony patches applied successfully!");
				configUI = new ConfigUI(Logger, this);
				configUI.InitializeConfigUI(((BaseUnityPlugin)this).Config);
				Instance = this;
				if (configUI.debugMode.Value)
				{
					Logger.LogInfo((object)("Config file location: " + ((BaseUnityPlugin)this).Config.ConfigFilePath));
				}
				Logger.LogInfo((object)"=== BellHomeColourChanger initialization COMPLETED ===");
			}
			catch (Exception ex)
			{
				Logger.LogError((object)("❌ ERROR during BellHomeColourChanger initialization: " + ex.Message));
				Logger.LogError((object)("Stack trace: " + ex.StackTrace));
			}
		}

		public void SetBellColor(BellhomePaintColours newColor)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			PlayerData.instance.BelltownHouseColour = newColor;
		}
	}
	public class ConfigUI
	{
		private readonly ManualLogSource logger;

		private readonly BellHomeColourChanger bellHomeColourChanger;

		public ConfigEntry<bool> debugMode;

		public ConfigEntry<BellhomePaintColours> colour;

		public ConfigUI(ManualLogSource logger, BellHomeColourChanger bellHomeColourChanger)
		{
			this.logger = logger;
			this.bellHomeColourChanger = bellHomeColourChanger;
		}

		public void InitializeConfigUI(ConfigFile config)
		{
			debugMode = config.Bind<bool>("Debug", "DebugMode", false, (ConfigDescription)null);
			colour = config.Bind<BellhomePaintColours>("General", "Bell Color", (BellhomePaintColours)0, "Choose the color for your bell");
			colour.SettingChanged += delegate
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				bellHomeColourChanger.SetBellColor(colour.Value);
			};
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BellHomeColourChanger";

		public const string PLUGIN_NAME = "BellHomeColourChanger";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}