Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Armor Inscriptions v0.5.2
BepInEx/plugins/OctoberJemini-Armor_Inscriptions/ArmorInscriptions.dll
Decompiled 10 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 BepInEx; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.5.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace OctoberJemini.ArmorInscriptions { internal static class ApplyMenu { internal sealed class Entry { internal Recipe Recipe; internal ItemData Armor; internal string Kind; } [HarmonyPatch(typeof(Player), "GetAvailableRecipes")] private static class Recipes { private static void Postfix(Player __instance, ref List<Recipe> __0) { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown Bench bench = Current(__instance); if (!Object.op_Implicit((Object)(object)bench) || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } __0.Clear(); CraftingStation component = ((Component)bench).GetComponent<CraftingStation>(); foreach (ItemData armor in ((Humanoid)__instance).GetInventory().GetAllItems()) { string[] ids = Rules.Ids; foreach (string kind in ids) { if (Plugin.Compatible(armor, kind) && armor.m_stack == 1 && Required(armor, kind) != 0 && !Rules.Has(armor.m_customData, kind)) { Entry entry = Entries.Values.FirstOrDefault((Entry x) => x.Armor == armor && x.Kind == kind); if (entry == null) { Recipe val = ScriptableObject.CreateInstance<Recipe>(); ((Object)val).name = "OCT_InscriptionRecipe_" + Entries.Count; val.m_item = armor.m_dropPrefab.GetComponent<ItemDrop>(); val.m_amount = 1; val.m_enabled = true; val.m_minStationLevel = 1; val.m_qualityResultAmountMultiplier = 0f; entry = new Entry { Recipe = val, Armor = armor, Kind = kind }; Entries.Add(val, entry); } entry.Recipe.m_craftingStation = component; entry.Recipe.m_resources = (Requirement[])(object)new Requirement[1] { new Requirement { m_resItem = Plugin.Items[kind].ItemDrop, m_amount = Required(armor, kind), m_amountPerLevel = 0, m_recover = false } }; __0.Add(entry.Recipe); } } } } } [HarmonyPatch(typeof(InventoryGui), "InCraftTab")] private static class CraftTab { private static bool Prefix(ref bool __result) { if (!Here()) { return true; } __result = true; return false; } } [HarmonyPatch(typeof(InventoryGui), "InUpradeTab")] private static class UpgradeTab { private static bool Prefix(ref bool __result) { if (!Here()) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")] private static class Labels { private static void Postfix(InventoryGui __instance) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!Here()) { return; } foreach (object item in (IEnumerable)Available.GetValue(__instance)) { Entry entry = Find(RecipeOf(item)); if (entry != null) { GameObject val = (GameObject)item.GetType().GetProperty("InterfaceElement").GetValue(item, null); Transform val2 = val.transform.Find("name"); if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).GetComponent<TMP_Text>().text = Name(entry); } Transform val3 = val.transform.Find("icon"); if (Object.op_Implicit((Object)(object)val3)) { Image component = ((Component)val3).GetComponent<Image>(); component.sprite = entry.Armor.GetIcon(); Badge(component, entry.Kind); } } } } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] private static class Preview { private static void Prefix(ref int ___m_multiCraftAmount, out int __state) { __state = ___m_multiCraftAmount; if (Here()) { ___m_multiCraftAmount = 1; } } private static void Postfix(InventoryGui __instance, Player __0, TMP_Text ___m_recipeName, TMP_Text ___m_recipeDecription, Image ___m_recipeIcon, Button ___m_craftButton, Button ___m_tabCraft, Button ___m_tabUpgrade, ref int ___m_multiCraftAmount, int __state, float ___m_craftTimer) { ___m_multiCraftAmount = __state; if (!Here()) { Badge(___m_recipeIcon, null); if (customized) { ((Component)___m_tabCraft).GetComponentInChildren<TMP_Text>().text = Localization.instance.Localize("$inventory_craft"); customized = false; } return; } customized = true; ((Component)___m_tabCraft).gameObject.SetActive(true); ((Component)___m_tabUpgrade).gameObject.SetActive(false); ((Selectable)___m_tabCraft).interactable = false; ((Component)___m_tabCraft).GetComponentInChildren<TMP_Text>().text = "UPGRADE"; Entry entry = Find(RecipeOf(Selected.GetValue(__instance))); if (entry == null) { Badge(___m_recipeIcon, null); ___m_recipeDecription.text = "Carry a helmet, chest armor or leg armor with an available inscription.\n\nBuy patches from Hildir for 500 coins each after Eikthyr."; return; } ___m_recipeName.text = Name(entry); ___m_recipeIcon.sprite = entry.Armor.GetIcon(); Badge(___m_recipeIcon, entry.Kind); ___m_recipeDecription.text = Plugin.Benefit(entry.Kind) + "\n\nQuality: " + entry.Armor.m_quality + (((Humanoid)__0).IsItemEquiped(entry.Armor) ? " · Equipped" : "") + "\n\nPatches: " + Count(__0, entry.Kind) + " / " + Required(entry.Armor, entry.Kind) + "\n\nPermanent on this armor. Keeps quality, durability, enchantments, sockets and other inscriptions."; string text = TailoringExtensions.Missing(Current(__0), Tier(entry.Armor)); if (text != null) { ___m_recipeDecription.text = ___m_recipeDecription.text + "\n\n<color=orange>" + text + " (within 5m).</color>"; } ((Component)___m_craftButton).GetComponentInChildren<TMP_Text>().text = "Apply Inscription"; ((Selectable)___m_craftButton).interactable = ___m_craftTimer < 0f && Valid(__0, entry) && Count(__0, entry.Kind) >= Required(entry.Armor, entry.Kind); } } [HarmonyPatch(typeof(InventoryGui), "OnCraftPressed")] private static class Start { private static bool Prefix(InventoryGui __instance, out object __state) { __state = null; object value = Selected.GetValue(__instance); Entry entry = Find(RecipeOf(value)); if (entry == null) { return !Here(); } Player localPlayer = Player.m_localPlayer; if (!Valid(localPlayer, entry) || Count(localPlayer, entry.Kind) < Required(entry.Armor, entry.Kind)) { return false; } pending = entry; __state = Selected.GetValue(__instance); value.GetType().GetProperty("ItemData").SetValue(value, entry.Armor, null); Selected.SetValue(__instance, value); return true; } private static void Postfix(InventoryGui __instance, object __state, ref bool ___m_multiCrafting) { if (__state != null) { Selected.SetValue(__instance, __state); ___m_multiCrafting = false; } } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] private static class Finish { [HarmonyPriority(800)] private static bool Prefix(Player __0, Recipe ___m_craftRecipe) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Entry entry = Find(___m_craftRecipe); if (entry == null) { return !Here(); } Entry pending = ApplyMenu.pending; ApplyMenu.pending = null; try { if (entry != pending || !Apply(__0, entry)) { ((Character)__0).Message((MessageType)2, "Armor or patches changed. Nothing was applied.", 0, (Sprite)null, false); return false; } __0.GetCurrentCraftingStation().m_craftItemDoneEffects.Create(((Component)__0).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); } catch (Exception e) { Plugin.Instance.Error(e); } finally { refresh = true; } return false; } } [HarmonyPatch(typeof(InventoryGui), "OnCraftCancelPressed")] private static class Cancel { private static void Postfix() { pending = null; } } [HarmonyPatch(typeof(InventoryGui), "Hide")] private static class Hidden { private static void Postfix() { Close(); } } private static readonly Dictionary<Recipe, Entry> Entries = new Dictionary<Recipe, Entry>(); private static readonly FieldInfo Selected = AccessTools.Field(typeof(InventoryGui), "m_selectedRecipe"); private static readonly FieldInfo Available = AccessTools.Field(typeof(InventoryGui), "m_availableRecipes"); private static readonly MethodInfo Changed = AccessTools.Method(typeof(Inventory), "Changed", new Type[2] { typeof(bool), typeof(bool) }, (Type[])null); private static Entry pending; private static bool refresh; private static bool customized; internal static int Tier(ItemData item) { if (item == null || !Object.op_Implicit((Object)(object)item.m_dropPrefab)) { return 0; } return ArmorTiers.Cost(((Object)item.m_dropPrefab).name); } internal static int Required(ItemData item, string kind) { return Rules.PatchCost(kind, Tier(item)); } private static Bench Current(Player p) { CraftingStation val = (Object.op_Implicit((Object)(object)p) ? p.GetCurrentCraftingStation() : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } return ((Component)val).GetComponent<Bench>(); } private static bool Here() { return Object.op_Implicit((Object)(object)Current(Player.m_localPlayer)); } private static Entry Find(Recipe recipe) { if (!Object.op_Implicit((Object)(object)recipe) || !Entries.TryGetValue(recipe, out var value)) { return null; } return value; } private static Recipe RecipeOf(object pair) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown return (Recipe)pair.GetType().GetProperty("Recipe").GetValue(pair, null); } private static int Count(Player p, string kind) { return (from i in ((Humanoid)p).GetInventory().GetAllItems() where Plugin.PatchId(i) == kind select i).Sum((ItemData i) => i.m_stack); } private static bool Valid(Player p, Entry e) { Bench bench = Current(p); if (e != null && Object.op_Implicit((Object)(object)bench) && bench.CanUse(p) && ((Humanoid)p).GetInventory().ContainsItem(e.Armor) && e.Armor.m_stack == 1 && Plugin.Compatible(e.Armor, e.Kind) && Required(e.Armor, e.Kind) > 0 && TailoringExtensions.Missing(bench, Tier(e.Armor)) == null) { return !Rules.Has(e.Armor.m_customData, e.Kind); } return false; } internal static void Open(Player p, Bench bench, string kind = null) { if (bench.CanUse(p) && !((Character)p).InAttack() && !((Character)p).InDodge()) { p.SetCraftingStation(((Component)bench).GetComponent<CraftingStation>()); InventoryGui.instance.Show((Container)null, 3); } } internal static void Close() { pending = null; foreach (Recipe key in Entries.Keys) { Object.Destroy((Object)(object)key); } Entries.Clear(); refresh = false; } internal static void Tick() { Player localPlayer = Player.m_localPlayer; InventoryGui instance = InventoryGui.instance; if (Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)instance)) { Bench bench = Current(localPlayer); if (Object.op_Implicit((Object)(object)bench) && InventoryGui.IsVisible() && !bench.CanUse(localPlayer)) { instance.Hide(); } else if (refresh && InventoryGui.IsVisible()) { refresh = false; AccessTools.Method(typeof(InventoryGui), "UpdateCraftingPanel", (Type[])null, (Type[])null).Invoke(instance, new object[1] { false }); } } } private static bool Consume(Inventory inventory, string kind, int amount) { ItemData[] array = (from i in inventory.GetAllItems() where Plugin.PatchId(i) == kind select i).ToArray(); int[] array2 = ArmorTiers.Plan(array.Select((ItemData i) => i.m_stack).ToArray(), amount); if (array2 == null) { return false; } List<ItemData> allItems = inventory.GetAllItems(); for (int num = 0; num < array.Length; num++) { if (array2[num] > 0) { ItemData obj = array[num]; obj.m_stack -= array2[num]; if (array[num].m_stack == 0) { allItems.Remove(array[num]); } } } return true; } private static bool Apply(Player p, Entry e) { Bench bench = Current(p); if (!Object.op_Implicit((Object)(object)bench) || !bench.CanUse(p) || !Valid(p, e)) { return false; } int cost = Required(e.Armor, e.Kind); if (Count(p, e.Kind) < cost) { return false; } if (e.Armor.m_customData == null) { e.Armor.m_customData = new Dictionary<string, string>(); } if (!Rules.TryApply(e.Armor.m_customData, e.Kind, correctSlot: true, singleArmor: true, () => Consume(((Humanoid)p).GetInventory(), e.Kind, cost))) { return false; } Changed.Invoke(((Humanoid)p).GetInventory(), new object[2] { false, false }); ((Character)p).Message((MessageType)2, Plugin.Title(e.Kind) + " applied", 0, (Sprite)null, false); return true; } private static void Badge(Image image, string kind) { //IL_0062: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)image)) { return; } Transform val = ((Component)image).transform.Find("OCT_InscriptionBadge"); if (kind == null) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.SetActive(false); } return; } if (!Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject("OCT_InscriptionBadge", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(((Component)image).transform, false); val = val2.transform; RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.54f, 0f); component.anchorMax = new Vector2(1f, 0.46f); Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; ((Graphic)val2.GetComponent<Image>()).raycastTarget = false; val2.GetComponent<Image>().preserveAspect = true; } ((Component)val).gameObject.SetActive(true); ((Component)val).GetComponent<Image>().sprite = Plugin.Items[kind].ItemDrop.m_itemData.GetIcon(); } private static string Name(Entry e) { return Localization.instance.Localize(e.Armor.m_shared.m_name) + " — " + Plugin.Title(e.Kind); } } internal static class ArmorTiers { private static readonly Dictionary<string, int> Costs; static ArmorTiers() { Costs = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); Add(1, "ArmorRagsChest ArmorRagsLegs ArmorLeatherChest ArmorLeatherLegs ArmorTrollLeatherChest ArmorTrollLeatherLegs ArmorBronzeChest ArmorBronzeLegs ArmorBerserkerChest ArmorBerserkerLegs ArmorHarvester1 ArmorHarvester2"); Add(2, "ArmorIronChest ArmorIronLegs ArmorRootChest ArmorRootLegs"); Add(3, "ArmorWolfChest ArmorWolfLegs ArmorFenringChest ArmorFenringLegs"); Add(4, "ArmorPaddedCuirass ArmorPaddedGreaves ArmorLoxChest ArmorLoxLegs ArmorBerserkerUndeadChest ArmorBerserkerUndeadLegs"); Add(5, "ArmorCarapaceChest ArmorCarapaceLegs ArmorMageChest ArmorMageLegs"); Add(6, "ArmorFlametalChest ArmorFlametalLegs ArmorAshlandsMediumChest ArmorAshlandsMediumlegs ArmorMageChest_Ashlands ArmorMageLegs_Ashlands"); Add(7, "ArmorDeepNorthHeavyChest ArmorDeepNorthHeavylegs ArmorDeepNorthMediumChest ArmorDeepNorthMediumlegs ArmorDeepNorthMageChest ArmorDeepNorthMagelegs"); Add(1, "HelmetLeather HelmetTrollLeather HelmetBronze HelmetBerserkerHood HelmetDverger HelmetYule HelmetOdin HelmetMidsummerCrown HelmetStrawHat HelmetSweatBand HelmetCelebration"); Add(2, "HelmetIron HelmetRoot"); Add(3, "HelmetDrake HelmetFenring"); Add(4, "HelmetPadded HelmetLox HelmetBerserkerUndead"); Add(5, "HelmetCarapace HelmetMage HelmetFishingHat"); Add(6, "HelmetFlametal HelmetAshlandsMediumHood HelmetMage_Ashlands"); Add(7, "HelmetDNHeavy HelmetDNMediumHood HelmetDNMage HelmetCrownofValheim"); for (int i = 1; i <= 10; i++) { Costs["HelmetHat" + i] = 1; } for (int j = 1; j <= 10; j++) { Costs["ArmorTunic" + j] = 1; Costs["ArmorDress" + j] = 1; } } private static void Add(int cost, string names) { string[] array = names.Split(' '); foreach (string key in array) { Costs[key] = cost; } } internal static int Cost(string prefab) { if (prefab == null || !Costs.TryGetValue(prefab, out var value)) { return 0; } return value; } internal static bool Override(string prefab, int cost) { if (string.IsNullOrWhiteSpace(prefab) || cost < 1 || cost > 7) { return false; } Costs[prefab.Trim()] = cost; return true; } internal static int[] Plan(int[] stacks, int needed) { if (needed < 1) { return null; } int[] array = new int[stacks.Length]; int num = needed; for (int i = 0; i < stacks.Length; i++) { if (stacks[i] < 0) { return null; } array[i] = Math.Min(stacks[i], num); num -= array[i]; } if (num != 0) { return null; } return array; } } public sealed class Bench : MonoBehaviour, Hoverable, Interactable { internal const string Prefab = "OCT_InscriptionBench"; private static GameObject registered; internal static void Register() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Expected O, but got Unknown //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Expected O, but got Unknown //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Expected O, but got Unknown //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)registered)) { return; } GameObject prefab = PrefabManager.Instance.GetPrefab("piece_beehive"); if (!Object.op_Implicit((Object)(object)prefab)) { throw new InvalidOperationException("Building template unavailable"); } GameObject val = PrefabManager.Instance.CreateClonedPrefab("OCT_InscriptionBench", prefab); Beehive[] components = val.GetComponents<Beehive>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } for (int num = val.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num)).gameObject); } Collider[] components2 = val.GetComponents<Collider>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } val.transform.localScale = Vector3.one; val.transform.localRotation = Quaternion.identity; WearNTear component = val.GetComponent<WearNTear>(); component.m_new = BenchVisual.Build(val); component.m_worn = Object.Instantiate<GameObject>(component.m_new, val.transform); ((Object)component.m_worn).name = "Worn"; component.m_broken = Object.Instantiate<GameObject>(component.m_new, val.transform); ((Object)component.m_broken).name = "Weathered"; component.m_new.SetActive(true); component.m_worn.SetActive(false); component.m_broken.SetActive(false); component.m_fragmentRoots = (GameObject[])(object)new GameObject[1] { component.m_new }; component.m_comOffset = new Vector3(0f, 0.6f, 0f); component.m_health = 200f; component.m_noRoofWear = false; component.m_noSupportWear = false; component.m_supports = false; Box(val, new Vector3(0f, 1f, 0f), new Vector3(2.12f, 0.13f, 1.06f)); float[] array = new float[2] { -0.86f, 0.86f }; foreach (float num2 in array) { float[] array2 = new float[2] { -0.38f, 0.38f }; foreach (float num3 in array2) { Box(val, new Vector3(num2, 0.48f, num3), new Vector3(0.15f, 0.96f, 0.15f)); } } Box(val, new Vector3(0f, 1.36f, 0.46f), new Vector3(2.05f, 0.5f, 0.12f)); Piece component2 = val.GetComponent<Piece>(); component2.m_noInWater = true; component2.m_groundPiece = false; component2.m_clipGround = false; val.AddComponent<Bench>(); CraftingStation component3 = PrefabManager.Instance.GetPrefab("piece_workbench").GetComponent<CraftingStation>(); CraftingStation obj = val.AddComponent<CraftingStation>(); obj.m_name = "Inscription Bench"; obj.m_icon = Plugin.LoadIcon("bench"); obj.m_craftRequireRoof = false; obj.m_craftRequireFire = false; obj.m_showBasicRecipies = false; obj.m_canRepair = false; obj.m_useDistance = 4f; obj.m_hasCraftTab = true; obj.m_useAnimation = component3.m_useAnimation; obj.m_craftingSkill = (SkillType)0; obj.m_connectionPoint = val.transform; obj.m_roofCheckPoint = val.transform; obj.m_craftItemEffects = component3.m_craftItemEffects; obj.m_craftItemDoneEffects = component3.m_craftItemDoneEffects; PieceConfig val2 = new PieceConfig(); val2.Name = "Inscription Bench"; val2.Description = "Sew purchased inscription patches onto body or leg armor. Higher-tier armor needs more matching patches. Press Use to select a patch and armor."; val2.PieceTable = "Hammer"; val2.Category = "Crafting"; val2.CraftingStation = "piece_workbench"; val2.Icon = Plugin.LoadIcon("bench"); val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Wood", Amount = 20, Recover = true }, new RequirementConfig { Item = "LeatherScraps", Amount = 10, Recover = true }, new RequirementConfig { Item = "DeerHide", Amount = 5, Recover = true } }; PieceConfig val3 = val2; if (!PieceManager.Instance.AddPiece(new CustomPiece(val, false, val3))) { throw new InvalidOperationException("Bench registration rejected"); } registered = val; } private static void Box(GameObject go, Vector3 center, Vector3 size) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) BoxCollider obj = go.AddComponent<BoxCollider>(); obj.center = center; obj.size = size; } internal bool CanUse(Player player) { //IL_004c: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)this) || !Object.op_Implicit((Object)(object)player) || (Object)(object)player != (Object)(object)Player.m_localPlayer || ((Character)player).IsDead() || ((Character)player).IsTeleporting()) { return false; } ZNetView component = ((Component)this).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component) && component.IsValid()) { Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= 16f) { return PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false); } } return false; } public string GetHoverName() { return "Inscription Bench"; } public float GetHoverOffset() { return 0f; } public string GetHoverText() { return Localization.instance.Localize("Inscription Bench\n[<color=yellow><b>$KEY_Use</b></color>] Apply armor inscriptions"); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if (!CanUse(val)) { return false; } ApplyMenu.Open(val, this); return true; } public bool UseItem(Humanoid user, ItemData item) { string text = Plugin.PatchId(item); Player val = (Player)(object)((user is Player) ? user : null); if (text == null || !CanUse(val)) { return false; } ApplyMenu.Open(val, this, text); return true; } } internal static class BenchVisual { private static Mesh beam; private static Material wood; private static Material hide; private static Material thread; private static Material bone; private static GameObject Child(GameObject parent, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown GameObject val = new GameObject(name) { layer = parent.layer }; val.transform.SetParent(parent.transform, false); return val; } private static void Part(GameObject parent, string name, Mesh mesh, Material mat, Vector3 pos, Vector3 scale, Quaternion rotation) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Child(parent, name); obj.transform.localPosition = pos; obj.transform.localScale = scale; obj.transform.localRotation = rotation; obj.AddComponent<MeshFilter>().sharedMesh = mesh; ((Renderer)obj.AddComponent<MeshRenderer>()).sharedMaterial = mat; } private static Material Native(string prefab) { GameObject prefab2 = PrefabManager.Instance.GetPrefab(prefab); MeshRenderer val = (Object.op_Implicit((Object)(object)prefab2) ? prefab2.GetComponentInChildren<MeshRenderer>(true) : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { throw new InvalidOperationException("Missing material: " + prefab); } return ((Renderer)val).sharedMaterial; } private static Material Tint(Material source, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(source); if (val.HasProperty("_Color")) { val.SetColor("_Color", color); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0f); } return val; } internal static GameObject Build(GameObject parent) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: 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_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_082a: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0847: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = PrefabManager.Instance.GetPrefab("wood_beam_1"); GameObject val = prefab.GetComponent<WearNTear>().m_new; MeshFilter componentInChildren = val.GetComponentInChildren<MeshFilter>(true); beam = Normalize(prefab, componentInChildren); wood = ((Renderer)val.GetComponentInChildren<MeshRenderer>(true)).sharedMaterial; hide = Tint(Native("DeerHide"), new Color(0.8f, 0.65f, 0.46f)); thread = Tint(Native("Wood"), new Color(0.78f, 0.62f, 0.4f)); bone = Tint(Native("Wood"), new Color(0.95f, 0.87f, 0.64f)); GameObject val2 = Child(parent, "InscriptionBenchVisual"); for (int i = 0; i < 5; i++) { Part(val2, "TopPlank", beam, wood, new Vector3(0f, 1f, -0.42f + (float)i * 0.21f), new Vector3(0.2f, 0.1f, 2.1f), Quaternion.Euler(0f, 90f, 0f)); } float[] array = new float[2] { -0.86f, 0.86f }; foreach (float num in array) { float[] array2 = new float[2] { -0.38f, 0.38f }; foreach (float num2 in array2) { Beam(val2, wood, new Vector3(num, 0f, num2), new Vector3(num, 1f, num2), 0.15f); } } for (int l = 0; l < 4; l++) { Part(val2, "ShelfPlank", beam, wood, new Vector3(0f, 0.27f, -0.3f + (float)l * 0.2f), new Vector3(0.18f, 0.08f, 1.8f), Quaternion.Euler(0f, 90f, 0f)); } array = new float[2] { -0.37f, 0.37f }; foreach (float num3 in array) { Beam(val2, wood, new Vector3(-0.85f, 0.35f, num3), new Vector3(-0.38f, 0.92f, num3), 0.09f); Beam(val2, wood, new Vector3(0.85f, 0.35f, num3), new Vector3(0.38f, 0.92f, num3), 0.09f); } array = new float[2] { -0.95f, 0.95f }; foreach (float num4 in array) { Beam(val2, wood, new Vector3(num4, 1f, 0.45f), new Vector3(num4, 1.85f, 0.45f), 0.1f); } Part(val2, "RearShelf", beam, wood, new Vector3(0f, 1.48f, 0.36f), new Vector3(0.34f, 0.08f, 1.96f), Quaternion.Euler(0f, 90f, 0f)); array = new float[2] { -0.85f, 0.85f }; foreach (float num5 in array) { Beam(val2, wood, new Vector3(num5, 1.15f, 0.45f), new Vector3(num5, 1.45f, 0.2f), 0.065f); } StorageBox(val2, new Vector3(-0.57f, 1.67f, 0.36f), new Vector3(0.53f, 0.3f, 0.28f)); StorageBox(val2, new Vector3(0f, 1.62f, 0.36f), new Vector3(0.25f, 0.2f, 0.25f)); StorageBox(val2, new Vector3(0.55f, 1.7f, 0.36f), new Vector3(0.36f, 0.36f, 0.28f)); BlankBoxPatch(val2, new Vector3(-0.57f, 1.67f, 0.196f)); Part(val2, "HideMat", HideMesh(), hide, new Vector3(-0.35f, 1.058f, -0.12f), new Vector3(0.96f, 1f, 0.68f), Quaternion.identity); Item(val2, "DeerHide", "FoldedHideA", new Vector3(-0.16f, 0.38f, 0f), new Vector3(0.75f, 0.15f, 0.45f)); Item(val2, "LeatherScraps", "FoldedHideB", new Vector3(0.05f, 0.49f, 0f), new Vector3(0.65f, 0.1f, 0.4f)); Item(val2, "DeerHide", "DrapedHide", new Vector3(0.44f, 1.1f, -0.3f), new Vector3(1.02f, 0.025f, 1.65f), uniform: false, drape: true); Item(val2, "DeerHide", "HidePileMiddle", new Vector3(0.44f, 1.14f, -0.05f), new Vector3(1.03f, 0.035f, 0.85f)); Item(val2, "DeerHide", "HidePileTop", new Vector3(0.48f, 1.18f, -0.02f), new Vector3(0.94f, 0.035f, 0.77f)); GameObject val3 = Item(val2, "LinenThread", "ThreadBundleA", new Vector3(-0.75f, 1.16f, 0.17f), new Vector3(0.2f, 0.25f, 0.2f), uniform: true, drape: false, new Vector3(0f, 12f, 90f)); GameObject val4 = Item(val2, "LinenThread", "ThreadBundleB", new Vector3(-0.5f, 1.16f, 0.17f), new Vector3(0.2f, 0.25f, 0.2f), uniform: true, drape: false, new Vector3(0f, -9f, 90f)); GameObject obj = Item(val2, "LinenThread", "ThreadBundleC", new Vector3(-0.63f, 1.32f, 0.17f), new Vector3(0.2f, 0.25f, 0.2f), uniform: true, drape: false, new Vector3(0f, 5f, 90f)); float num6 = Mathf.Max(RestOn(val3, 1.052f), RestOn(val4, 1.052f)); RestOn(obj, num6 - 0.012f); Item(val2, "BronzeNails", "UpholsteryTacks", new Vector3(-0.81f, 1.08f, -0.32f), new Vector3(0.12f, 0.035f, 0.11f)); Beam(val2, bone, new Vector3(-0.67f, 1.085f, -0.28f), new Vector3(-0.17f, 1.085f, -0.06f), 0.016f); Item(val2, "Flint", "FlintTool", new Vector3(-0.15f, 1.085f, -0.35f), new Vector3(0.19f, 0.035f, 0.1f)); Loop(val2, new Vector3(-0.5f, 1.09f, -0.06f), 0.13f, upright: false); Combine(val2); return val2; } internal static GameObject BuildExtension(GameObject parent, bool tools) { //IL_0051: 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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_059f: 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_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08e6: Unknown result type (might be due to invalid IL or missing references) //IL_0900: Unknown result type (might be due to invalid IL or missing references) GameObject val = Child(parent, tools ? "StitchingToolsVisual" : "LeatherRackVisual"); if (!tools) { float[] array = new float[2] { -0.63f, 0.63f }; foreach (float num in array) { Beam(val, wood, new Vector3(num, 0.05f, 0f), new Vector3(num, 1.72f, 0f), 0.11f); Beam(val, wood, new Vector3(num, 0.06f, -0.32f), new Vector3(num, 0.06f, 0.32f), 0.13f); Beam(val, wood, new Vector3(num, 0.1f, -0.28f), new Vector3(num, 0.43f, 0f), 0.075f); Lash(val, new Vector3(num, 1.52f, 0f)); Lash(val, new Vector3(num, 0.2f, 0f)); } Beam(val, wood, new Vector3(-0.72f, 1.52f, 0f), new Vector3(0.72f, 1.52f, 0f), 0.1f); Color[] array2 = (Color[])(object)new Color[3] { new Color(0.4f, 0.23f, 0.12f), new Color(0.61f, 0.4f, 0.23f), new Color(0.3f, 0.16f, 0.09f) }; for (int j = 0; j < 3; j++) { Part(val, "IndividualDrapedLeather", RackLeather(j), LeatherSurface(array2[j], j + 7), new Vector3(-0.4f + (float)j * 0.4f, 1.52f, 0f), Vector3.one, Quaternion.identity); } Part(val, "LowSlat", beam, wood, new Vector3(0f, 0.16f, 0f), new Vector3(0.35f, 0.06f, 1.25f), Quaternion.Euler(0f, 90f, 0f)); TailoringLeatherStack(val, new Vector3(0f, 0.2f, 0f), 0.8f); } else { float[] array = new float[2] { -0.34f, 0.34f }; foreach (float num2 in array) { float[] array3 = new float[2] { -0.24f, 0.24f }; foreach (float num3 in array3) { Beam(val, wood, new Vector3(num2, 0f, num3), new Vector3(num2, 0.9f, num3), 0.1f); } } for (int l = 0; l < 3; l++) { Part(val, "TablePlank", beam, wood, new Vector3(0f, 0.9f, -0.22f + (float)l * 0.22f), new Vector3(0.21f, 0.07f, 0.86f), Quaternion.Euler(0f, 90f, 0f)); } Part(val, "LowerShelf", beam, wood, new Vector3(0f, 0.25f, 0f), new Vector3(0.5f, 0.06f, 0.72f), Quaternion.Euler(0f, 90f, 0f)); Material val2 = Surface(new Color(0.24f, 0.26f, 0.27f)); array = new float[2] { -0.36f, 0.36f }; foreach (float num4 in array) { float[] array3 = new float[2] { -0.27f, 0.27f }; foreach (float num5 in array3) { Part(val, "BracketFront", beam, val2, new Vector3(num4, 0.875f, num5 + Mathf.Sign(num5) * 0.065f), new Vector3(0.018f, 0.09f, 0.13f), Quaternion.Euler(0f, 90f, 0f)); Part(val, "BracketSide", beam, val2, new Vector3(num4 + Mathf.Sign(num4) * 0.065f, 0.875f, num5), new Vector3(0.018f, 0.09f, 0.13f), Quaternion.identity); Part(val, "Rivet", Cylinder(), val2, new Vector3(num4, 0.875f, num5 + Mathf.Sign(num5) * 0.078f), new Vector3(0.022f, 0.012f, 0.022f), Quaternion.Euler(90f, 0f, 0f)); } } GameObject val3 = Child(val, "StitchingClamp"); val3.transform.localPosition = new Vector3(-0.18f, 0.94f, 0f); Part(val3, "ClampBase", beam, wood, new Vector3(0f, 0.025f, 0f), new Vector3(0.2f, 0.05f, 0.32f), Quaternion.Euler(0f, 90f, 0f)); array = new float[2] { -0.09f, 0.09f }; foreach (float num6 in array) { Part(val3, "BroadJaw", beam, wood, new Vector3(num6, 0.16f, 0f), new Vector3(0.055f, 0.27f, 0.15f), Quaternion.Euler(0f, 0f, (float)((num6 < 0f) ? (-7) : 7))); } Beam(val3, val2, new Vector3(-0.17f, 0.14f, 0f), new Vector3(0.17f, 0.14f, 0f), 0.018f); Part(val3, "ScrewKnob", Cylinder(), wood, new Vector3(0.18f, 0.14f, 0f), new Vector3(0.065f, 0.035f, 0.065f), Quaternion.Euler(0f, 0f, 90f)); Part(val3, "LeatherBeingSewn", RackLeather(1), LeatherSurface(new Color(0.48f, 0.28f, 0.14f), 19), new Vector3(0f, 0.27f, 0f), new Vector3(0.36f, 0.24f, 0.32f), Quaternion.identity); Material mat = Surface(new Color(0.73f, 0.65f, 0.46f)); for (int m = 0; m < 5; m++) { Beam(val3, mat, new Vector3(-0.045f + (float)m * 0.022f, 0.252f, -0.038f), new Vector3(-0.035f + (float)m * 0.022f, 0.241f, -0.041f), 0.004f); } Part(val, "ToolBlock", beam, wood, new Vector3(0.22f, 0.96f, 0.18f), new Vector3(0.13f, 0.06f, 0.3f), Quaternion.Euler(0f, 90f, 0f)); for (int n = 0; n < 3; n++) { float num7 = 0.12f + (float)n * 0.09f; Beam(val, wood, new Vector3(num7, 0.98f, 0.18f), new Vector3(num7, 1.09f, 0.18f), 0.035f); Beam(val, val2, new Vector3(num7, 1.09f, 0.18f), new Vector3(num7, 1.32f, 0.18f), 0.009f); } for (int num8 = 0; num8 < 3; num8++) { RestOn(Item(val, "LinenThread", "ThreadBundle", new Vector3(0.1f + (float)num8 * 0.1f, 1f, -0.18f), new Vector3(0.09f, 0.18f, 0.09f), uniform: true, drape: false, new Vector3(90f, 0f, 0f)), 0.938f); } Shears(val, val2, new Vector3(-0.2f, 0.945f, -0.19f)); TailoringLeatherStack(val, new Vector3(0f, 0.285f, 0f)); } Combine(val); return val; } private static Material Surface(Color color) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) Material val = Tint(wood, Color.white); Texture2D val2 = new Texture2D(8, 8, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[64]; for (int i = 0; i < 64; i++) { array[i] = color * (0.9f + (float)(i * 13 % 7) * 0.025f); } val2.SetPixels(array); val2.Apply(); ((Texture)val2).filterMode = (FilterMode)0; val.mainTexture = (Texture)(object)val2; val.mainTextureScale = Vector2.one; val.mainTextureOffset = Vector2.zero; val.DisableKeyword("_NORMALMAP"); if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)null); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); } return val; } private static Material LeatherSurface(Color color, int seed) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) Material val = Surface(color); Texture2D val2 = new Texture2D(32, 32, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[1024]; Random random = new Random(seed); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = 0.9f + (float)random.NextDouble() * 0.15f + 0.025f * Mathf.Sin((float)j * 0.6f + (float)i * 0.31f + (float)seed); Color val3 = color * num; val3.a = 1f; array[i * 32 + j] = val3; } } val2.SetPixels(array); val2.Apply(); ((Texture)val2).filterMode = (FilterMode)0; val.mainTexture = (Texture)(object)val2; return val; } private static void Lash(GameObject root, Vector3 center) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Material mat = LeatherSurface(new Color(0.32f, 0.16f, 0.075f), 31); for (int i = -1; i <= 1; i += 2) { Part(root, "DiagonalLeatherLashing", LashingMesh(i), mat, center, Vector3.one, Quaternion.identity); } } private static Mesh LashingMesh(int direction) { //IL_00ef: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); List<Vector2> uv = new List<Vector2>(); List<int> list2 = new List<int>(); Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < 48; i++) { float num = (float)i * (float)Math.PI / 24f; float num2 = (float)(i + 1) * (float)Math.PI / 24f; float num3 = Mathf.Cos(num); float num4 = Mathf.Sin(num); float num5 = Mathf.Cos(num2); float num6 = Mathf.Sin(num2); ((Vector3)(ref val))..ctor(Mathf.Sign(num3) * Mathf.Sqrt(Mathf.Abs(num3)) * 0.096f, (float)direction * 0.063f * num3, Mathf.Sign(num4) * Mathf.Sqrt(Mathf.Abs(num4)) * 0.086f); ((Vector3)(ref val2))..ctor(Mathf.Sign(num5) * Mathf.Sqrt(Mathf.Abs(num5)) * 0.096f, (float)direction * 0.063f * num5, Mathf.Sign(num6) * Mathf.Sqrt(Mathf.Abs(num6)) * 0.086f); Vector3 val3 = new Vector3(num3, 0f, num4) * 0.004f; Vector3 val4 = new Vector3(num5, 0f, num6) * 0.004f; Vector3 val5 = Vector3.up * 0.017f; LeatherFace(list, uv, list2, val - val5 + val3, val2 - val5 + val4, val2 + val5 + val4, val + val5 + val3); LeatherFace(list, uv, list2, val + val5 - val3, val2 + val5 - val4, val2 - val5 - val4, val - val5 - val3); LeatherFace(list, uv, list2, val + val5 + val3, val2 + val5 + val4, val2 + val5 - val4, val + val5 - val3); LeatherFace(list, uv, list2, val - val5 - val3, val2 - val5 - val4, val2 - val5 + val4, val - val5 + val3); } for (int j = 0; j < list2.Count; j += 3) { int value = list2[j + 1]; list2[j + 1] = list2[j + 2]; list2[j + 2] = value; } return LeatherMesh(list, uv, list2); } private static Mesh RackLeather(int variant) { //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); List<Vector2> list2 = new List<Vector2>(); List<int> list3 = new List<int>(); float num = variant switch { 1 => 0.4f, 0 => 0.35f, _ => 0.34f, }; float num2 = variant switch { 1 => 1.27f, 0 => 1.48f, _ => 1.6f, }; for (int i = 0; i < 2; i++) { for (int j = 0; j <= 32; j++) { for (int k = 0; k <= 12; k++) { float num3 = (float)k / 12f; float num4 = (float)j / 32f; float num5 = (num4 - 0.5f) * num2; float num6 = 1f - 0.13f * Mathf.Pow(Mathf.Abs(num4 - 0.5f) * 2f, 4f) + 0.035f * Mathf.Sin(num4 * 19f + (float)(variant * 3)); float num7 = (num3 - 0.5f) * num * num6 + 0.01f * Mathf.Sin(num4 * 11f + (float)variant); float num8 = 0.105f; float num9 = Mathf.Min(Mathf.Abs(num5) / num8, (float)Math.PI / 2f); float num10 = Mathf.Sign(num5); float num11 = ((i == 0) ? 0.003f : (-0.003f)); float num12 = num10 * (num8 + num11) * Mathf.Sin(num9); float num13 = (num8 + num11) * Mathf.Cos(num9) - Mathf.Max(0f, Mathf.Abs(num5) - num8 * (float)Math.PI * 0.5f); float num14 = Mathf.Clamp01((Mathf.Abs(num5) - 0.17f) * 4f); num12 += num14 * 0.014f * Mathf.Sin(num3 * 9f + (float)(variant * 2)); num13 += num14 * 0.022f * Mathf.Sin(num3 * 8f + (float)variant * 1.7f); list.Add(new Vector3(num7, num13, num12)); list2.Add(new Vector2(num3, num4)); } } } int num15 = 13; int num16 = num15 * 33; for (int l = 0; l < 32; l++) { for (int m = 0; m < 12; m++) { int num17 = l * num15 + m; int num18 = num17 + 1; int num19 = num17 + num15 + 1; int num20 = num17 + num15; list3.AddRange(new int[12] { num17, num20, num19, num17, num19, num18, num17 + num16, num18 + num16, num19 + num16, num17 + num16, num19 + num16, num20 + num16 }); } } for (int n = 0; n < 32; n++) { int[] array = new int[2] { 0, 12 }; foreach (int num22 in array) { int num23 = n * num15 + num22; int num24 = num23 + num15; list3.AddRange(new int[6] { num23, num24, num24 + num16, num23, num24 + num16, num23 + num16 }); } } for (int num25 = 0; num25 < 12; num25++) { int[] array = new int[2] { 0, 32 }; for (int num21 = 0; num21 < array.Length; num21++) { int num26 = array[num21] * num15 + num25; int num27 = num26 + 1; list3.AddRange(new int[6] { num26, num27 + num16, num27, num26, num26 + num16, num27 + num16 }); } } return LeatherMesh(list, list2, list3); } private static Mesh LeatherMesh(List<Vector3> v, List<Vector2> uv, List<int> t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown Mesh val = new Mesh(); val.SetVertices(v); val.SetUVs(0, uv); val.SetTriangles(t, 0); val.colors = Enumerable.Repeat<Color>(Color.white, v.Count).ToArray(); val.RecalculateNormals(); val.RecalculateTangents(); val.RecalculateBounds(); return val; } private static void FoldedPile(GameObject root, Vector3 pos, float width) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[3] { new Color(0.45f, 0.27f, 0.16f), new Color(0.92f, 0.75f, 0.52f), new Color(0.65f, 0.4f, 0.24f) }; float num = pos.y; for (int i = 0; i < 3; i++) { num = RestOn(Item(root, "DeerHide", "FoldedLeather", new Vector3(pos.x + (float)(i - 1) * 0.025f, 0f, pos.z), new Vector3(width - (float)i * 0.045f, 0.018f, 0.65f), uniform: false, drape: false, new Vector3(90f, (float)(i * 7 - 7), 0f), fold: true, array[i]), num + 0.003f); } } private static void TailoringLeatherStack(GameObject root, Vector3 pos, float width = 0.58f) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[3] { new Color(0.3f, 0.15f, 0.075f), new Color(0.51f, 0.31f, 0.16f), new Color(0.68f, 0.47f, 0.27f) }; for (int i = 0; i < 3; i++) { Part(root, "FoldedLeatherBundle", FoldedLeatherMesh(width - (float)i * 0.035f, i), LeatherSurface(array[i], i + 41), pos + new Vector3((float)(i - 1) * 0.017f, (float)i * 0.075f, 0f), Vector3.one, Quaternion.Euler(0f, (float)((i - 1) * 5), 0f)); } } private static Mesh FoldedLeatherMesh(float width, int variant) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_011a: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: 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) Vector2[] array = (Vector2[])(object)new Vector2[7] { new Vector2(-0.18f, 0.012f), new Vector2(0.14f, 0.012f), new Vector2(0.17f, 0.018f), new Vector2(0.185f, 0.035f), new Vector2(0.17f, 0.052f), new Vector2(0.14f, 0.058f), new Vector2(-0.18f, 0.058f) }; Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length]; Vector2[] array3 = (Vector2[])(object)new Vector2[array.Length]; for (int i = 0; i < array.Length; i++) { Vector2 val = array[Mathf.Min(i + 1, array.Length - 1)] - array[Mathf.Max(i - 1, 0)]; Vector2 normalized = ((Vector2)(ref val)).normalized; Vector2 val2 = new Vector2(0f - normalized.y, normalized.x) * 0.006f; array2[i] = array[i] + val2; array3[i] = array[i] - val2; } List<Vector3> vertices = new List<Vector3>(); List<Vector2> list = new List<Vector2>(); List<int> list2 = new List<int>(); Vector3 a = default(Vector3); Vector3 val3 = default(Vector3); Vector3 val4 = default(Vector3); Vector3 val5 = default(Vector3); Vector3 val6 = default(Vector3); Vector3 val7 = default(Vector3); Vector3 c = default(Vector3); Vector3 val8 = default(Vector3); for (int j = 0; j < array.Length - 1; j++) { ((Vector3)(ref a))..ctor((0f - width) / 2f, array2[j].y, array2[j].x); ((Vector3)(ref val3))..ctor(width / 2f, array2[j].y, array2[j].x); ((Vector3)(ref val4))..ctor(width / 2f, array2[j + 1].y, array2[j + 1].x); ((Vector3)(ref val5))..ctor((0f - width) / 2f, array2[j + 1].y, array2[j + 1].x); ((Vector3)(ref val6))..ctor((0f - width) / 2f, array3[j].y, array3[j].x); ((Vector3)(ref val7))..ctor(width / 2f, array3[j].y, array3[j].x); ((Vector3)(ref c))..ctor(width / 2f, array3[j + 1].y, array3[j + 1].x); ((Vector3)(ref val8))..ctor((0f - width) / 2f, array3[j + 1].y, array3[j + 1].x); LeatherFace(vertices, list, list2, a, val5, val4, val3); LeatherFace(vertices, list, list2, val6, val7, c, val8); LeatherFace(vertices, list, list2, a, val6, val8, val5); LeatherFace(vertices, list, list2, val3, val4, c, val7); if (j == 0) { LeatherFace(vertices, list, list2, a, val3, val7, val6); } if (j == array.Length - 2) { LeatherFace(vertices, list, list2, val5, val8, c, val4); } } Mesh val9 = new Mesh(); val9.SetVertices(vertices); val9.SetUVs(0, list); val9.SetTriangles(list2, 0); SubdivideHide(val9); Vector3[] vertices2 = val9.vertices; for (int k = 0; k < vertices2.Length; k++) { Vector3 val10 = vertices2[k]; float num = val10.x / (width * 0.5f); float num2 = (val10.z + 0.18f) / 0.365f; float num3 = (float)variant * 1.9f; float num4 = Mathf.Pow(Mathf.Abs(num), 8f) * Mathf.Pow(Mathf.Abs(num2 - 0.5f) * 2f, 6f); val10.x += Mathf.Sign(num) * (0.008f * Mathf.Sin(num2 * 12f + num3) + 0.004f * Mathf.Sin(num2 * 25f + num3)) - 0.012f * Mathf.Sign(num) * num4; val10.z += 0.012f * Mathf.Sin(num * 6f + num3) * Mathf.Pow(Mathf.Abs(num2 - 0.5f) * 2f, 4f) - 0.009f * Mathf.Sign(num2 - 0.5f) * num4; val10.y += 0.004f * Mathf.Sin(num * 4f + num2 * 3f + num3) - 0.003f * (1f - num * num) * Mathf.Sin(num2 * (float)Math.PI); vertices2[k] = val10; } val9.vertices = vertices2; val9.RecalculateNormals(); val9.RecalculateTangents(); val9.RecalculateBounds(); return val9; } private static void LeatherFace(List<Vector3> vertices, List<Vector2> uv, List<int> triangles, Vector3 a, Vector3 b, Vector3 c, Vector3 d) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) int count = vertices.Count; vertices.AddRange((IEnumerable<Vector3>)(object)new Vector3[4] { a, b, c, d }); uv.AddRange((IEnumerable<Vector2>)(object)new Vector2[4] { Vector2.zero, Vector2.right, Vector2.one, Vector2.up }); triangles.AddRange(new int[6] { count, count + 1, count + 2, count, count + 2, count + 3 }); } private static void Shears(GameObject root, Material metal, Vector3 pos) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) GameObject val = Child(root, "TailoringShears"); val.transform.localPosition = pos; float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { float num2 = num * 0.044f; for (int j = 0; j < 20; j++) { float num3 = (float)j * (float)Math.PI / 10f; float num4 = (float)(j + 1) * (float)Math.PI / 10f; Beam(val, metal, new Vector3(-0.1f + Mathf.Cos(num3) * 0.048f, 0f, num2 + Mathf.Sin(num3) * 0.03f), new Vector3(-0.1f + Mathf.Cos(num4) * 0.048f, 0f, num2 + Mathf.Sin(num4) * 0.03f), 0.01f); } Beam(val, metal, new Vector3(-0.06f, 0f, num2), Vector3.zero, 0.015f); Part(val, "TaperedBlade", Blade(), metal, new Vector3(0f, num * 0.003f, 0f), Vector3.one, Quaternion.Euler(0f, num * 12f, 0f)); } Part(val, "PivotRivet", Cylinder(), metal, new Vector3(0f, 0.009f, 0f), new Vector3(0.025f, 0.016f, 0.025f), Quaternion.identity); } private static Mesh Blade() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00fe: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); val.vertices = (Vector3[])(object)new Vector3[6] { new Vector3(-0.018f, 0.003f, -0.018f), new Vector3(-0.018f, 0.003f, 0.018f), new Vector3(0.2f, 0.003f, 0f), new Vector3(-0.018f, -0.003f, -0.018f), new Vector3(-0.018f, -0.003f, 0.018f), new Vector3(0.2f, -0.003f, 0f) }; val.uv = (Vector2[])(object)new Vector2[6] { Vector2.zero, Vector2.up, Vector2.right, Vector2.zero, Vector2.up, Vector2.right }; val.triangles = new int[24] { 0, 1, 2, 3, 5, 4, 0, 3, 4, 0, 4, 1, 1, 4, 5, 1, 5, 2, 2, 5, 3, 2, 3, 0 }; val.RecalculateNormals(); val.RecalculateBounds(); return val; } private static void BlankBoxPatch(GameObject root, Vector3 center) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) GameObject val = Child(root, "BlankStitchedPatch"); val.transform.localPosition = center; Vector2[] array = (Vector2[])(object)new Vector2[8] { new Vector2(-0.065f, -0.085f), new Vector2(0.065f, -0.085f), new Vector2(0.085f, -0.065f), new Vector2(0.085f, 0.065f), new Vector2(0.065f, 0.085f), new Vector2(-0.065f, 0.085f), new Vector2(-0.085f, 0.065f), new Vector2(-0.085f, -0.065f) }; List<Vector3> list = new List<Vector3> { new Vector3(0f, 0f, -0.002f) }; List<Vector2> list2 = new List<Vector2> { new Vector2(0.5f, 0.5f) }; List<int> list3 = new List<int>(); Vector2[] array2 = array; foreach (Vector2 val2 in array2) { list.Add(new Vector3(val2.x, val2.y, -0.002f)); list2.Add(new Vector2(val2.x / 0.17f + 0.5f, val2.y / 0.17f + 0.5f)); } for (int j = 0; j < array.Length; j++) { list3.AddRange(new int[3] { 0, (j + 1) % array.Length + 1, j + 1 }); } Part(val, "BlankLeatherFace", LeatherMesh(list, list2, list3), LeatherSurface(new Color(0.42f, 0.23f, 0.105f), 73), Vector3.zero, Vector3.one, Quaternion.identity); Material mat = Surface(new Color(0.76f, 0.63f, 0.4f)); for (int k = 0; k < array.Length; k++) { Vector2 val3 = array[k] * 0.84f; Vector2 val4 = array[(k + 1) % array.Length] * 0.84f; int num = Mathf.Max(1, Mathf.RoundToInt(Vector2.Distance(val3, val4) / 0.019f)); for (int l = 0; l < num; l++) { Vector2 val5 = Vector2.Lerp(val3, val4, ((float)l + 0.18f) / (float)num); Vector2 val6 = Vector2.Lerp(val3, val4, ((float)l + 0.65f) / (float)num); Beam(val, mat, new Vector3(val5.x, val5.y, -0.005f), new Vector3(val6.x, val6.y, -0.005f), 0.0035f); } } } private static void StorageBox(GameObject root, Vector3 center, Vector3 size) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) GameObject val = Child(root, "SupplyBox"); val.transform.localPosition = center; float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { Part(val, "FrontBack", beam, wood, new Vector3(0f, 0f, num * size.z * 0.5f), new Vector3(0.035f, size.y, size.x), Quaternion.Euler(0f, 90f, 0f)); Part(val, "Side", beam, wood, new Vector3(num * size.x * 0.5f, 0f, 0f), new Vector3(0.035f, size.y, size.z), Quaternion.identity); } Part(val, "Lid", beam, wood, new Vector3(0f, size.y * 0.5f, 0f), new Vector3(size.z + 0.04f, 0.035f, size.x + 0.05f), Quaternion.Euler(0f, 90f, 0f)); } private static void Beam(GameObject root, Material mat, Vector3 a, Vector3 b, float width) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Part(root, "Timber", beam, mat, (a + b) * 0.5f, new Vector3(width, width, Vector3.Distance(a, b)), Quaternion.LookRotation(b - a)); } private static void Loop(GameObject root, Vector3 center, float radius, bool upright) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 16; i++) { float num = (float)i * (float)Math.PI / 8f; float num2 = (float)(i + 1) * (float)Math.PI / 8f; Vector3 val = (upright ? new Vector3(Mathf.Cos(num) * radius, Mathf.Sin(num) * radius, 0f) : new Vector3(Mathf.Cos(num) * radius, 0f, Mathf.Sin(num) * radius)); Vector3 val2 = (upright ? new Vector3(Mathf.Cos(num2) * radius, Mathf.Sin(num2) * radius, 0f) : new Vector3(Mathf.Cos(num2) * radius, 0f, Mathf.Sin(num2) * radius)); Beam(root, thread, center + val, center + val2, 0.012f); } } private static Mesh Normalize(GameObject source, MeshFilter filter) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or mis