Decompiled source of Homebrewery v2.4.33

Homebrewery.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Networking;

[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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Homebrewery")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.4.33.0")]
[assembly: AssemblyInformationalVersion("2.4.33+24144d615ed49afd166d969b8c6360643868ac75")]
[assembly: AssemblyProduct("Homebrewery")]
[assembly: AssemblyTitle("Homebrewery")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.33.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 Homebrewery
{
	public static class StringExtensions
	{
		public static string FCap(this string input)
		{
			return input[0].ToString().ToUpper() + input.Substring(1).ToLower();
		}
	}
	[BepInPlugin("Homebrewery", "Homebrewery", "2.4.33")]
	public class HB : BaseUnityPlugin
	{
		public class hbFolder
		{
			public object this[string key]
			{
				get
				{
					try
					{
						return GetType().GetProperty(key).GetValue(this);
					}
					catch (Exception ex)
					{
						Log("Problem with setting '" + key + "' in hbFolder instance!\n" + ex.Message, 4);
						return "";
					}
				}
				set
				{
					try
					{
						GetType().GetProperty(key).SetValue(this, value);
					}
					catch (Exception ex)
					{
						Log("Problem with setting '" + key + "' : '" + value?.ToString() + "' in hbFolder instance!\n" + ex.Message, 4);
					}
				}
			}

			public string name { get; set; }

			public string type { get; set; }

			public string race { get; set; }

			public List<string> contents { get; set; }

			public string path { get; set; }

			public string source { get; set; } = modFolderName;


			public bool done { get; set; } = false;


			public object thing { get; set; }

			public ShopkeepItem shopitem { get; set; }

			public string condname { get; set; }

			public hbParam param { get; set; }

			public hbImage itemIcon { get; set; }

			public hbImage armor { get; set; }

			public hbImage legPieceTexture_01 { get; set; }

			public hbImage legPieceTexture_02 { get; set; }

			public hbImage legPieceTexture_03 { get; set; }

			public hbImage legPieceTexture_04 { get; set; }

			public hbImage legOverlay { get; set; }

			public hbImage boobOverride { get; set; }

			public hbImage neckCollar { get; set; }

			public hbImage chestRender { get; set; }

			public hbImage chestRenderBoob { get; set; }

			public hbImage robeSkirt { get; set; }

			public hbImage shoulderPad { get; set; }

			public hbImage shield { get; set; }

			public hbImage up { get; set; }

			public hbImage pissed { get; set; }

			public hbImage center { get; set; }

			public hbImage right { get; set; }

			public hbImage left { get; set; }

			public hbImage down { get; set; }

			public hbImage hurt { get; set; }

			public hbImage closed { get; set; }

			public hbImage open { get; set; }

			public string textureGroupTag { get; set; }

			public hbImage body { get; set; }

			public hbImage leg { get; set; }

			public hbImage head { get; set; }

			public hbImage hair { get; set; }

			public hbImage tail { get; set; }

			public hbImage ear { get; set; }
		}

		public class hbParam
		{
			public int food = 2;

			public string extra = "";

			public string _itemName = "New Homebrewery Item";

			public string _itemDescription = "";

			public ColorAdjustShader_Profile _dyeParams = new ColorAdjustShader_Profile
			{
				_hue = 0f,
				_saturation = 1f,
				_brightness = 0f,
				_contrast = 1f
			};

			public bool _canDyeArmor = true;

			public ColorAdjustShader_Profile _colorAdjustParams = new ColorAdjustShader_Profile
			{
				_hue = 0f,
				_saturation = 1f,
				_brightness = 0f,
				_contrast = 1f
			};

			public bool _lockBoobs = false;

			public bool _disableJiggleBoobBones = false;

			public string _neckCollarMesh = "";

			public string _chestRenderDisplay = "";

			public string _robeSkirtRender = "";

			public string _armCuffRender = "";

			public bool _textureArms = true;

			public ShoulderPadDisplayType _shoulderPadDisplayType = (ShoulderPadDisplayType)0;

			public string _shoulderpadMesh = "";

			public string _helmRender = "";

			public string _helmOverrideMesh = "";

			public float _blendHelmValue = 0f;

			public bool _useHelmHairDisplay = false;

			public bool _hideHair = false;

			public bool _hideEars = false;

			public bool _hideMisc = false;

			public string _legPieceRender_01 = "";

			public string _legPieceRender_02 = "";

			public string _legPieceRender_03 = "";

			public string _legPieceRender_04 = "";

			public bool _textureUpperLegOnly = false;

			public bool _textureFeet = true;

			public string _capeMesh = "";

			public string _shieldMesh = "";

			public object this[string key]
			{
				get
				{
					try
					{
						return GetType().GetProperty(key).GetValue(this);
					}
					catch (Exception ex)
					{
						Log("Problem with getting '" + key + "' in hbParam instance!\n" + ex.Message, 4);
						return "";
					}
				}
				set
				{
					try
					{
						GetType().GetProperty(key.FCap()).SetValue(this, value);
					}
					catch (Exception ex)
					{
						Log("Problem with setting '" + key + "' : '" + value?.ToString() + "' in hbParam instance!\n" + ex.Message, 4);
					}
				}
			}

			public string name { get; set; }

			public string path { get; set; }

			public hbFolder folder { get; set; }

			public string json { get; set; }

			public string hash { get; set; }

			public ItemType _itemType { get; set; } = (ItemType)0;


			public SortTag _itemSortTag { get; set; } = (SortTag)0;


			public int _maxStackAmount { get; set; } = 1;


			public int _vendorCost { get; set; } = 10;


			public ItemRarity _itemRarity { get; set; } = (ItemRarity)4;


			public int _levelRequirement { get; set; } = 0;


			public float _consumableCooldown { get; set; } = 1.5f;


			public bool _useOnlyInTown { get; set; } = false;


			public GameObject _consumableObject { get; set; }

			public int _equipmentLevel { get; set; } = 1;


			public ItemEquipType _equipType { get; set; } = (ItemEquipType)0;

		}

		public class hbImage
		{
			public Texture2D tex = new Texture2D(4, 4, (TextureFormat)5, false)
			{
				name = "Blank Texture",
				anisoLevel = 16,
				filterMode = filter,
				mipMapBias = 0f
			};

			public string name { get; set; }

			public string field { get; set; }

			public bool sprite { get; set; } = false;


			public string path { get; set; }

			public hbFolder folder { get; set; }

			public string hash { get; set; }

			public bool done { get; set; } = false;


			public Sprite spr { get; set; }
		}

		private readonly Harmony _harmony = new Harmony("Homebrewery");

		public static string modFolderName = "Catman-Homebrewery";

		private string folderPath;

		private string internalPath;

		private string modsPath;

		public static readonly List<string> itemFolders = new List<string>(8) { "Cape", "Chestpiece", "Helm", "Leggings", "Shield", "Dye", "Consumable", "TradeItem" };

		private readonly Dictionary<string, List<string>> itemFields = new Dictionary<string, List<string>>
		{
			{
				"Dye",
				new List<string>()
			},
			{
				"Leggings",
				new List<string>(5) { "armor", "legPieceTexture_01", "legPieceTexture_02", "legPieceTexture_03", "legPieceTexture_04" }
			},
			{
				"Chestpiece",
				new List<string>(7) { "armor", "legOverlay", "boobOverride", "neckCollar", "chestRender", "robeSkirt", "shoulderPad" }
			},
			{
				"Helm",
				new List<string>(1) { "armor" }
			},
			{
				"Cape",
				new List<string>(1) { "armor" }
			},
			{
				"Shield",
				new List<string>(1) { "shield" }
			},
			{
				"Consumable",
				new List<string>()
			},
			{
				"TradeItem",
				new List<string>()
			}
		};

		public static readonly List<string> partFolders = new List<string>(3) { "Eyes", "Mouth", "Skin" };

		private readonly Dictionary<string, List<string>> partFields = new Dictionary<string, List<string>>
		{
			{
				"Eyes",
				new List<string>(8) { "up", "pissed", "closed", "center", "right", "left", "down", "hurt" }
			},
			{
				"Mouth",
				new List<string>(2) { "open", "closed" }
			},
			{
				"Skin",
				new List<string>(6) { "body", "leg", "head", "hair", "tail", "ear" }
			}
		};

		public static readonly List<string> races = new List<string>(5) { "Byrdle", "Chang", "Imp", "Kubold", "Poon" };

		private readonly List<string> raceFolders;

		public static readonly Dictionary<string, List<hbFolder>> hbDir = new Dictionary<string, List<hbFolder>>();

		private static readonly HashSet<string> hbFolds = new HashSet<string>();

		public static readonly List<hbFolder> hbItemTable = new List<hbFolder>();

		public static readonly Dictionary<string, List<hbFolder>> hbPartTable = new Dictionary<string, List<hbFolder>>();

		public static List<hbImage> hbImages = new List<hbImage>();

		public static List<hbParam> hbParams = new List<hbParam>();

		public static Dictionary<string, Dictionary<string, Dictionary<string, string>>> hbPartInd = new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();

		private static ConfigEntry<int> cfgLogLevel;

		private static ConfigEntry<int> cfgFilterMode;

		public static FilterMode filter = (FilterMode)0;

		private static ConfigEntry<bool> cfgEnforceTexSize;

		private static ConfigEntry<bool> cfgBlinkPatch;

		public static bool blink = true;

		private static ConfigEntry<int> cfgBlinkPercent;

		public static int blinkPercent = 87;

		private static ConfigEntry<bool> cfgHotkeysOn;

		public static bool hotkeysOn = true;

		private static ConfigEntry<bool> cfgBackfillSkin;

		private static ConfigEntry<int> cfgBumpscosity;

		public static ConfigEntry<int> cfgEasterEggChance;

		public static ConfigEntry<bool> cfgSpreadVanillaParts;

		public static ConfigEntry<int> cfgUpdateMessage;

		public static ConfigEntry<bool> cfgAlwaysShowUpdateMsg;

		public static readonly int updateCount = 7;

		private static readonly string updateString = "Thank you for using Homebrewery 2.4.33!\nNew condition effects, and improved part syncing!\nUhh, part sync on character load too! It'll start working when you've saved the characters once!\nRemember: don't store custom items!\nClose: 'T' | Ctrl+P to open HB Phone!";

		public static bool shownUpdateMessage = false;

		public static ConfigEntry<bool> cfgBypassFoodCapacity;

		public static ConfigEntry<bool> cfgCanDieInSanctuary;

		public static ConfigEntry<string> cfgP0EyesPart;

		public static ConfigEntry<string> cfgP0MouthPart;

		public static ConfigEntry<string> cfgP0SkinPart;

		public static ConfigEntry<string> cfgP1EyesPart;

		public static ConfigEntry<string> cfgP1MouthPart;

		public static ConfigEntry<string> cfgP1SkinPart;

		public static ConfigEntry<string> cfgP2EyesPart;

		public static ConfigEntry<string> cfgP2MouthPart;

		public static ConfigEntry<string> cfgP2SkinPart;

		public static ConfigEntry<string> cfgP3EyesPart;

		public static ConfigEntry<string> cfgP3MouthPart;

		public static ConfigEntry<string> cfgP3SkinPart;

		public static ConfigEntry<string> cfgP4EyesPart;

		public static ConfigEntry<string> cfgP4MouthPart;

		public static ConfigEntry<string> cfgP4SkinPart;

		public static ConfigEntry<string> cfgP5EyesPart;

		public static ConfigEntry<string> cfgP5MouthPart;

		public static ConfigEntry<string> cfgP5SkinPart;

		public static ConfigEntry<string> cfgP6EyesPart;

		public static ConfigEntry<string> cfgP6MouthPart;

		public static ConfigEntry<string> cfgP6SkinPart;

		public static Dictionary<string, List<AudioClip>> hbSFX = new Dictionary<string, List<AudioClip>>();

		public static Dictionary<string, Sprite> hbSprites = new Dictionary<string, Sprite>();

		public static Dictionary<string, ScriptableArmorRender> aRend = new Dictionary<string, ScriptableArmorRender>();

		public static Dictionary<string, Mesh> aMesh = new Dictionary<string, Mesh>();

		public static Dictionary<string, byte[]> backfill = new Dictionary<string, byte[]>();

		public static Dictionary<string, ScriptableStatusCondition> sCond = new Dictionary<string, ScriptableStatusCondition>();

		public static GameObject consumableObject;

		public static Dictionary<string, GameObject> sCondObj = new Dictionary<string, GameObject>();

		public static Dictionary<string, string> hbConsumableKeywords = new Dictionary<string, string>();

		public static Dictionary<string, int> hbConsumableFoodStat = new Dictionary<string, int>();

		public static float foodcapacity = 0f;

		public static GameManager gm;

		public static ScriptableArmorDye testDye;

		public static DialogManager dm;

		public static PlayerRaceModel ccm;

		public static PlayerLexicon pl;

		public static string version;

		public static string meshesstring;

		public static string armrendsstring;

		public static Sprite shopIcon;

		public static ScriptableShopkeep shopKeep_skritGamble;

		public static List<ScriptableShopkeep> hbShopKeep;

		public static Dictionary<ItemType, List<ShopkeepItem>> hbShopkeepItems = new Dictionary<ItemType, List<ShopkeepItem>>
		{
			{
				(ItemType)0,
				new List<ShopkeepItem>()
			},
			{
				(ItemType)1,
				new List<ShopkeepItem>()
			},
			{
				(ItemType)2,
				new List<ShopkeepItem>()
			}
		};

		public static Dictionary<ConditionData, bool> condat = new Dictionary<ConditionData, bool>();

		internal static ManualLogSource Logger;

		private static readonly List<(string msg, int typ)> errorList = new List<(string, int)>();

		private bool playing;

		public static readonly Dictionary<string, PlayerRaceModel> playerRaceModels = new Dictionary<string, PlayerRaceModel>();

		public static readonly Dictionary<string, int> vanPartsGrabbed = new Dictionary<string, int>();

		public static readonly Dictionary<string, List<EyeTextureGroup>> eyes = new Dictionary<string, List<EyeTextureGroup>>();

		public static readonly Dictionary<string, List<MouthTextureGroup>> mouths = new Dictionary<string, List<MouthTextureGroup>>();

		public static readonly Dictionary<string, List<SkinTextureGroup>> skins = new Dictionary<string, List<SkinTextureGroup>>();

		public static readonly Dictionary<string, List<Mesh>> hairs = new Dictionary<string, List<Mesh>>();

		public static readonly Dictionary<string, List<SkinnedMeshRenderer>> ears = new Dictionary<string, List<SkinnedMeshRenderer>>();

		public static readonly Dictionary<string, List<MeshRenderer>> miscs = new Dictionary<string, List<MeshRenderer>>();

		public static readonly Dictionary<string, List<SkinnedMeshRenderer>> miscskinneds = new Dictionary<string, List<SkinnedMeshRenderer>>();

		public static readonly Dictionary<string, List<SkinnedMeshRenderer>> tails = new Dictionary<string, List<SkinnedMeshRenderer>>();

		public static void Log<T>(T t, int l = 0)
		{
			if (cfgLogLevel.Value == -1)
			{
				return;
			}
			switch (l)
			{
			case 1:
				if (cfgLogLevel.Value <= 1)
				{
					Logger.LogDebug((object)t);
				}
				break;
			case 2:
				if (cfgLogLevel.Value <= 2)
				{
					Logger.LogMessage((object)t);
				}
				break;
			case 3:
				errorList.Add((t.ToString(), 3));
				if (cfgLogLevel.Value <= 3)
				{
					ManualLogSource logger2 = Logger;
					T val = t;
					logger2.LogWarning((object)(val?.ToString() + "\n"));
				}
				break;
			case 4:
			{
				errorList.Add((t.ToString(), 4));
				ManualLogSource logger = Logger;
				T val = t;
				logger.LogError((object)(val?.ToString() + "\n"));
				break;
			}
			default:
				Logger.LogMessage((object)t);
				break;
			}
		}

		public static void errorLister()
		{
			Log("Reprinting warnings and errors:", 2);
			foreach (var error in errorList)
			{
				if (error.typ == 3)
				{
					Logger.LogWarning((object)error.msg);
				}
				else
				{
					Logger.LogError((object)error.msg);
				}
			}
			Log("List cleared.", 2);
			errorList.Clear();
		}

		private static void cfgBinds(ConfigFile Config)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			cfgLogLevel = Config.Bind<int>("General", "LogLevel", 3, "Homebrewery's log output level:\n-1 cancels all logs.\n0 shows everything - the higher levels exclude the previous levels.\n1 for File path logs.\n2 for Processes.\n3 for Cautions.\n4 for Warnings.");
			cfgFilterMode = Config.Bind<int>("Texture Creation", "FilterMode", 0, "Use this to set what you want the texture filter variable to default to, the mod tries to set it when the game loads by checking the settings but sometimes fails.\nThis config setting will determine what it will use if it doesn't succeed. (It will update the variable if you change the setting in-game though).\n0 for Point filtering, which the game labels as 'Nearest (Crunchy).'\n1 for Bilinear, which the game labels as 'Bilnear (Smooth)', but IMO they should call it 'Blurry as fuck'.");
			filter = (FilterMode)cfgFilterMode.Value;
			cfgEnforceTexSize = Config.Bind<bool>("Texture Creation", "EnforceTexSize", true, "Sets whether Homebrewery will validate texture sizes and aspect ratios, for consistency with *most* of the vanilla ones.");
			cfgBlinkPatch = Config.Bind<bool>("Misc", "BlinkPatch", true, "Set this to false if you for some reason don't want the blinking improvement this mod implements (Using the closed eyes texture when the blink 'squish' animation plays).");
			blink = cfgBlinkPatch.Value;
			cfgBlinkPercent = Config.Bind<int>("Misc", "BlinkPercent", 87, "This integer lets you customise the point in the eye squish blendshape that the eyes will invoke the closed eyes state.\nIt is 87 by default because that seemed alright to me, but it seems to be very FPS dependant and hasn't worked for everyone.\nSet it to a lower number to increase the range. Setting it any higher would be redundant if it already works for you.");
			blink = cfgBlinkPatch.Value;
			cfgHotkeysOn = Config.Bind<bool>("Controls", "HotkeysOn", true, "Controls whether the mod's hotkeys are on by default.");
			hotkeysOn = cfgHotkeysOn.Value;
			cfgBackfillSkin = Config.Bind<bool>("Misc", "BackfillSkin", true, "Set this to false if you want the mod to NOT backfill missing SkinTextureGroup fields using vanilla textures. This means they will be transparent when absent!");
			cfgBumpscosity = Config.Bind<int>("General", "Bumpscosity", 1, "Adjusts the Bumpscosity.");
			cfgEasterEggChance = Config.Bind<int>("Misc", "EasterEggChance", 20, "The easter egg odds will be altered by this setting. The default value represents 1 in 20 odds, I think.");
			cfgSpreadVanillaParts = Config.Bind<bool>("General", "SpreadVanillaParts", true, "This controls whether the mod copies and distributes every race's vanilla parts (eyes, mouths, skins etc) to the other races.");
			cfgUpdateMessage = Config.Bind<int>("Misc", "UpdateMessage", 0, "A number the mod checks to simply determine if the mod has updated since the last time it loaded.\nLets me put a little update message up to say what has changed in the current version.");
			cfgAlwaysShowUpdateMsg = Config.Bind<bool>("Misc", "AlwaysShowUpdateMessage", false, "Set this to true to prevent the UpdateMessage number from changing, so it will always show the message.");
			cfgBypassFoodCapacity = Config.Bind<bool>("Consumables", "BypassFoodCapacity", false, "Set this to true to never be prevented from eating custom food consumables due to the food capacity stat.");
			cfgCanDieInSanctuary = Config.Bind<bool>("General", "CanDieInSanctuary", true, "If True, your ZoneType is set to 'Field' rather than 'Safe' while in the Sanctuary, meaning you can die there!");
			cfgP0EyesPart = Config.Bind<string>("zPart Markers", "cfgP0EyesPart", "", "Don't touch these, please.");
			cfgP0MouthPart = Config.Bind<string>("zPart Markers", "cfgP0MouthPart", "", "Don't touch these, please.");
			cfgP0SkinPart = Config.Bind<string>("zPart Markers", "cfgP0SkinPart", "", "Don't touch these, please.");
			cfgP1EyesPart = Config.Bind<string>("zPart Markers", "cfgP1EyesPart", "", "Don't touch these, please.");
			cfgP1MouthPart = Config.Bind<string>("zPart Markers", "cfgP1MouthPart", "", "Don't touch these, please.");
			cfgP1SkinPart = Config.Bind<string>("zPart Markers", "cfgP1SkinPart", "", "Don't touch these, please.");
			cfgP2EyesPart = Config.Bind<string>("zPart Markers", "cfgP2EyesPart", "", "Don't touch these, please.");
			cfgP2MouthPart = Config.Bind<string>("zPart Markers", "cfgP2MouthPart", "", "Don't touch these, please.");
			cfgP2SkinPart = Config.Bind<string>("zPart Markers", "cfgP2SkinPart", "", "Don't touch these, please.");
			cfgP3EyesPart = Config.Bind<string>("zPart Markers", "cfgP3EyesPart", "", "Don't touch these, please.");
			cfgP3MouthPart = Config.Bind<string>("zPart Markers", "cfgP3MouthPart", "", "Don't touch these, please.");
			cfgP3SkinPart = Config.Bind<string>("zPart Markers", "cfgP3SkinPart", "", "Don't touch these, please.");
			cfgP4EyesPart = Config.Bind<string>("zPart Markers", "cfgP4EyesPart", "", "Don't touch these, please.");
			cfgP4MouthPart = Config.Bind<string>("zPart Markers", "cfgP4MouthPart", "", "Don't touch these, please.");
			cfgP4SkinPart = Config.Bind<string>("zPart Markers", "cfgP4SkinPart", "", "Don't touch these, please.");
			cfgP5EyesPart = Config.Bind<string>("zPart Markers", "cfgP5EyesPart", "", "Don't touch these, please.");
			cfgP5MouthPart = Config.Bind<string>("zPart Markers", "cfgP5MouthPart", "", "Don't touch these, please.");
			cfgP5SkinPart = Config.Bind<string>("zPart Markers", "cfgP5SkinPart", "", "Don't touch these, please.");
			cfgP6EyesPart = Config.Bind<string>("zPart Markers", "cfgP6EyesPart", "", "Don't touch these, please.");
			cfgP6MouthPart = Config.Bind<string>("zPart Markers", "cfgP6MouthPart", "", "Don't touch these, please.");
			cfgP6SkinPart = Config.Bind<string>("zPart Markers", "cfgP6SkinPart", "", "Don't touch these, please.");
		}

		private static bool tryGetFilterMode(bool secondAttempt = false)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (!secondAttempt)
			{
				Log("Trying to get _textureFilterSetting.", 2);
			}
			else
			{
				Log("Trying to get _textureFilterSetting again.", 2);
			}
			try
			{
				filter = (FilterMode)SettingsManager._current._settingsProfile._textureFilterSetting;
				Log("Got it: " + ((object)(FilterMode)(ref filter)).ToString() + "\n", 2);
				return true;
			}
			catch
			{
				if (!secondAttempt)
				{
					Log("Didn't get FilterMode setting on first attempt, will try again before it is needed!", 3);
				}
				else
				{
					Log("Still didn't get _textureFilterSetting. Using default from config: " + ((object)(FilterMode)(ref filter)).ToString(), 3);
				}
				return false;
			}
		}

		private void Bumpscosity()
		{
			int[] array = new int[7] { 0, 1, 12, 50, 76, 100, 1000 };
			cfgBumpscosity.Value = array[Random.Range(0, 6)];
			int value = cfgBumpscosity.Value;
			int num = value;
			if (num < 50)
			{
				if (num > 0)
				{
					if (num < 12)
					{
						if (num == 1)
						{
							Log("Well I'm quite feeling the lack of bumpscosity in here.\nOnly a single bumpscosit. Still, it'll have to do.\n");
						}
						else
						{
							Log("Well I'm quite feeling the lack of bumpscosity in here.\nOnly a few bumpscosits. Still, it'll have to do.\n");
						}
					}
					else
					{
						Log("Just a light breeze of bumpscosity in here at the moment, not bad. I personally enjoy a bit more bumpscosity, but at this amount it's absolutely reasonable.\n");
					}
				}
				else
				{
					Log("Dear me, where did all the bumpscosity go? Quite unnerving in here with all of it gone.\n");
				}
			}
			else if (num < 100)
			{
				if (num < 76)
				{
					Log("Ahh, quite a pleasant amount of bumpscosity we've got today, wouldn't you say? Very enjoyable.\n");
				}
				else
				{
					Log("Well, the bumpscosity in here is really getting up there, isn't it?\nNo matter, the story must carry on no matter how much or how little bumpscosity there is.\n");
				}
			}
			else if (num < 1000)
			{
				Log("Who turned up the bumpscosity so high?\nI like bumpscosity as much as the next person, but a hundred is quite a lot, wouldn't you say?\n");
			}
			else
			{
				Log("My god, the bumpscosity in here is absolutely overwhelming.\nA thousand?! You people have got to be nuts!\nHow can you stand this much bumpscosity?\n");
			}
		}

		private void Awake()
		{
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0902: Unknown result type (might be due to invalid IL or missing references)
			//IL_0912: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Expected O, but got Unknown
			//IL_09d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f8: Expected O, but got Unknown
			Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)2);
			Logger = ((BaseUnityPlugin)this).Logger;
			cfgBinds(((BaseUnityPlugin)this).Config);
			version = Application.version;
			Log("Waking up... Game Version is: " + version);
			Bumpscosity();
			blinkPercent = Mathf.Clamp(cfgBlinkPercent.Value, 1, 99);
			Log("Checking for Mod Manager type install", 2);
			folderPath = Path.Combine(Paths.ConfigPath, "HomebreweryFiles");
			internalPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Internal");
			modsPath = Paths.PluginPath;
			modFolderName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location).Replace(Paths.PluginPath + "\\", "");
			if (!Directory.Exists(folderPath) || !Directory.Exists(internalPath))
			{
				Log("Checking for manual install instead", 2);
				folderPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "config", "HomebreweryFiles");
				internalPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "plugins", "Internal");
				if (!Directory.Exists(folderPath) || !Directory.Exists(internalPath))
				{
					Log("The 'HomebreweryFiles' or 'Internal' folder could not be found by the plugin, so there's no files to work with.\nHomebrewery will cease functioning now to prevent errors!", 4);
					Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1);
					return;
				}
			}
			Log("Mod's folder is called: " + modFolderName);
			Log("folderPath should be: " + folderPath);
			Log("internalPath should be: " + internalPath);
			Log("modsPath should be: " + modsPath + "\n");
			bool flag = tryGetFilterMode();
			shopIcon = Resources.Load<Sprite>("_graphic/_ui/_currencyBagIco");
			shopKeep_skritGamble = Resources.Load<ScriptableShopkeep>("_prefab/_entity/_npc/_skrit/shopKeep_skritGamble");
			partFolders.Sort();
			raceFolders.Sort();
			races.Sort();
			Log("Loading backfill texture data", 1);
			foreach (string race in races)
			{
				foreach (string item in partFields["Skin"])
				{
					string text = race + "-" + item;
					string path = Path.Combine(internalPath, "Backfill", text.ToLower() + ".png");
					if (File.Exists(path))
					{
						backfill.Add(text.ToLower(), File.ReadAllBytes(path));
					}
					else
					{
						backfill.Add(text.ToLower(), Array.Empty<byte>());
					}
				}
			}
			List<Mesh> list = new List<Mesh>();
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/00_armor/_neck/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/00_armor/_shoulderpads/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/00_armor/_helm/_halos"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/00_armor/_cape/"));
			list.AddRange(Resources.LoadAll<Mesh>("_graphic/_mesh/03_item/00_armor/_shield/"));
			IEnumerable<Mesh> enumerable = new <>z__ReadOnlyList<Mesh>(list);
			foreach (Mesh item2 in enumerable)
			{
				aMesh.Add(((Object)item2).name, item2);
			}
			Log("Meshes:\n" + string.Join(", ", aMesh.Keys), 1);
			meshesstring = string.Join(",", aMesh.Keys);
			string[] array = new string[12]
			{
				"based", "Nokia_3310", "BrokenDye", "joker", "VanityIco", "PortalIco", "ExitIco", "ForwardIco", "BackIco", "NextIco",
				"PreviousIco", "StorageIco"
			};
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				hbSprites.Add(text2, makeImage(internalPath, text2, sprite: true).spr);
			}
			consumableObject = Resources.Load<GameObject>("_item/02_consumable/_status/_consumableEffect_healthConsumable");
			sCondObj.Add("smoke", Resources.Load<GameObject>("_skill/_banditskills/_mistveil/_conditionEffect_mistVeil"));
			HardcodedConditions();
			if (!flag)
			{
				tryGetFilterMode(secondAttempt: true);
			}
			Log("Searching for other mods inside 'plugins' with HB content in them!");
			List<string> list2 = new List<string>();
			foreach (string item3 in Directory.EnumerateDirectories(modsPath))
			{
				if (!(item3 == modFolderName))
				{
					if (Directory.Exists(Path.Combine(item3, "HomebreweryFiles")))
					{
						list2.Add(Path.Combine(item3, "HomebreweryFiles"));
					}
					else if (Directory.Exists(Path.Combine(item3, "plugins", "HomebreweryFiles")))
					{
						list2.Add(Path.Combine(item3, "plugins", "HomebreweryFiles"));
					}
				}
			}
			if (list2.Count > 0)
			{
				Log("Folders:\n" + string.Join("\n", list2).Replace(modsPath, "") + "\n");
			}
			else
			{
				Log("None found!\n");
			}
			string text3 = folderPath;
			List<string> list3 = list2;
			int num = 0;
			string[] array3 = new string[1 + list3.Count];
			array3[num] = text3;
			num++;
			foreach (string item4 in list3)
			{
				array3[num] = item4;
				num++;
			}
			string[] array4 = array3;
			Log("contentFolders:\n" + string.Join("\n", array4) + "\n", 1);
			Log("Setting up hbDir - itemFolders", 2);
			Stopwatch stopwatch = Stopwatch.StartNew();
			foreach (string itemFolder in itemFolders)
			{
				hbDir.Add(itemFolder, new List<hbFolder>());
				string[] array5 = array4;
				foreach (string text4 in array5)
				{
					if (FindCustoms(text4, itemFolder, out var found) != null)
					{
						Log("Folders:\n" + string.Join("\n", found).Replace(text4, "") + "\n", 1);
						string text5 = text4.Replace(modsPath, "");
						text5 = ((!(text5 == folderPath)) ? text5.Split(new char[1] { '\\' })[1] : modFolderName);
						Log("Source: " + text5, 2);
						getItems(found.ToArray(), text4, text5);
						Log("", 2);
					}
				}
			}
			stopwatch.Stop();
			Log("getItems took " + stopwatch.ElapsedMilliseconds + "ms\n", 1);
			foreach (string race2 in races)
			{
				hbPartTable.Add(race2, new List<hbFolder>());
				hbPartInd.Add(race2, new Dictionary<string, Dictionary<string, string>>());
				foreach (string partFolder in partFolders)
				{
					hbPartInd[race2].Add(partFolder, new Dictionary<string, string>());
				}
			}
			hbFolder hbFolder = new hbFolder
			{
				name = "hbByrdleBeakTex_01",
				type = "Mouth",
				race = "Byrdle",
				thing = (object)new MouthTextureGroup
				{
					_closed = Resources.Load<Texture>("_graphic/_mesh/00_player/player_meshes/_racemesh_byrdle/byrdlebeaktex_01"),
					_open = Resources.Load<Texture>("_graphic/_mesh/00_player/player_meshes/_racemesh_byrdle/byrdlebeaktex_01")
				},
				done = true
			};
			hbFolder.condname = hbFolder.source + "-" + hbFolder.race + "-" + hbFolder.type + "-" + hbFolder.name;
			makeCondMark(hbFolder.condname, "Mouth");
			hbPartTable["Byrdle"].Add(hbFolder);
			hbFolder hbFolder2 = new hbFolder
			{
				name = "hbInvisBeak",
				type = "Mouth",
				race = "Byrdle",
				thing = (object)new MouthTextureGroup
				{
					_closed = (Texture)(object)Texture2D.blackTexture,
					_open = (Texture)(object)Texture2D.blackTexture
				},
				done = true
			};
			hbFolder2.condname = hbFolder2.source + "-" + hbFolder2.race + "-" + hbFolder2.type + "-" + hbFolder2.name;
			makeCondMark(hbFolder2.condname, "Mouth");
			hbPartTable["Byrdle"].Add(hbFolder2);
			Log("", 2);
			Log("Setting up hbDir - partFolders", 2);
			Stopwatch stopwatch2 = Stopwatch.StartNew();
			foreach (string partFolder2 in partFolders)
			{
				hbDir.Add(partFolder2, new List<hbFolder>());
				foreach (string raceFolder in raceFolders)
				{
					string part = Path.Combine(partFolder2, raceFolder);
					string[] array6 = array4;
					foreach (string text6 in array6)
					{
						if (FindCustoms(text6, part, out var found2) != null)
						{
							Log("Folders:\n" + string.Join("\n", found2).Replace(text6, "") + "\n", 1);
							string text7 = text6.Replace(modsPath, "");
							text7 = ((!(text7 == folderPath)) ? text7.Split(new char[1] { '\\' })[1] : modFolderName);
							Log("Source: " + text7, 2);
							getParts(found2.ToArray(), text6, text7);
							Log("", 2);
						}
					}
				}
			}
			stopwatch2.Stop();
			Log("getParts took " + stopwatch2.ElapsedMilliseconds + "ms\n", 1);
			Log("Getting SFX", 2);
			string path2 = Path.Combine(internalPath, "SFX");
			hbSFX.Add("phone", new List<AudioClip>());
			List<string> list4 = new List<string>();
			for (int l = 0; l <= 9; l++)
			{
				list4.Add(Path.Combine(path2, "phone", "0" + l + ".mp3"));
			}
			getSFX(list4.ToArray());
			_harmony.PatchAll();
			Log("_harmony.PatchAll() done");
			Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1);
		}

		private void HardcodedConditions()
		{
			//IL_0048: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			ScriptableStatusCondition val = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val).name = "Homebrewery-InstantKill";
			val._applyByTargetHealth = true;
			val._applyHealth = -999999999;
			((ScriptableCondition)val)._duration = 0.1f;
			((ScriptableCondition)val)._conditionName = "Homebrewery-InstantKill";
			((ScriptableCondition)val)._conditionDescription = "";
			((ScriptableCondition)val)._conditionType = (ConditionType)3;
			((ScriptableCondition)val)._isRefreshable = false;
			((ScriptableCondition)val)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-InstantKill_1", val);
			ScriptableStatusCondition val2 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val2).name = "Homebrewery-Low Gravity";
			val2._changeGravityMultiplier = 0.15f;
			((ScriptableCondition)val2)._duration = 14f;
			((ScriptableCondition)val2)._conditionName = "Homebrewery-Low Gravity";
			((ScriptableCondition)val2)._conditionDescription = "Gravity is momentarily lowered!";
			((ScriptableCondition)val2)._conditionType = (ConditionType)0;
			((ScriptableCondition)val2)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Low Gravity_1", val2);
			ScriptableStatusCondition val3 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val3).name = "Homebrewery-Inverted Gravity";
			val3._changeGravityMultiplier = -0.15f;
			((ScriptableCondition)val3)._duration = 5f;
			((ScriptableCondition)val3)._conditionName = "Homebrewery-Inverted Gravity";
			((ScriptableCondition)val3)._conditionDescription = "Gravity is momentarily inverted!";
			((ScriptableCondition)val3)._conditionType = (ConditionType)0;
			((ScriptableCondition)val3)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Inverted Gravity_1", val3);
			ScriptableStatusCondition val4 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val4).name = "Homebrewery-Hyperactive";
			val4._movSpeedPercentChange = 2f;
			val4._atkSpeedChange = 2f;
			((ScriptableCondition)val4)._duration = 7f;
			((ScriptableCondition)val4)._conditionName = "Homebrewery-Hyperactive";
			((ScriptableCondition)val4)._conditionDescription = "Briefly hyperactive!";
			((ScriptableCondition)val4)._conditionType = (ConditionType)0;
			((ScriptableCondition)val4)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Hyperactive_1", val4);
			ScriptableStatusCondition val5 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val5).name = "Homebrewery-Invisible";
			val5._hideEntity = true;
			((ScriptableCondition)val5)._duration = 3f;
			((ScriptableCondition)val5)._conditionName = "Homebrewery-Invisible";
			((ScriptableCondition)val5)._conditionDescription = "You've dissapeared momentarily!";
			((ScriptableCondition)val5)._conditionType = (ConditionType)0;
			((ScriptableCondition)val5)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Invisible_1", val5);
			ScriptableStatusCondition val6 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val6).name = "Homebrewery-Dancing?";
			val6._animlayer = 11;
			val6._animTag = "dance_loop";
			((ScriptableCondition)val6)._duration = 5f;
			((ScriptableCondition)val6)._conditionName = "Homebrewery-Dancing?";
			((ScriptableCondition)val6)._conditionDescription = "Started busting a move!";
			((ScriptableCondition)val6)._conditionType = (ConditionType)3;
			((ScriptableCondition)val6)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Dancing?_1", val6);
			ScriptableStatusCondition val7 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val7).name = "Homebrewery-Cannot Move";
			val7._movSpeedPercentChange = -1f;
			((ScriptableCondition)val7)._duration = 3f;
			((ScriptableCondition)val7)._conditionName = "Homebrewery-Cannot Move";
			((ScriptableCondition)val7)._conditionDescription = "You can't move!";
			((ScriptableCondition)val7)._conditionType = (ConditionType)3;
			((ScriptableCondition)val7)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Cannot Move_1", val7);
			ScriptableStatusCondition val8 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val8).name = "Homebrewery-Boob Toggler";
			((ScriptableCondition)val8)._duration = 0.5f;
			((ScriptableCondition)val8)._conditionName = "Homebrewery-Boob Toggler";
			((ScriptableCondition)val8)._conditionDescription = "Bimbofication or Femboyification?";
			((ScriptableCondition)val8)._conditionType = (ConditionType)2;
			((ScriptableCondition)val8)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Boob Toggler_1", val8);
			ScriptableStatusCondition val9 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val9).name = "Homebrewery-Rainbow Hair";
			((ScriptableCondition)val9)._isPermanent = true;
			((ScriptableCondition)val9)._conditionName = "Homebrewery-Rainbow Hair";
			((ScriptableCondition)val9)._conditionDescription = "HBHairEffect";
			((ScriptableCondition)val9)._conditionType = (ConditionType)0;
			((ScriptableCondition)val9)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Rainbow Hair_1", val9);
			ScriptableStatusCondition val10 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val10).name = "Homebrewery-Hairwash";
			((ScriptableCondition)val10)._duration = 0.5f;
			((ScriptableCondition)val10)._conditionName = "Homebrewery-Hairwash";
			((ScriptableCondition)val10)._conditionDescription = "Cleansed your hair effects away!";
			((ScriptableCondition)val10)._conditionType = (ConditionType)2;
			((ScriptableCondition)val10)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Hairwash_1", val10);
			ScriptableStatusCondition val11 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val11).name = "Homebrewery-Super Jump";
			((ScriptableCondition)val11)._duration = 2f;
			((ScriptableCondition)val11)._conditionName = "Homebrewery-Super Jump";
			((ScriptableCondition)val11)._conditionDescription = "Scroll of Icarian Flight? Nah!";
			((ScriptableCondition)val11)._conditionType = (ConditionType)0;
			((ScriptableCondition)val11)._displayConditionOnUI = false;
			sCond.Add("Homebrewery-Super Jump_1", val11);
			ScriptableStatusCondition val12 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val12).name = "Homebrewery-Drunk";
			((ScriptableCondition)val12)._duration = 600f;
			((ScriptableCondition)val12)._conditionName = "Homebrewery-Drunk";
			((ScriptableCondition)val12)._conditionDescription = "I'm drunk! You don't have an excuse!";
			((ScriptableCondition)val12)._conditionType = (ConditionType)3;
			((ScriptableCondition)val12)._displayConditionOnUI = false;
			((ScriptableCondition)val12)._isStackable = true;
			((ScriptableCondition)val12)._isRefreshable = false;
			sCond.Add("Homebrewery-Drunk_1", val12);
			float[] array = new float[2] { 10f, 1f };
			string[] array2 = new string[10] { "Mega Milk", "Caked Up", "Muffin Top", "Grow Big", "Grow Wide", "Mini Milk", "Pancaked Up", "Tummy Vacuum", "Shrinking", "Get Thinner" };
			float[] array3 = array;
			foreach (float num in array3)
			{
				string[] array4 = array2;
				foreach (string text in array4)
				{
					ScriptableStatusCondition val13 = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
					((Object)val13).name = "Homebrewery-" + text;
					((ScriptableCondition)val13)._conditionName = "Homebrewery-" + text;
					if (num == 1f)
					{
						((Object)val13).name = ((Object)val13).name + " (Fast)";
						((ScriptableCondition)val13)._conditionName = ((ScriptableCondition)val13)._conditionName + " (Fast)";
					}
					((ScriptableCondition)val13)._duration = num;
					((ScriptableCondition)val13)._conditionType = (ConditionType)0;
					((ScriptableCondition)val13)._displayConditionOnUI = false;
					sCond.Add(((Object)val13).name + "_1", val13);
				}
			}
		}

		public static void makeCondMark(string name, string type)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Log("makeCondMark(" + name + ")", 1);
			ScriptableStatusCondition val = ScriptableObject.CreateInstance<ScriptableStatusCondition>();
			((Object)val).name = name;
			((ScriptableCondition)val)._conditionName = name;
			((ScriptableCondition)val)._conditionDescription = "HBPartMarker-" + type;
			((ScriptableCondition)val)._conditionType = (ConditionType)0;
			((ScriptableCondition)val)._duration = 300f;
			((ScriptableCondition)val)._isStackable = false;
			((ScriptableCondition)val)._displayConditionOnUI = false;
			sCond.Add(name + "_1", val);
		}

		private async void getParts(string[] itemTargs, string path, string source)
		{
			List<Task> tasks = new List<Task>();
			foreach (string targ in itemTargs)
			{
				tasks.Add(getPart(targ, path, source));
			}
			await Task.WhenAll(tasks);
		}

		private Task getPart(string targ, string path, string source)
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			string text = targ.Replace(path, "");
			string text2 = text.Split(new char[1] { '\\' })[1];
			string text3 = text.Split(new char[1] { '\\' })[2];
			string text4 = text.Split(new char[1] { '\\' })[3];
			string[] source2 = new string[1] { text3 };
			if (text2 == "Skin" && text3 == "HB_ALLRACES")
			{
				source2 = races.ToArray();
			}
			foreach (string item in source2.ToList())
			{
				text3 = item;
				Log("getPart - " + text3 + " " + text2 + ": " + text4, 2);
				hbFolder hbFolder = new hbFolder
				{
					name = text4,
					type = text2,
					race = text3,
					path = targ,
					source = source,
					contents = partFields[text2].ToList()
				};
				if (hbFolder.contents.Count > 0)
				{
					Log("Looking for: " + string.Join(", ", hbFolder.contents), 1);
					foreach (string item2 in partFields[text2])
					{
						hbFolder[item2] = (hbImage)getItemField(item2, hbFolder);
					}
				}
				if (checkTexGroup(hbFolder))
				{
					Log("Marking partFold as done.", 1);
					hbFolder.done = true;
				}
				else
				{
					Log("Not marking partFold as done.", 1);
				}
				if (hbFolder.done)
				{
					makeObject(hbFolder);
					hbFolder.condname = source + "-" + text3 + "-" + text2 + "-" + text4;
					makeCondMark(hbFolder.condname, text2);
				}
				Log("Adding to hbDir.", 1);
				hbDir[text2].Add(hbFolder);
				hbFolds.Add(targ);
				if (hbFolder.race != "HB_ALLRACES")
				{
					hbPartTable[hbFolder.race].Add(hbFolder);
					continue;
				}
				if (hbFolder.type != "Mouth")
				{
					foreach (string race in races)
					{
						hbPartTable[race].Add(hbFolder);
					}
					continue;
				}
				foreach (string race2 in races)
				{
					if (!(race2 == "Byrdle"))
					{
						hbPartTable[race2].Add(hbFolder);
					}
				}
			}
			stopwatch.Stop();
			Log(text + " took " + stopwatch.ElapsedMilliseconds + "ms\n", 1);
			return Task.CompletedTask;
		}

		private bool checkTexGroup(hbFolder partFold)
		{
			string type = partFold.type;
			if (1 == 0)
			{
			}
			bool result = type switch
			{
				"Eyes" => checkEyeGroup(partFold), 
				"Mouth" => checkMouthGroup(partFold), 
				"Skin" => checkSkinGroup(partFold), 
				_ => false, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private bool checkEyeGroup(hbFolder partFold)
		{
			Log("checkEyeGroup()", 1);
			string name = partFold.name;
			if (!partFold.center.done)
			{
				Log(name + " - Eyes parts cannot be missing 'center' state!", 4);
				return false;
			}
			byte[] array = File.ReadAllBytes(partFold.center.path);
			if (!partFold.up.done)
			{
				Log(name + " - Missing 'up' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.up.tex, array, true);
			}
			if (!partFold.down.done)
			{
				Log(name + " - Missing 'down' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.down.tex, array, true);
			}
			if (!partFold.left.done)
			{
				Log(name + " - Missing 'left' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.left.tex, array, true);
			}
			if (!partFold.right.done)
			{
				Log(name + " - Missing 'right' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.right.tex, array, true);
			}
			if (!partFold.pissed.done)
			{
				Log(name + " - Missing 'pissed' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.pissed.tex, array, true);
			}
			if (!partFold.hurt.done)
			{
				Log(name + " - Missing 'hurt' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.hurt.tex, array, true);
			}
			if (!partFold.closed.done)
			{
				Log(name + " - Missing 'closed' Eye state being subbed with 'center' state", 3);
				ImageConversion.LoadImage(partFold.closed.tex, array, true);
			}
			return true;
		}

		private bool checkMouthGroup(hbFolder partFold)
		{
			Log("checkMouthGroup()", 1);
			string name = partFold.name;
			if (!partFold.closed.done)
			{
				if (partFold.race != "Byrdle")
				{
					Log(name + " - Mouth parts cannot be missing 'closed' state!", 4);
					return false;
				}
				Log(name + " - Byrdle 'Mouth' parts cannot be missing the Beak image!", 4);
				return false;
			}
			byte[] array = File.ReadAllBytes(partFold.closed.path);
			if (!partFold.open.done)
			{
				if (partFold.race != "Byrdle")
				{
					Log(name + " - Missing 'open' Mouth state being subbed with 'closed' state", 3);
				}
				else
				{
					Log(name + " - Copying Byrdle Beak image to 'open' state.", 2);
				}
				ImageConversion.LoadImage(partFold.open.tex, array, true);
			}
			return true;
		}

		private bool checkSkinGroup(hbFolder partFold)
		{
			Log("checkSkinGroup()", 1);
			if (!partFold.head.done && !partFold.body.done && !partFold.leg.done && !partFold.hair.done && !partFold.ear.done && !partFold.tail.done)
			{
				Log(partFold.name + " did not have a single 'done' texture!", 4);
				return false;
			}
			if (partFold.head.done && partFold.body.done && partFold.leg.done && partFold.hair.done && partFold.ear.done && partFold.tail.done)
			{
				Log("All six textures provided for " + partFold.name, 1);
				return true;
			}
			switch (partFold.race)
			{
			default:
				Log(partFold.race + " skins that don't contain all six images will use vanilla textures for backfilling.", 2);
				break;
			case "Poon":
			{
				if (!partFold.head.done)
				{
					Log("Poon SkinTextureGroups typically share the Head texture to the Hair, Ear and Tail.\nSince there isn't one in this custom set, all absent images will be backfilled by vanilla ones.", 2);
					break;
				}
				byte[] array2 = File.ReadAllBytes(partFold.head.path);
				if (!partFold.hair.done)
				{
					Log("Unprovided Poon Hair texture being subbed with given Head texture.", 2);
					ImageConversion.LoadImage(partFold.hair.tex, array2, true);
				}
				if (!partFold.ear.done)
				{
					Log("Unprovided Poon Ear texture being subbed with given Head texture.", 2);
					ImageConversion.LoadImage(partFold.ear.tex, array2, true);
				}
				if (!partFold.tail.done)
				{
					Log("Unprovided Poon Tail texture being subbed with given Head texture.", 2);
					ImageConversion.LoadImage(partFold.tail.tex, array2, true);
				}
				if (!partFold.body.done || !partFold.leg.done)
				{
					Log("Unprovided Poon Body/Leg texture will be backfilled by vanilla ones.", 2);
				}
				break;
			}
			case "Byrdle":
				if (!partFold.tail.done)
				{
					Log("Byrdle SkinTextureGroups typically share the Tail texture to the Hair.\nSince the Tail texture is absent, it will be backfilled by a vanilla Tail texture.\n", 2);
					if (!partFold.hair.done)
					{
						Log("Unprovided Byrdle Hair texture will be backfilled by a vanilla Hair texture.", 2);
					}
				}
				else if (!partFold.hair.done)
				{
					byte[] array3 = File.ReadAllBytes(partFold.tail.path);
					Log("Unprovided Byrdle Hair texture being subbed with given Tail texture.", 2);
					ImageConversion.LoadImage(partFold.hair.tex, array3, true);
				}
				if (!partFold.head.done)
				{
					Log("Byrdle SkinTextureGroups typically share the Head texture to the Ear.\nSince the Head texture is absent, it will be backfilled by a vanilla Head texture.\n", 2);
					if (!partFold.ear.done)
					{
						Log("Unprovided Byrdle Ear texture will be backfilled by a vanilla Ear texture.", 2);
					}
				}
				else if (!partFold.ear.done)
				{
					byte[] array4 = File.ReadAllBytes(partFold.head.path);
					Log("Unprovided Byrdle Ear texture being subbed with given Head texture.", 2);
					ImageConversion.LoadImage(partFold.ear.tex, array4, true);
				}
				if (!partFold.body.done || !partFold.leg.done)
				{
					Log("Unprovided Byrdle Body/Leg texture will be backfilled by vanilla ones.", 2);
				}
				break;
			case "Imp":
				if (!partFold.head.done)
				{
					Log("Imp SkinTextureGroups typically share the Head texture to the Ear.\nSince the Head texture is absent, it will be backfilled by a vanilla Head texture.\n", 2);
					if (!partFold.ear.done)
					{
						Log("Unprovided Imp Ear texture will be backfilled by a vanilla Ear texture.", 2);
					}
				}
				else if (!partFold.ear.done)
				{
					byte[] array5 = File.ReadAllBytes(partFold.head.path);
					Log("Unprovided Imp Ear texture being subbed with given Head texture.", 2);
					ImageConversion.LoadImage(partFold.ear.tex, array5, true);
				}
				if (!partFold.body.done || !partFold.leg.done || !partFold.hair.done || !partFold.tail.done)
				{
					Log("Unprovided Imp Body/Leg/Hair/Tail texture will be backfilled by vanilla ones.", 2);
				}
				break;
			case "Chang":
				if (!partFold.head.done)
				{
					Log("Chang SkinTextureGroups typically share the Head texture to the Hair.\nSince the Head texture is absent, it will be backfilled by a vanilla Head texture.\n", 2);
					if (!partFold.hair.done)
					{
						Log("Unprovided Chang Hair texture will be backfilled by a vanilla Hair texture.", 2);
					}
				}
				else if (!partFold.hair.done)
				{
					byte[] array = File.ReadAllBytes(partFold.head.path);
					Log("Unprovided Chang Hair texture being subbed with given Head texture.", 2);
					ImageConversion.LoadImage(partFold.hair.tex, array, true);
				}
				if (!partFold.body.done || !partFold.leg.done || !partFold.ear.done || !partFold.tail.done)
				{
					Log("Unprovided Chang Body/Leg/Ear/Tail texture will be backfilled by vanilla ones.", 2);
				}
				break;
			}
			return true;
		}

		private async void getItems(string[] itemTargs, string path, string source)
		{
			List<Task> tasks = new List<Task>();
			foreach (string targ in itemTargs)
			{
				tasks.Add(getItem(targ, path, source));
			}
			await Task.WhenAll(tasks);
		}

		private Task getItem(string targ, string path, string source)
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			string text = targ.Replace(path, "");
			string text2 = text.Split(new char[1] { '\\' })[1];
			string text3 = text.Split(new char[1] { '\\' })[2];
			Log("getItem - " + text2 + ": " + text3, 2);
			hbFolder hbFolder = new hbFolder
			{
				name = text3,
				type = text2,
				path = targ,
				source = source,
				contents = itemFields[text2].ToList()
			};
			if (source == modFolderName)
			{
				hbFolder.source = "Catman-Homebrewery";
			}
			Log("Looking for: itemIcon", 1);
			hbFolder.itemIcon = (hbImage)getItemField("itemIcon", hbFolder);
			if (!hbFolder.itemIcon.done)
			{
				hbImage itemIcon = hbFolder.itemIcon;
				if (1 == 0)
				{
				}
				Sprite spr = ((!(text2 == "Dye")) ? hbSprites["joker"] : hbSprites["BrokenDye"]);
				if (1 == 0)
				{
				}
				itemIcon.spr = spr;
			}
			Log("Looking for: param", 1);
			hbFolder.param = (hbParam)getItemField("param", hbFolder);
			if (hbFolder.contents.Count > 0)
			{
				Log("Looking for: " + string.Join(", ", hbFolder.contents), 1);
				foreach (string item in itemFields[text2])
				{
					hbFolder[item] = (hbImage)getItemField(item, hbFolder);
				}
			}
			if (hbFolder.param != null)
			{
				makeObject(hbFolder);
				Log("Marking itemFold as done.", 1);
				hbFolder.done = true;
			}
			Log("Adding to hbDir.", 1);
			hbDir[text2].Add(hbFolder);
			hbFolds.Add(targ);
			hbItemTable.Add(hbFolder);
			stopwatch.Stop();
			Log(text + " took " + stopwatch.ElapsedMilliseconds + "ms\n", 1);
			return Task.CompletedTask;
		}

		private object getItemField(string targ, hbFolder itemFold)
		{
			if (1 == 0)
			{
			}
			object result = ((targ == "param") ? ((object)getParam(targ, itemFold)) : ((object)((!(targ == "itemIcon")) ? getImage(targ, itemFold) : getImage(targ, itemFold, sprite: true))));
			if (1 == 0)
			{
			}
			return result;
		}

		private object makeScriptableObject(hbFolder itemFold)
		{
			string type = itemFold.type;
			if (1 == 0)
			{
			}
			object result;
			switch (type)
			{
			case "Dye":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableArmorDye>());
				result = obj2;
				break;
			}
			case "Consumable":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableStatusConsumable>());
				result = obj2;
				break;
			}
			case "TradeItem":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableTradeItem>());
				result = obj2;
				break;
			}
			case "Cape":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableCape>());
				result = obj2;
				break;
			}
			case "Helm":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableHelm>());
				result = obj2;
				break;
			}
			case "Leggings":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableLeggings>());
				result = obj2;
				break;
			}
			case "Chestpiece":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableChestpiece>());
				result = obj2;
				break;
			}
			case "Shield":
			{
				object obj2 = (itemFold.thing = ScriptableObject.CreateInstance<ScriptableShield>());
				result = obj2;
				break;
			}
			default:
				result = null;
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		private void makeObject_Dye(hbFolder itemFold, ScriptableArmorDye dye)
		{
			//IL_0054: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			itemFold.param._itemType = (ItemType)1;
			itemFold.param._itemSortTag = (SortTag)1;
			itemFold.param._itemRarity = (ItemRarity)0;
			Log("makeObject_Dye doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)dye);
			Log("makeObject_Dye did FromJsonOverwrite", 1);
			((ScriptableItem)dye)._itemType = (ItemType)1;
			((ScriptableItem)dye)._itemSortTag = (SortTag)1;
			((ScriptableItem)dye)._itemRarity = (ItemRarity)0;
			Log("Setting _itemIcon", 1);
			((ScriptableItem)dye)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject_Consumable(hbFolder itemFold, ScriptableStatusConsumable cons)
		{
			//IL_0054: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			itemFold.param._itemType = (ItemType)1;
			itemFold.param._itemSortTag = (SortTag)2;
			itemFold.param._itemRarity = (ItemRarity)0;
			Log("makeObject_Consumable doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)cons);
			Log("makeObject_Consumable did FromJsonOverwrite", 1);
			((ScriptableItem)cons)._itemType = (ItemType)1;
			((ScriptableItem)cons)._itemSortTag = (SortTag)2;
			((ScriptableItem)cons)._itemRarity = (ItemRarity)0;
			cons._healthApply = 0;
			cons._staminaApply = 0;
			cons._manaApply = 0;
			cons._expGain = 0;
			cons._resetAttributePoints = false;
			cons._resetSkillPoints = false;
			cons._selfConditions = Array.Empty<ScriptableCondition>();
			((ScriptableConsumable)cons)._consumableObject = consumableObject;
			((ScriptableConsumable)cons)._consumableCooldown = 8f;
			((ScriptableItem)cons)._maxStackAmount = 99;
			Log("Setting _itemIcon", 1);
			((ScriptableItem)cons)._itemIcon = itemFold.itemIcon.spr;
			if (itemFold.param.food != 0 && hbConsumableFoodStat.ContainsKey(((ScriptableItem)cons)._itemName))
			{
				hbConsumableFoodStat[((ScriptableItem)cons)._itemName] = itemFold.param.food;
			}
			else
			{
				hbConsumableFoodStat.Add(((ScriptableItem)cons)._itemName, itemFold.param.food);
			}
			if (itemFold.param.extra != "" && hbConsumableKeywords.ContainsKey(((ScriptableItem)cons)._itemName))
			{
				hbConsumableKeywords[((ScriptableItem)cons)._itemName] = itemFold.param.extra;
			}
			else
			{
				hbConsumableKeywords.Add(((ScriptableItem)cons)._itemName, itemFold.param.extra);
			}
		}

		private void makeObject_TradeItem(hbFolder itemFold, ScriptableTradeItem trade)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			itemFold.param._itemType = (ItemType)2;
			itemFold.param._itemSortTag = (SortTag)9;
			itemFold.param._itemRarity = (ItemRarity)0;
			Log("makeObject_TradeItem doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)trade);
			Log("makeObject_TradeItem did FromJsonOverwrite", 1);
			((ScriptableItem)trade)._itemType = (ItemType)2;
			((ScriptableItem)trade)._itemSortTag = (SortTag)9;
			((ScriptableItem)trade)._itemRarity = (ItemRarity)0;
			((ScriptableItem)trade)._maxStackAmount = 99;
			Log("Setting _itemIcon", 1);
			((ScriptableItem)trade)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject_Cape(hbFolder itemFold, ScriptableCape cape)
		{
			//IL_0047: 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)
			itemFold.param._itemType = (ItemType)0;
			itemFold.param._itemRarity = (ItemRarity)4;
			Log("makeObject_Cape doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)cape);
			Log("makeObject_Cape did FromJsonOverwrite", 1);
			((ScriptableItem)cape)._itemType = (ItemType)0;
			((ScriptableItem)cape)._itemRarity = (ItemRarity)4;
			Log("Checking _capeMesh", 1);
			if (itemFold.param._capeMesh != "")
			{
				if (aMesh.ContainsKey(itemFold.param._capeMesh))
				{
					Log("_capeMesh is OK", 1);
					cape._capeMesh = aMesh[itemFold.param._capeMesh];
				}
				else
				{
					Log(itemFold.name + " - _capeMesh name is invalid, field will be set to 'cape01'!", 4);
					cape._capeMesh = aMesh["cape01"];
				}
			}
			else
			{
				Log(itemFold.name + " - Cape has no _capeMesh, so it will not display in-game!", 4);
			}
			Log("Setting _armorTexture and _itemIcon", 1);
			((ScriptableArmor)cape)._armorTexture = (Texture)(object)itemFold.armor.tex;
			((ScriptableItem)cape)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject_Shield(hbFolder itemFold, ScriptableShield shield)
		{
			//IL_0054: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			itemFold.param._itemType = (ItemType)0;
			itemFold.param._itemRarity = (ItemRarity)0;
			itemFold.param._equipType = (ItemEquipType)2;
			Log("makeObject_Shield doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)shield);
			Log("makeObject_Shield did FromJsonOverwrite", 1);
			((ScriptableItem)shield)._itemType = (ItemType)0;
			((ScriptableItem)shield)._itemRarity = (ItemRarity)0;
			((ScriptableEquipment)shield)._equipType = (ItemEquipType)2;
			shield._blockDamageThreshold = 0;
			Log("Checking _shieldMesh", 1);
			if (itemFold.param._shieldMesh != "")
			{
				if (aMesh.ContainsKey(itemFold.param._shieldMesh))
				{
					Log("_shieldMesh is OK", 1);
					shield._shieldMesh = aMesh[itemFold.param._shieldMesh];
				}
				else
				{
					Log(itemFold.name + " - _shieldMesh name is invalid, field will be set to '_shield_01'!", 4);
					shield._shieldMesh = aMesh["_shield_01"];
				}
			}
			else
			{
				Log(itemFold.name + " - Shield has no _shieldMesh, so it will not display in-game!", 4);
			}
			Log("Setting _shieldTexture and _itemIcon", 1);
			shield._shieldTexture = (Texture)(object)itemFold.shield.tex;
			((ScriptableItem)shield)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject_Helm(hbFolder itemFold, ScriptableHelm helm)
		{
			//IL_0047: 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)
			itemFold.param._itemType = (ItemType)0;
			itemFold.param._itemRarity = (ItemRarity)4;
			Log("makeObject_Helm doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)helm);
			Log("makeObject_Helm did FromJsonOverwrite", 1);
			((ScriptableItem)helm)._itemType = (ItemType)0;
			((ScriptableItem)helm)._itemRarity = (ItemRarity)4;
			Log("Checking _helmOverrideMesh", 1);
			if (itemFold.param._helmOverrideMesh != "" && !aMesh.ContainsKey(itemFold.param._helmOverrideMesh))
			{
				Log(itemFold.name + " - _helmOverrideMesh name is invalid, field will be considered blank!", 4);
				itemFold.param._helmOverrideMesh = "";
			}
			if (itemFold.param._helmRender == "halo" || itemFold.param._helmRender == "halo_01")
			{
				if (itemFold.param._helmOverrideMesh != "")
				{
					helm._helmOverrideMesh = aMesh[itemFold.param._helmOverrideMesh];
				}
				else
				{
					Log(itemFold.name + " - Halo type Helm has no _helmOverrideMesh, so it will not display in-game!", 4);
				}
			}
			Log("Setting _armorTexture and _itemIcon", 1);
			((ScriptableArmor)helm)._armorTexture = (Texture)(object)itemFold.armor.tex;
			((ScriptableItem)helm)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject_Legs(hbFolder itemFold, ScriptableLeggings legs)
		{
			//IL_0047: 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)
			itemFold.param._itemType = (ItemType)0;
			itemFold.param._itemRarity = (ItemRarity)4;
			Log("makeObject_Legs doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)legs);
			Log("makeObject_Legs did FromJsonOverwrite", 1);
			((ScriptableItem)legs)._itemType = (ItemType)0;
			((ScriptableItem)legs)._itemRarity = (ItemRarity)4;
			Log("Setting textures", 1);
			legs._legPieceTexture_01 = (Texture)(object)itemFold.legPieceTexture_01.tex;
			legs._legPieceTexture_02 = (Texture)(object)itemFold.legPieceTexture_02.tex;
			legs._legPieceTexture_03 = (Texture)(object)itemFold.legPieceTexture_03.tex;
			legs._legPieceTexture_04 = (Texture)(object)itemFold.legPieceTexture_04.tex;
			Log("Setting _armorTexture and _itemIcon", 1);
			((ScriptableArmor)legs)._armorTexture = (Texture)(object)itemFold.armor.tex;
			((ScriptableItem)legs)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject_Chest(hbFolder itemFold, ScriptableChestpiece chest)
		{
			//IL_0047: 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)
			itemFold.param._itemType = (ItemType)0;
			itemFold.param._itemRarity = (ItemRarity)4;
			Log("makeObject doing FromJsonOverwrite", 1);
			JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)itemFold.param), (object)chest);
			Log("makeObject did FromJsonOverwrite", 1);
			((ScriptableItem)chest)._itemType = (ItemType)0;
			((ScriptableItem)chest)._itemRarity = (ItemRarity)4;
			if (!itemFold.boobOverride.done && itemFold.armor.done)
			{
				Log("Loading armorTexture into boobOverrideTexture", 1);
				ImageConversion.LoadImage(itemFold.boobOverride.tex, File.ReadAllBytes(itemFold.armor.path), true);
			}
			Log("Setting textures", 1);
			chest._legOverlayTexture = (Texture)(object)itemFold.legOverlay.tex;
			chest._boobOverrideTexture = (Texture)(object)itemFold.boobOverride.tex;
			chest._neckCollarTexture = (Texture)(object)itemFold.neckCollar.tex;
			chest._chestRenderTexture = (Texture)(object)itemFold.chestRender.tex;
			chest._robeSkirtTexture = (Texture)(object)itemFold.robeSkirt.tex;
			chest._shoulderpadTexture = (Texture)(object)itemFold.shoulderPad.tex;
			if (itemFold.neckCollar.done)
			{
				Log("Checking _neckCollarMesh", 1);
				if (itemFold.param._neckCollarMesh != "" && !aMesh.ContainsKey(itemFold.param._neckCollarMesh))
				{
					Log(itemFold.name + " - _neckCollarMesh name is invalid, field will be considered blank!", 4);
					itemFold.param._neckCollarMesh = "";
				}
				if (itemFold.param._neckCollarMesh != "")
				{
					chest._neckCollarMesh = aMesh[itemFold.param._neckCollarMesh];
				}
				else
				{
					Log(itemFold.name + " - Chestpiece has no _neckCollarMesh, so it will not display in-game!", 2);
				}
			}
			if (itemFold.shoulderPad.done)
			{
				Log("Checking _shoulderPadMesh", 1);
				if (itemFold.param._shoulderpadMesh != "" && !aMesh.ContainsKey(itemFold.param._shoulderpadMesh))
				{
					Log(itemFold.name + " - _shoulderpadMesh name is invalid, field will be considered blank!", 4);
					itemFold.param._shoulderpadMesh = "";
				}
				if (itemFold.param._shoulderpadMesh != "")
				{
					chest._shoulderpadMesh = aMesh[itemFold.param._shoulderpadMesh];
				}
				else
				{
					Log(itemFold.name + " - Chestpiece has no _shoulderpadMesh, so they/it will not display in-game!", 2);
				}
			}
			Log("Setting _armorTexture and _itemIcon", 1);
			((ScriptableArmor)chest)._armorTexture = (Texture)(object)itemFold.armor.tex;
			((ScriptableItem)chest)._itemIcon = itemFold.itemIcon.spr;
		}

		private void makeObject(hbFolder itemFold)
		{
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Expected O, but got Unknown
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: 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_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Expected O, but got Unknown
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: 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_040d: Expected O, but got Unknown
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Expected O, but got Unknown
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Expected O, but got Unknown
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Expected O, but got Unknown
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Expected O, but got Unknown
			Log("makeObject() for " + itemFold.type + ": " + itemFold.name, 1);
			switch (itemFold.type)
			{
			default:
				Log("Not handling " + itemFold.type + " yet...", 2);
				break;
			case "Dye":
			{
				Log("Dye", 1);
				ScriptableArmorDye val8 = (ScriptableArmorDye)makeScriptableObject(itemFold);
				makeObject_Dye(itemFold, val8);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val8;
				break;
			}
			case "Consumable":
			{
				Log("Consumable", 1);
				ScriptableStatusConsumable val7 = (ScriptableStatusConsumable)makeScriptableObject(itemFold);
				makeObject_Consumable(itemFold, val7);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val7;
				break;
			}
			case "TradeItem":
			{
				Log("TradeItem", 1);
				ScriptableTradeItem val6 = (ScriptableTradeItem)makeScriptableObject(itemFold);
				makeObject_TradeItem(itemFold, val6);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val6;
				break;
			}
			case "Cape":
			{
				Log("Cape", 1);
				ScriptableCape val5 = (ScriptableCape)makeScriptableObject(itemFold);
				makeObject_Cape(itemFold, val5);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val5;
				break;
			}
			case "Shield":
			{
				Log("Shield", 1);
				ScriptableShield val4 = (ScriptableShield)makeScriptableObject(itemFold);
				makeObject_Shield(itemFold, val4);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val4;
				break;
			}
			case "Helm":
			{
				Log("Helm", 1);
				ScriptableHelm val3 = (ScriptableHelm)makeScriptableObject(itemFold);
				makeObject_Helm(itemFold, val3);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val3;
				break;
			}
			case "Leggings":
			{
				Log("Leggings", 1);
				ScriptableLeggings val2 = (ScriptableLeggings)makeScriptableObject(itemFold);
				makeObject_Legs(itemFold, val2);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val2;
				break;
			}
			case "Chestpiece":
			{
				Log("Chestpiece", 1);
				ScriptableChestpiece val = (ScriptableChestpiece)makeScriptableObject(itemFold);
				makeObject_Chest(itemFold, val);
				Log("Storing item in itemFold.thing", 1);
				itemFold.thing = val;
				break;
			}
			case "Mouth":
			{
				Log("Mouth", 1);
				MouthTextureGroup thing3 = new MouthTextureGroup
				{
					_closed = (Texture)(object)itemFold.closed.tex,
					_open = (Texture)(object)itemFold.open.tex
				};
				itemFold.thing = thing3;
				break;
			}
			case "Eyes":
			{
				Log("Eyes", 1);
				EyeTextureGroup thing2 = new EyeTextureGroup
				{
					_closed = (Texture)(object)itemFold.closed.tex,
					_center = (Texture)(object)itemFold.center.tex,
					_down = (Texture)(object)itemFold.down.tex,
					_up = (Texture)(object)itemFold.up.tex,
					_right = (Texture)(object)itemFold.right.tex,
					_left = (Texture)(object)itemFold.left.tex,
					_hurt = (Texture)(object)itemFold.hurt.tex,
					_pissed = (Texture)(object)itemFold.pissed.tex
				};
				itemFold.thing = thing2;
				break;
			}
			case "Skin":
			{
				Log("Skin", 1);
				SkinTextureGroup thing = new SkinTextureGroup
				{
					_bodyTexture = (Texture)(object)itemFold.body.tex,
					_earTexture = (Texture)(object)itemFold.ear.tex,
					_hairTexture = (Texture)(object)itemFold.hair.tex,
					_headTexture = (Texture)(object)itemFold.head.tex,
					_legTexture = (Texture)(object)itemFold.leg.tex,
					_tailTexture = (Texture)(object)itemFold.tail.tex,
					_textureGroupTag = itemFold.name
				};
				itemFold.thing = thing;
				break;
			}
			}
			switch (itemFold.type)
			{
			case "Eyes":
				return;
			case "Skin":
				return;
			}
			itemFold.shopitem = ShopkeepItemMaker((ScriptableItem)itemFold.thing);
		}

		private void remakeObject(hbFolder itemFold)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Expected O, but got Unknown
			//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ea: Expected O, but got Unknown
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			Log("remakeObject() for " + itemFold.type + ": " + itemFold.name, 1);
			ScriptableItem val = (ScriptableItem)itemFold.thing;
			if (val._itemName != itemFold.param._itemName)
			{
				gm._cachedScriptableItems.Remove(val._itemName);
				gm._cachedScriptableItems.Add(itemFold.param._itemName, val);
			}
			switch (itemFold.type)
			{
			default:
				Log("Not re-handling " + itemFold.type + " yet...", 2);
				break;
			case "Dye":
			{
				Log("Dye", 1);
				ScriptableArmorDye dye = (ScriptableArmorDye)itemFold.thing;
				makeObject_Dye(itemFold, dye);
				break;
			}
			case "Consumable":
			{
				Log("Consumable", 1);
				ScriptableStatusConsumable cons = (ScriptableStatusConsumable)itemFold.thing;
				makeObject_Consumable(itemFold, cons);
				break;
			}
			case "TradeItem":
			{
				Log("TradeItem", 1);
				ScriptableTradeItem trade = (ScriptableTradeItem)itemFold.thing;
				makeObject_TradeItem(itemFold, trade);
				break;
			}
			case "Cape":
			{
				Log("Cape", 1);
				ScriptableCape cape = (ScriptableCape)itemFold.thing;
				makeObject_Cape(itemFold, cape);
				break;
			}
			case "Shield":
			{
				Log("Shield", 1);
				ScriptableShield shield = (ScriptableShield)itemFold.thing;
				makeObject_Shield(itemFold, shield);
				break;
			}
			case "Helm":
			{
				Log("Helm", 1);
				ScriptableHelm val3 = (ScriptableHelm)itemFold.thing;
				makeObject_Helm(itemFold, val3);
				Log("Checking _helmRender", 1);
				if (itemFold.param._helmRender == "")
				{
					Log(itemFold.name + " - Helm does not have a _helmRender, so nothing will be displayed!", 4);
				}
				else if (!aRend.ContainsKey(itemFold.param._helmRender))
				{
					Log(itemFold.name + " - _helmRender name is invalid! Not changing current _helmRender!", 4);
				}
				else
				{
					val3._helmRender = aRend[itemFold.param._helmRender];
				}
				break;
			}
			case "Leggings":
			{
				Log("Leggings", 1);
				ScriptableLeggings val4 = (ScriptableLeggings)itemFold.thing;
				makeObject_Legs(itemFold, val4);
				Log("Checking _legPieceRender01", 1);
				if (itemFold.param._legPieceRender_01 == "")
				{
					Log(itemFold.name + " - Leggings does not have a _legPieceRender_01, so nothing would be displayed!", 4);
				}
				else if (!aRend.ContainsKey(itemFold.param._legPieceRender_01))
				{
					Log(itemFold.name + " - _legPieceRender_01 name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val4._legPieceRender_01 = aRend[itemFold.param._legPieceRender_01];
				}
				Log("Checking _legPieceRender02", 1);
				if (itemFold.param._legPieceRender_02 == "")
				{
					Log(itemFold.name + " - Leggings does not have a _legPieceRender_02, hopefully this is intentional!", 2);
				}
				else if (!aRend.ContainsKey(itemFold.param._legPieceRender_02))
				{
					Log(itemFold.name + " - _legPieceRender_02 name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val4._legPieceRender_02 = aRend[itemFold.param._legPieceRender_02];
				}
				Log("Checking _legPieceRender03", 1);
				if (itemFold.param._legPieceRender_03 == "")
				{
					Log(itemFold.name + " - Leggings does not have a _legPieceRender_03, hopefully this is intentional!", 2);
				}
				else if (!aRend.ContainsKey(itemFold.param._legPieceRender_03))
				{
					Log(itemFold.name + " - _legPieceRender_03 name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val4._legPieceRender_03 = aRend[itemFold.param._legPieceRender_03];
				}
				Log("Checking _legPieceRender04", 1);
				if (itemFold.param._legPieceRender_04 == "")
				{
					Log(itemFold.name + " - Leggings does not have a _legPieceRender_04, hopefully this is intentional!", 2);
				}
				else if (!aRend.ContainsKey(itemFold.param._legPieceRender_04))
				{
					Log(itemFold.name + " - _legPieceRender_04 name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val4._legPieceRender_04 = aRend[itemFold.param._legPieceRender_04];
				}
				break;
			}
			case "Chestpiece":
			{
				Log("Chestpiece", 1);
				ScriptableChestpiece val2 = (ScriptableChestpiece)itemFold.thing;
				makeObject_Chest(itemFold, val2);
				Log("Checking _chestRenderDisplay", 1);
				if (itemFold.param._chestRenderDisplay == "")
				{
					Log(itemFold.name + " - Chestpiece does not have a _chestRenderDisplay, hopefully this is intentional!", 2);
				}
				else if (!aRend.ContainsKey(itemFold.param._chestRenderDisplay))
				{
					Log(itemFold.name + " - _chestRenderDisplay name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val2._chestRenderDisplay = aRend[itemFold.param._chestRenderDisplay];
				}
				Log("Checking _robeSkirtRender", 1);
				if (itemFold.param._robeSkirtRender == "")
				{
					Log(itemFold.name + " - Chestpiece does not have a _robeSkirtRender, hopefully this is intentional!", 2);
				}
				else if (!aRend.ContainsKey(itemFold.param._robeSkirtRender))
				{
					Log(itemFold.name + " - _robeSkirtRender name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val2._robeSkirtRender = aRend[itemFold.param._robeSkirtRender];
				}
				Log("Checking _armCuffRender", 1);
				if (itemFold.param._armCuffRender == "")
				{
					Log(itemFold.name + " - Chestpiece does not have a _armCuffRender, hopefully this is intentional!", 2);
				}
				else if (!aRend.ContainsKey(itemFold.param._armCuffRender))
				{
					Log(itemFold.name + " - _armCuffRender name is invalid! Not changing current ArmorRender!", 4);
				}
				else
				{
					val2._armCuffRender = aRend[itemFold.param._armCuffRender];
				}
				break;
			}
			}
			itemFold.shopitem._scriptItem = (ScriptableItem)itemFold.thing;
			itemFold.shopitem._itemNameTag = itemFold.shopitem._scriptItem._itemName;
		}

		private hbParam getParam(string targ, hbFolder Fold)
		{
			Log("getParam() for " + Fold.type + ": " + Fold.name, 1);
			hbParam hbParam = new hbParam
			{
				name = Fold.name + "_" + targ,
				folder = Fold
			};
			hbParams.Add(hbParam);
			string[] array = new string[7]
			{
				Path.Combine(Fold.path, targ),
				Path.Combine(Fold.path, targ.FCap()),
				Path.Combine(Fold.path, targ) + "s",
				Path.Combine(Fold.path, targ.FCap() + "s"),
				Path.Combine(Fold.path, Fold.name),
				Path.Combine(Fold.path, Fold.name.FCap()),
				Path.Combine(Fold.path, Fold.name.ToLower())
			};
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (File.Exists(text + ".txt"))
				{
					hbParam.path = text + ".txt";
					Log("par.path is: " + hbParam.path, 1);
					break;
				}
			}
			if (hbParam.path == "" || hbParam.path == null)
			{
				Log("Didn't find '" + hbParam.name + "'. Item cannot be created!", 4);
				return null;
			}
			try
			{
				hbParam.json = File.ReadAllText(hbParam.path);
			}
			catch (Exception ex)
			{
				Log(hbParam.name + " - Something went wrong with reading the txt file! Item cannot be created!\n" + ex, 4);
				return null;
			}
			Log("getParam doing FromJsonOverwrite", 1);
			try
			{
				JsonUtility.FromJsonOverwrite(hbParam.json, (object)hbParam);
			}
			catch (Exception ex2)
			{
				Log(hbParam.name + " - Something is wrong with the JSON! Item cannot be created!\n" + ex2.Message, 4);
				return null;
			}
			hbParam hbParam2 = hbParam;
			hbParam2._itemName = hbParam2._itemName + "<color=#00000000><size=1>" + Fold.source + "-" + Fold.type + "-" + Fold.name + "</size></color>";
			hbParam._itemDescription = hbParam._itemDescription + "\n<color=yellow>[" + Fold.source + "]</color>";
			return hbParam;
		}

		private string getImage_FieldIsBlank(string targ, hbFolder Fold)
		{
			if (1 == 0)
			{
			}
			string result = targ switch
			{
				"legPieceTexture_01" => Fold.param._legPieceRender_01, 
				"legPieceTexture_02" => Fold.param._legPieceRender_02, 
				"legPieceTexture_03" => Fold.param._legPieceRender_03, 
				"legPieceTexture_04" => Fold.param._legPieceRender_04, 
				"neckCollar" => Fold.param._neckCollarMesh, 
				"chestRender" => Fold.param._chestRenderDisplay, 
				"robeSkirt" => Fold.param._robeSkirtRender, 
				"shoulderPad" => Fold.param._shoulderpadMesh, 
				_ => targ, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		private hbImage getImage(string targ, hbFolder Fold, bool sprite = false)
		{
			//IL_10d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e1: Unknown result type (might be due to invalid IL or missing references)
			Log("getImage(" + targ + ")", 1);
			hbImage hbImage = hbImageMaker(targ, Fold, sprite);
			hbImages.Add(hbImage);
			string text = Path.Combine(Fold.path, targ);
			if (!File.Exists(text + ".png"))
			{
				if (1 == 0)
				{
				}
				string[] array = targ switch
				{
					"itemIcon" => new string[9]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, targ.ToLower()),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "_" + targ.ToLower()),
						Path.Combine(Fold.path, "icon"),
						Path.Combine(Fold.path, "_icon"),
						Path.Combine(Fold.path, "Icon"),
						Path.Combine(Fold.path, "_Icon")
					}, 
					"center" => new string[8]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "centre"),
						Path.Combine(Fold.path, "Centre"),
						Path.Combine(Fold.path, "Centre"),
						Path.Combine(Fold.path, "open"),
						Path.Combine(Fold.path, "Open"),
						Path.Combine(Fold.path, "opened"),
						Path.Combine(Fold.path, "Opened")
					}, 
					"closed" => new string[3]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "beak"),
						Path.Combine(Fold.path, "Beak")
					}, 
					"open" => new string[3]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, targ + "ed"),
						Path.Combine(Fold.path, targ.FCap() + "ed")
					}, 
					"pissed" => new string[5]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "angry"),
						Path.Combine(Fold.path, "Angry"),
						Path.Combine(Fold.path, "mad"),
						Path.Combine(Fold.path, "Mad")
					}, 
					"hurt" => new string[3]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "damaged"),
						Path.Combine(Fold.path, "Damaged")
					}, 
					"body" => new string[5]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "chest"),
						Path.Combine(Fold.path, "Chest"),
						Path.Combine(Fold.path, "torso"),
						Path.Combine(Fold.path, "Torso")
					}, 
					"leg" => new string[3]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "legs"),
						Path.Combine(Fold.path, "Legs")
					}, 
					"ear" => new string[3]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "ears"),
						Path.Combine(Fold.path, "Ears")
					}, 
					"armor" => new string[21]
					{
						Path.Combine(Fold.path, targ.FCap()),
						text + "Texture",
						text + "texture",
						Path.Combine(Fold.path, targ.FCap() + "Texture"),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "_" + targ + "Texture"),
						Path.Combine(Fold.path, "_" + targ.FCap() + "Texture"),
						Path.Combine(Fold.path, "_" + targ + "texture"),
						Path.Combine(Fold.path, "_" + targ.FCap() + "texture"),
						Path.Combine(Fold.path, "armour"),
						Path.Combine(Fold.path, "Armour"),
						"armourTexture",
						"armourtexture",
						Path.Combine(Fold.path, "ArmourTexture"),
						Path.Combine(Fold.path, "_armour"),
						Path.Combine(Fold.path, "_Armour"),
						Path.Combine(Fold.path, "_armourTexture"),
						Path.Combine(Fold.path, "_ArmourTexture"),
						Path.Combine(Fold.path, "_armourtexture"),
						Path.Combine(Fold.path, "_Armourtexture")
					}, 
					"legPieceTexture_01" => new string[15]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "legPiece01"),
						Path.Combine(Fold.path, "LegPiece01"),
						Path.Combine(Fold.path, "legpiece01"),
						Path.Combine(Fold.path, "_legPiece01"),
						Path.Combine(Fold.path, "_LegPiece01"),
						Path.Combine(Fold.path, "_legpiece01"),
						Path.Combine(Fold.path, "legPiece1"),
						Path.Combine(Fold.path, "LegPiece1"),
						Path.Combine(Fold.path, "legpiece1"),
						Path.Combine(Fold.path, "_legPiece1"),
						Path.Combine(Fold.path, "_LegPiece1"),
						Path.Combine(Fold.path, "_legpiece1")
					}, 
					"legPieceTexture_02" => new string[15]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "legPiece02"),
						Path.Combine(Fold.path, "LegPiece02"),
						Path.Combine(Fold.path, "legpiece02"),
						Path.Combine(Fold.path, "_legPiece02"),
						Path.Combine(Fold.path, "_LegPiece02"),
						Path.Combine(Fold.path, "_legpiece02"),
						Path.Combine(Fold.path, "legPiece2"),
						Path.Combine(Fold.path, "LegPiece2"),
						Path.Combine(Fold.path, "legpiece2"),
						Path.Combine(Fold.path, "_legPiece2"),
						Path.Combine(Fold.path, "_LegPiece2"),
						Path.Combine(Fold.path, "_legpiece2")
					}, 
					"legPieceTexture_03" => new string[15]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "legPiece03"),
						Path.Combine(Fold.path, "LegPiece03"),
						Path.Combine(Fold.path, "legpiece03"),
						Path.Combine(Fold.path, "_legPiece03"),
						Path.Combine(Fold.path, "_LegPiece03"),
						Path.Combine(Fold.path, "_legpiece03"),
						Path.Combine(Fold.path, "legPiece3"),
						Path.Combine(Fold.path, "LegPiece3"),
						Path.Combine(Fold.path, "legpiece3"),
						Path.Combine(Fold.path, "_legPiece3"),
						Path.Combine(Fold.path, "_LegPiece3"),
						Path.Combine(Fold.path, "_legpiece3")
					}, 
					"legPieceTexture_04" => new string[15]
					{
						Path.Combine(Fold.path, targ.FCap()),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "legPiece04"),
						Path.Combine(Fold.path, "LegPiece04"),
						Path.Combine(Fold.path, "legpiece04"),
						Path.Combine(Fold.path, "_legPiece04"),
						Path.Combine(Fold.path, "_LegPiece04"),
						Path.Combine(Fold.path, "_legpiece04"),
						Path.Combine(Fold.path, "legPiece4"),
						Path.Combine(Fold.path, "LegPiece4"),
						Path.Combine(Fold.path, "legpiece4"),
						Path.Combine(Fold.path, "_legPiece4"),
						Path.Combine(Fold.path, "_LegPiece4"),
						Path.Combine(Fold.path, "_legpiece4")
					}, 
					_ => new string[10]
					{
						Path.Combine(Fold.path, targ.FCap()),
						text + "Texture",
						text + "texture",
						Path.Combine(Fold.path, targ.FCap() + "Texture"),
						Path.Combine(Fold.path, "_" + targ),
						Path.Combine(Fold.path, "_" + targ.FCap()),
						Path.Combine(Fold.path, "_" + targ + "Texture"),
						Path.Combine(Fold.path, "_" + targ.FCap() + "Texture"),
						Path.Combine(Fold.path, "_" + targ + "texture"),
						Path.Combine(Fold.path, "_" + targ.FCap() + "texture")
					}, 
				};
				if (1 == 0)
				{
				}
				string[] array2 = array;
				string[] array3 = array2;
				foreach (string text2 in array3)
				{
					if (File.Exists(text2 + ".png"))
					{
						hbImage.path = text2 + ".png";
						Log("img.path is: " + hbImage.path, 1);
						break;
					}
				}
			}
			else
			{
				hbImage.path = text + ".png";
				Log("img.path is: " + hbImage.path, 1);
			}
			if (hbImage.path == "")
			{
				string image_FieldIsBlank = getImage_FieldIsBlank(hbImage.field, Fold);
				if (image_FieldIsBlank != "")
				{
					Log("Didn't find '" + hbImage.field + ".png'", 2);
				}
				ImageConversion.LoadImage(hbImage.tex, Array.Empty<byte>(), false);
				hbImage.path = text + ".png";
				return hbImage;
			}
			byte[] array4;
			try
			{
				array4 = File.ReadAllBytes(hbImage.path);
			}
			catch (Exception ex)
			{
				Log(hbImage.name + " - Failed to read image! Not marking Image as done.\n" + ex.Message, 4);
				ImageConversion.LoadImage(hbImage.tex, Array.Empty<byte>(), false);
				return hbImage;
			}
			if (array4.Length == 0)
			{
				Log(hbImage.name + " - Image was totally devoid of contents! Not marking Image as done.", 4);
				ImageConversion.LoadImage(hbImage.tex, Array.Empty<byte>(), false);
				return hbImage;
			}
			var (num, num2) = GetImageSize(hbImage.path);
			if (num < 9 || num2 < 9)
			{
				Log(hbImage.name + " - Image dimensions cannot be smaller than 9px in either axis! Not marking Image as done.", 4);
				ImageConversion.LoadImage(hbImage.tex, Array.Empty<byte>(), false);
				return hbImage;
			}
			if (cfgEnforceTexSize.Value)
			{
			}
			ImageConversion.LoadImage(hbImage.tex, array4, true);
			using (MD5 mD = MD5.Create())
			{
				hbImage.hash = Convert.ToBase64String(mD.ComputeHash(array4));
			}
			if (sprite)
			{
				hbImage.spr = Sprite.Create(hbImage.tex, new Rect(0f, 0f, (float)((Texture)hbImage.tex).width, (float)((Texture)hbImage.tex).height), new Vector2(0.5f, 0.5f));
				((Object)hbImage.spr).name = hbImage.name + "_Spr";
			}
			hbImage.done = true;
			return hbImage;
		}

		private hbImage hbImageMaker(string targ, hbFolder Fold, bool sprite = false, string fname = "")
		{
			if (Fold != null)
			{
				fname = Fold.name;
			}
			hbImage hbImage = new hbImage
			{
				name = fname + "_" + targ,
				field = targ,
				folder = Fold,
				path = "",
				sprite = sprite
			};
			((Object)hbImage.tex).name = hbImage.name + "_Tex";
			return hbImage;
		}

		private hbImage makeImage(string path, string targ, bool sprite = false)
		{
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			Log("makeImage(" + targ + ")", 1);
			hbImage hbImage = hbImageMaker(targ, null, sprite, "Internal");
			hbImage.path = Path.Combine(path, targ + ".png");
			if (!File.Exists(hbImage.path))
			{
				Log("Didn't find '" + hbImage.name + "'. Not marking Image as done.\nThis is a serious problem, what has happened to the files in the Internal folder?", 4);
				ImageConversion.LoadImage(hbImage.tex, Array.Empty<byte>(), false);
			}
			byte[] array;
			try
			{
				array = File.ReadAllBytes(hbImage.path);
			}
			catch (Exception t)
			{
				Log(hbImage.name + " - Failed to read image! Not marking Image as done.", 4);
				Log(t, 4);
				return hbImage;
			}
			if (array.Length == 0)
			{
				Log(hbImage.name + " - Image was totally devoid of contents! Not marking Image as done.", 4);
				return hbImage;
			}
			var (num, num2) = GetImageSize(hbImage.path);
			if (num < 9 || num2 < 9)
			{
				Log(hbImage.name + " - Image dimensions cannot be smaller than 9px in either axis! Not marking Image as done.", 4);
				return hbImage;
			}
			if (cfgEnforceTexSize.Value)
			{
			}
			ImageConversion.LoadImage(hbImage.tex, array, true);
			using (MD5 mD = MD5.Create())
			{
				hbImage.hash = Convert.ToBase64String(mD.ComputeHash(array));
			}
			if (sprite)
			{
				hbImage.spr = Sprite.Create(hbImage.tex, new Rect(0f, 0f, (float)((Texture)hbImage.tex).width, (float)((Texture)hbImage.tex).height), new Vector2(0.5f, 0.5f));
				((Object)hbImage.spr).name = hbImage.name + "_Spr";
			}
			hbImage.done = true;
			hbImages.Add(hbImage);
			return hbImage;
		}

		private async void getSFX(string[] sfxTargs)
		{
			List<Task<bool>> tasks = new List<Task<bool>>();
			foreach (string targ in sfxTargs)
			{
				tasks.Add(getSFXTask(targ));
			}
			await Task.WhenAll(tasks);
		}

		private Task<bool> getSFXTask(string targ)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			string fileName = Path.GetFileName(targ);
			string text = "file:///" + targ.Replace("\\", "/");
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)13);
			audioClip.SendWebRequest();
			while (!audioClip.isDone)
			{
			}
			DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)audioClip.downloadHandler;
			((Object)val.audioClip).name = fileName;
			if (fileName == "hitsound.mp3" || fileName == "killsound.mp3")
			{
				hbSFX.Add(fileName, new List<AudioClip>(1) { val.audioClip });
			}
			else
			{
				hbSFX["phone"].Add(val.audioClip);
			}
			return Task.FromResult(result: true);
		}

		private List<string> FindCustoms(string path, string part, out List<string> found)
		{
			Log("FindCustoms(" + path + "\\" + part + ")\n", 1);
			found = new List<string>();
			if (Directory.Exists(Path.Combine(path, part)))
			{
				Log("Looking for " + part + " folders in " + path.Replace(modsPath, ""), 1);
				foreach (string item in Directory.EnumerateDirectories(Path.Combine(path, part)))
				{
					if (!hbFolds.Contains(item))
					{
						found.Add(item);
					}
				}
				if (found.Count == 0)
				{
					Log("None found!\n", 1);
					return null;
				}
				found.Sort();
				return found;
			}
			return null;
		}

		private GameObject Dial()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Log("Dialed the hotline...", 1);
			GameObject val = new GameObject("Homebrewery Master Object");
			GameObject val2 = new GameObject("Homebrewery Object");
			val2.transform.SetParent(val.transform);
			AudioSource val3 = val2.AddComponent<AudioSource>();
			((Object)val3).name = "Homebrewery Audio Source";
			val3.volume = 0.5f;
			val3.outputAudioMixerGroup = SettingsManager._current._masterMixer.FindMatchingGroups("Voice")[0];
			DialogTrigger val4 = val2.AddComponent<DialogTrigger>();
			((Component)val4).transform.position = ((Component)Player._mainPlayer).transform.forward * 1f + ((Component)Player._mainPlayer).transform.position;
			((Object)val4).name = "Homebrewery DialogTrigger";
			val4._voxAsrc = val3;
			Log("Returning hbMGO", 1);
			return val;
		}

		private ScriptableDialogData ChattyBased()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0094: Expected O, but got Unknown
			//IL_0094: