Decompiled source of Overstocked v1.1.0

Mods/Overstocked.dll

Decompiled 12 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using GorillaExtensions;
using GorillaNetworking;
using GorillaNetworking.Store;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Overstocked;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Plugin), "Overstocked", "1.1.0", "NotABird", null)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Overstocked")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fb103bf0f7a17db4fb5919a259818f2952272213")]
[assembly: AssemblyProduct("Overstocked")]
[assembly: AssemblyTitle("Overstocked")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 Overstocked
{
	public class Plugin : MelonMod
	{
		[CompilerGenerated]
		private sealed class <SetStandsPageForCategoryNextFrame>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

			public CosmeticCategory category;

			public int page;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SetStandsPageForCategoryNextFrame>d__12(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Expected O, but got Unknown
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					plugin.SetStandsPageForCategory(category, page);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static Transform? _mirrorSofa;

		private DynamicCosmeticStand? _defaultStand;

		private CosmeticCategory _currentSelectedCategory = (CosmeticCategory)1;

		private readonly List<DynamicCosmeticStand> _stands = new List<DynamicCosmeticStand>();

		private readonly Dictionary<CosmeticCategory, HashSet<CosmeticItem>> _allItemsWithPrice = new Dictionary<CosmeticCategory, HashSet<CosmeticItem>>();

		private readonly Dictionary<CosmeticCategory, int> _categoryPage = new Dictionary<CosmeticCategory, int>();

		private Util? _utility;

		private int TotalCosmetics => _allItemsWithPrice.Sum<KeyValuePair<CosmeticCategory, HashSet<CosmeticItem>>>((KeyValuePair<CosmeticCategory, HashSet<CosmeticItem>> items) => items.Value.Count);

		public override void OnLateInitializeMelon()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
			GorillaTagger.OnPlayerSpawned((Action)delegate
			{
				CosmeticsController instance = CosmeticsController.instance;
				((CosmeticsController)instance).V2_OnGetCosmeticsPlayFabCatalogData_PostSuccess = (Action)Delegate.Combine(((CosmeticsController)instance).V2_OnGetCosmeticsPlayFabCatalogData_PostSuccess, new Action(OnCosmeticsLoaded));
				_defaultStand = Resources.FindObjectsOfTypeAll<DynamicCosmeticStand>().First((DynamicCosmeticStand x) => ((Object)x).name == "DynamicCosmeticStand_CustomMap");
				_utility = new Util(((Component)((Component)_defaultStand.AddToCartButton).transform.parent).gameObject);
			});
		}

		private void SetItemForStand(DynamicCosmeticStand stand, CosmeticItem item)
		{
			//IL_0023: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected I4, but got Unknown
			stand.AddToCartButton.isOn = false;
			stand.AddToCartButton.UpdateColor();
			if (((CosmeticsController)CosmeticsController.instance).currentCart.Contains(item))
			{
				stand.AddToCartButton.isOn = true;
				stand.AddToCartButton.UpdateColor();
			}
			stand.thisCosmeticName = item.itemName;
			stand.StandName = item.itemName;
			((StoreController)StoreController.instance).AddStandToPlayfabIDDictionary(stand);
			stand.InitializeCosmetic();
			CosmeticCategory itemCategory = item.itemCategory;
			switch ((int)itemCategory)
			{
			case 1:
			case 3:
			case 4:
				stand.SetStandType((BustType)1);
				break;
			case 2:
			case 5:
			case 7:
			case 8:
			case 9:
				stand.SetStandType((BustType)2);
				break;
			case 6:
				stand.SetStandType((BustType)4);
				break;
			case 10:
			case 13:
				stand.SetStandType((BustType)3);
				break;
			case 11:
				stand.SetStandType((BustType)7);
				break;
			default:
				stand.SetStandType((BustType)0);
				break;
			}
		}

		private void SetStandsPageForCategory(CosmeticCategory category, int page)
		{
			//IL_0006: 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)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			_categoryPage[category] = page;
			if (!_allItemsWithPrice.TryGetValue(category, out HashSet<CosmeticItem> value))
			{
				return;
			}
			List<CosmeticItem> list = value.Skip(page * _stands.Count).Take(_stands.Count).ToList();
			for (int i = 0; i < _stands.Count; i++)
			{
				if (list.Count <= i)
				{
					SetItemForStand(_stands[i], ((CosmeticsController)CosmeticsController.instance).nullItem);
				}
				else
				{
					SetItemForStand(_stands[i], list[i]);
				}
			}
		}

		[IteratorStateMachine(typeof(<SetStandsPageForCategoryNextFrame>d__12))]
		private IEnumerator SetStandsPageForCategoryNextFrame(CosmeticCategory category, int page)
		{
			//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)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SetStandsPageForCategoryNextFrame>d__12(0)
			{
				<>4__this = this,
				category = category,
				page = page
			};
		}

		private int GetPagesForCategory(CosmeticCategory category)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!_allItemsWithPrice.TryGetValue(category, out HashSet<CosmeticItem> value) || _stands.Count == 0)
			{
				return 0;
			}
			return (value.Count + _stands.Count - 1) / _stands.Count;
		}

		private void OnCosmeticsLoaded()
		{
			//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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0104: Invalid comparison between Unknown and I4
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			IEnumerable<CosmeticItem> enumerable = ((CosmeticsController)CosmeticsController.instance).allCosmetics.Where((CosmeticItem x) => x.canTryOn && (int)x.itemCategory != 0 && !((CosmeticsController)CosmeticsController.instance).unlockedCosmetics.Contains(x));
			HashSet<CosmeticItem> hashSet = new HashSet<CosmeticItem>();
			foreach (CosmeticItem item in ((CosmeticsController)CosmeticsController.instance).allCosmetics.Where((CosmeticItem x) => (int)x.itemCategory == 13))
			{
				string[] bundledItems = item.bundledItems;
				if (bundledItems != null && bundledItems.Length > 0)
				{
					bundledItems = item.bundledItems;
					foreach (string text in bundledItems)
					{
						hashSet.Add(((CosmeticsController)CosmeticsController.instance).GetItemFromDict(text));
					}
				}
			}
			foreach (CosmeticItem item2 in enumerable)
			{
				if (_allItemsWithPrice.TryGetValue(item2.itemCategory, out HashSet<CosmeticItem> value))
				{
					if ((int)item2.itemCategory == 13 || !hashSet.Contains(item2))
					{
						value.Add(item2);
					}
				}
				else
				{
					_allItemsWithPrice.Add(item2.itemCategory, new HashSet<CosmeticItem> { item2 });
					_categoryPage.Add(item2.itemCategory, 0);
				}
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0014: 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)
			if (!(((Scene)(ref scene)).name != "City"))
			{
				Transform mirrorSofa = default(Transform);
				Transform upClearCartButton = default(Transform);
				if (!GTExt.TryFindByPath(scene, "City_Pretty/CosmeticsRoomAnchor/nicegorillastore_prefab/DressingRoom_Furniture_Prefab/mirror sofa/", ref mirrorSofa, false) || !GTExt.TryFindByPath(scene, "City_Pretty/CosmeticsRoomAnchor/nicegorillastore_prefab/DressingRoom_Mirrors_Prefab/TryOnConsole/", ref upClearCartButton, false))
				{
					MelonLogger.Error("Could not find mirror sofa or TryOnConsole");
					return;
				}
				_mirrorSofa = mirrorSofa;
				LoadHeads(_mirrorSofa);
				SetUpCategoryButtons(_mirrorSofa);
				SetUpPageButtons(_mirrorSofa);
				SetUpText(_mirrorSofa);
				SetUpClearCartButton(upClearCartButton);
			}
		}

		private void LoadHeads(Transform parent)
		{
			//IL_004d: 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_0068: 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)
			if (!((Object)(object)_defaultStand == (Object)null))
			{
				Vector3 localPosition = default(Vector3);
				((Vector3)(ref localPosition))..ctor(-1.2f, -0.2f, 0.45f);
				for (int i = 0; i < 3; i++)
				{
					Transform transform = ((Component)Object.Instantiate<DynamicCosmeticStand>(_defaultStand, parent, false)).transform;
					localPosition.x += 0.6f;
					transform.localPosition = localPosition;
					transform.localRotation = Quaternion.Euler(new Vector3(270f, 180f, 0f));
					_stands.Add(((Component)transform).GetComponent<DynamicCosmeticStand>());
				}
				MelonCoroutines.Start(SetStandsPageForCategoryNextFrame(_currentSelectedCategory, 0));
			}
		}

		private void SetUpCategoryButtons(Transform parent)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0040: 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_0074: 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_0099: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			if (_utility == null)
			{
				MelonLogger.Error("Utility class is null most likely failed to get headstand model");
				return;
			}
			GameObject val = new GameObject("CosmeticSetButtons");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = new Vector3(0f, 0.1f, 0.1f);
			val.transform.localRotation = Quaternion.Euler(new Vector3(300f, 0f, 180f));
			val.transform.localScale = Vector3.one * 0.7f;
			GridLayoutGroup obj = val.AddComponent<GridLayoutGroup>();
			obj.cellSize = new Vector2(0.2f, 0.13f);
			((LayoutGroup)obj).childAlignment = (TextAnchor)4;
			obj.startCorner = (Corner)2;
			obj.constraint = (Constraint)2;
			foreach (KeyValuePair<CosmeticCategory, HashSet<CosmeticItem>> set in _allItemsWithPrice.OrderByDescending<KeyValuePair<CosmeticCategory, HashSet<CosmeticItem>>, int>((KeyValuePair<CosmeticCategory, HashSet<CosmeticItem>> kvp) => kvp.Value.Count).Reverse())
			{
				object arg = set.Value.Count;
				CosmeticCategory key = set.Key;
				string text = $"{arg}\n{((object)(CosmeticCategory)(ref key)).ToString().ToUpper()}";
				_utility.CreateButton(val.transform, new Vector3(0f, 0f, 0.042f), Vector3.one * 0.004f, text, delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: 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_0038: Unknown result type (might be due to invalid IL or missing references)
					_currentSelectedCategory = set.Key;
					MelonCoroutines.Start(SetStandsPageForCategoryNextFrame(_currentSelectedCategory, _categoryPage[set.Key]));
				}).AddComponent<RectTransform>();
			}
		}

		private void SetUpPageButtons(Transform parent)
		{
			//IL_005c: 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)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if (_utility == null)
			{
				MelonLogger.Error("Utility class is null most likely failed to get headstand model");
				return;
			}
			for (int i = 0; i < 2; i++)
			{
				bool first = i == 1;
				string text = (first ? "<" : ">");
				GameObject obj = _utility.CreateButton(parent, new Vector3(0f, 0f, 0.042f), Vector3.one * 0.004f, text, delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0035: 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_006e: Unknown result type (might be due to invalid IL or missing references)
					int pagesForCategory = GetPagesForCategory(_currentSelectedCategory);
					int num = ((!first) ? 1 : (-1));
					int num2 = (_categoryPage[_currentSelectedCategory] + num + pagesForCategory) % pagesForCategory;
					_categoryPage[_currentSelectedCategory] = num2;
					MelonCoroutines.Start(SetStandsPageForCategoryNextFrame(_currentSelectedCategory, num2));
				});
				((Object)obj).name = "Page Selector " + text;
				obj.transform.localPosition = (first ? new Vector3(-0.3f, -0.02f, 0.3f) : new Vector3(0.3f, -0.02f, 0.3f));
				obj.transform.localRotation = Quaternion.Euler(new Vector3(315.2f, 0f, 90f));
				obj.transform.GetChild(1).localRotation = Quaternion.Euler(new Vector3(0f, 0f, 270f));
			}
		}

		private void SetUpText(Transform parent)
		{
			//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_002f: 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_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_defaultStand))
			{
				MelonLogger.Error("Failed to get defaultStand");
				return;
			}
			GameObject val = new GameObject("Text");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = new Vector3(0f, 0.753f, 0f);
			val.transform.localScale = Vector3.one * 0.1f;
			val.transform.localRotation = Quaternion.Euler(new Vector3(45f, 180f, 180f));
			TextMeshPro obj = val.AddComponent<TextMeshPro>();
			((TMP_Text)obj).font = ((TMP_Text)((Component)((Component)_defaultStand.AddToCartButton).transform.parent.GetChild(1)).GetComponent<TextMeshPro>()).font;
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj).fontSize = 10f;
			((TMP_Text)obj).text = $"{TotalCosmetics} COSMETICS";
		}

		private void SetUpClearCartButton(Transform parent)
		{
			//IL_0028: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(((Component)parent.GetChild(2)).gameObject, parent, false);
			obj.transform.localPosition = new Vector3(0.1895f, 0.2657f, -0.2043f);
			PlayerPrefFlagButton component = obj.GetComponent<PlayerPrefFlagButton>();
			GorillaPressableButton obj2 = obj.AddComponent<GorillaPressableButton>();
			GameObject obj3 = Object.Instantiate<GameObject>(((Component)((GorillaPressableButton)component).myTmpText).gameObject);
			obj3.transform.localPosition = new Vector3(19.398f, -0.6059f, -26.9f);
			obj3.transform.localScale = ((GorillaPressableButton)component).myTmpText.transform.localScale;
			obj3.transform.localRotation = ((GorillaPressableButton)component).myTmpText.transform.localRotation;
			TextMeshPro component2 = obj3.GetComponent<TextMeshPro>();
			obj2.myTmpText = (TMP_Text)(object)component2;
			obj2.buttonRenderer = ((GorillaPressableButton)component).buttonRenderer;
			obj2.unpressedMaterial = ((GorillaPressableButton)component).unpressedMaterial;
			obj2.isOn = false;
			obj2.offText = "CLEAR";
			obj2.UpdateColor();
			obj2.onPressed += delegate
			{
				//IL_000f: 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)
				((CosmeticsController)CosmeticsController.instance).ClearCheckoutAndCart(false);
				MelonCoroutines.Start(SetStandsPageForCategoryNextFrame(_currentSelectedCategory, _categoryPage[_currentSelectedCategory]));
			};
			ObjectExtensions.Destroy((Object)(object)component);
		}
	}
	public static class PluginInfo
	{
		public const string NAME = "Overstocked";

		public const string VERSION = "1.1.0";

		public const string AUTHOR = "NotABird";

		public const string GUID = "NotABird.Overstocked";
	}
	public class Util
	{
		[CompilerGenerated]
		private GameObject <buttonToClone>P;

		public Util(GameObject buttonToClone)
		{
			<buttonToClone>P = buttonToClone;
			base..ctor();
		}

		public GameObject CreateButton(Transform parent, Vector3 localPosition, Vector3 localScale, string text, Action onPressed)
		{
			//IL_0049: 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)
			Action onPressed2 = onPressed;
			GameObject obj = Object.Instantiate<GameObject>(<buttonToClone>P, parent, false);
			ObjectExtensions.Destroy((Object)(object)obj.GetComponentInChildren<DynamicCosmeticStand_Link>());
			ObjectExtensions.Destroy((Object)(object)((Component)obj.transform.GetChild(2)).gameObject);
			Transform child = obj.transform.GetChild(1);
			child.localPosition = localPosition;
			child.localScale = localScale;
			GorillaPressableButton componentInChildren = obj.GetComponentInChildren<GorillaPressableButton>();
			componentInChildren.offText = text;
			componentInChildren.UpdateColor();
			componentInChildren.onPressButton = null;
			componentInChildren.onPressed += delegate
			{
				onPressed2();
			};
			return obj;
		}
	}
}
namespace Overstocked.Patches
{
	[HarmonyPatch(typeof(GorillaSkin))]
	public class GorillaSkinPatches
	{
		[HarmonyPatch("ApplyToRig")]
		[HarmonyPrefix]
		public static bool ApplyToRigPatch(VRRig rig)
		{
			return !GTExt.IsNull((Object)(object)rig);
		}
	}
	[HarmonyPatch(typeof(GorillaSkinToggle))]
	public class GorillaSkinTogglePatches
	{
		private static readonly FieldInfo _rig = AccessTools.Field(typeof(GorillaSkinToggle), "_rig");

