Decompiled source of CopyCat v1.0.0

plugins/YonDev.CopyCat.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("YonDev.CopyCat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+3e69e3909a771a54e80e4d6650ac044209ca6bf4")]
[assembly: AssemblyProduct("YonDev.CopyCat")]
[assembly: AssemblyTitle("CopyCat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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")]
	[Embedded]
	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")]
	[Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace CopyCat
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("YonDev.CopyCat", "CopyCat", "0.1.0")]
	internal class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__15_0;

			public static UnityAction <>9__17_0;

			internal void <CreatePlayerSelectionMenu>b__15_0()
			{
				PlayersMenu.SetActive(false);
			}

			internal void <AddRightClicks>b__17_0()
			{
				Log.LogInfo((object)"Right-clicked loadout");
				if ((Object)(object)PlayersMenu != (Object)null)
				{
					PopulatePlayerList();
					PlayersMenu.SetActive(true);
					PlayersMenu.transform.SetAsLastSibling();
				}
			}
		}

		private Harmony harmony = null;

		public const string Id = "YonDev.CopyCat";

		internal static ManualLogSource Log { get; private set; }

		internal static Plugin Instance { get; private set; }

		public static GameObject? PlayersMenu { get; private set; }

		public static string Name => "CopyCat";

		public static string Version => "0.1.0";

		private void Awake()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			harmony = new Harmony(Name);
			harmony.PatchAll();
		}

		public static void SetupCustomUI(GameObject wardrobeObj)
		{
			if (!((Object)(object)wardrobeObj == (Object)null))
			{
				if ((Object)(object)PlayersMenu == (Object)null)
				{
					CreatePlayerSelectionMenu(wardrobeObj.transform);
				}
				AddRightClicks(wardrobeObj);
				AddDeleteButtons(wardrobeObj);
			}
		}

		private static void CreatePlayerSelectionMenu(Transform parent)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Expected O, but got Unknown
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Expected O, but got Unknown
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Expected O, but got Unknown
			PlayersMenu = new GameObject("PlayerSelectionPanel", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			RectTransform component = PlayersMenu.GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			component.sizeDelta = new Vector2(350f, 500f);
			component.anchoredPosition = Vector2.zero;
			Image component2 = PlayersMenu.GetComponent<Image>();
			((Graphic)component2).color = new Color(0.12f, 0.12f, 0.12f, 0.98f);
			((Graphic)component2).raycastTarget = true;
			GameObject val = new GameObject("Header", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(TextMeshProUGUI)
			});
			RectTransform component3 = val.GetComponent<RectTransform>();
			((Transform)component3).SetParent(PlayersMenu.transform, false);
			component3.anchoredPosition = new Vector2(0f, 220f);
			component3.sizeDelta = new Vector2(330f, 40f);
			TextMeshProUGUI component4 = val.GetComponent<TextMeshProUGUI>();
			((TMP_Text)component4).text = "SELECT PLAYER TO STEAL FROM";
			((TMP_Text)component4).fontSize = 16f;
			((TMP_Text)component4).fontStyle = (FontStyles)1;
			((TMP_Text)component4).alignment = (TextAlignmentOptions)514;
			((Graphic)component4).color = Color.yellow;
			GameObject val2 = new GameObject("ScrollView", new Type[4]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(ScrollRect),
				typeof(RectMask2D)
			});
			RectTransform component5 = val2.GetComponent<RectTransform>();
			((Transform)component5).SetParent(PlayersMenu.transform, false);
			component5.anchoredPosition = new Vector2(0f, -20f);
			component5.sizeDelta = new Vector2(320f, 400f);
			ScrollRect component6 = val2.GetComponent<ScrollRect>();
			GameObject val3 = new GameObject("Content", new Type[3]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			RectTransform component7 = val3.GetComponent<RectTransform>();
			((Transform)component7).SetParent(val2.transform, false);
			component7.anchorMin = new Vector2(0.5f, 1f);
			component7.anchorMax = new Vector2(0.5f, 1f);
			component7.pivot = new Vector2(0.5f, 1f);
			component7.sizeDelta = new Vector2(300f, 0f);
			VerticalLayoutGroup component8 = val3.GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component8).spacing = 8f;
			((LayoutGroup)component8).childAlignment = (TextAnchor)1;
			((HorizontalOrVerticalLayoutGroup)component8).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)component8).childControlWidth = false;
			ContentSizeFitter component9 = val3.GetComponent<ContentSizeFitter>();
			component9.verticalFit = (FitMode)2;
			component6.content = component7;
			component6.horizontal = false;
			component6.vertical = true;
			GameObject val4 = new GameObject("CloseButton", new Type[4]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image),
				typeof(Button)
			});
			val4.layer = 5;
			RectTransform component10 = val4.GetComponent<RectTransform>();
			((Transform)component10).SetParent(PlayersMenu.transform, false);
			component10.anchoredPosition = new Vector2(145f, 225f);
			component10.sizeDelta = new Vector2(30f, 30f);
			Image component11 = val4.GetComponent<Image>();
			((Graphic)component11).color = new Color(0.8f, 0.3f, 0.3f);
			((Graphic)component11).raycastTarget = true;
			Button component12 = val4.GetComponent<Button>();
			ButtonClickedEvent onClick = component12.onClick;
			object obj = <>c.<>9__15_0;
			if (obj == null)
			{
				UnityAction val5 = delegate
				{
					PlayersMenu.SetActive(false);
				};
				<>c.<>9__15_0 = val5;
				obj = (object)val5;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			GameObject val6 = new GameObject("X", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(TextMeshProUGUI)
			});
			RectTransform component13 = val6.GetComponent<RectTransform>();
			((Transform)component13).SetParent(val4.transform, false);
			TextMeshProUGUI component14 = val6.GetComponent<TextMeshProUGUI>();
			((TMP_Text)component14).text = "X";
			((TMP_Text)component14).fontSize = 14f;
			((TMP_Text)component14).alignment = (TextAlignmentOptions)514;
			((Graphic)component14).color = Color.white;
			PlayersMenu.SetActive(false);
		}

		public static void PopulatePlayerList()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)PlayersMenu == (Object)null)
			{
				return;
			}
			Transform val = PlayersMenu.transform.Find("ScrollView/Content");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			foreach (Transform item in val)
			{
				Transform val2 = item;
				Object.Destroy((Object)(object)((Component)val2).gameObject);
			}
			if (!PhotonNetwork.InRoom || PhotonNetwork.PlayerList == null)
			{
				Log.LogWarning((object)"Cannot populate players: Not in Photon room.");
				return;
			}
			Player[] playerList = PhotonNetwork.PlayerList;
			foreach (Player val3 in playerList)
			{
				GameObject val4 = new GameObject("PlayerItem_" + val3.NickName, new Type[4]
				{
					typeof(RectTransform),
					typeof(CanvasRenderer),
					typeof(Image),
					typeof(Button)
				});
				RectTransform component = val4.GetComponent<RectTransform>();
				((Transform)component).SetParent(val, false);
				component.sizeDelta = new Vector2(280f, 40f);
				Image component2 = val4.GetComponent<Image>();
				((Graphic)component2).color = new Color(0.22f, 0.22f, 0.22f, 0.9f);
				Button component3 = val4.GetComponent<Button>();
				Player targetPlayer = val3;
				((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
				{
					Log.LogInfo((object)("Copying outfit from: " + targetPlayer.NickName));
					Instance?.Copyoutfit(targetPlayer);
					PlayersMenu.SetActive(false);
				});
				GameObject val5 = new GameObject("NameText", new Type[3]
				{
					typeof(RectTransform),
					typeof(CanvasRenderer),
					typeof(TextMeshProUGUI)
				});
				RectTransform component4 = val5.GetComponent<RectTransform>();
				((Transform)component4).SetParent(val4.transform, false);
				component4.anchorMin = Vector2.zero;
				component4.anchorMax = Vector2.one;
				component4.sizeDelta = Vector2.zero;
				TextMeshProUGUI component5 = val5.GetComponent<TextMeshProUGUI>();
				((TMP_Text)component5).text = (string.IsNullOrEmpty(targetPlayer.NickName) ? $"Player {targetPlayer.ActorNumber}" : targetPlayer.NickName);
				((TMP_Text)component5).fontSize = 14f;
				((TMP_Text)component5).alignment = (TextAlignmentOptions)514;
				((Graphic)component5).color = Color.white;
			}
		}

		public static void AddRightClicks(GameObject wardrobeObj)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			Button[] componentsInChildren = wardrobeObj.GetComponentsInChildren<Button>(true);
			foreach (Button val in componentsInChildren)
			{
				if (((Object)val).name == "DeleteCardButton")
				{
					continue;
				}
				((UnityEventBase)val.GetOnRightClick()).RemoveAllListeners();
				UnityEvent onRightClick = val.GetOnRightClick();
				object obj = <>c.<>9__17_0;
				if (obj == null)
				{
					UnityAction val2 = delegate
					{
						Log.LogInfo((object)"Right-clicked loadout");
						if ((Object)(object)PlayersMenu != (Object)null)
						{
							PopulatePlayerList();
							PlayersMenu.SetActive(true);
							PlayersMenu.transform.SetAsLastSibling();
						}
					};
					<>c.<>9__17_0 = val2;
					obj = (object)val2;
				}
				onRightClick.AddListener((UnityAction)obj);
			}
		}

		public static void AddDeleteButtons(GameObject wardrobeObj)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Expected O, but got Unknown
			Transform val = wardrobeObj.transform.Find("WardrobeBackground/Loadouts/Cards");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			foreach (Transform item in val)
			{
				Transform val2 = item;
				Component cardComponent = ((Component)val2).GetComponent("LoadoutCard");
				if ((Object)(object)cardComponent == (Object)null)
				{
					continue;
				}
				Transform val3 = val2;
				Graphic componentInChildren = (Graphic)(object)((Component)val2).GetComponentInChildren<RawImage>(true);
				if ((Object)(object)componentInChildren == (Object)null)
				{
					componentInChildren = (Graphic)(object)((Component)val2).GetComponentInChildren<Image>(true);
				}
				if ((Object)(object)componentInChildren != (Object)null)
				{
					val3 = ((Component)componentInChildren).transform;
				}
				if ((Object)(object)val3.Find("DeleteCardButton") != (Object)null || (Object)(object)val2.Find("DeleteCardButton") != (Object)null)
				{
					continue;
				}
				GameObject val4 = new GameObject("DeleteCardButton", new Type[4]
				{
					typeof(RectTransform),
					typeof(CanvasRenderer),
					typeof(Image),
					typeof(Button)
				});
				val4.layer = 5;
				RectTransform component = val4.GetComponent<RectTransform>();
				((Transform)component).SetParent(val3, false);
				component.anchorMin = new Vector2(1f, 1f);
				component.anchorMax = new Vector2(1f, 1f);
				component.pivot = new Vector2(1f, 1f);
				component.anchoredPosition = new Vector2(-5f, -5f);
				component.sizeDelta = new Vector2(24f, 24f);
				Image component2 = val4.GetComponent<Image>();
				((Graphic)component2).color = new Color(0.85f, 0.2f, 0.2f, 0.95f);
				((Graphic)component2).raycastTarget = true;
				Button component3 = val4.GetComponent<Button>();
				GameObject val5 = new GameObject("XText", new Type[3]
				{
					typeof(RectTransform),
					typeof(CanvasRenderer),
					typeof(TextMeshProUGUI)
				});
				RectTransform component4 = val5.GetComponent<RectTransform>();
				((Transform)component4).SetParent(val4.transform, false);
				component4.anchorMin = Vector2.zero;
				component4.anchorMax = Vector2.one;
				component4.sizeDelta = Vector2.zero;
				TextMeshProUGUI component5 = val5.GetComponent<TextMeshProUGUI>();
				((TMP_Text)component5).text = "X";
				((TMP_Text)component5).fontSize = 14f;
				((TMP_Text)component5).fontStyle = (FontStyles)1;
				((TMP_Text)component5).alignment = (TextAlignmentOptions)514;
				((Graphic)component5).color = Color.white;
				((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
				{
					object value = Traverse.Create((object)cardComponent).Property("AssignedLoadout", (object[])null).GetValue();
					if (value != null)
					{
						Log.LogInfo((object)"Deleting selected loadout...");
						DeleteLoadout(value, wardrobeObj);
					}
					else
					{
						Log.LogWarning((object)"Attempted to delete a card with no assigned loadout.");
					}
				});
			}
		}

		public static void DeleteLoadout(object loadout, GameObject wardrobeObj)
		{
			Type type = AccessTools.TypeByName("PersonalWardrobe.WardrobeManager");
			if (type == null)
			{
				return;
			}
			Traverse val = Traverse.CreateWithType("PersonalWardrobe.WardrobeManager").Property("Instance", (object[])null);
			object value = val.Property("Wardrobe", (object[])null).GetValue();
			if (value != null)
			{
				Traverse val2 = Traverse.Create(value).Field("Loadouts");
				if (val2.GetValue() is IList list && list.Contains(loadout))
				{
					list.Remove(loadout);
					val.Method("SaveWardrobe", Array.Empty<object>()).GetValue();
					Log.LogInfo((object)"Loadout successfully deleted via reflection and saved!");
					RefreshWardrobeUI(wardrobeObj);
				}
			}
		}

		private static void RefreshWardrobeUI(GameObject wardrobeObj)
		{
			Type type = AccessTools.TypeByName("PersonalWardrobe.WardrobeMenu");
			if (type == null)
			{
				return;
			}
			Object val = Object.FindFirstObjectByType(type);
			if (val != (Object)null)
			{
				Traverse val2 = Traverse.Create((object)val);
				object value = val2.Field("cardManager").GetValue();
				if (value != null)
				{
					Traverse.Create(value).Method("UpdateCardVisibility", new object[2]
					{
						0,
						int.MaxValue
					}).GetValue();
				}
			}
		}

		private void Copyoutfit(Player targetPlayer)
		{
			PersistentPlayerData playerData = GameHandler.GetService<PersistentPlayerDataService>().GetPlayerData(targetPlayer);
			if (playerData == null || playerData.customizationData == null)
			{
				Log.LogError((object)("Could not extract network customization data from player: " + targetPlayer.NickName));
				return;
			}
			CharacterCustomizationData customizationData = playerData.customizationData;
			Type type = AccessTools.TypeByName("PersonalWardrobe.Loadout");
			if (type == null)
			{
				return;
			}
			object obj = Activator.CreateInstance(type);
			if (obj != null)
			{
				Traverse val = Traverse.Create(obj);
				val.Property("Name", (object[])null).SetValue((object)targetPlayer.NickName);
				val.Property("SkinIndex", (object[])null).SetValue((object)customizationData.currentSkin);
				val.Property("AccessoryIndex", (object[])null).SetValue((object)customizationData.currentAccessory);
				val.Property("EyesIndex", (object[])null).SetValue((object)customizationData.currentEyes);
				val.Property("MouthIndex", (object[])null).SetValue((object)customizationData.currentMouth);
				val.Property("HatIndex", (object[])null).SetValue((object)customizationData.currentHat);
				val.Property("OutfitIndex", (object[])null).SetValue((object)customizationData.currentOutfit);
				val.Property("SashIndex", (object[])null).SetValue((object)customizationData.currentSash);
				Traverse.CreateWithType("PersonalWardrobe.WardrobeManager").Property("Instance", (object[])null).Method("SaveLoadout", new object[1] { obj })
					.GetValue();
				GameObject val2 = GameObject.Find("WardrobeMenu");
				if ((Object)(object)val2 != (Object)null)
				{
					RefreshWardrobeUI(val2);
				}
			}
		}

		private void OnDestroy()
		{
			harmony.UnpatchSelf();
		}
	}
	internal static class ButtonExtensions
	{
		private class RightClickHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
		{
			public UnityEvent onRightClick = new UnityEvent();

			public void OnPointerClick(PointerEventData eventData)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				if ((int)eventData.button == 1)
				{
					UnityEvent obj = onRightClick;
					if (obj != null)
					{
						obj.Invoke();
					}
				}
			}
		}

		internal static UnityEvent GetOnRightClick(this Button button)
		{
			RightClickHandler rightClickHandler = ((Component)button).gameObject.GetComponent<RightClickHandler>();
			if ((Object)(object)rightClickHandler == (Object)null)
			{
				rightClickHandler = ((Component)button).gameObject.AddComponent<RightClickHandler>();
			}
			return rightClickHandler.onRightClick;
		}
	}
	[HarmonyPatch]
	internal static class WardrobeMenuPatch
	{
		private static MethodBase? TargetMethod()
		{
			return AccessTools.Method("PersonalWardrobe.WardrobeMenu:CreateUI", (Type[])null, (Type[])null);
		}

		[HarmonyPostfix]
		internal static void Postfix(object __instance)
		{
			if (__instance != null)
			{
				object? value = AccessTools.Field(__instance.GetType(), "uiObject").GetValue(__instance);
				GameObject val = (GameObject)((value is GameObject) ? value : null);
				if ((Object)(object)val != (Object)null)
				{
					Plugin.SetupCustomUI(val);
				}
			}
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	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]
	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;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}