Decompiled source of Homebrewery v2.6.47
Homebrewery.dll
Decompiled 20 hours ago
The result has been truncated due to the large size, download it to view full contents!
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; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GLTFast; using GLTFast.Loading; using GLTFast.Logging; using GLTFast.Materials; using HarmonyLib; using Marioalexsan.AtlyssGLTF; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Homebrewery")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.6.47.0")] [assembly: AssemblyInformationalVersion("2.6.47+c6ad63e5b7df9c001954a443d4f3d509554440a5")] [assembly: AssemblyProduct("Homebrewery")] [assembly: AssemblyTitle("Homebrewery")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.6.47.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Homebrewery { internal static class AtlyssGLTF { public const string ModID = "Marioalexsan.AtlyssGLTF"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("Marioalexsan.AtlyssGLTF"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool GetForceReadableMeshes() { return AtlyssGLTF.ForceReadableMeshes; } public static async Task getMeshes(string[] folds, string path, string source, string type) { List<Task> tasks = new List<Task>(); foreach (string fold in folds) { tasks.Add(getMesh(fold, path, source, type)); } try { await Task.WhenAll(tasks); } catch (Exception e) { HB.Log("Task.WhenAll in getMeshes failed with Exception:\n" + e.GetType().Name + " : " + e.Message, 4); } } private static async Task getMesh(string fold, string path, string source, string type) { Stopwatch sw = Stopwatch.StartNew(); string fname = fold.Replace(path + "\\" + type + "\\", ""); HB.Log("getMesh(" + type + ") - " + fname, 2); IEnumerable<string> foldconts = Directory.EnumerateFiles(fold, "*.glb"); if (foldconts.Count() == 0) { HB.Log("Mesh Folder: " + fname + " from " + source + " is empty!", 4); return; } Mesh[] mesh = await ImportGLB(path: foldconts.First(), objectName: source + "#" + fname); if (mesh.Length != 0) { if (Object.op_Implicit((Object)(object)mesh[0])) { switch (type) { case "Mesh": getMesh_Mesh(mesh[0], source, fname, path); break; case "Hair": getMesh_Hair(mesh, source, fname, path); break; case "ArmorRender": getMesh_Armor(mesh, source, fname, path); break; } } else { HB.Log(source + "#" + fname + " - Imported meshes are null!", 4); } } else { HB.Log(source + "#" + fname + " - Nothing actually imported, where are the meshes!", 4); } sw.Stop(); HB.Log("getMesh took " + sw.ElapsedMilliseconds + "ms\n", 2); } private static void getMesh_Mesh(Mesh m, string source, string fname, string path) { HB.Log("getMesh_Mesh(" + fname + ")", 1); ((Object)m).name = source + "-Mesh-" + fname; HB.hbMesh hbMesh = new HB.hbMesh { name = ((Object)m).name, source = source, path = path, mesh = m }; HB.hbMeshes.Add(hbMesh); HB.hbSources[source].hbMeshes.Add(hbMesh); HB.aMesh.Add(((Object)m).name, hbMesh.mesh); } private static void getMesh_Hair(Mesh[] mesh, string source, string fname, string path) { HB.Log("getMesh_Hair(" + fname + ")", 1); foreach (Mesh val in mesh) { string name = ((Object)val).name; if (HB.races.Contains(name)) { HB.Log("Hair: " + fname + " - for: " + name, 1); ((Object)val).name = source + "-" + name + "-Hair-" + fname; HB.makeCondMark(((Object)val).name, "Hair"); HB.hbHair hbHair = new HB.hbHair { name = ((Object)val).name, source = source, path = path, mesh = val }; HB.hbHairs.Add(hbHair); HB.hbSources[hbHair.source].hbHairs.Add(hbHair); HB.hbHairdos[name].Add(hbHair.mesh); } else { HB.Log("Hair: " + fname + " - Incorrectly named Mesh: \"" + name + "\".\nHair Meshes must be named as the Race they are for e.g. \"Byrdle\", \"Chang\", \"Imp\", \"Kubold\", \"Poon\".", 4); } } } private static void getMesh_Armor(Mesh[] mesh, string source, string fname, string path) { HB.Log("getMesh_Armor(" + fname + ")", 1); HB.hbArmor hbArmor = new HB.hbArmor { name = source + "-ArmorRender-" + fname, source = source, path = path }; foreach (Mesh val in mesh) { string name = ((Object)val).name; if (HB.races.Contains(name)) { HB.Log("ArmorRender: " + fname + " - for: " + name, 1); ((Object)val).name = source + "-" + name + "-ArmorRender-" + fname; hbArmor.r[name]._raceArmorMesh = val; continue; } HB.Log("ArmorRender: " + fname + " - Incorrectly named mesh: \"" + name + "\".\nArmorRender Meshes must be named as the Race they are for e.g. \"Byrdle\", \"Chang\", \"Imp\", \"Kubold\", \"Poon\".", 4); return; } HB.hbArmors.Add(hbArmor); HB.hbSources[hbArmor.source].hbArmors.Add(hbArmor); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static async Task<Mesh[]> ImportGLB(string objectName, string path) { Stopwatch sw = Stopwatch.StartNew(); Mesh[] mesh = Array.Empty<Mesh>(); try { GltfImport gltf = new GltfImport((IDownloadProvider)null, (IDeferAgent)null, (IMaterialGenerator)null, (ICodeLogger)null); Uri uri = new Uri(path); HB.Log(uri, 1); if (await ((GltfImportBase)gltf).Load(uri, new ImportSettings { AnimationMethod = (AnimationMethod)2 }, default(CancellationToken))) { GameObject GO = new GameObject(objectName); if (await ((GltfImportBase)gltf).InstantiateMainSceneAsync(GO.transform, default(CancellationToken))) { IReadOnlyCollection<Mesh> meshes = ((GltfImportBase)gltf).Meshes; int num = 0; Mesh[] array = (Mesh[])(object)new Mesh[meshes.Count]; foreach (Mesh item in meshes) { array[num] = item; num++; } mesh = array; } else { HB.Log("InstantiateMainSceneAsync returned false", 4); } } else { HB.Log("LoadGltfBinary returned false", 4); } } catch (Exception ex) { Exception e = ex; HB.Log(e.GetType().Name + " : " + e.Message, 4); } sw.Stop(); HB.Log("ImportGLB took " + sw.ElapsedMilliseconds + "ms\n", 1); return mesh; } } internal class CFG { public ConfigEntry<int> LogLevel = 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."); public ConfigEntry<int> FilterMode = 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'."); public ConfigEntry<bool> EnforceTexSize = 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."); public ConfigEntry<bool> BlinkPatch = 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)."); public ConfigEntry<int> BlinkPercent = 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."); public ConfigEntry<bool> HotkeysOn = Config.Bind<bool>("Controls", "HotkeysOn", true, "Controls whether the mod's hotkeys are on by default."); public ConfigEntry<bool> BackfillSkin = 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!"); public ConfigEntry<int> Bumpscosity = Config.Bind<int>("General", "Bumpscosity", 1, "Adjusts the Bumpscosity."); public ConfigEntry<int> EasterEggChance = 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."); public ConfigEntry<bool> SpreadVanillaParts = 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."); public ConfigEntry<int> UpdateMessage = 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."); public ConfigEntry<bool> AlwaysShowUpdateMsg = Config.Bind<bool>("Misc", "AlwaysShowUpdateMessage", false, "Set this to true to prevent the UpdateMessage number from changing, so it will always show the message."); public ConfigEntry<bool> BypassFoodCapacity = 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."); public ConfigEntry<bool> CanDieInSanctuary = Config.Bind<bool>("General", "CanDieInSanctuary", true, "If True, your ZoneType is set to 'Field' rather than 'Safe' in any zone that would normally be 'Safe', meaning you can die there!\n I don't know why I called it '...Sanctuary' instead of '...Sanctum'"); public ConfigEntry<bool> zPartMarkerRestore = Config.Bind<bool>("zPart Markers", "zPartMarkerRestore", true, "Changing this to false will deactivate the automatic part index adjustments when the parts on your character have changed index and desynced."); public ConfigEntry<string> P0Name = Config.Bind<string>("zPart Markers", "cfgP0Name", "", "Don't touch these, please."); public ConfigEntry<string> P0EyesPart = Config.Bind<string>("zPart Markers", "cfgP0EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P0MouthPart = Config.Bind<string>("zPart Markers", "cfgP0MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P0SkinPart = Config.Bind<string>("zPart Markers", "cfgP0SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P0HairPart = Config.Bind<string>("zPart Markers", "cfgP0HairPart", "", "Don't touch these, please."); public ConfigEntry<string> P1Name = Config.Bind<string>("zPart Markers", "cfgP1Name", "", "Don't touch these, please."); public ConfigEntry<string> P1EyesPart = Config.Bind<string>("zPart Markers", "cfgP1EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P1MouthPart = Config.Bind<string>("zPart Markers", "cfgP1MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P1SkinPart = Config.Bind<string>("zPart Markers", "cfgP1SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P1HairPart = Config.Bind<string>("zPart Markers", "cfgP1HairPart", "", "Don't touch these, please."); public ConfigEntry<string> P2Name = Config.Bind<string>("zPart Markers", "cfgP2Name", "", "Don't touch these, please."); public ConfigEntry<string> P2EyesPart = Config.Bind<string>("zPart Markers", "cfgP2EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P2MouthPart = Config.Bind<string>("zPart Markers", "cfgP2MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P2SkinPart = Config.Bind<string>("zPart Markers", "cfgP2SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P2HairPart = Config.Bind<string>("zPart Markers", "cfgP2HairPart", "", "Don't touch these, please."); public ConfigEntry<string> P3Name = Config.Bind<string>("zPart Markers", "cfgP3Name", "", "Don't touch these, please."); public ConfigEntry<string> P3EyesPart = Config.Bind<string>("zPart Markers", "cfgP3EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P3MouthPart = Config.Bind<string>("zPart Markers", "cfgP3MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P3SkinPart = Config.Bind<string>("zPart Markers", "cfgP3SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P3HairPart = Config.Bind<string>("zPart Markers", "cfgP3HairPart", "", "Don't touch these, please."); public ConfigEntry<string> P4Name = Config.Bind<string>("zPart Markers", "cfgP4Name", "", "Don't touch these, please."); public ConfigEntry<string> P4EyesPart = Config.Bind<string>("zPart Markers", "cfgP4EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P4MouthPart = Config.Bind<string>("zPart Markers", "cfgP4MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P4SkinPart = Config.Bind<string>("zPart Markers", "cfgP4SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P4HairPart = Config.Bind<string>("zPart Markers", "cfgP4HairPart", "", "Don't touch these, please."); public ConfigEntry<string> P5Name = Config.Bind<string>("zPart Markers", "cfgP5Name", "", "Don't touch these, please."); public ConfigEntry<string> P5EyesPart = Config.Bind<string>("zPart Markers", "cfgP5EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P5MouthPart = Config.Bind<string>("zPart Markers", "cfgP5MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P5SkinPart = Config.Bind<string>("zPart Markers", "cfgP5SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P5HairPart = Config.Bind<string>("zPart Markers", "cfgP5HairPart", "", "Don't touch these, please."); public ConfigEntry<string> P6Name = Config.Bind<string>("zPart Markers", "cfgP6Name", "", "Don't touch these, please."); public ConfigEntry<string> P6EyesPart = Config.Bind<string>("zPart Markers", "cfgP6EyesPart", "", "Don't touch these, please."); public ConfigEntry<string> P6MouthPart = Config.Bind<string>("zPart Markers", "cfgP6MouthPart", "", "Don't touch these, please."); public ConfigEntry<string> P6SkinPart = Config.Bind<string>("zPart Markers", "cfgP6SkinPart", "", "Don't touch these, please."); public ConfigEntry<string> P6HairPart = Config.Bind<string>("zPart Markers", "cfgP6HairPart", "", "Don't touch these, please."); public CFG(ConfigFile Config) { } } public static class StringExtensions { public static string FCap(this string input) { return input[0].ToString().ToUpper() + input.Substring(1, input.Length - 1).ToLower(); } } [BepInPlugin("Homebrewery", "Homebrewery", "2.6.47")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class HB : BaseUnityPlugin { public class hbSource { public List<hbFolder> hbFolders = new List<hbFolder>(); public Dictionary<ItemType, List<ShopkeepItem>> ShopkeepItems = new Dictionary<ItemType, List<ShopkeepItem>> { { (ItemType)0, new List<ShopkeepItem>() }, { (ItemType)1, new List<ShopkeepItem>() }, { (ItemType)2, new List<ShopkeepItem>() } }; public bool HasItems = false; public List<hbMesh> hbMeshes = new List<hbMesh>(); public List<hbArmor> hbArmors = new List<hbArmor>(); public List<hbHair> hbHairs = new List<hbHair>(); public string name { get; set; } public hbSource(string name) { this.name = name; hbSources.Add(name, this); Log("Created hbSource: '" + name + "'", 1); } public void FetchItems() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (hbFolders.Count == 0) { return; } foreach (hbFolder item in hbFolders.Where((hbFolder f) => f.shopitem != null)) { if (item.shopitem != null) { ShopkeepItems[item.shopitem._scriptItem._itemType].Add(item.shopitem); } } Sort((ItemType)0); Sort((ItemType)1); Sort((ItemType)2); if (ShopkeepItems[(ItemType)0].Count > 0 || ShopkeepItems[(ItemType)1].Count > 0 || ShopkeepItems[(ItemType)2].Count > 0) { HasItems = true; } } public void Sort(ItemType type) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (ShopkeepItems[type].Count > 0) { ShopkeepItems[type].Sort((ShopkeepItem a, ShopkeepItem b) => a._itemNameTag.CompareTo(b._itemNameTag)); } } } public class hbFolder { public List<string> contents = new List<string>(); 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.GetType().Name + " : " + 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.GetType().Name + " : " + ex.Message, 4); } } } public string name { get; set; } = string.Empty; public string type { get; set; } = string.Empty; public string race { get; set; } = string.Empty; public string path { get; set; } = string.Empty; public string source { get; set; } = modFolderName; public bool done { get; set; } = false; public object thing { get; set; } = string.Empty; public ShopkeepItem? shopitem { get; set; } public string condname { get; set; } = string.Empty; 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; } = string.Empty; 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 = string.Empty; public string _itemName = "New Homebrewery Item"; public string _itemDescription = string.Empty; 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 = string.Empty; public string _chestRenderDisplay = string.Empty; public string _robeSkirtRender = string.Empty; public string _armCuffRender = string.Empty; public bool _textureArms = true; public ShoulderPadDisplayType _shoulderPadDisplayType = (ShoulderPadDisplayType)0; public string _shoulderpadMesh = string.Empty; public string _helmRender = string.Empty; public string _helmOverrideMesh = string.Empty; public float _blendHelmValue = 0f; public bool _useHelmHairDisplay = false; public bool _hideHair = false; public bool _hideEars = false; public bool _hideMisc = false; public string _legPieceRender_01 = string.Empty; public string _legPieceRender_02 = string.Empty; public string _legPieceRender_03 = string.Empty; public string _legPieceRender_04 = string.Empty; public bool _textureUpperLegOnly = false; public bool _textureFeet = true; public string _capeMesh = string.Empty; public string _shieldMesh = string.Empty; 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.GetType().Name + " : " + 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.GetType().Name + " : " + ex.Message, 4); } } } public string name { get; set; } = string.Empty; public string path { get; set; } = string.Empty; public hbFolder? folder { get; set; } public string json { get; set; } = string.Empty; public string hash { get; set; } = string.Empty; 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 = (FilterMode)filter, mipMapBias = 0f }; public string name { get; set; } = string.Empty; public string field { get; set; } = string.Empty; public bool sprite { get; set; } = false; public string path { get; set; } = string.Empty; public hbFolder? folder { get; set; } public string hash { get; set; } = string.Empty; public bool done { get; set; } = false; public Sprite? spr { get; set; } } public class hbArmor { public readonly Dictionary<string, RaceArmorRender> r = new Dictionary<string, RaceArmorRender>(); public string name { get; set; } = string.Empty; public string source { get; set; } = string.Empty; public string path { get; set; } = string.Empty; public ScriptableArmorRender? SAR { get; set; } public hbArmor() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown foreach (string race in races) { RaceArmorRender value = new RaceArmorRender { _raceNameTag = race, _meshPosition = new Vector3(0f, 0.008f, 0f) }; r.Add(race, value); } } public void Go() { foreach (string race in races) { r[race]._scriptableRace = gm.LocateRace(race); } SAR = ScriptableObject.CreateInstance<ScriptableArmorRender>(); ((Object)SAR).name = name; ScriptableArmorRender sAR = SAR; Dictionary<string, RaceArmorRender>.ValueCollection values = r.Values; int num = 0; RaceArmorRender[] array = (RaceArmorRender[])(object)new RaceArmorRender[values.Count]; foreach (RaceArmorRender item in values) { array[num] = item; num++; } sAR._raceArmorRenders = array; aRend.Add(name, SAR); } } public class hbMesh { public string name { get; set; } = string.Empty; public string source { get; set; } = string.Empty; public string path { get; set; } = string.Empty; public Mesh? mesh { get; set; } } public class hbHair { public string name { get; set; } = string.Empty; public string source { get; set; } = string.Empty; public string path { get; set; } = string.Empty; public Mesh? mesh { get; set; } } private readonly Harmony _harmony = new Harmony("Homebrewery"); public static string modFolderName = "Catman-Homebrewery"; private string folderPath = string.Empty; private string internalPath = string.Empty; private string modsPath = string.Empty; private static CFG? _cfg; 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 Dictionary<string, hbSource> hbSources = new Dictionary<string, hbSource>(); public static List<hbArmor> hbArmors = new List<hbArmor>(); public static List<hbMesh> hbMeshes = new List<hbMesh>(); public static List<hbHair> hbHairs = new List<hbHair>(); 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 readonly Dictionary<string, List<Mesh>> hbHairdos = new Dictionary<string, List<Mesh>>(); 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>>>(); public static int filter = 0; public static bool hotkeysOn = true; public static readonly int updateCount = 8; private static readonly string updateString = "Thank you for using Homebrewery 2.6.47!\n\nHuge thanks to Marioalexsan and Scottyfox for giving us convenient custom mesh importing!\nNow let's make some cool stuff!\n\nRemember: don't store custom items!\nClose: 'T' | Ctrl+P to open HB Phone!"; public static bool shownUpdateMessage = false; 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, List<string>> hbConsumableKeywords = new Dictionary<string, List<string>>(); public static Dictionary<string, int> hbConsumableFoodStat = new Dictionary<string, int>(); public static float foodcapacity = 0f; public static ScriptableArmorDye? testDye; private static PlayerRaceModel? _ccm; public static string version = string.Empty; public static string meshesstring = string.Empty; public static string armrendsstring = string.Empty; 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)>(); 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>>(); internal static CFG cfg { get { return _cfg ?? throw new InvalidOperationException("CFG wasn't initialised!"); } set { _cfg = value; } } public static GameManager gm => GameManager._current ?? throw new InvalidOperationException("Tried to get GameManager._current before it was even there!"); public static PlayerRaceModel ccm { get { return _ccm ?? throw new InvalidOperationException("Tried to read HB.ccm before it was even set!"); } set { _ccm = value; } } public static void Log(object t, int l = 0) { if (cfg.LogLevel.Value == -1) { return; } switch (l) { case 1: if (cfg.LogLevel.Value <= 1) { Logger.LogDebug(t); } break; case 2: if (cfg.LogLevel.Value <= 2) { Logger.LogMessage(t); } break; case 3: errorList.Add((t.ToString(), 3)); if (cfg.LogLevel.Value <= 3) { Logger.LogWarning((object)(t?.ToString() + "\n")); } break; case 4: errorList.Add((t.ToString(), 4)); Logger.LogError((object)(t?.ToString() + "\n")); break; default: Logger.LogMessage(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 bool tryGetFilterMode(bool secondAttempt = false) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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); } FilterMode val; try { filter = SettingsManager._current._settingsProfile._textureFilterSetting; val = (FilterMode)filter; Log("Got it: " + ((object)(FilterMode)(ref val)).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 { val = (FilterMode)filter; Log("Still didn't get _textureFilterSetting. Using default from config: " + ((object)(FilterMode)(ref val)).ToString(), 3); } return false; } } private void Bumpscosity() { int[] array = new int[7] { 0, 1, 12, 50, 76, 100, 1000 }; cfg.Bumpscosity.Value = array[Random.Range(0, 6)]; int value = cfg.Bumpscosity.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 async Task Awake() { Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)2); Logger = ((BaseUnityPlugin)this).Logger; cfg = new CFG(((BaseUnityPlugin)this).Config); filter = cfg.FilterMode.Value; hotkeysOn = cfg.HotkeysOn.Value; if (cfg.UpdateMessage.Value >= updateCount && !cfg.AlwaysShowUpdateMsg.Value) { shownUpdateMessage = true; } version = Application.version; Log("Waking up... Game Version is: " + version); Log($"AtlyssGLTF available: {AtlyssGLTF.Enabled}.", 2); if (AtlyssGLTF.Enabled) { Log($"AtlyssGLTF ForceReadableMeshes is {AtlyssGLTF.GetForceReadableMeshes()}", 1); } Bumpscosity(); cfg.BlinkPercent.Value = Mathf.Clamp(cfg.BlinkPercent.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.GetFileName(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); 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"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log("_harmony.PatchAll() done"); Log("Getting SFX", 2); string sfxPath = Path.Combine(internalPath, "SFX"); hbSFX.Add("phone", new List<AudioClip>()); List<string> sfxTargs = new List<string>(); for (int i = 0; i <= 9; i++) { sfxTargs.Add(Path.Combine(sfxPath, "phone", "0" + i + ".mp3")); } sfxTargs.Add(Path.Combine(sfxPath, "objection.mp3")); try { await getSFX(sfxTargs.ToArray()); } catch (Exception e3) { Log("await getSFX() has failed with the Exception:\n" + e3.GetType().Name + " : " + e3.Message, 4); } bool gotfilter = tryGetFilterMode(); partFolders.Sort(); raceFolders.Sort(); races.Sort(); Log("Loading backfill texture data", 1); foreach (string r2 in races) { foreach (string p in partFields["Skin"]) { string name = r2 + "-" + p; string path = Path.Combine(internalPath, "Backfill", name.ToLower() + ".png"); if (File.Exists(path)) { backfill.Add(name.ToLower(), File.ReadAllBytes(path)); } else { backfill.Add(name.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> gearMeshes = new <>z__ReadOnlyList<Mesh>(list); foreach (Mesh j in gearMeshes) { aMesh.Add(((Object)j).name, j); } Log("Meshes:\n" + string.Join(", ", aMesh.Keys), 1); meshesstring = string.Join(",", aMesh.Keys); string[] spriteTargs = new string[12] { "based", "Nokia_3310", "BrokenDye", "joker", "VanityIco", "PortalIco", "ExitIco", "ForwardIco", "BackIco", "NextIco", "PreviousIco", "StorageIco" }; string[] array = spriteTargs; foreach (string sprite in array) { hbSprites.Add(sprite, makeImage(internalPath, sprite, sprite: true).spr); } consumableObject = Resources.Load<GameObject>("_item/02_consumable/_status/_consumableEffect_healthConsumable"); GameObject objectioneffect = Object.Instantiate<GameObject>(consumableObject.gameObject); ((Object)objectioneffect).hideFlags = (HideFlags)61; Object.Destroy((Object)(object)objectioneffect.GetComponentInChildren<ParticleSystem>()); Object.Destroy((Object)(object)objectioneffect.GetComponentInChildren<ParticleSystemRenderer>()); ((Object)objectioneffect).name = "consumableObject_Objection!"; AudioSource audio = objectioneffect.GetComponentInChildren<AudioSource>(); audio.clip = hbSFX["objection.mp3"][0]; sCondObj.Add("objection", objectioneffect); sCondObj.Add("smoke", Resources.Load<GameObject>("_skill/_banditskills/_mistveil/_conditionEffect_mistVeil")); HardcodedConditions(); new hbSource("Catman232-Homebrewery"); Log("Searching for other mods inside 'plugins' with HB content in them!"); List<string> otherMods = new List<string>(); foreach (string mod in Directory.EnumerateDirectories(modsPath)) { string name2 = Path.GetFileName(mod); if (!(name2 == modFolderName) && !File.Exists(Path.Combine(mod, "manifest.json.old"))) { if (Directory.Exists(Path.Combine(mod, "HomebreweryFiles"))) { otherMods.Add(Path.Combine(mod, "HomebreweryFiles")); new hbSource(name2); } else if (Directory.Exists(Path.Combine(mod, "plugins", "HomebreweryFiles"))) { otherMods.Add(Path.Combine(mod, "plugins", "HomebreweryFiles")); new hbSource(name2); } } } if (otherMods.Count > 0) { Log("Folders:\n" + string.Join("\n", otherMods).Replace(modsPath, "") + "\n"); } else { Log("None found!\n"); } string text = folderPath; List<string> list2 = otherMods; int num = 0; string[] array2 = new string[1 + list2.Count]; array2[num] = text; num++; foreach (string item in list2) { array2[num] = item; num++; } string[] contentFolders = array2; Log("contentFolders:\n" + string.Join("\n", contentFolders) + "\n", 1); foreach (string r3 in races) { hbPartTable.Add(r3, new List<hbFolder>()); hbPartInd.Add(r3, new Dictionary<string, Dictionary<string, string>>()); hbHairdos.Add(r3, new List<Mesh>()); foreach (string p2 in partFolders) { hbPartInd[r3].Add(p2, new Dictionary<string, string>()); } hbPartInd[r3].Add("Hair", new Dictionary<string, string>()); } hbPartInd.Add("Item", new Dictionary<string, Dictionary<string, string>>()); hbPartInd["Item"].Add("Dye", new Dictionary<string, string>()); if (AtlyssGLTF.Enabled) { Log("Trying to get custom meshes", 2); string[] meshfolds = new string[3] { "Mesh", "ArmorRender", "Hair" }; string[] array3 = meshfolds; foreach (string fold in array3) { Stopwatch swgm = Stopwatch.StartNew(); Log("getMeshes(" + fold + ")", 2); string[] array4 = contentFolders; foreach (string content3 in array4) { if (FindCustoms(content3, fold, out List<string> folds3) != null) { Log("Folders:\n" + string.Join("\n", folds3).Replace(content3, "") + "\n", 1); string source3 = SourceIt(content3); Log("Source: " + source3, 2); try { await AtlyssGLTF.getMeshes(folds3.ToArray(), content3, source3, fold); } catch (Exception ex) { Exception e5 = ex; Log("await AtlyssGLTF.getMeshes() has failed with the Exception:\n" + e5.GetType().Name + " : " + e5.Message, 4); } folds3 = null; } } swgm.Stop(); Log("getMeshes(" + fold + ") took " + swgm.ElapsedMilliseconds + "ms\n", 1); } } if (!gotfilter) { tryGetFilterMode(secondAttempt: true); } Log("Setting up hbDir - itemFolders", 2); Stopwatch swgi = Stopwatch.StartNew(); foreach (string f2 in itemFolders) { hbDir.Add(f2, new List<hbFolder>()); string[] array5 = contentFolders; foreach (string content2 in array5) { if (FindCustoms(content2, f2, out List<string> folds2) != null) { Log("Folders:\n" + string.Join("\n", folds2).Replace(content2, "") + "\n", 1); string source2 = SourceIt(content2); Log("Source: " + source2, 2); try { await getItems(folds2.ToArray(), content2, source2); } catch (Exception ex) { Exception e4 = ex; Log("await getItems() has failed with the Exception:\n" + e4.GetType().Name + " : " + e4.Message, 4); } Log("", 2); folds2 = null; } } } swgi.Stop(); Log("getItems took " + swgi.ElapsedMilliseconds + "ms\n", 1); hbFolder beak = 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 }; beak.condname = beak.source + "-" + beak.race + "-" + beak.type + "-" + beak.name; makeCondMark(beak.condname, "Mouth"); hbPartTable["Byrdle"].Add(beak); hbFolder beakgone = new hbFolder { name = "hbInvisBeak", type = "Mouth", race = "Byrdle", thing = (object)new MouthTextureGroup { _closed = (Texture)(object)Texture2D.blackTexture, _open = (Texture)(object)Texture2D.blackTexture }, done = true }; beakgone.condname = beakgone.source + "-" + beakgone.race + "-" + beakgone.type + "-" + beakgone.name; makeCondMark(beakgone.condname, "Mouth"); hbPartTable["Byrdle"].Add(beakgone); Log("", 2); Log("Setting up hbDir - partFolders", 2); Stopwatch swgp = Stopwatch.StartNew(); foreach (string f in partFolders) { hbDir.Add(f, new List<hbFolder>()); foreach (string r in raceFolders) { string t = Path.Combine(f, r); string[] array6 = contentFolders; foreach (string content in array6) { if (FindCustoms(content, t, out List<string> folds) != null) { Log("Folders:\n" + string.Join("\n", folds).Replace(content, "") + "\n", 1); string source = SourceIt(content); Log("Source: " + source, 2); try { await getParts(folds.ToArray(), content, source); } catch (Exception ex) { Exception e2 = ex; Log("await getParts() has failed with the Exception:\n" + e2.GetType().Name + " : " + e2.Message, 4); } Log("", 2); folds = null; } } } } swgp.Stop(); Log("getParts took " + swgp.ElapsedMilliseconds + "ms\n", 1); try { await Cache_ScriptableAssetsPatch(); } catch (Exception e) { Log("await Cache_ScriptableAssetsPatch() has failed with the Exception:\n" + e.GetType().Name + " : " + e.Message, 4); } PHONE.Setup(); PHONE.SetupBased(Path.Combine(internalPath, "based.txt")); Application.SetStackTraceLogType((LogType)4, (StackTraceLogType)1); } private string SourceIt(string content) { string text = Path.GetFileName(Directory.GetParent(content).Name); if (text.Equals("plugins", StringComparison.OrdinalIgnoreCase) || text.Equals("config", StringComparison.OrdinalIgnoreCase)) { text = Path.GetFileName(Directory.GetParent(content).Parent.Name); } if (text == modFolderName || text.Equals("BepInEx", StringComparison.OrdinalIgnoreCase)) { text = "Catman232-Homebrewery"; } return text; } private async Task Cache_ScriptableAssetsPatch() { Log("Cache_ScriptableAssetsPatch()", 1); ScriptableArmorRender[] array = Resources.FindObjectsOfTypeAll<ScriptableArmorRender>(); foreach (ScriptableArmorRender a in array) { aRend.Add(((Object)a).name.Replace("armorRender_", "").Replace("helmRender_", ""), a); } armrendsstring = string.Join(",", aRend.Keys); Log("Fetched ScriptableArmorRender objects:\n" + armrendsstring, 1); Log("Here's the meshes again too:\n" + meshesstring, 1); Log("Processing hbArmors", 1); foreach (hbArmor a2 in hbArmors) { Log(a2.name, 1); a2.Go(); } await Task.Run(async delegate { while ((Object)(object)gm == (Object)null) { await Task.Delay(10); } }); placeStatuses(gm); Log("Here's the Status Conditions list:\n" + string.Join(", ", gm._cachedScriptableConditions.Keys), 1); placeItems(gm); testDye = (ScriptableArmorDye)gm.LocateItem("TEST Dye<color=#00000000><size=1>Catman-Homebrewery-Dye-Homebrewery_Dye_Test</size></color>"); new hbSource("Vanilla Items"); GetVanillaItems(); new hbSource("Ctrl+R New Items").HasItems = true; foreach (hbSource s in hbSources.Values) { s.FetchItems(); if (s.HasItems) { SHOP.Aisles.Add(s.name); SHOP.Items[(ItemType)0].AddRange(s.ShopkeepItems[(ItemType)0]); SHOP.Items[(ItemType)1].AddRange(s.ShopkeepItems[(ItemType)1]); SHOP.Items[(ItemType)2].AddRange(s.ShopkeepItems[(ItemType)2]); } } int c = Math.Min(SHOP.Items[(ItemType)0].Count, 32); SHOP.Shelf.AddRange(SHOP.Items[(ItemType)0].GetRange(0, c)); SHOP.Shopkeep._shopkeepItemTables[0]._shopkeepItems = SHOP.Shelf.ToArray(); } private void GetVanillaItems() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[15] { "Blue Dye", "Red Dye", "Grey Dye", "Green Dye", "Blue Dye", "Necro Marrow", "Necro Caustics", "Leather Top", "Leather Britches", "Sagecloth Top", "Sagecloth Shorts", "Aero Top", "Aero Pants", "Nutso Top", "Nutso Pants" }; hbSource hbSource = hbSources["Vanilla Items"]; string[] array2 = array; foreach (string text in array2) { ScriptableItem val = gm.LocateItem(text); if ((Object)(object)val != (Object)null) { ItemType itemType = val._itemType; ShopkeepItem item = new ShopkeepItem { _itemNameTag = val._itemName, _scriptItem = val, _initialStock = 1, _stockRefreshTimer = 0f, _isInfiniteStock = true, _removeAtEmptyStock = false, _setStatModifier = null, _randomizeModifier = false, _gambleLootTable = null, _gambleValue = 0, _isGambleSlot = false }; hbSource.ShopkeepItems[itemType].Add(item); } } hbSource.Sort((ItemType)0); hbSource.Sort((ItemType)1); hbSource.Sort((ItemType)2); hbSource.HasItems = true; } private void HardcodedConditions() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_0878: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Unknown result type (might be due to invalid IL or missing references) hbConsumableKeywords.Add("hurt", new List<string>()); hbConsumableKeywords.Add("cold", new List<string>()); hbConsumableKeywords.Add("spicy", new List<string>()); hbConsumableKeywords.Add("smoke", new List<string>()); 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 = string.Empty; ((ScriptableCondition)val)._conditionType = (ConditionType)3; ((ScriptableCondition)val)._isRefreshable = false; ((ScriptableCondition)val)._displayConditionOnUI = false; sCond.Add("Homebrewery-InstantKill_1", val); hbConsumableKeywords.Add("death", new List<string>()); 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); hbConsumableKeywords.Add("lowgrav", new List<string>()); 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); hbConsumableKeywords.Add("float", new List<string>()); ScriptableStatusCondition val4 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val4).name = "Homebrewery-Hyperactive"; val4._movSpeedPercentChange = 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); hbConsumableKeywords.Add("hyper", new List<string>()); 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); hbConsumableKeywords.Add("invisible", new List<string>()); 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); hbConsumableKeywords.Add("bustamove", new List<string>()); 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); hbConsumableKeywords.Add("stopmoving", new List<string>()); ScriptableStatusCondition val8 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val8).name = "Homebrewery-Immobilised"; val8._movSpeedPercentChange = -1f; ((ScriptableCondition)val8)._duration = 30f; ((ScriptableCondition)val8)._conditionName = "Homebrewery-Immobilised"; ((ScriptableCondition)val8)._conditionDescription = "You can't move!"; ((ScriptableCondition)val8)._conditionType = (ConditionType)3; ((ScriptableCondition)val8)._displayConditionOnUI = false; sCond.Add("Homebrewery-Immobilised_1", val8); hbConsumableKeywords.Add("immobilised", new List<string>()); ScriptableStatusCondition val9 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val9).name = "Homebrewery-Boob Toggler"; ((ScriptableCondition)val9)._duration = 0.5f; ((ScriptableCondition)val9)._conditionName = "Homebrewery-Boob Toggler"; ((ScriptableCondition)val9)._conditionDescription = "Bimbofication or Femboyification?"; ((ScriptableCondition)val9)._conditionType = (ConditionType)2; ((ScriptableCondition)val9)._displayConditionOnUI = false; sCond.Add("Homebrewery-Boob Toggler_1", val9); hbConsumableKeywords.Add("chestbinded", new List<string>()); ScriptableStatusCondition val10 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val10).name = "Homebrewery-Rainbow Hair"; ((ScriptableCondition)val10)._isPermanent = true; ((ScriptableCondition)val10)._conditionName = "Homebrewery-Rainbow Hair"; ((ScriptableCondition)val10)._conditionDescription = "HBHairEffect"; ((ScriptableCondition)val10)._conditionType = (ConditionType)0; ((ScriptableCondition)val10)._displayConditionOnUI = false; sCond.Add("Homebrewery-Rainbow Hair_1", val10); hbConsumableKeywords.Add("rainbowhair", new List<string>()); ScriptableStatusCondition val11 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val11).name = "Homebrewery-Hairwash"; ((ScriptableCondition)val11)._duration = 1f; ((ScriptableCondition)val11)._conditionName = "Homebrewery-Hairwash"; ((ScriptableCondition)val11)._conditionDescription = "Cleansed your hair effects away!"; ((ScriptableCondition)val11)._conditionType = (ConditionType)2; ((ScriptableCondition)val11)._displayConditionOnUI = false; sCond.Add("Homebrewery-Hairwash_1", val11); hbConsumableKeywords.Add("hairwash", new List<string>()); ScriptableStatusCondition val12 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val12).name = "Homebrewery-Rainbow Fur"; ((ScriptableCondition)val12)._isPermanent = true; ((ScriptableCondition)val12)._conditionName = "Homebrewery-Rainbow Fur"; ((ScriptableCondition)val12)._conditionDescription = "HBHairEffect"; ((ScriptableCondition)val12)._conditionType = (ConditionType)0; ((ScriptableCondition)val12)._displayConditionOnUI = false; sCond.Add("Homebrewery-Rainbow Fur_1", val12); hbConsumableKeywords.Add("rainbowfur", new List<string>()); ScriptableStatusCondition val13 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val13).name = "Homebrewery-Super Jump"; ((ScriptableCondition)val13)._duration = 2f; ((ScriptableCondition)val13)._conditionName = "Homebrewery-Super Jump"; ((ScriptableCondition)val13)._conditionDescription = "Scroll of Icarian Flight? Nah!"; ((ScriptableCondition)val13)._conditionType = (ConditionType)0; ((ScriptableCondition)val13)._displayConditionOnUI = false; sCond.Add("Homebrewery-Super Jump_1", val13); hbConsumableKeywords.Add("superjump", new List<string>()); ScriptableStatusCondition val14 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val14).name = "Homebrewery-Drunk"; ((ScriptableCondition)val14)._duration = 600f; ((ScriptableCondition)val14)._conditionName = "Homebrewery-Drunk"; ((ScriptableCondition)val14)._conditionDescription = "I'm drunk! You don't have an excuse!"; ((ScriptableCondition)val14)._conditionType = (ConditionType)3; ((ScriptableCondition)val14)._displayConditionOnUI = false; ((ScriptableCondition)val14)._isStackable = true; ((ScriptableCondition)val14)._isRefreshable = false; sCond.Add("Homebrewery-Drunk_1", val14); hbConsumableKeywords.Add("drunk", new List<string>()); ScriptableStatusCondition val15 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val15).name = "Homebrewery-Objection!"; val15._animlayer = 11; val15._animTag = "point_loop"; ((ScriptableCondition)val15)._duration = 2f; ((ScriptableCondition)val15)._conditionName = "Homebrewery-Objection!"; ((ScriptableCondition)val15)._conditionDescription = "Objection!"; ((ScriptableCondition)val15)._conditionType = (ConditionType)6; ((ScriptableCondition)val15)._displayConditionOnUI = false; sCond.Add("Homebrewery-Objection!_1", val15); hbConsumableKeywords.Add("objection", new List<string>()); ScriptableStatusCondition val16 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val16).name = "Homebrewery-Sit Down"; val16._animlayer = 11; val16._animTag = "sit_Init"; ((ScriptableCondition)val16)._duration = 30f; ((ScriptableCondition)val16)._cancelOnAttack = true; ((ScriptableCondition)val16)._cancelOnHit = true; ((ScriptableCondition)val16)._cancelOnSkillCast = (CancelConditionOnCastType)1; ((ScriptableCondition)val16)._conditionName = "Homebrewery-Sit Down"; ((ScriptableCondition)val16)._conditionDescription = "Be seated..."; ((ScriptableCondition)val16)._conditionType = (ConditionType)6; ((ScriptableCondition)val16)._displayConditionOnUI = false; sCond.Add("Homebrewery-Sit Down_1", val16); hbConsumableKeywords.Add("sitdown", new List<string>()); ScriptableStatusCondition val17 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val17).name = "Homebrewery-Untextured"; ((ScriptableCondition)val17)._duration = 4f; ((ScriptableCondition)val17)._conditionName = "Homebrewery-Untextured"; ((ScriptableCondition)val17)._conditionDescription = "Feeling absent..."; ((ScriptableCondition)val17)._conditionType = (ConditionType)3; ((ScriptableCondition)val17)._displayConditionOnUI = false; ((ScriptableCondition)val17)._tintEntityOnEffect = true; ((ScriptableCondition)val17)._effectTint = new Color(1f, 0f, 1f, 1f); ((ScriptableCondition)val17)._shineEntityOnEffect = true; ((ScriptableCondition)val17)._shineIntensity = -100f; ((ScriptableCondition)val17)._effectShine = new Color(0f, 1f, 0f, 1f); sCond.Add("Homebrewery-Untextured_1", val17); hbConsumableKeywords.Add("untextured", new List<string>()); 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 val18 = ScriptableObject.CreateInstance<ScriptableStatusCondition>(); ((Object)val18).name = "Homebrewery-" + text; ((ScriptableCondition)val18)._conditionName = "Homebrewery-" + text; if (num == 1f) { ((Object)val18).name = ((Object)val18).name + " (Fast)"; ((ScriptableCondition)val18)._conditionName = ((ScriptableCondition)val18)._conditionName + " (Fast)"; } ((ScriptableCondition)val18)._duration = num; ((ScriptableCondition)val18)._conditionType = (ConditionType)0; ((ScriptableCondition)val18)._displayConditionOnUI = false; sCond.Add(((Object)val18).name + "_1", val18); } } hbConsumableKeywords.Add("megamilk", new List<string>()); hbConsumableKeywords.Add("minimilk", new List<string>()); hbConsumableKeywords.Add("cakedup", new List<string>()); hbConsumableKeywords.Add("pancakes", new List<string>()); hbConsumableKeywords.Add("muffintop", new List<string>()); hbConsumableKeywords.Add("tonedtummy", new List<string>()); hbConsumableKeywords.Add("elongate", new List<string>()); hbConsumableKeywords.Add("compact", new List<string>()); hbConsumableKeywords.Add("wideload", new List<string>()); hbConsumableKeywords.Add("twiggy", new List<string>()); hbConsumableKeywords.Add("megamilkfast", new List<string>()); hbConsumableKeywords.Add("minimilkfast", new List<string>()); hbConsumableKeywords.Add("cakedupfast", new List<string>()); hbConsumableKeywords.Add("pancakesfast", new List<string>()); hbConsumableKeywords.Add("muffintopfast", new List<string>()); hbConsumableKeywords.Add("tonedtummyfast", new List<string>()); hbConsumableKeywords.Add("elongatefast", new List<string>()); hbConsumableKeywords.Add("compactfast", new List<string>()); hbConsumableKeywords.Add("wideloadfast", new List<string>()); hbConsumableKeywords.Add("twiggyfast", new List<string>()); hbConsumableKeywords.Add("fragile", new List<string>()); hbConsumableKeywords.Add("hourlong", new List<string>()); } 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 Task getParts(string[] itemTargs, string path, string source) { List<Task> tasks = new List<Task>(); foreach (string targ in itemTargs) { tasks.Add(getPart(targ, path, source)); } try { await Task.WhenAll(tasks); } catch (Exception e) { Log("Task.WhenAll in getParts failed with Exception:\n" + e.GetType().Name + " : " + e.Message, 4); } } private Task getPart(string targ, string path, string source) { Stopwatch stopwatch = Stopwatch.StartNew(); string text = targ.Replace(path, ""); string text2 = text.Split('\\')[1]; string text3 = text.Split('\\')[2]; string text4 = text.Split('\\')[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); hbSources[source].hbFolders.Add(hbFolder); 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 text = partFold.source + ": " + partFold.name; if (!partFold.center.done) { Log(text + " - Eyes cannot be missing 'center.png'! Skipped!", 4); return false; } byte[] array = File.ReadAllBytes(partFold.center.path); if (!partFold.up.done) { Log(text + " - Missing Eyes 'up.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.up.tex, array, true); } if (!partFold.down.done) { Log(text + " - Missing Eyes 'down.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.down.tex, array, true); } if (!partFold.left.done) { Log(text + " - Missing Eyes 'left.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.left.tex, array, true); } if (!partFold.right.done) { Log(text + " - Missing Eyes 'right.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.right.tex, array, true); } if (!partFold.pissed.done) { Log(text + " - Missing Eyes 'pissed.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.pissed.tex, array, true); } if (!partFold.hurt.done) { Log(text + " - Missing Eyes 'hurt.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.hurt.tex, array, true); } if (!partFold.closed.done) { Log(text + " - Missing Eyes 'closed.png' subbed with 'center.png'", 3); ImageConversion.LoadImage(partFold.closed.tex, array, true); } return true; } private bool checkMouthGroup(hbFolder partFold) { Log("checkMouthGroup()", 1); string text = partFold.source + ": " + partFold.name; if (!partFold.closed.done) { if (partFold.race != "Byrdle") { Log(text + " - Mouths cannot be missing 'closed.png'! Skipped!", 4); return false; } Log(text + " - Byrdle 'Mouths' cannot be missing 'beak.png'! Skipped!", 4); return false; } byte[] array = File.ReadAllBytes(partFold.closed.path); if (!partFold.open.done) { if (partFold.race != "Byrdle") { Log(text + " - Missing Mouth 'open.png' subbed with 'closed.png'", 3); } else { Log(text + " - Copying Byrdle 'beak.png' to 'open.png'", 2); } ImageConversion.LoadImage(partFold.open.tex, array, true); } return true; } private bool checkSkinGroup(hbFolder partFold) { Log("checkSkinGroup()", 1); string text = partFold.source + ": " + partFold.name; if (!partFold.head.done && !partFold.body.done && !partFold.leg.done && !partFold.hair.done && !partFold.ear.done && !partFold.tail.done) { Log(text + " did not have a single valid 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 " + text, 1); return true; } switch (partFold.race) { default: Log(text + " - " + 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(text + " - 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(text + " - Missing Poon 'hair.png' subbed with 'head.png'", 2); ImageConversion.LoadImage(partFold.hair.tex, array2, true); } if (!partFold.ear.done) { Log(text + " - Missing Poon 'ear.png' subbed with 'head.png'", 2); ImageConversion.LoadImage(partFold.ear.tex, array2, true); } if (!partFold.tail.done) { Log(text + " - Missing Poon 'tail.png' subbed with 'head.png'", 2); ImageConversion.LoadImage(partFold.tail.tex, array2, true); } if (!partFold.body.done || !partFold.leg.done) { Log(text + " - Missing Poon 'body.png'/'leg.png' will be backfilled by Vanilla textures", 2); } break; } case "Byrdle": if (!partFold.tail.done) { Log(text + " - 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(text + " - Missing Byrdle 'hair.png' will be backfilled by Vanilla Hair texture", 2); } } else if (!partFold.hair.done) { byte[] array3 = File.ReadAllBytes(partFold.tail.path); Log(text + " - Missing Byrdle 'hair.png' subbed with 'tail.png'", 2); ImageConversion.LoadImage(partFold.hair.tex, array3, true); } if (!partFold.head.done) { Log(text + " - 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(text + " - Missing Byrdle 'ear.png' will be backfilled by Vanilla Ear texture", 2); } } else if (!partFold.ear.done) { byte[] array4 = File.ReadAllBytes(partFold.head.path); Log(text + " - Missing Byrdle 'ear.png' subbed with 'head.png'", 2); ImageConversion.LoadImage(partFold.ear.tex, array4, true); } if (!partFold.body.done || !partFold.leg.done) { Log(text + " - Missing Byrdle 'body.png'/'leg.png' will be backfilled by Vanilla textures", 2); } break; case "Imp": if (!partFold.head.done) { Log(text + " - 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(text + " - Missing Imp 'ear.png' will be backfilled by Vanilla Ear texture", 2); } } else if (!partFold.ear.done) { byte[] array5 = File.ReadAllBytes(partFold.head.path); Log(text + " - Missing Imp 'ear.png' subbed with 'head.png'", 2); ImageConversion.LoadImage(partFold.ear.tex, array5, true); } if (!partFold.body.done || !partFold.leg.done || !partFold.hair.done || !partFold.tail.done) { Log(text + " - Missing Imp 'body.png'/'leg.png'/'hair.png'/'tail.png' will be backfilled by Vanilla textures", 2); } break; case "Chang": if (!partFold.head.done) { Log(text + " - 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(text + " - Missing Chang 'hair.png' will be backfilled by Vanilla Hair texture", 2); } } else if (!partFold.hair.done) { byte[] array = File.ReadAllBytes(partFold.head.path); Log(text + " - Missing Chang 'hair.png' subbed 'head.png'", 2); ImageConversion.LoadImage(partFold.hair.tex, array, true); } if (!partFold.body.done || !partFold.leg.done || !partFold.ear.done || !partFold.tail.done) { Log(text + " - Missing Chang 'body.png'/'leg.png'/'ear.png'/'tail.png' will be backfilled by Vanilla textures", 2); } break; } return true; } private async Task getItems(string[] itemTargs, string path, string source) { List<Task> tasks = new List<Task>(); foreach (string targ in itemTargs) { tasks.Add(getItem(targ, path, source)); } try { await Task.WhenAll(tasks); } catch (Exception e) { Log("Task.WhenAll in getItems failed with Exception:\n" + e.GetType().Name + " : " + e.Message, 4); } } private Task getItem(string targ, string path, string source) { Stopwatch stopwatch = Stopwatch.StartNew(); string text = targ.Replace(path, ""); string text2 = text.Split('\\')[1]; string text3 = text.Split('\\')[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; hbFolder.condname = source + "-" + text2 + "-" + text3; } Log("Adding to hbDir.", 1); hbDir[text2].Add(hbFolder); hbFolds.Add(targ); hbItemTable.Add(hbFolder); hbSources[source].hbFolders.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) { if (hbConsumableFoodStat.ContainsKey(((ScriptableItem)cons)._itemName)) { hbConsumableFoodStat[((ScriptableItem)cons)._itemName] = itemFold.param.food; } else { hbConsumableFoodStat.Add(((ScriptableItem)cons)._itemName, itemFold.param.food); } } } 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 != string.Empty) { 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 != string.Empty) { 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 != string.Empty && !aMesh.ContainsKey(itemFold.param._helmOverrideMesh)) { Log(itemFold.name + " - _helmOverrideMesh name is invalid, field will be considered blank!", 4); itemFold.param._helmOverrideMesh = string.Empty; } if (itemFold.param._helmRender == "halo" || itemFold.param._helmRender == "halo_01") { if (itemFold.param._helmOverrideMesh != string.Empty) { 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 != string.Empty && !aMesh.ContainsKey(itemFold.param._neckCollarMesh)) { Log(itemFold.name + " - _neckCollarMesh name is invalid, field will be considered blank!", 4); itemFold.param._neckCollarMesh = string.Empty; } if (itemFold.param._neckCollarMesh != string.Empty) { 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 != string.Empty && !aMesh.ContainsKey(itemFold.param._shoulderpadMesh)) { Log(itemFold.name + " - _shoulderpadMesh name is invalid, field will be considered blank!", 4); itemFold.param._shoulderpadMesh = string.Empty; } if (itemFold.param._shoulderpadMesh != string.Empty) { 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 = val