Decompiled source of ColorChat v1.1.1

catrice.ColorChat.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("catrice.ColorChat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1")]
[assembly: AssemblyProduct("catrice.ColorChat")]
[assembly: AssemblyTitle("catrice.ColorChat")]
[assembly: AssemblyVersion("0.1.1.0")]
namespace catrice.ColorChat;

public static class ColorChatHooks
{
	public static void Postfix_OnPlayerEvent()
	{
		if ((Object)(object)PlayerChatManager.Current != (Object)null)
		{
			if (((Il2CppArrayBase<int>)(object)PlayerChatManager.Current.m_forbiddenChars).Length > 0)
			{
				PlayerChatManager.Current.m_forbiddenChars = new Il2CppStructArray<int>(0L);
			}
			Logger.Log("change success");
		}
		else
		{
			Logger.Log("failed to change");
		}
	}
}
[BepInPlugin("com.catrice.ColorChat", "ColorChat", "1.1.1")]
[BepInProcess("GTFO.exe")]
public class EntryPoint : BasePlugin
{
	public const string GUID = "com.catrice.ColorChat";

	private bool once = false;

	public override void Load()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		Logger.LogInstance = ((BasePlugin)this).Log;
		Harmony val = new Harmony("com.catrice.ColorChat");
		MethodInfo method = typeof(GS_Lobby).GetMethod("OnPlayerEvent");
		MethodInfo method2 = typeof(ColorChatHooks).GetMethod("Postfix_OnPlayerEvent");
		val.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.PatchAll();
	}
}
public static class Logger
{
	public static ManualLogSource LogInstance;

	public static void Log(string format, params object[] args)
	{
		Log(string.Format(format, args));
	}

	public static void Log(string str)
	{
		ManualLogSource logInstance = LogInstance;
		if (logInstance != null)
		{
			logInstance.Log((LogLevel)8, (object)str);
		}
	}

	public static void Warning(string format, params object[] args)
	{
		Warning(string.Format(format, args));
	}

	public static void Warning(string str)
	{
		ManualLogSource logInstance = LogInstance;
		if (logInstance != null)
		{
			logInstance.Log((LogLevel)4, (object)str);
		}
	}

	public static void Error(string format, params object[] args)
	{
		Error(string.Format(format, args));
	}

	public static void Error(string str)
	{
		ManualLogSource logInstance = LogInstance;
		if (logInstance != null)
		{
			logInstance.Log((LogLevel)2, (object)str);
		}
	}
}