		[HarmonyPatch("OnEnable")]
		[HarmonyPrefix]
		public static bool OnEnablePatch(GorillaSkinToggle __instance)
		{
			return _rig.GetValue(__instance) != null;
		}
	}
	[HarmonyPatch(typeof(StoreController))]
	public class StoreControllerPatches
	{
		[HarmonyPatch("AddStandToPlayfabIDDictionary")]
		[HarmonyPrefix]
		public static bool AddStandToPlayfabIDDictionaryPatch(StoreController __instance, DynamicCosmeticStand dynamicCosmeticStand)
		{
			if (StringUtils.IsNullOrEmpty(dynamicCosmeticStand.StandName) || StringUtils.IsNullOrEmpty(dynamicCosmeticStand.thisCosmeticName))
			{
				return false;
			}
			if (__instance.StandsByPlayfabID.ContainsKey(dynamicCosmeticStand.thisCosmeticName))
			{
				if (!__instance.StandsByPlayfabID[dynamicCosmeticStand.thisCosmeticName].Contains(dynamicCosmeticStand))
				{
					__instance.StandsByPlayfabID[dynamicCosmeticStand.thisCosmeticName].Add(dynamicCosmeticStand);
				}
			}
			else
			{
				__instance.StandsByPlayfabID.Add(dynamicCosmeticStand.thisCosmeticName, new List<DynamicCosmeticStand>(1) { dynamicCosmeticStand });
			}
			return false;
		}
	}
}