Decompiled source of KeepRandomizedVanillaColors v1.0.1

KeepRandomizedVanillaColors.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NeckzillaBossMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NeckzillaBossMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9f25e332-f027-4b0a-9f1c-7ec49784c32a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KeepRandomizedVanillaColors;

[BepInPlugin("manu.KeepRandomizedVanillaColors", "Keep Randomized Vanilla Colors", "1.0.0")]
public class KeepRandomizedVanillaColorsPlugin : BaseUnityPlugin
{
	internal static ManualLogSource Log;

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		_harmony = new Harmony("manu.KeepRandomizedVanillaColors");
		_harmony.PatchAll();
		Log.LogInfo((object)"KeepRandomizedVanillaColors cargado.");
	}
}
[HarmonyPatch(typeof(Character), "Awake")]
public static class Character_Awake_Patch
{
	public static void Postfix(Character __instance)
	{
		try
		{
			if ((Object)(object)__instance == (Object)null || __instance is Player)
			{
				return;
			}
			ZNetView component = ((Component)__instance).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			ZDO zDO = component.GetZDO();
			if (zDO == null)
			{
				return;
			}
			LevelEffects[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<LevelEffects>(true);
			LevelEffects[] array = componentsInChildren;
			foreach (LevelEffects val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					Object.Destroy((Object)(object)val);
				}
			}
			KeepRandomizedVanillaColorsPlugin.Log.LogDebug((object)("Eliminados LevelEffects en " + Utils.GetPrefabName(((Component)__instance).gameObject) + " (" + __instance.m_name + ")."));
		}
		catch (Exception arg)
		{
			KeepRandomizedVanillaColorsPlugin.Log.LogError((object)$"Error limpiando colores: {arg}");
		}
	}
}