Decompiled source of MoreClothing v1.0.1

Mods/MoreClothing_IL2Cpp.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.Clothing;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.UI.Shop;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;
using MoreClothing;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "MoreClothing", "1.0.1", "j0ckinjz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyMetadata("NexusModID", "1062")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("MoreClothing_IL2Cpp")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreClothing_IL2Cpp")]
[assembly: AssemblyTitle("MoreClothing_IL2Cpp")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreClothing
{
	public static class ClothingInjector
	{
		private static bool _hasInjected;

		private static bool _baseDefMissingWarned;

		private static CategoryInstance MakeCategory(EClothingSlot slot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_002e: 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_0030: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_001e: 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_0013: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			EShopCategory val = (((int)slot == 2) ? ((EShopCategory)10) : (((int)slot == 4) ? ((EShopCategory)12) : (((int)slot != 8) ? ((EShopCategory)0) : ((EShopCategory)16))));
			if (1 == 0)
			{
			}
			EShopCategory category = val;
			return new CategoryInstance
			{
				Category = category
			};
		}

		public static void InjectAll()
		{
			//IL_0156: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			if (_hasInjected)
			{
				return;
			}
			_hasInjected = true;
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition val = null;
				Enumerator<ItemRegister> enumerator2 = Singleton<Registry>.Instance.ItemRegistry.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					ItemRegister current2 = enumerator2.Current;
					ItemDefinition val2 = ((current2 != null) ? current2.Definition : null);
					if (!Object.op_Implicit((Object)(object)val2) || !(((Object)val2).name == "TacticalVest"))
					{
						continue;
					}
					val = ((Il2CppObjectBase)val2).TryCast<ClothingDefinition>();
					break;
				}
				if (!Object.op_Implicit((Object)(object)val) && !_baseDefMissingWarned)
				{
					Log.Warn("[MoreClothing] Could not find base item 'TacticalVest' in Registry.");
					_baseDefMissingWarned = true;
				}
				ClothingDefinition val3 = ((Il2CppObjectBase)ScriptableObject.CreateInstance(Il2CppType.Of<ClothingDefinition>())).TryCast<ClothingDefinition>();
				if (!Object.op_Implicit((Object)(object)val3))
				{
					Log.Error("[MoreClothing] Failed to create ClothingDefinition for '" + item.ID + "'");
					continue;
				}
				((ItemDefinition)val3).Name = item.Name;
				((Object)val3).name = item.Name.Replace(" ", "");
				((ItemDefinition)val3).ID = item.ID;
				val3.ClothingAssetPath = item.AssetPath;
				val3.Slot = item.Slot;
				val3.ApplicationType = item.ApplicationType;
				val3.Colorable = item.Colorable;
				val3.DefaultColor = item.DefaultColor;
				((StorableItemDefinition)val3).BasePurchasePrice = item.Price;
				((ItemDefinition)val3).Category = (EItemCategory)11;
				((ItemDefinition)val3).Description = item.Description;
				((ItemDefinition)val3).StackLimit = 1;
				((ItemDefinition)val3).UsableInFilters = false;
				((StorableItemDefinition)val3).ShopCategories = new List<CategoryInstance>();
				((StorableItemDefinition)val3).ShopCategories.Add(MakeCategory(item.Slot));
				if (!string.IsNullOrEmpty(item.ID))
				{
					string resourceName = "MoreClothing.Icons." + item.ID + ".png";
					Sprite val4 = Helpers.LoadEmbeddedIcon(resourceName);
					if (Object.op_Implicit((Object)(object)val4))
					{
						((ItemDefinition)val3).Icon = val4;
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					((StorableItemDefinition)val3).StoredItem = ((StorableItemDefinition)val).StoredItem;
					((ItemDefinition)val3).CustomItemUI = ((ItemDefinition)val).CustomItemUI;
					((ItemDefinition)val3).Keywords = ((ItemDefinition)val).Keywords;
				}
				item.Definition = val3;
				Log.Msg("Created ClothingDefinition: " + ((ItemDefinition)val3).Name);
			}
		}

		public static void RegisterDefinitions()
		{
			//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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition definition = item.Definition;
				if (!Object.op_Implicit((Object)(object)definition))
				{
					Log.Warn("Missing definition for variant " + item.ID);
					continue;
				}
				Singleton<Registry>.Instance.AddToRegistry((ItemDefinition)(object)definition);
				Singleton<Registry>.Instance.AddToItemDictionary(new ItemRegister
				{
					ID = ((ItemDefinition)definition).ID,
					Definition = (ItemDefinition)(object)definition
				});
			}
		}
	}
	[HarmonyPatch(typeof(ClothingShopInterface), "Start")]
	public static class PatchClothingShopInterfaceStart
	{
		private static readonly HashSet<int> InjectedShopInstances = new HashSet<int>();

		[HarmonyPostfix]
		public static void Postfix(ClothingShopInterface __instance)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			if (((__instance != null) ? ((ShopInterface)__instance).Listings : null) == null)
			{
				Log.Warn("[MoreClothing] ClothingShopInterface not ready, skipping injection.");
				return;
			}
			int instanceID = ((Object)__instance).GetInstanceID();
			if (InjectedShopInstances.Contains(instanceID))
			{
				return;
			}
			InjectedShopInstances.Add(instanceID);
			foreach (Variants item in ClothingVariants.All)
			{
				if (!Object.op_Implicit((Object)(object)item?.Definition))
				{
					Log.Warn("[MoreClothing] Skipped " + item?.Name + " — no definition.");
					continue;
				}
				ShopListing val = new ShopListing
				{
					Item = (StorableItemDefinition)(object)item.Definition,
					name = item.Name,
					OverridePrice = true,
					OverriddenPrice = item.Price
				};
				((ShopInterface)__instance).Listings.Add(val);
				((ShopInterface)__instance).CreateListingUI(val);
				Log.Msg("Injected " + item.Name + " into clothing shop.");
			}
			Log.Msg("All listings injected successfully.");
		}
	}
	[HarmonyPatch(typeof(Registry), "Awake")]
	public static class PatchRegistryAwake
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			ClothingInjector.InjectAll();
			ClothingInjector.RegisterDefinitions();
		}
	}
	public class Variants
	{
		public string Name;

		public string ID;

		public float Price;

		public string Description;

		public string AssetPath;

		public EClothingSlot Slot;

		public EClothingApplicationType ApplicationType;

		public bool Colorable;

		public EClothingColor DefaultColor;

		public ClothingDefinition Definition;
	}
	public static class ClothingVariants
	{
		public static List<Variants> All = new List<Variants>
		{
			new Variants
			{
				Name = "Police Tactical Vest",
				ID = "bulletproofvest_police",
				Description = "Very tough looking vest. It doesn't actually block bullets, though. Police issued.",
				Price = 200f,
				AssetPath = "Avatar/Accessories/Chest/BulletproofVest/BulletproofVest_Police",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Police Cap",
				ID = "policecap",
				Description = "Standard-issue police cap. Offers no protection, but a strong sense of authority.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/policecap/PoliceCap",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Respirator",
				ID = "respirator",
				Description = "Blocks out the bad stuff. Or at least makes you feel like it does.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/respirator/Respirator",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Hazmat Suit",
				ID = "hazmatsuit",
				Description = "Complete body coverage for those ‘don’t ask what I’m doing’ days.",
				Price = 200f,
				AssetPath = "Avatar/Accessories/waist/hazmatsuit/HazmatSuit",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = true,
				DefaultColor = (EClothingColor)13
			},
			new Variants
			{
				Name = "Police Belt",
				ID = "policebelt",
				Description = "Comes with holsters and zero responsibility. For decorative law enforcement.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/waist/policebelt/PoliceBelt",
				Slot = (EClothingSlot)2,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Fast Food T-Shirt",
				ID = "fastfoodtshirt",
				Description = "Grease-stained uniform of the flavor elite. Smells like tacos, permanently.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/FastFood T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Taco Ticklers Cap",
				ID = "fastfoodcap",
				Description = "Grease-stained uniform of the flavor elite. Smells like tacos, permanently.",
				Price = 50f,
				AssetPath = "Avatar/Accessories/Head/Cap/Cap_FastFood",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Gas Station T-Shirt",
				ID = "gasstationtshirt",
				Description = "Proudly repping petroleum. Includes complimentary sweat.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/GasStation T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Tucked T-Shirt",
				ID = "tuckedtshirt",
				Description = "For when you want to look like you care... but not that much.",
				Price = 50f,
				AssetPath = "Avatar/layers/top/Tucked T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = true,
				DefaultColor = (EClothingColor)0
			},
			new Variants
			{
				Name = "Priest Gown",
				ID = "priestgown",
				Description = "God is good. We're not.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/Waist/PriestGown/PriestGown",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			}
		};
	}
	public class Core : MelonMod
	{
		public override void OnInitializeMelon()
		{
			Harmony.CreateAndPatchAll(typeof(Core).Assembly, (string)null);
			Log.Msg("Mod Initialized. Version " + ((MelonBase)this).Info.Version);
		}
	}
	internal static class Log
	{
		public static void Msg(string msg)
		{
			Melon<Core>.Logger.Msg(msg);
		}

		public static void Warn(string warn)
		{
			Melon<Core>.Logger.Warning(warn);
		}

		public static void Error(string error)
		{
			Melon<Core>.Logger.Error(error);
		}
	}
	internal class Helpers
	{
		public static Sprite LoadEmbeddedIcon(string resourceName)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Assembly assembly = typeof(Core).Assembly;
			using Stream stream = assembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Log.Warn("Resource not found: " + resourceName);
				return null;
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(memoryStream.ToArray()));
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

