Decompiled source of ClonesDrowned v1.0.1

CloneDrowned.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameplayEntities;
using HarmonyLib;
using LLHandlers;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("CloneDrowned")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("littleNoisesForFun")]
[assembly: AssemblyTitle("CloneDrowned")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CloneDrowned
{
	[BepInPlugin("us.wallace.plugins.llb.CloneDrowned", "CloneDrowned Plug-In", "1.0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource BLogger;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			BLogger = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogDebug((object)"CloneDrowned");
			Harmony val = new Harmony("us.wallace.plugins.llb.CloneDrowned");
			val.PatchAll(typeof(JPLELOFJOOHMHOHIACFLOHPatch));
			val.PatchAll(typeof(AOOJOMIECLDDMAMFHLFOJFPatch));
			val.PatchAll(typeof(GrafPlayerInnitPatch));
		}
	}
	public class JPLELOFJOOHMHOHIACFLOHPatch
	{
		[HarmonyPatch(typeof(JPLELOFJOOH), "MHOHIACFLOH")]
		[HarmonyPrefix]
		public static bool MHOHIACFLOH_Prefix(JPLELOFJOOH __instance)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Invalid comparison between Unknown and I4
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Invalid comparison between Unknown and I4
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Invalid comparison between Unknown and I4
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			List<NCBHPNHFLAJ> list = new List<NCBHPNHFLAJ>();
			NCBHPNHFLAJ item = default(NCBHPNHFLAJ);
			for (int i = 0; i < JPLELOFJOOH.LKIFMPEFNGB.Length; i++)
			{
				NCBHPNHFLAJ val = JPLELOFJOOH.LKIFMPEFNGB[i];
				list.Add(val);
				if ((int)val.AIINAIDBHJI == 0)
				{
					int num = 0;
					for (CharacterVariant val2 = (CharacterVariant)1; (int)val2 < 8; val2 = (CharacterVariant)(val2 + 1))
					{
						string[] array = new string[val.MJJFEAGJICG.Length];
						for (int j = 0; j < array.Length; j++)
						{
							if (j == 0)
							{
								array[j] = val.MJJFEAGJICG[j] + "_Alt" + num.ToString("00");
							}
							else
							{
								array[j] = val.MJJFEAGJICG[j];
							}
						}
						((NCBHPNHFLAJ)(ref item))..ctor(val.LALEEFJMMLH, val2, val.BADNNNCEKEF, array, val.MIGKFLKFCIJ, (DLC)0);
						list.Add(item);
						num++;
					}
					list.Add(new NCBHPNHFLAJ(val.LALEEFJMMLH, (CharacterVariant)8, val.BADNNNCEKEF, val.MJJFEAGJICG[0] + "_Creepy", val.MIGKFLKFCIJ));
					JPLELOFJOOH.HIDKOLCMMGJ(list, val, (CharacterVariant)13);
				}
				else if ((int)val.AIINAIDBHJI == 9 || (int)val.AIINAIDBHJI == 10)
				{
					JPLELOFJOOH.HIDKOLCMMGJ(list, val, (CharacterVariant)14);
				}
				else if ((int)val.AIINAIDBHJI == 11 || (int)val.AIINAIDBHJI == 12)
				{
					JPLELOFJOOH.HIDKOLCMMGJ(list, val, (CharacterVariant)15);
				}
			}
			JPLELOFJOOH.LKIFMPEFNGB = list.ToArray();
			return false;
		}
	}
	public class AOOJOMIECLDDMAMFHLFOJFPatch
	{
		private static Texture2D creepyTexture;

		[HarmonyPatch(typeof(AOOJOMIECLD), "DMAMFHLFOJF")]
		[HarmonyPrefix]
		public static bool DMAMFHLFOJF_Prefix(AOOJOMIECLD __instance, int JIIFGECECMP, bool NGNCDNMOKDK, ref Material __result)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			if (JIIFGECECMP >= __instance.IODEGBOKAAK.Length)
			{
				if (__instance.IODEGBOKAAK.Length == 0)
				{
					__result = null;
					return false;
				}
				JIIFGECECMP = 0;
			}
			string text = __instance.IODEGBOKAAK[JIIFGECECMP];
			if (NGNCDNMOKDK)
			{
				if (!text.EndsWith("Mat") && !text.Contains("Mat_"))
				{
					__result = null;
					return false;
				}
				text = text.Replace("Mat", "EffectMat");
			}
			Bundle val = (((int)__instance.MIGKFLKFCIJ != 3) ? __instance.EDKLFODCINA : Bundle.op_Implicit((BundleType)9));
			if (text.Contains("_Creepy"))
			{
				string text2 = text.Replace("_Creepy", "");
				Material val2 = BundleHandler.LoadFromBundle<Material>(val, text2, true);
				if ((Object)(object)val2 == (Object)null)
				{
					__result = null;
					return false;
				}
				Material val3 = new Material(val2);
				setCopy(ref creepyTexture, val3.mainTexture);
				invertColor(ref creepyTexture);
				val3.mainTexture = (Texture)(object)creepyTexture;
				__result = val3;
			}
			else
			{
				Material val4 = BundleHandler.LoadFromBundle<Material>(val, text, true);
				if ((Object)(object)val4 == (Object)null)
				{
				}
				__result = val4;
			}
			return false;
		}

		private static void setCopy(ref Texture2D dst, Texture source)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1);
			Graphics.Blit(source, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			dst = new Texture2D(source.width, source.height);
			dst.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
			dst.Apply();
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
		}

		private static void invertColor(ref Texture2D tex)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			Color[] pixels = tex.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				pixels[i] = new Color(1f - pixels[i].r, 1f - pixels[i].g, 1f - pixels[i].b, pixels[i].a);
			}
			tex.SetPixels(pixels);
			tex.Apply();
		}
	}
	public class GrafPlayerInnitPatch
	{
		[HarmonyPatch(typeof(GrafPlayer), "Init")]
		[HarmonyPostfix]
		public static void Init_Postfix(GrafPlayer __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			__instance.outfitEffectColors[8] = new Color32((byte)149, (byte)0, (byte)225, byte.MaxValue);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CloneDrowned";

		public const string PLUGIN_NAME = "littleNoisesForFun";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}