Decompiled source of MoreSkins v0.1.0

plugins/com.github.RatherChaotic.MoreSkins.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.RatherChaotic.MoreSkins")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+932fac6cff3d9047ab4fd1974d6603e23f7ce023")]
[assembly: AssemblyProduct("com.github.RatherChaotic.MoreSkins")]
[assembly: AssemblyTitle("MoreSkins")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace MoreSkins
{
	[BepInPlugin("com.github.RatherChaotic.MoreSkins", "MoreSkins", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private class Patcher
		{
			private static bool CreateSkinOption(Customization customization, string name, Color color)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				string name2 = name;
				if (Array.Exists(customization.skins, (CustomizationOption skin) => ((Object)skin).name == name2) || Array.Exists(customization.skins, (CustomizationOption skin) => skin.color == color))
				{
					return false;
				}
				CustomizationOption val = ScriptableObject.CreateInstance<CustomizationOption>();
				val.color = color;
				((Object)val).name = name2;
				val.texture = customization.skins[0].texture;
				val.type = (Type)0;
				customization.skins = CollectionExtensions.AddToArray<CustomizationOption>(customization.skins, val);
				return true;
			}

			[HarmonyPatch(typeof(PassportManager), "Awake")]
			[HarmonyPostfix]
			private static void PassportManagerAwakePostfix(PassportManager __instance)
			{
				//IL_000d: 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_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				Customization component = ((Component)__instance).GetComponent<Customization>();
				CreateSkinOption(component, "Skin_White", Color.white);
				CreateSkinOption(component, "Skin_Black", new Color(0.2f, 0.2f, 0.2f, 1f));
				CreateSkinOption(component, "Skin_SkinTone1", Color32.op_Implicit(new Color32((byte)141, (byte)85, (byte)36, (byte)1)));
				CreateSkinOption(component, "Skin_SkinTone2", Color32.op_Implicit(new Color32((byte)198, (byte)134, (byte)66, (byte)1)));
				CreateSkinOption(component, "Skin_SkinTone3", Color32.op_Implicit(new Color32((byte)224, (byte)172, (byte)105, (byte)1)));
				CreateSkinOption(component, "Skin_SkinTone4", Color32.op_Implicit(new Color32((byte)241, (byte)194, (byte)125, (byte)1)));
				CreateSkinOption(component, "Skin_SkinTone5", Color32.op_Implicit(new Color32(byte.MaxValue, (byte)219, (byte)172, (byte)1)));
			}
		}

		private readonly Harmony _harmony = new Harmony("com.ratherchaotic.moreskins");

		public const string Id = "com.github.RatherChaotic.MoreSkins";

		public static string Name => "MoreSkins";

		public static string Version => "0.1.0";

		private void Awake()
		{
			_harmony.PatchAll(typeof(Patcher));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}