Mods/MoreClothing_Mono.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using MoreClothing;
using ScheduleOne;
using ScheduleOne.Clothing;
using ScheduleOne.DevUtilities;
using ScheduleOne.ItemFramework;
using ScheduleOne.UI.Shop;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "MoreClothing", "1.0.1", "j0ckinjz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyMetadata("NexusModID", "1062")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("MoreClothing_Mono")]
[assembly: AssemblyConfiguration("MONO")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreClothing_Mono")]
[assembly: AssemblyTitle("MoreClothing_Mono")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoreClothing
{
	public static class ClothingInjector
	{
		private static bool _hasInjected;

		private static bool _baseDefMissingWarned;

		private static CategoryInstance MakeCategory(EClothingSlot slot)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_002e: 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_0030: 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_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_003d: Expected O, but got Unknown
			//IL_001e: 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_0013: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (1 == 0)
			{
			}
			EShopCategory val = (((int)slot == 2) ? ((EShopCategory)10) : (((int)slot == 4) ? ((EShopCategory)12) : (((int)slot != 8) ? ((EShopCategory)0) : ((EShopCategory)16))));
			if (1 == 0)
			{
			}
			EShopCategory category = val;
			return new CategoryInstance
			{
				Category = category
			};
		}

		public static void InjectAll()
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			if (_hasInjected)
			{
				return;
			}
			_hasInjected = true;
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition val = null;
				foreach (ItemRegister item2 in Singleton<Registry>.Instance.ItemRegistry)
				{
					ItemDefinition val2 = item2?.Definition;
					if (!Object.op_Implicit((Object)(object)val2) || !(((Object)val2).name == "TacticalVest"))
					{
						continue;
					}
					val = (ClothingDefinition)(object)((val2 is ClothingDefinition) ? val2 : null);
					break;
				}
				if (!Object.op_Implicit((Object)(object)val) && !_baseDefMissingWarned)
				{
					Log.Warn("[MoreClothing] Could not find base item 'TacticalVest' in Registry.");
					_baseDefMissingWarned = true;
				}
				ClothingDefinition val3 = ScriptableObject.CreateInstance<ClothingDefinition>();
				if (!Object.op_Implicit((Object)(object)val3))
				{
					Log.Error("[MoreClothing] Failed to create ClothingDefinition for '" + item.ID + "'");
					continue;
				}
				((ItemDefinition)val3).Name = item.Name;
				((Object)val3).name = item.Name.Replace(" ", "");
				((ItemDefinition)val3).ID = item.ID;
				val3.ClothingAssetPath = item.AssetPath;
				val3.Slot = item.Slot;
				val3.ApplicationType = item.ApplicationType;
				val3.Colorable = item.Colorable;
				val3.DefaultColor = item.DefaultColor;
				((StorableItemDefinition)val3).BasePurchasePrice = item.Price;
				((ItemDefinition)val3).Category = (EItemCategory)11;
				((ItemDefinition)val3).Description = item.Description;
				((ItemDefinition)val3).StackLimit = 1;
				((ItemDefinition)val3).UsableInFilters = false;
				((StorableItemDefinition)val3).ShopCategories = new List<CategoryInstance>();
				((StorableItemDefinition)val3).ShopCategories.Add(MakeCategory(item.Slot));
				if (!string.IsNullOrEmpty(item.ID))
				{
					string resourceName = "MoreClothing.Icons." + item.ID + ".png";
					Sprite val4 = Helpers.LoadEmbeddedIcon(resourceName);
					if (Object.op_Implicit((Object)(object)val4))
					{
						((ItemDefinition)val3).Icon = val4;
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					((StorableItemDefinition)val3).StoredItem = ((StorableItemDefinition)val).StoredItem;
					((ItemDefinition)val3).CustomItemUI = ((ItemDefinition)val).CustomItemUI;
					((ItemDefinition)val3).Keywords = ((ItemDefinition)val).Keywords;
				}
				item.Definition = val3;
				Log.Msg("Created ClothingDefinition: " + ((ItemDefinition)val3).Name);
			}
		}

		public static void RegisterDefinitions()
		{
			//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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			foreach (Variants item in ClothingVariants.All)
			{
				ClothingDefinition definition = item.Definition;
				if (!Object.op_Implicit((Object)(object)definition))
				{
					Log.Warn("Missing definition for variant " + item.ID);
					continue;
				}
				Singleton<Registry>.Instance.AddToRegistry((ItemDefinition)(object)definition);
				Singleton<Registry>.Instance.AddToItemDictionary(new ItemRegister
				{
					ID = ((ItemDefinition)definition).ID,
					Definition = (ItemDefinition)(object)definition
				});
			}
		}
	}
	[HarmonyPatch(typeof(ClothingShopInterface), "Start")]
	public static class PatchClothingShopInterfaceStart
	{
		private static readonly HashSet<int> InjectedShopInstances = new HashSet<int>();

		[HarmonyPostfix]
		public static void Postfix(ClothingShopInterface __instance)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			if (((ShopInterface)(__instance?)).Listings == null)
			{
				Log.Warn("[MoreClothing] ClothingShopInterface not ready, skipping injection.");
				return;
			}
			int instanceID = ((Object)__instance).GetInstanceID();
			if (InjectedShopInstances.Contains(instanceID))
			{
				return;
			}
			InjectedShopInstances.Add(instanceID);
			foreach (Variants item in ClothingVariants.All)
			{
				if (!Object.op_Implicit((Object)(object)item?.Definition))
				{
					Log.Warn("[MoreClothing] Skipped " + item?.Name + " — no definition.");
					continue;
				}
				ShopListing val = new ShopListing
				{
					Item = (StorableItemDefinition)(object)item.Definition,
					name = item.Name,
					OverridePrice = true,
					OverriddenPrice = item.Price
				};
				((ShopInterface)__instance).Listings.Add(val);
				((ShopInterface)__instance).CreateListingUI(val);
				Log.Msg("Injected " + item.Name + " into clothing shop.");
			}
			Log.Msg("All listings injected successfully.");
		}
	}
	[HarmonyPatch(typeof(Registry), "Awake")]
	public static class PatchRegistryAwake
	{
		[HarmonyPostfix]
		public static void Postfix()
		{
			ClothingInjector.InjectAll();
			ClothingInjector.RegisterDefinitions();
		}
	}
	public class Variants
	{
		public string Name;

		public string ID;

		public float Price;

		public string Description;

		public string AssetPath;

		public EClothingSlot Slot;

		public EClothingApplicationType ApplicationType;

		public bool Colorable;

		public EClothingColor DefaultColor;

		public ClothingDefinition Definition;
	}
	public static class ClothingVariants
	{
		public static List<Variants> All = new List<Variants>
		{
			new Variants
			{
				Name = "Police Tactical Vest",
				ID = "bulletproofvest_police",
				Description = "Very tough looking vest. It doesn't actually block bullets, though. Police issued.",
				Price = 200f,
				AssetPath = "Avatar/Accessories/Chest/BulletproofVest/BulletproofVest_Police",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Police Cap",
				ID = "policecap",
				Description = "Standard-issue police cap. Offers no protection, but a strong sense of authority.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/policecap/PoliceCap",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Respirator",
				ID = "respirator",
				Description = "Blocks out the bad stuff. Or at least makes you feel like it does.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/head/respirator/Respirator",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Hazmat Suit",
				ID = "hazmatsuit",
				Description = "Complete body coverage for those ‘don’t ask what I’m doing’ days.",
				Price = 200f,
				AssetPath = "Avatar/Accessories/waist/hazmatsuit/HazmatSuit",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = true,
				DefaultColor = (EClothingColor)13
			},
			new Variants
			{
				Name = "Police Belt",
				ID = "policebelt",
				Description = "Comes with holsters and zero responsibility. For decorative law enforcement.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/waist/policebelt/PoliceBelt",
				Slot = (EClothingSlot)2,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Fast Food T-Shirt",
				ID = "fastfoodtshirt",
				Description = "Grease-stained uniform of the flavor elite. Smells like tacos, permanently.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/FastFood T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Taco Ticklers Cap",
				ID = "fastfoodcap",
				Description = "Grease-stained uniform of the flavor elite. Smells like tacos, permanently.",
				Price = 50f,
				AssetPath = "Avatar/Accessories/Head/Cap/Cap_FastFood",
				Slot = (EClothingSlot)8,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			},
			new Variants
			{
				Name = "Gas Station T-Shirt",
				ID = "gasstationtshirt",
				Description = "Proudly repping petroleum. Includes complimentary sweat.",
				Price = 75f,
				AssetPath = "Avatar/layers/top/GasStation T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = false
			},
			new Variants
			{
				Name = "Tucked T-Shirt",
				ID = "tuckedtshirt",
				Description = "For when you want to look like you care... but not that much.",
				Price = 50f,
				AssetPath = "Avatar/layers/top/Tucked T-Shirt",
				Slot = (EClothingSlot)3,
				ApplicationType = (EClothingApplicationType)0,
				Colorable = true,
				DefaultColor = (EClothingColor)0
			},
			new Variants
			{
				Name = "Priest Gown",
				ID = "priestgown",
				Description = "God is good. We're not.",
				Price = 100f,
				AssetPath = "Avatar/Accessories/Waist/PriestGown/PriestGown",
				Slot = (EClothingSlot)4,
				ApplicationType = (EClothingApplicationType)2,
				Colorable = false
			}
		};
	}
	public class Core : MelonMod
	{
		public override void OnInitializeMelon()
		{
			Harmony.CreateAndPatchAll(typeof(Core).Assembly, (string)null);
			Log.Msg("Mod Initialized. Version " + ((MelonBase)this).Info.Version);
		}
	}
	internal static class Log
	{
		public static void Msg(string msg)
		{
			Melon<Core>.Logger.Msg(msg);
		}

		public static void Warn(string warn)
		{
			Melon<Core>.Logger.Warning(warn);
		}

		public static void Error(string error)
		{
			Melon<Core>.Logger.Error(error);
		}
	}
	internal class Helpers
	{
		public static Sprite LoadEmbeddedIcon(string resourceName)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Assembly assembly = typeof(Core).Assembly;
			using Stream stream = assembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Log.Warn("Resource not found: " + resourceName);
				return null;
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, memoryStream.ToArray());
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}