Decompiled source of Bananas Text Color Mod v1.2.0

BananaShit.dll

Decompiled a month ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using MageConfigurationAPI.Data;
using MageConfigurationAPI.Enums;
using TMPro;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BananaShit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BananaShit")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("65ba7f91-70de-4765-98c7-ef667a2d68fc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("BANANAS", "Banana's Shit Plugin", "1.2.0.0")]
public class BananaMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(MainMenuManager), "SendLobbyChatMessage")]
	public class ChatMessageSendPatch
	{
		[HarmonyPrefix]
		public static void Prefix(ref TMP_InputField ___chatInputFieldText)
		{
			if (!string.IsNullOrWhiteSpace(___chatInputFieldText.text))
			{
				if (configItalics.Value)
				{
					___chatInputFieldText.text = "<i><color=" + configTextColor.Value + ">" + ___chatInputFieldText.text + "</color></i>";
					configBold.Value = false;
				}
				else if (configBold.Value)
				{
					___chatInputFieldText.text = "<b><color=" + configTextColor.Value + ">" + ___chatInputFieldText.text + "</color></b>";
				}
				else
				{
					___chatInputFieldText.text = "<color=" + configTextColor.Value + ">" + ___chatInputFieldText.text + "</color>";
				}
			}
		}
	}

	internal static ConfigEntry<string> configTextColor { get; private set; }

	internal static ConfigEntry<bool> configBold { get; private set; }

	internal static ConfigEntry<bool> configItalics { get; private set; }

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("BANANAS");
		val.PatchAll();
		LoadConfig();
	}

	private void LoadConfig()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		//IL_007e: Expected O, but got Unknown
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		configTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("Color", "Text Color", "#ff0000", "Set the pre-text color as a hex or color name (ex. red, purple, etc...)");
		configBold = ((BaseUnityPlugin)this).Config.Bind<bool>("Bold", "Is Text Bold", true, "Whether or not to make text bold. Cannot be used if italics option is true and vice versa");
		configItalics = ((BaseUnityPlugin)this).Config.Bind<bool>("Italics", "Is Text Italics", true, "Whether or not to make text italics. Cannot be used if bold option is true and vice versa");
		new ModConfig((BaseUnityPlugin)this, (ConfigEntryBase)configTextColor, (SettingsFlag)3);
	}
}
namespace BananaShit;

internal class BananaInfo
{
	private const string modGUID = "BANANAS";

	private const string modName = "Banana's Shit plugin";

	private const string modVersion = "1.0.0.0";
}