Decompiled source of R2API Skins v1.2.0

plugins/R2API.Skins/R2API.Skins.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using HG;
using HG.Reflection;
using IL.RoR2;
using IL.RoR2.Orbs;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates;
using On.RoR2;
using R2API.AutoVersionGen;
using RoR2;
using RoR2.Orbs;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("R2API.Skins")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+240776568fcb0a318bb7ef04774f91e87a15e305")]
[assembly: AssemblyProduct("R2API.Skins")]
[assembly: AssemblyTitle("R2API.Skins")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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 System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace R2API
{
	internal struct IconTexJob : IJobParallelFor
	{
		[ReadOnly]
		public Color32 Top;

		[ReadOnly]
		public Color32 Right;

		[ReadOnly]
		public Color32 Bottom;

		[ReadOnly]
		public Color32 Left;

		[ReadOnly]
		public Color32 Line;

		public NativeArray<Color32> TexOutput;

		public void Execute(int index)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			int num = index % 128 - 64;
			int num2 = index / 128 - 64;
			if (Math.Abs(Math.Abs(num2) - Math.Abs(num)) <= 2)
			{
				TexOutput[index] = Line;
			}
			else if (num2 > num && num2 > -num)
			{
				TexOutput[index] = Top;
			}
			else if (num2 < num && num2 < -num)
			{
				TexOutput[index] = Bottom;
			}
			else if (num2 > num && num2 < -num)
			{
				TexOutput[index] = Left;
			}
			else if (num2 < num && num2 > -num)
			{
				TexOutput[index] = Right;
			}
		}
	}
	public static class SkinLightReplacement
	{
		private struct RuntimeLightReplacement
		{
			public string path;

			public Color color;
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_ApplySkin <0>__SetLightOverrides;
		}

		private static List<(SkinDef, LightReplacement[])> _tuples = new List<(SkinDef, LightReplacement[])>();

		private static Dictionary<SkinIndex, RuntimeLightReplacement[]> _skinIndexToLightReplacements = new Dictionary<SkinIndex, RuntimeLightReplacement[]>();

		private static bool _hooksSet = false;

		private static bool _catalogInitialized = false;

		public static bool AddLightReplacement(SkinDef targetSkinDef, params LightReplacement[] lightReplacements)
		{
			SkinDef targetSkinDef2 = targetSkinDef;
			SetHooks();
			if (_catalogInitialized)
			{
				SkinsPlugin.Logger.LogInfo((object)$"Cannot add {lightReplacements.Length} light replacement(s) to the SkinDef {targetSkinDef2} because the skin catalog has already initialized.");
				return false;
			}
			if (_tuples.Any<(SkinDef, LightReplacement[])>(((SkinDef, LightReplacement[]) t) => (Object)(object)t.Item1 == (Object)(object)targetSkinDef2))
			{
				SkinsPlugin.Logger.LogInfo((object)$"Cannot add {lightReplacements.Length} light replacement(s) to the SkinDef {targetSkinDef2} because the skinDef already has light replacements associated to it.");
				return false;
			}
			_tuples.Add((targetSkinDef2, lightReplacements));
			return true;
		}

		private static void SystemInit()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			_catalogInitialized = true;
			foreach (var tuple2 in _tuples)
			{
				var (skin, source) = tuple2;
				_skinIndexToLightReplacements.Add(skin.skinIndex, source.Select(delegate(LightReplacement lr)
				{
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					RuntimeLightReplacement result = default(RuntimeLightReplacement);
					result.color = lr.color;
					result.path = Util.BuildPrefabTransformPath(skin.rootObject.transform, ((Component)lr.light).transform, false, false);
					return result;
				}).ToArray());
			}
		}

		private static void SetHooks()
		{
			//IL_001e: 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_0029: Expected O, but got Unknown
			if (!_hooksSet)
			{
				_hooksSet = true;
				object obj = <>O.<0>__SetLightOverrides;
				if (obj == null)
				{
					hook_ApplySkin val = SetLightOverrides;
					<>O.<0>__SetLightOverrides = val;
					obj = (object)val;
				}
				ModelSkinController.ApplySkin += (hook_ApplySkin)obj;
			}
		}

		internal static void UnsetHooks()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			_hooksSet = false;
			object obj = <>O.<0>__SetLightOverrides;
			if (obj == null)
			{
				hook_ApplySkin val = SetLightOverrides;
				<>O.<0>__SetLightOverrides = val;
				obj = (object)val;
			}
			ModelSkinController.ApplySkin -= (hook_ApplySkin)obj;
		}

		private static void SetLightOverrides(orig_ApplySkin orig, ModelSkinController self, int skinIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, skinIndex);
			SkinDef safe = ArrayUtils.GetSafe<SkinDef>(self.skins, skinIndex);
			if (!Object.op_Implicit((Object)(object)safe) || !_skinIndexToLightReplacements.TryGetValue(safe.skinIndex, out RuntimeLightReplacement[] value))
			{
				return;
			}
			RuntimeLightReplacement[] array = value;
			for (int i = 0; i < array.Length; i++)
			{
				RuntimeLightReplacement runtimeLightReplacement = array[i];
				Light component = ((Component)((Component)self).transform.Find(runtimeLightReplacement.path)).GetComponent<Light>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.color = runtimeLightReplacement.color;
				}
			}
		}
	}
	[Serializable]
	public struct LightReplacement
	{
		[Tooltip("The light which we will modify it's color")]
		[PrefabReference]
		public Light light;

		[Tooltip("The new color for the light")]
		public Color color;
	}
	public struct SkinDefInfo
	{
		public SkinDef?[]? BaseSkins;

		public Sprite? Icon;

		public string? NameToken;

		public UnlockableDef? UnlockableDef;

		public GameObject? RootObject;

		public RendererInfo[]? RendererInfos;

		public MeshReplacement[]? MeshReplacements;

		public GameObjectActivation[]? GameObjectActivations;

		public ProjectileGhostReplacement[]? ProjectileGhostReplacements;

		public MinionSkinReplacement[]? MinionSkinReplacements;

		public string? Name;
	}
	public static class SkinIDRS
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_ApplySkin <0>__SetCustomIDRS;

			public static Action <1>__SystemInit;
		}

		private static readonly Dictionary<SkinDef, ItemDisplayRuleSet> skinToIDRS = new Dictionary<SkinDef, ItemDisplayRuleSet>();

		private static readonly Dictionary<SkinDef, Dictionary<Object, DisplayRuleGroup>> skinIDRSOverrides = new Dictionary<SkinDef, Dictionary<Object, DisplayRuleGroup>>();

		private static bool hooksSet = false;

		private static bool initialized = false;

		public static bool AddPair(SkinDef skinDef, ItemDisplayRuleSet ruleSet)
		{
			SetHooks();
			if (initialized)
			{
				SkinsPlugin.Logger.LogInfo((object)$"Cannot add pair {skinDef} && {ruleSet} as the SkinIDRS has already initialized.");
				return false;
			}
			if (skinToIDRS.ContainsKey(skinDef))
			{
				SkinsPlugin.Logger.LogInfo((object)$"Cannot add pair {skinDef} && {ruleSet}, the skin {skinDef} already has an entry associated to it.");
				return false;
			}
			skinToIDRS[skinDef] = ruleSet;
			return true;
		}

		public static bool AddGroupOverride(SkinDef skinDef, Object keyAsset, DisplayRuleGroup displayRuleGroup)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			SetHooks();
			if (initialized)
			{
				SkinsPlugin.Logger.LogInfo((object)"Cannot add group SkinIDRS has already initialized.");
				return false;
			}
			if (!skinIDRSOverrides.TryGetValue(skinDef, out Dictionary<Object, DisplayRuleGroup> value))
			{
				value = (skinIDRSOverrides[skinDef] = new Dictionary<Object, DisplayRuleGroup>());
			}
			value[keyAsset] = displayRuleGroup;
			return true;
		}

		private static void SystemInit()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			initialized = true;
			ModelLocator val = default(ModelLocator);
			CharacterModel val2 = default(CharacterModel);
			foreach (CharacterBody allBodyPrefabBodyBodyComponent in BodyCatalog.allBodyPrefabBodyBodyComponents)
			{
				if (!Object.op_Implicit((Object)(object)allBodyPrefabBodyBodyComponent) || !((Component)allBodyPrefabBodyBodyComponent).TryGetComponent<ModelLocator>(ref val) || !Object.op_Implicit((Object)(object)val.modelTransform) || !((Component)val.modelTransform).TryGetComponent<CharacterModel>(ref val2))
				{
					continue;
				}
				ItemDisplayRuleSet itemDisplayRuleSet = val2.itemDisplayRuleSet;
				SkinDef[] bodySkins = BodyCatalog.GetBodySkins(allBodyPrefabBodyBodyComponent.bodyIndex);
				foreach (SkinDef key in bodySkins)
				{
					if (!skinIDRSOverrides.TryGetValue(key, out Dictionary<Object, DisplayRuleGroup> value))
					{
						if (!skinToIDRS.ContainsKey(key))
						{
							skinToIDRS[key] = itemDisplayRuleSet;
						}
						continue;
					}
					if (!skinToIDRS.TryGetValue(key, out ItemDisplayRuleSet value2))
					{
						value2 = (skinToIDRS[key] = (Object.op_Implicit((Object)(object)itemDisplayRuleSet) ? Object.Instantiate<ItemDisplayRuleSet>(itemDisplayRuleSet) : ScriptableObject.CreateInstance<ItemDisplayRuleSet>()));
					}
					foreach (KeyValuePair<Object, DisplayRuleGroup> item in value)
					{
						value2.SetDisplayRuleGroup(item.Key, item.Value);
					}
					value2.GenerateRuntimeValues();
				}
			}
			skinIDRSOverrides.Clear();
		}

		internal static void SetHooks()
		{
			//IL_001e: 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_0029: Expected O, but got Unknown
			if (!hooksSet)
			{
				hooksSet = true;
				object obj = <>O.<0>__SetCustomIDRS;
				if (obj == null)
				{
					hook_ApplySkin val = SetCustomIDRS;
					<>O.<0>__SetCustomIDRS = val;
					obj = (object)val;
				}
				ModelSkinController.ApplySkin += (hook_ApplySkin)obj;
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(SystemInit));
			}
		}

		private static void SetCustomIDRS(orig_ApplySkin orig, ModelSkinController self, int skinIndex)
		{
			orig.Invoke(self, skinIndex);
			SkinDef safe = ArrayUtils.GetSafe<SkinDef>(self.skins, skinIndex);
			if (Object.op_Implicit((Object)(object)safe) && skinToIDRS.TryGetValue(safe, out ItemDisplayRuleSet value))
			{
				self.characterModel.itemDisplayRuleSet = value;
			}
		}

		internal static void UnsetHooks()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			hooksSet = false;
			object obj = <>O.<0>__SetCustomIDRS;
			if (obj == null)
			{
				hook_ApplySkin val = SetCustomIDRS;
				<>O.<0>__SetCustomIDRS = val;
				obj = (object)val;
			}
			ModelSkinController.ApplySkin -= (hook_ApplySkin)obj;
			RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(SystemInit));
		}
	}
	[AutoVersion]
	public static class Skins
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__DoNothing;
		}

		public const string PluginGUID = "com.bepis.r2api.skins";

		public const string PluginName = "R2API.Skins";

		private static readonly HashSet<SkinDef> AddedSkins = new HashSet<SkinDef>();

		public const string PluginVersion = "1.2.0";

		public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			return CreateSkinIcon(top, right, bottom, left, new Color(0.6f, 0.6f, 0.6f));
		}

		public static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left, Color line)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001c: 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)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			IconTexJob iconTexJob = default(IconTexJob);
			iconTexJob.Top = Color32.op_Implicit(top);
			iconTexJob.Bottom = Color32.op_Implicit(bottom);
			iconTexJob.Right = Color32.op_Implicit(right);
			iconTexJob.Left = Color32.op_Implicit(left);
			iconTexJob.Line = Color32.op_Implicit(line);
			iconTexJob.TexOutput = val.GetRawTextureData<Color32>();
			IconTexJob iconTexJob2 = iconTexJob;
			JobHandle val2 = default(JobHandle);
			val2 = IJobParallelForExtensions.Schedule<IconTexJob>(iconTexJob2, 16384, 1, val2);
			((JobHandle)(ref val2)).Complete();
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f));
		}

		public static SkinDef CreateNewSkinDef(SkinDefInfo skin)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			object obj = <>O.<0>__DoNothing;
			if (obj == null)
			{
				hook_Awake val = DoNothing;
				<>O.<0>__DoNothing = val;
				obj = (object)val;
			}
			SkinDef.Awake += (hook_Awake)obj;
			SkinDef val2 = ScriptableObject.CreateInstance<SkinDef>();
			val2.baseSkins = skin.BaseSkins ?? Array.Empty<SkinDef>();
			val2.icon = skin.Icon;
			val2.unlockableDef = skin.UnlockableDef;
			val2.rootObject = skin.RootObject;
			val2.rendererInfos = skin.RendererInfos ?? Array.Empty<RendererInfo>();
			val2.gameObjectActivations = skin.GameObjectActivations ?? Array.Empty<GameObjectActivation>();
			val2.meshReplacements = skin.MeshReplacements ?? Array.Empty<MeshReplacement>();
			val2.projectileGhostReplacements = skin.ProjectileGhostReplacements ?? Array.Empty<ProjectileGhostReplacement>();
			val2.minionSkinReplacements = skin.MinionSkinReplacements ?? Array.Empty<MinionSkinReplacement>();
			val2.nameToken = skin.NameToken;
			((Object)val2).name = skin.Name;
			object obj2 = <>O.<0>__DoNothing;
			if (obj2 == null)
			{
				hook_Awake val3 = DoNothing;
				<>O.<0>__DoNothing = val3;
				obj2 = (object)val3;
			}
			SkinDef.Awake -= (hook_Awake)obj2;
			AddedSkins.Add(val2);
			return val2;
		}

		public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDefInfo skin)
		{
			SkinDef skin2 = CreateNewSkinDef(skin);
			return AddSkinToCharacter(bodyPrefab, skin2);
		}

		public static bool AddSkinToCharacter(GameObject? bodyPrefab, SkinDef? skin)
		{
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bodyPrefab == (Object)null)
			{
				SkinsPlugin.Logger.LogError((object)"Tried to add skin to null body prefab.");
				return false;
			}
			if ((Object)(object)skin == (Object)null)
			{
				SkinsPlugin.Logger.LogError((object)"Tried to add invalid skin.");
				return false;
			}
			AddedSkins.Add(skin);
			ModelLocator component = bodyPrefab.GetComponent<ModelLocator>();
			if ((Object)(object)component == (Object)null)
			{
				SkinsPlugin.Logger.LogError((object)"Tried to add skin to invalid body prefab (No ModelLocator).");
				return false;
			}
			Transform modelTransform = component.modelTransform;
			if ((Object)(object)modelTransform == (Object)null)
			{
				SkinsPlugin.Logger.LogError((object)"Tried to add skin to body prefab with no modelTransform.");
				return false;
			}
			if ((Object)(object)skin.rootObject != (Object)(object)((Component)modelTransform).gameObject)
			{
				SkinsPlugin.Logger.LogError((object)"Tried to add skin with improper root object set.");
				return false;
			}
			ModelSkinController val = ((Component)modelTransform).GetComponent<ModelSkinController>();
			if ((Object)(object)val == (Object)null)
			{
				SkinsPlugin.Logger.LogWarning((object)(((Object)bodyPrefab).name + " does not have a modelSkinController.\nAdding a new one and attempting to populate the default skin.\nHighly recommended you set the controller up manually."));
				CharacterModel component2 = ((Component)modelTransform).GetComponent<CharacterModel>();
				if ((Object)(object)component2 == (Object)null)
				{
					SkinsPlugin.Logger.LogError((object)"Unable to locate CharacterModel, default skin creation aborted.");
					return false;
				}
				SkinnedMeshRenderer mainSkinnedMeshRenderer = component2.mainSkinnedMeshRenderer;
				if ((Object)(object)mainSkinnedMeshRenderer == (Object)null)
				{
					SkinsPlugin.Logger.LogError((object)"CharacterModel did not contain a main SkinnedMeshRenderer, default skin creation aborted.");
					return false;
				}
				RendererInfo[] baseRendererInfos = component2.baseRendererInfos;
				if (baseRendererInfos == null || baseRendererInfos.Length == 0)
				{
					SkinsPlugin.Logger.LogError((object)"CharacterModel rendererInfos are invalid, default skin creation aborted.");
					return false;
				}
				val = ((Component)modelTransform).gameObject.AddComponent<ModelSkinController>();
				SkinDefInfo skin2 = default(SkinDefInfo);
				skin2.BaseSkins = Array.Empty<SkinDef>();
				skin2.GameObjectActivations = Array.Empty<GameObjectActivation>();
				skin2.Icon = CreateDefaultSkinIcon();
				skin2.Name = "skin" + ((Object)bodyPrefab).name + "Default";
				skin2.NameToken = ((Object)bodyPrefab).name.ToUpper() + "_DEFAULT_SKIN_NAME";
				skin2.RootObject = ((Component)modelTransform).gameObject;
				skin2.UnlockableDef = null;
				skin2.MeshReplacements = (MeshReplacement[]?)(object)new MeshReplacement[1]
				{
					new MeshReplacement
					{
						renderer = (Renderer)(object)mainSkinnedMeshRenderer,
						mesh = mainSkinnedMeshRenderer.sharedMesh
					}
				};
				skin2.RendererInfos = component2.baseRendererInfos;
				skin2.ProjectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				skin2.MinionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				SkinDef val2 = CreateNewSkinDef(skin2);
				val.skins = (SkinDef[])(object)new SkinDef[1] { val2 };
			}
			SkinDef[] array = val.skins;
			int num = array.Length;
			Array.Resize(ref array, num + 1);
			array[num] = skin;
			val.skins = array;
			return true;
		}

		private static Sprite CreateDefaultSkinIcon()
		{
			//IL_0000: 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_000a: 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)
			return CreateSkinIcon(Color.red, Color.green, Color.blue, Color.black);
		}

		private static void DoNothing(orig_Awake orig, SkinDef self)
		{
		}
	}
	[BepInPlugin("com.bepis.r2api.skins", "R2API.Skins", "1.2.0")]
	public sealed class SkinsPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
		}

		private void OnEnable()
		{
			SkinIDRS.SetHooks();
			SkinVFX.SetHooks();
		}

		private void OnDisable()
		{
			SkinIDRS.UnsetHooks();
			SkinVFX.UnsetHooks();
			SkinLightReplacement.UnsetHooks();
		}
	}
	public static class SkinVFX
	{
		public delegate void OnEffectSpawnedDelegate(GameObject spawnedEffect);

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Start <0>__ApplyModifier;

			public static hook_SpawnEffect_GameObject_EffectData_bool <1>__ApplyReplacement;

			public static Manipulator <2>__ModifyBulletAttack;

			public static Manipulator <3>__ModifyMuzzleFlash;

			public static hook_BeginMeleeAttackEffect <4>__ModifyGenericMelee;

			public static Manipulator <5>__ModifyGenericOrb;
		}

		private static List<SkinVFXInfo> skinVFXInfos = new List<SkinVFXInfo>();

		private static bool hooksSet = false;

		private const uint BaseIdentifier = 24000u;

		private static uint currentIdentifier = 24000u;

		private static bool hasCatalogInitOccured = false;

		private static uint nextIdentifier => currentIdentifier++;

		internal static void SetHooks()
		{
			//IL_001e: 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_0029: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			if (!hooksSet)
			{
				hooksSet = true;
				object obj = <>O.<0>__ApplyModifier;
				if (obj == null)
				{
					hook_Start val = ApplyModifier;
					<>O.<0>__ApplyModifier = val;
					obj = (object)val;
				}
				EffectComponent.Start += (hook_Start)obj;
				object obj2 = <>O.<1>__ApplyReplacement;
				if (obj2 == null)
				{
					hook_SpawnEffect_GameObject_EffectData_bool val2 = ApplyReplacement;
					<>O.<1>__ApplyReplacement = val2;
					obj2 = (object)val2;
				}
				EffectManager.SpawnEffect_GameObject_EffectData_bool += (hook_SpawnEffect_GameObject_EffectData_bool)obj2;
				object obj3 = <>O.<2>__ModifyBulletAttack;
				if (obj3 == null)
				{
					Manipulator val3 = ModifyBulletAttack;
					<>O.<2>__ModifyBulletAttack = val3;
					obj3 = (object)val3;
				}
				BulletAttack.FireSingle += (Manipulator)obj3;
				object obj4 = <>O.<3>__ModifyMuzzleFlash;
				if (obj4 == null)
				{
					Manipulator val4 = ModifyMuzzleFlash;
					<>O.<3>__ModifyMuzzleFlash = val4;
					obj4 = (object)val4;
				}
				EffectManager.SimpleMuzzleFlash += (Manipulator)obj4;
				object obj5 = <>O.<4>__ModifyGenericMelee;
				if (obj5 == null)
				{
					hook_BeginMeleeAttackEffect val5 = ModifyGenericMelee;
					<>O.<4>__ModifyGenericMelee = val5;
					obj5 = (object)val5;
				}
				BasicMeleeAttack.BeginMeleeAttackEffect += (hook_BeginMeleeAttackEffect)obj5;
				object obj6 = <>O.<5>__ModifyGenericOrb;
				if (obj6 == null)
				{
					Manipulator val6 = ModifyGenericOrb;
					<>O.<5>__ModifyGenericOrb = val6;
					obj6 = (object)val6;
				}
				GenericDamageOrb.Begin += (Manipulator)obj6;
			}
		}

		internal static void UnsetHooks()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0076: 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)
			//IL_0081: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//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_00c1: Expected O, but got Unknown
			hooksSet = false;
			object obj = <>O.<0>__ApplyModifier;
			if (obj == null)
			{
				hook_Start val = ApplyModifier;
				<>O.<0>__ApplyModifier = val;
				obj = (object)val;
			}
			EffectComponent.Start -= (hook_Start)obj;
			object obj2 = <>O.<1>__ApplyReplacement;
			if (obj2 == null)
			{
				hook_SpawnEffect_GameObject_EffectData_bool val2 = ApplyReplacement;
				<>O.<1>__ApplyReplacement = val2;
				obj2 = (object)val2;
			}
			EffectManager.SpawnEffect_GameObject_EffectData_bool -= (hook_SpawnEffect_GameObject_EffectData_bool)obj2;
			object obj3 = <>O.<2>__ModifyBulletAttack;
			if (obj3 == null)
			{
				Manipulator val3 = ModifyBulletAttack;
				<>O.<2>__ModifyBulletAttack = val3;
				obj3 = (object)val3;
			}
			BulletAttack.FireSingle -= (Manipulator)obj3;
			object obj4 = <>O.<3>__ModifyMuzzleFlash;
			if (obj4 == null)
			{
				Manipulator val4 = ModifyMuzzleFlash;
				<>O.<3>__ModifyMuzzleFlash = val4;
				obj4 = (object)val4;
			}
			EffectManager.SimpleMuzzleFlash -= (Manipulator)obj4;
			object obj5 = <>O.<4>__ModifyGenericMelee;
			if (obj5 == null)
			{
				hook_BeginMeleeAttackEffect val5 = ModifyGenericMelee;
				<>O.<4>__ModifyGenericMelee = val5;
				obj5 = (object)val5;
			}
			BasicMeleeAttack.BeginMeleeAttackEffect -= (hook_BeginMeleeAttackEffect)obj5;
			object obj6 = <>O.<5>__ModifyGenericOrb;
			if (obj6 == null)
			{
				Manipulator val6 = ModifyGenericOrb;
				<>O.<5>__ModifyGenericOrb = val6;
				obj6 = (object)val6;
			}
			GenericDamageOrb.Begin -= (Manipulator)obj6;
		}

		[SystemInitializer(new Type[] { typeof(EffectCatalog) })]
		private static void FindEffectIndexes()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			hasCatalogInitOccured = true;
			for (int i = 0; i < skinVFXInfos.Count; i++)
			{
				SkinVFXInfo skinVFXInfo = skinVFXInfos[i];
				if (Object.op_Implicit((Object)(object)skinVFXInfo.EffectPrefab))
				{
					skinVFXInfo.TargetEffect = EffectCatalog.FindEffectIndexFromPrefab(skinVFXInfo.EffectPrefab);
				}
				else if (!string.IsNullOrEmpty(skinVFXInfo.EffectString))
				{
					EffectDef val = ((IEnumerable<EffectDef>)EffectCatalog.entries).FirstOrDefault((Func<EffectDef, bool>)((EffectDef effectDef) => effectDef.prefabName == skinVFXInfo.EffectString));
					if (val == null)
					{
						SkinsPlugin.Logger.LogError((object)("Failed to find effect " + skinVFXInfo.EffectString + " for SkinVFXInfo!"));
					}
					else
					{
						skinVFXInfo.TargetEffect = val.index;
					}
				}
			}
		}

		private static SkinVFXInfo FindSkinVFXInfo(uint identifier)
		{
			if (identifier < 24000 || identifier >= (long)skinVFXInfos.Count + 24000L)
			{
				return null;
			}
			return skinVFXInfos[(int)(identifier - 24000)];
		}

		private static SkinVFXInfo FindSkinVFXInfo(GameObject attacker, GameObject effectPrefab)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)effectPrefab))
			{
				return null;
			}
			SkinDef skinDef = SkinCatalog.FindCurrentSkinDefForBodyInstance(attacker);
			EffectIndex index = EffectCatalog.FindEffectIndexFromPrefab(effectPrefab);
			return skinVFXInfos.FirstOrDefault((SkinVFXInfo skinVFXInfo) => (Object)(object)skinVFXInfo.RequiredSkin == (Object)(object)skinDef && skinVFXInfo.TargetEffect == index);
		}

		private static void ModifyGenericMelee(orig_BeginMeleeAttackEffect orig, BasicMeleeAttack self)
		{
			SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(((EntityState)self).gameObject, self.swingEffectPrefab);
			if (skinVFXInfo != null && Object.op_Implicit((Object)(object)skinVFXInfo.ReplacementEffectPrefab))
			{
				self.swingEffectPrefab = skinVFXInfo.ReplacementEffectPrefab;
			}
			orig.Invoke(self);
			if (skinVFXInfo != null && skinVFXInfo.OnEffectSpawned != null)
			{
				skinVFXInfo.OnEffectSpawned(self.swingEffectInstance);
			}
		}

		private static void ApplyReplacement(orig_SpawnEffect_GameObject_EffectData_bool orig, GameObject effectPrefab, EffectData effectData, bool transmit)
		{
			if (effectData == null)
			{
				orig.Invoke(effectPrefab, effectData, transmit);
				return;
			}
			if (effectData.genericUInt < 24000)
			{
				orig.Invoke(effectPrefab, effectData, transmit);
				return;
			}
			SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(effectData.genericUInt);
			if (skinVFXInfo == null)
			{
				orig.Invoke(effectPrefab, effectData, transmit);
			}
			else if ((Object)(object)skinVFXInfo.ReplacementEffectPrefab != (Object)null)
			{
				orig.Invoke(skinVFXInfo.ReplacementEffectPrefab, effectData, transmit);
			}
			else
			{
				orig.Invoke(effectPrefab, effectData, transmit);
			}
		}

		private static void ApplyModifier(orig_Start orig, EffectComponent self)
		{
			orig.Invoke(self);
			if (self.effectData != null && self.effectData.genericUInt >= 24000)
			{
				FindSkinVFXInfo(self.effectData.genericUInt)?.OnEffectSpawned?.Invoke(((Component)self).gameObject);
			}
		}

		private static void ModifyMuzzleFlash(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0049: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EffectData>(x, "SetChildLocatorTransformReference")
			}))
			{
				SkinsPlugin.Logger.LogError((object)"Failed to apply SkinVFX IL hook on EffectManager.SimpleMuzzleFlash");
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_1);
			val.Emit(OpCodes.Ldloc, 4);
			val.EmitDelegate<Action<GameObject, GameObject, EffectData>>((Action<GameObject, GameObject, EffectData>)delegate(GameObject effectPrefab, GameObject owner, EffectData data)
			{
				SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(owner, effectPrefab);
				if (skinVFXInfo != null)
				{
					data.genericUInt = skinVFXInfo.Identifier;
				}
			});
		}

		private static void ModifyGenericOrb(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0064: 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)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EffectData>(x, "SetHurtBoxReference")
			}))
			{
				SkinsPlugin.Logger.LogError((object)$"Failed to apply SkinVFX IL hook on {il.Method.DeclaringType}.{((MemberReference)il.Method).Name}");
				return;
			}
			val.Emit(OpCodes.Ldloc_0);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<EffectData, GenericDamageOrb>>((Action<EffectData, GenericDamageOrb>)delegate(EffectData data, GenericDamageOrb orb)
			{
				if (data != null && Object.op_Implicit((Object)(object)orb.attacker))
				{
					SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(orb.attacker, orb.GetOrbEffect());
					if (skinVFXInfo != null)
					{
						data.genericUInt = skinVFXInfo.Identifier;
					}
				}
			});
		}

		private static void ModifyBulletAttack(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EffectData>(x, "SetChildLocatorTransformReference")
			}))
			{
				SkinsPlugin.Logger.LogError((object)"Failed to apply SkinVFX IL hook on BulletAttack.FireSingle");
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<BulletAttack>>((Action<BulletAttack>)delegate(BulletAttack bulletAttack)
			{
				SkinVFXInfo skinVFXInfo = FindSkinVFXInfo(bulletAttack.owner, bulletAttack.tracerEffectPrefab);
				if (skinVFXInfo != null)
				{
					BulletAttack._effectData.genericUInt = skinVFXInfo.Identifier;
				}
			});
		}

		public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, EffectIndex targetEffect, GameObject replacementPrefab)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			SetHooks();
			SkinVFXInfo obj = new SkinVFXInfo
			{
				RequiredSkin = skinDef,
				TargetEffect = targetEffect,
				ReplacementEffectPrefab = replacementPrefab
			};
			AddSkinVFX(obj);
			return obj;
		}

		public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, string targetEffect, GameObject replacementPrefab)
		{
			SetHooks();
			SkinVFXInfo obj = new SkinVFXInfo
			{
				RequiredSkin = skinDef,
				EffectString = targetEffect,
				ReplacementEffectPrefab = replacementPrefab
			};
			AddSkinVFX(obj);
			return obj;
		}

		public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, GameObject targetEffect, GameObject replacementPrefab)
		{
			SetHooks();
			SkinVFXInfo obj = new SkinVFXInfo
			{
				RequiredSkin = skinDef,
				EffectPrefab = targetEffect,
				ReplacementEffectPrefab = replacementPrefab
			};
			AddSkinVFX(obj);
			return obj;
		}

		public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, EffectIndex targetEffect, OnEffectSpawnedDelegate onEffectSpawned)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			SetHooks();
			SkinVFXInfo obj = new SkinVFXInfo
			{
				RequiredSkin = skinDef,
				TargetEffect = targetEffect,
				OnEffectSpawned = onEffectSpawned
			};
			AddSkinVFX(obj);
			return obj;
		}

		public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, string targetEffect, OnEffectSpawnedDelegate onEffectSpawned)
		{
			SetHooks();
			SkinVFXInfo obj = new SkinVFXInfo
			{
				RequiredSkin = skinDef,
				EffectString = targetEffect,
				OnEffectSpawned = onEffectSpawned
			};
			AddSkinVFX(obj);
			return obj;
		}

		public static SkinVFXInfo AddSkinVFX(SkinDef skinDef, GameObject targetEffect, OnEffectSpawnedDelegate onEffectSpawned)
		{
			SetHooks();
			SkinVFXInfo obj = new SkinVFXInfo
			{
				RequiredSkin = skinDef,
				EffectPrefab = targetEffect,
				OnEffectSpawned = onEffectSpawned
			};
			AddSkinVFX(obj);
			return obj;
		}

		public static bool AddSkinVFX(SkinVFXInfo skinVFXInfo)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Invalid comparison between Unknown and I4
			//IL_003d: 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_008e: 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)
			SkinVFXInfo skinVFXInfo2 = skinVFXInfo;
			SetHooks();
			if (hasCatalogInitOccured && (Object)(object)skinVFXInfo2.EffectPrefab != (Object)null)
			{
				skinVFXInfo2.TargetEffect = EffectCatalog.FindEffectIndexFromPrefab(skinVFXInfo2.EffectPrefab);
				EffectDef val = ((IEnumerable<EffectDef>)EffectCatalog.entries).FirstOrDefault((Func<EffectDef, bool>)((EffectDef effectDef) => effectDef.prefabName == skinVFXInfo2.EffectString));
				if (val == null)
				{
					SkinsPlugin.Logger.LogError((object)("Failed to find effect " + skinVFXInfo2.EffectString + " for SkinVFXInfo!"));
					return false;
				}
				skinVFXInfo2.TargetEffect = val.index;
			}
			if ((Object)(object)skinVFXInfo2.RequiredSkin == (Object)null)
			{
				SkinsPlugin.Logger.LogError((object)"Cannot add a SkinVFXInfo with no assigned SkinDef.");
				return false;
			}
			if ((int)skinVFXInfo2.TargetEffect == -1 && (Object)(object)skinVFXInfo2.EffectPrefab == (Object)null && skinVFXInfo2.EffectString == null)
			{
				SkinsPlugin.Logger.LogError((object)"SkinVFXInfo may not have a TargetEffect of EffectIndex.Invalid, or must also specify an EffectPrefab or EffectString.");
				return false;
			}
			if ((Object)(object)skinVFXInfo2.ReplacementEffectPrefab == (Object)null && skinVFXInfo2.OnEffectSpawned == null)
			{
				SkinsPlugin.Logger.LogError((object)"SkinVFXInfo must have either a ReplacementEffectPrefab or an OnEffectSpawnedDelegate assigned.");
				return false;
			}
			skinVFXInfo2.Identifier = nextIdentifier;
			skinVFXInfos.Add(skinVFXInfo2);
			return true;
		}
	}
	public class SkinVFXInfo
	{
		public SkinDef RequiredSkin;

		public EffectIndex TargetEffect = (EffectIndex)(-1);

		public GameObject? ReplacementEffectPrefab;

		public SkinVFX.OnEffectSpawnedDelegate? OnEffectSpawned;

		public uint Identifier = uint.MaxValue;

		public GameObject EffectPrefab;

		public string EffectString;
	}
}
namespace R2API.AutoVersionGen
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	internal class AutoVersionAttribute : Attribute
	{
	}
}