Decompiled source of ColorChanger v1.1.0

Mods/TeamColorChanger.dll

Decompiled a month ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2Cpp;
using MelonLoader;
using MelonLoader.Preferences;
using PrettyColors;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "Pretty Colors", "1.0.0", "Spike", null)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("TeamColorChanger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TeamColorChanger")]
[assembly: AssemblyTitle("TeamColorChanger")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PrettyColors;

public class Mod : MelonMod
{
	public static MelonPreferences_Category Colors;

	public static MelonPreferences_Entry<string> Enemy_hex_Color;

	public static MelonPreferences_Entry<string> Friendly_hex_Color;

	public static MelonPreferences_Entry<string> None_hex_Color;

	public override void OnInitializeMelon()
	{
		Colors = MelonPreferences.CreateCategory("Colors");
		Enemy_hex_Color = Colors.CreateEntry<string>("Enemy Hex Color", "#d6134b", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		Friendly_hex_Color = Colors.CreateEntry<string>("Friendly Hex Color", "#34eb86", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		None_hex_Color = Colors.CreateEntry<string>("None Hex Color", "#b5d8e8", (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		Init();
	}

	public static void Init()
	{
		//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("com.spike.PrettyColors");
		val.PatchAll(Assembly.GetExecutingAssembly());
	}
}
[HarmonyPatch(typeof(SettingSO_ColourBlindness), "GetTeamColour")]
public static class Patch_GetTeamColour
{
	private static bool Prefix(TeamType team, ref Color __result)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		Color val = default(Color);
		if ((int)team != 1)
		{
			if ((int)team == 2)
			{
				ColorUtility.TryParseHtmlString(Mod.Enemy_hex_Color.Value, ref val);
				__result = val;
				return false;
			}
			ColorUtility.TryParseHtmlString(Mod.None_hex_Color.Value, ref val);
			__result = val;
			return false;
		}
		ColorUtility.TryParseHtmlString(Mod.Friendly_hex_Color.Value, ref val);
		__result = val;
		return false;
	}
}