using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GUIFramework; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("DadsCrafting")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+a2a1560cb169a58b6e6383309549349357b27563")] [assembly: AssemblyProduct("DadsCrafting")] [assembly: AssemblyTitle("DadsCrafting")] [assembly: AssemblyVersion("1.0.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 DadsCrafting { internal static class ContainerCompatibility { private const string PluginGuid = "com.dadisbored.dadsezcontainers"; internal static int CountAvailable(string itemName, int inventoryCount) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown if ((Object)(object)Player.m_localPlayer == (Object)null || !Chainloader.PluginInfos.TryGetValue("com.dadisbored.dadsezcontainers", out var value)) { return inventoryCount; } try { Type type = ((object)value.Instance).GetType().Assembly.GetType("DadsEZContainers.API"); if (type == null) { return inventoryCount; } MethodInfo methodInfo = type.GetMethod("GetNearbyContainers", BindingFlags.Static | BindingFlags.Public)?.MakeGenericMethod(typeof(Player)); MethodInfo method = type.GetMethod("CountItemInContainer", BindingFlags.Static | BindingFlags.Public); if (methodInfo == null || method == null) { return inventoryCount; } float num = 20f; ConfigEntry val = default(ConfigEntry); if (value.Instance.Config.TryGetEntry(new ConfigDefinition("2 - CraftyBoxes", "Container Range"), ref val)) { num = val.Value; } if (!(methodInfo.Invoke(null, new object[2] { Player.m_localPlayer, num }) is IEnumerable enumerable)) { return inventoryCount; } int num2 = inventoryCount; foreach (object item in enumerable) { num2 += Convert.ToInt32(method.Invoke(null, new object[2] { item, itemName })); } return num2; } catch (Exception ex) { DadsCraftingPlugin.ModLogger.LogDebug((object)("Container count integration skipped: " + ex.GetType().Name)); return inventoryCount; } } } [HarmonyPatch(typeof(InventoryGui), "Awake")] internal static class InventoryGuiAwakePatch { private static void Postfix(InventoryGui __instance) { CraftingUiManager.Attach(__instance); } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList", new Type[] { typeof(List) })] internal static class UpdateRecipeListPatch { private static void Prefix(List recipes) { recipes?.RemoveAll((Recipe recipe) => !CraftingState.Matches(recipe)); } private static void Postfix(InventoryGui __instance) { CraftingUiManager.Instance?.DecorateRecipeList(); } } [HarmonyPatch(typeof(InventoryGui), "SetRecipe", new Type[] { typeof(int), typeof(bool) })] internal static class SetRecipePatch { private static void Postfix() { CraftingUiManager.Instance?.OnRecipeChanged(); } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe", new Type[] { typeof(Player), typeof(float) })] internal static class UpdateRecipePatch { private static void Prefix(InventoryGui __instance) { CraftingState.ApplyMultiCraft(__instance); } } [HarmonyPatch(typeof(InventoryGui), "OnCraftPressed")] internal static class OnCraftPressedPatch { private static bool Prefix(InventoryGui __instance) { CraftingState.ApplyMultiCraft(__instance); if (!CraftingState.IsCraftTab(__instance) || CraftingState.Amount <= 1) { return true; } Recipe selectedRecipe = CraftingState.GetSelectedRecipe(__instance); Player localPlayer = Player.m_localPlayer; if ((Object)(object)selectedRecipe == (Object)null || (Object)(object)localPlayer == (Object)null) { return true; } int num = default(int); ItemData val = default(ItemData); int amount = selectedRecipe.GetAmount(1, ref num, ref val, CraftingState.Amount); if (!CraftingUiManager.HasOutputCapacity(((Humanoid)localPlayer).GetInventory(), selectedRecipe.m_item.m_itemData, amount)) { ((Character)localPlayer).Message((MessageType)2, "$inventory_full", 0, (Sprite)null, false); return false; } return true; } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting", new Type[] { typeof(Player) })] internal static class DoCraftingPatch { private static void Postfix() { if (DadsCraftingPlugin.IsOn(DadsCraftingPlugin.ResetCraftingValue)) { CraftingState.SetAmount(1); CraftingUiManager.Instance?.RefreshSelectionButtons(); } } } [HarmonyPatch(typeof(InventoryGui), "Show")] internal static class InventoryGuiShowPatch { private static void Prefix() { CraftingState.Page = 1; CraftingState.SearchText = string.Empty; } } [Flags] internal enum RecipeCategory { None = 0, Undefined = 1, Ammo = 2, Weapon = 4, Bow = 8, Armor = 0x10, Shield = 0x20, Tools = 0x40, Food = 0x80, Material = 0x100, All = 0x1FF } internal static class CraftingState { private const string FavoritesKey = "DadsCrafting.FavoriteItems"; private const string TrackedKey = "DadsCrafting.TrackedRecipes"; private static readonly FieldInfo SelectedRecipeField = AccessTools.Field(typeof(InventoryGui), "m_selectedRecipe"); private static readonly PropertyInfo SelectedRecipeProperty = SelectedRecipeField?.FieldType.GetProperty("Recipe", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly PropertyInfo SelectedItemProperty = SelectedRecipeField?.FieldType.GetProperty("ItemData", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo UpdateCraftingPanelMethod = AccessTools.Method(typeof(InventoryGui), "UpdateCraftingPanel", new Type[1] { typeof(bool) }, (Type[])null); private static readonly FieldInfo TouchMultiCraftingField = AccessTools.Field(typeof(InventoryGui), "m_touchMultiCrafting"); internal static readonly HashSet Favorites = new HashSet(StringComparer.Ordinal); internal static readonly Dictionary Tracked = new Dictionary(StringComparer.Ordinal); internal static int Amount { get; private set; } = 1; internal static int Page { get; set; } = 1; internal static int PageCount { get; set; } = 1; internal static string SearchText { get; set; } = string.Empty; internal static bool FavoritesOnly { get; set; } internal static RecipeCategory Categories { get; set; } = RecipeCategory.All; internal static void Load() { Favorites.Clear(); foreach (string item in Split(PlayerPrefs.GetString("DadsCrafting.FavoriteItems", string.Empty))) { Favorites.Add(item); } Tracked.Clear(); foreach (string item2 in Split(PlayerPrefs.GetString("DadsCrafting.TrackedRecipes", string.Empty))) { int num = item2.LastIndexOf('='); if (num > 0 && int.TryParse(item2.Substring(num + 1), out var result)) { Tracked[item2.Substring(0, num)] = Mathf.Clamp(result, 1, 100); } } } internal static void SetAmount(int amount) { Amount = Mathf.Clamp(amount, 1, 100); } internal static Recipe GetSelectedRecipe(InventoryGui gui) { object obj = (((Object)(object)gui == (Object)null) ? null : SelectedRecipeField?.GetValue(gui)); if (obj != null) { object? obj2 = SelectedRecipeProperty?.GetValue(obj, null); return (Recipe)((obj2 is Recipe) ? obj2 : null); } return null; } internal static ItemData GetSelectedUpgradeItem(InventoryGui gui) { object obj = (((Object)(object)gui == (Object)null) ? null : SelectedRecipeField?.GetValue(gui)); if (obj != null) { object? obj2 = SelectedItemProperty?.GetValue(obj, null); return (ItemData)((obj2 is ItemData) ? obj2 : null); } return null; } internal static bool IsCraftTab(InventoryGui gui) { if ((Object)(object)gui != (Object)null) { return gui.InCraftTab(); } return false; } internal static void ApplyMultiCraft(InventoryGui gui) { if (!((Object)(object)gui == (Object)null)) { int num = (gui.m_multiCraftAmount = ((!IsCraftTab(gui) || GetSelectedUpgradeItem(gui) != null) ? 1 : Amount)); TouchMultiCraftingField?.SetValue(gui, num > 1); } } internal static void RefreshRecipes(InventoryGui gui) { if ((Object)(object)gui != (Object)null && (Object)(object)Player.m_localPlayer != (Object)null) { UpdateCraftingPanelMethod?.Invoke(gui, new object[1] { false }); } } internal static bool Matches(Recipe recipe) { if (recipe?.m_item?.m_itemData == null) { return false; } if (DadsCraftingPlugin.IsOn(DadsCraftingPlugin.FavoritingSystem) && FavoritesOnly && !Favorites.Contains(RecipeId(recipe))) { return false; } if ((Categories & Classify(recipe)) == 0) { return false; } if (!AllowedAtNoCostStation(recipe)) { return false; } string text = (SearchText ?? string.Empty).Trim(); if (text.Length == 0) { return true; } string text2 = Localize(recipe.m_item.m_itemData.m_shared.m_name); string text3 = Localize(recipe.m_item.m_itemData.m_shared.m_description); string name = ((Object)((Component)recipe.m_item).gameObject).name; string name2 = ((Object)recipe).name; string text4 = string.Join(" ", from r in recipe.m_resources where r?.m_resItem?.m_itemData != null select Localize(r.m_resItem.m_itemData.m_shared.m_name) + " " + ((Object)((Component)r.m_resItem).gameObject).name); string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); for (int num = 0; num < array.Length; num++) { string text5 = array[num]; string text6; if (text5.StartsWith("!")) { text5 = text5.Substring(1); text6 = text4 + " " + text3; } else if (text5.StartsWith("@")) { text5 = text5.Substring(1); text6 = name2 + " " + name; } else { text6 = text2 + " " + text3 + " " + name + " " + name2; } if (text5.Length > 0 && text6.IndexOf(text5, StringComparison.OrdinalIgnoreCase) < 0) { return false; } } return true; } internal static int CalculateMax(Recipe recipe, int quality) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)recipe == (Object)null || (Object)(object)localPlayer == (Object)null) { return 1; } if (localPlayer.NoCostCheat() || ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGlobalKey((GlobalKeys)25))) { return 100; } int num = 100; Requirement[] resources = recipe.m_resources; foreach (Requirement val in resources) { if (!((Object)(object)val?.m_resItem == (Object)null)) { int amount = val.GetAmount(quality); if (amount > 0) { string name = val.m_resItem.m_itemData.m_shared.m_name; int inventoryCount = ((Humanoid)localPlayer).GetInventory().CountItems(name, -1, true); inventoryCount = ContainerCompatibility.CountAvailable(name, inventoryCount); num = Mathf.Min(num, inventoryCount / amount); } } } return Mathf.Clamp(num, 1, 100); } internal static void ToggleFavorite(Recipe recipe) { if (!((Object)(object)recipe == (Object)null)) { string item = RecipeId(recipe); if (!Favorites.Add(item)) { Favorites.Remove(item); } PlayerPrefs.SetString("DadsCrafting.FavoriteItems", string.Join(",", Favorites.OrderBy((string value) => value))); PlayerPrefs.Save(); } } internal static void ClearFavorites() { Favorites.Clear(); PlayerPrefs.SetString("DadsCrafting.FavoriteItems", string.Empty); PlayerPrefs.Save(); } internal static void ToggleTracked(Recipe recipe) { if (!((Object)(object)recipe == (Object)null)) { string key = RecipeId(recipe); if (Tracked.ContainsKey(key)) { Tracked.Remove(key); } else { Tracked[key] = Amount; } SaveTracked(); } } internal static void RemoveTracked(string id) { if (Tracked.Remove(id)) { SaveTracked(); } } internal static string RecipeId(Recipe recipe) { return ((recipe != null) ? ((Object)recipe).name : null) ?? string.Empty; } internal static string Localize(string value) { string text; if (Localization.instance == null) { text = value; if (text == null) { return string.Empty; } } else { text = Localization.instance.Localize(value ?? string.Empty); } return text; } internal static void ToggleCategory(RecipeCategory category) { Categories = ((Categories == RecipeCategory.All) ? category : (Categories ^ category)); if (Categories == RecipeCategory.None) { Categories = RecipeCategory.All; } Page = 1; } internal static RecipeCategory Classify(Recipe recipe) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 SharedData val = recipe?.m_item?.m_itemData?.m_shared; if (val == null) { return RecipeCategory.Undefined; } if ((int)val.m_itemType == 1) { return RecipeCategory.Material; } if ((int)val.m_itemType == 4) { return RecipeCategory.Bow; } if ((int)val.m_itemType == 5) { return RecipeCategory.Shield; } if ((int)val.m_itemType == 9 || (int)val.m_itemType == 23) { return RecipeCategory.Ammo; } if ((int)val.m_itemType == 19) { return RecipeCategory.Tools; } if ((int)val.m_itemType == 6 || (int)val.m_itemType == 7 || (int)val.m_itemType == 11 || (int)val.m_itemType == 17) { return RecipeCategory.Armor; } if ((int)val.m_itemType == 2 && (val.m_food > 0f || val.m_foodStamina > 0f || val.m_foodEitr > 0f)) { return RecipeCategory.Food; } if (recipe.m_item.m_itemData.IsWeapon()) { return RecipeCategory.Weapon; } return RecipeCategory.Undefined; } private static bool AllowedAtNoCostStation(Recipe recipe) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !DadsCraftingPlugin.IsOn(DadsCraftingPlugin.LimitNoCostToStation) || !localPlayer.NoCostCheat()) { return true; } CraftingStation currentCraftingStation = localPlayer.GetCurrentCraftingStation(); if ((Object)(object)recipe.m_craftingStation == (Object)null) { return (Object)(object)currentCraftingStation == (Object)null; } if ((Object)(object)currentCraftingStation == (Object)null || Utils.GetPrefabName(((Component)currentCraftingStation).gameObject) != Utils.GetPrefabName(((Component)recipe.m_craftingStation).gameObject)) { return false; } if (DadsCraftingPlugin.IsOn(DadsCraftingPlugin.RespectStationLevelNoCost)) { return currentCraftingStation.GetLevel(true) >= recipe.m_minStationLevel; } return true; } private static IEnumerable Split(string value) { return from s in (value ?? string.Empty).Split(new char[2] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim() into s where s.Length > 0 select s; } private static void SaveTracked() { PlayerPrefs.SetString("DadsCrafting.TrackedRecipes", string.Join(";", from p in Tracked orderby p.Key select p.Key + "=" + p.Value)); PlayerPrefs.Save(); } } internal sealed class CraftingUiManager : MonoBehaviour { private InventoryGui _gui; private GuiInputField _searchInput; private GuiInputField _amountInput; private Button _favoritesOnlyButton; private TMP_Text _favoritesOnlyButtonText; private TMP_Text _trackButtonText; private TMP_Text _pageText; private TMP_Text _maxCraftText; private RectTransform _recipeToolbar; private RectTransform _amountPanel; private bool _trackerManuallyHidden; private string _lastRecipeId = string.Empty; private RectTransform _trackerPanel; private TMP_Text _trackerText; private Image _trackerBackground; private float _nextTrackerUpdate; internal static CraftingUiManager Instance { get; private set; } internal static void Attach(InventoryGui gui) { if (!((Object)(object)gui == (Object)null) && !((Object)(object)Instance != (Object)null)) { CraftingState.Load(); Instance = ((Component)gui).gameObject.AddComponent(); Instance._gui = gui; ((MonoBehaviour)Instance).StartCoroutine(Instance.InitializeAfterFrame()); } } private IEnumerator InitializeAfterFrame() { yield return null; if (!((Object)(object)_gui == (Object)null)) { ApplyCraftDurations(); PrepareNativeLayouts(); CreateSearchControls(); CreateAmountControls(); CreateActionControls(); CreatePaginationControls(); EnsureTracker(); RefreshSelectionButtons(); CraftingState.RefreshRecipes(_gui); } } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { ApplyCraftDurations(); HandleControllerQuantity(); EnsureTracker(); if (Time.unscaledTime >= _nextTrackerUpdate) { _nextTrackerUpdate = Time.unscaledTime + 0.35f; RefreshTracker(); RefreshMaxCraftAmount(); } } internal void RefreshSelectionButtons() { Recipe selectedRecipe = CraftingState.GetSelectedRecipe(_gui); bool flag = (Object)(object)selectedRecipe != (Object)null; if ((Object)(object)_trackButtonText != (Object)null) { _trackButtonText.text = ((flag && CraftingState.Tracked.ContainsKey(CraftingState.RecipeId(selectedRecipe))) ? "T-" : "T+"); } if ((Object)(object)_amountInput != (Object)null && !CraftingState.IsCraftTab(_gui)) { SetAmount(1); } } internal void OnRecipeChanged() { string text = CraftingState.RecipeId(CraftingState.GetSelectedRecipe(_gui)); if (text != _lastRecipeId && DadsCraftingPlugin.IsOn(DadsCraftingPlugin.ResetCraftingValue)) { SetAmount(1); } _lastRecipeId = text; RefreshSelectionButtons(); RefreshMaxCraftAmount(); } internal void DecorateRecipeList() { RecipeListAccess.Decorate(_gui); } internal void RefreshPageLabel() { if ((Object)(object)_pageText != (Object)null) { _pageText.text = $"Page {CraftingState.Page}/{CraftingState.PageCount}"; } } internal void ToggleFavoritesOnly() { if (DadsCraftingPlugin.IsOn(DadsCraftingPlugin.FavoritingSystem)) { CraftingState.FavoritesOnly = !CraftingState.FavoritesOnly; if ((Object)(object)_favoritesOnlyButtonText != (Object)null) { _favoritesOnlyButtonText.text = (CraftingState.FavoritesOnly ? "Fav" : "All"); } CraftingState.Page = 1; CraftingState.RefreshRecipes(_gui); } } internal void ToggleTracker() { _trackerManuallyHidden = !_trackerManuallyHidden; RefreshTracker(); } private void PrepareNativeLayouts() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00af: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0193: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: 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_014b: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)_gui.m_recipeListRoot != (Object)null) ? ((Transform)_gui.m_recipeListRoot).parent : null); Transform val2 = (((Object)(object)val != (Object)null) ? val.parent : null); if ((Object)(object)val2 == (Object)null) { val2 = (Transform)(((object)((Transform)_gui.m_crafting).Find("RecipeList")) ?? ((object)_gui.m_crafting)); } GameObject val3 = new GameObject("DadsCrafting_Toolbar", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(val2, false); _recipeToolbar = val3.GetComponent(); _recipeToolbar.anchorMin = new Vector2(0f, 1f); _recipeToolbar.anchorMax = new Vector2(1f, 1f); _recipeToolbar.pivot = new Vector2(0.5f, 1f); _recipeToolbar.anchoredPosition = Vector2.zero; _recipeToolbar.sizeDelta = new Vector2(0f, 102f); ((Transform)_recipeToolbar).SetAsLastSibling(); RectTransform val4 = (RectTransform)(object)((val is RectTransform) ? val : null); if ((Object)(object)val4 != (Object)null) { Vector2 offsetMax = val4.offsetMax; offsetMax.y -= 106f; val4.offsetMax = offsetMax; } Transform transform = ((Component)_gui.m_craftButton).transform; RectTransform val5 = (RectTransform)(object)((transform is RectTransform) ? transform : null); Transform parent = ((Transform)val5).parent; int siblingIndex = ((Transform)val5).GetSiblingIndex(); GameObject val6 = new GameObject("DadsCrafting_CraftRow", new Type[1] { typeof(RectTransform) }); val6.transform.SetParent(parent, false); RectTransform component = val6.GetComponent(); component.anchorMin = val5.anchorMin; component.anchorMax = val5.anchorMax; component.pivot = val5.pivot; component.anchoredPosition = val5.anchoredPosition; component.sizeDelta = val5.sizeDelta; ((Transform)component).SetSiblingIndex(siblingIndex); ((Transform)val5).SetParent((Transform)(object)component, false); val5.anchorMin = new Vector2(0.43f, 0f); val5.anchorMax = Vector2.one; val5.pivot = new Vector2(0.5f, 0.5f); val5.offsetMin = new Vector2(3f, 0f); val5.offsetMax = Vector2.zero; GameObject val7 = new GameObject("DadsCrafting_AmountPanel", new Type[1] { typeof(RectTransform) }); val7.transform.SetParent((Transform)(object)component, false); _amountPanel = val7.GetComponent(); _amountPanel.anchorMin = Vector2.zero; _amountPanel.anchorMax = new Vector2(0.42f, 1f); _amountPanel.pivot = new Vector2(0.5f, 0.5f); _amountPanel.offsetMin = Vector2.zero; _amountPanel.offsetMax = new Vector2(-3f, 0f); } private void CreateSearchControls() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown _searchInput = CreateInputField((Transform)(object)_recipeToolbar, "DadsCrafting_Search", "Search recipes...", 80); SetToolbarSpan((RectTransform)((Component)_searchInput).transform, 0, 0, 10, 7); ((UnityEvent)(object)((TMP_InputField)_searchInput).onValueChanged).AddListener((UnityAction)delegate(string value) { CraftingState.SearchText = value ?? ""; CraftingState.Page = 1; CraftingState.RefreshRecipes(_gui); }); _favoritesOnlyButton = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_FavoritesOnly", "All", out _favoritesOnlyButtonText); SetToolbarSpan((RectTransform)((Component)_favoritesOnlyButton).transform, 0, 7, 10, 1); ((UnityEvent)_favoritesOnlyButton.onClick).AddListener((UnityAction)delegate { ToggleFavoritesOnly(); }); } private void CreateAmountControls() { //IL_0020: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_0147: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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) Transform amountPanel = (Transform)(object)_amountPanel; TMP_Text label; Button obj = CreateButton(amountPanel, "DadsCrafting_Minus", "-", out label); SetCentered((RectTransform)((Component)obj).transform, new Vector2(-69f, 0f), new Vector2(28f, 32f)); ((UnityEvent)obj.onClick).AddListener((UnityAction)delegate { AdjustAmount(-1); }); _amountInput = CreateInputField(amountPanel, "DadsCrafting_Amount", "1", 6); ((TMP_InputField)_amountInput).contentType = (ContentType)2; SetCentered((RectTransform)((Component)_amountInput).transform, new Vector2(-27f, 0f), new Vector2(50f, 32f)); ((TMP_InputField)_amountInput).SetTextWithoutNotify(CraftingState.Amount.ToString()); ((UnityEvent)(object)((TMP_InputField)_amountInput).onValueChanged).AddListener((UnityAction)delegate(string value) { if (int.TryParse(value, out var result)) { CraftingState.SetAmount(result); } }); ((UnityEvent)(object)((TMP_InputField)_amountInput).onEndEdit).AddListener((UnityAction)delegate(string value) { SetAmount((!int.TryParse(value, out var result)) ? 1 : result); }); ((Component)_amountInput).gameObject.AddComponent().Owner = this; Button obj2 = CreateButton(amountPanel, "DadsCrafting_Plus", "+", out label); SetCentered((RectTransform)((Component)obj2).transform, new Vector2(14f, 0f), new Vector2(28f, 32f)); ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { AdjustAmount(1); }); _maxCraftText = CreateNativeText(amountPanel, "DadsCrafting_MaxCraftAmount"); SetCentered(_maxCraftText.rectTransform, new Vector2(57f, 0f), new Vector2(54f, 32f)); _maxCraftText.fontSize = 13f; _maxCraftText.alignment = (TextAlignmentOptions)514; ((Graphic)_maxCraftText).color = DadsCraftingPlugin.InputTextColor.Value; RefreshMaxCraftAmount(); } private void RefreshMaxCraftAmount() { if (!((Object)(object)_maxCraftText == (Object)null)) { ((Component)_maxCraftText).gameObject.SetActive(DadsCraftingPlugin.IsOn(DadsCraftingPlugin.ShowMaxCraftAmount) && CraftingState.IsCraftTab(_gui)); if (((Component)_maxCraftText).gameObject.activeSelf) { Recipe selectedRecipe = CraftingState.GetSelectedRecipe(_gui); ItemData selectedUpgradeItem = CraftingState.GetSelectedUpgradeItem(_gui); int quality = ((selectedUpgradeItem == null) ? 1 : (selectedUpgradeItem.m_quality + 1)); _maxCraftText.text = "Max: " + (((Object)(object)Player.m_localPlayer != (Object)null && Player.m_localPlayer.NoCostCheat()) ? "∞" : CraftingState.CalculateMax(selectedRecipe, quality).ToString()); } } } private void CreateActionControls() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown Button obj = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_Track", "T+", out _trackButtonText); SetToolbarSpan((RectTransform)((Component)obj).transform, 0, 8, 10, 1); ((UnityEvent)obj.onClick).AddListener((UnityAction)delegate { CraftingState.ToggleTracked(CraftingState.GetSelectedRecipe(_gui)); RefreshSelectionButtons(); RefreshTracker(); }); TMP_Text label; Button obj2 = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_Materials", "!", out label); SetToolbarSpan((RectTransform)((Component)obj2).transform, 0, 9, 10, 1); ((UnityEvent)obj2.onClick).AddListener(new UnityAction(SpawnRequirementsInNoCostMode)); RecipeCategory[] array = new RecipeCategory[8] { RecipeCategory.Ammo, RecipeCategory.Weapon, RecipeCategory.Bow, RecipeCategory.Armor, RecipeCategory.Shield, RecipeCategory.Tools, RecipeCategory.Food, RecipeCategory.Material }; string[] array2 = new string[8] { "A", "W", "B", "R", "S", "T", "F", "M" }; string[] array3 = new string[8] { "ArrowWood", "SwordBronze", "Bow", "ArmorBronzeChest", "ShieldWood", "Hammer", "CookedMeat", "Wood" }; for (int num = 0; num < array.Length; num++) { RecipeCategory category = array[num]; Button obj3 = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_Filter_" + category, array2[num], out label); SetToolbarSpan((RectTransform)((Component)obj3).transform, 1, num, array.Length, 1); SetButtonIcon(obj3, array3[num]); ((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate { CraftingState.ToggleCategory(category); CraftingState.RefreshRecipes(_gui); }); } } private void CreatePaginationControls() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown TMP_Text label; Button val = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_PageFirst", "|<", out label); Button val2 = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_PagePrevious", "<", out label); Button val3 = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_PageNext", ">", out label); Button obj = CreateButton((Transform)(object)_recipeToolbar, "DadsCrafting_PageLast", ">|", out label); SetToolbarSpan((RectTransform)((Component)val).transform, 2, 0, 7, 1); SetToolbarSpan((RectTransform)((Component)val2).transform, 2, 1, 7, 1); _pageText = CreateNativeText((Transform)(object)_recipeToolbar, "DadsCrafting_PageText"); GameObject gameObject = ((Component)_pageText).gameObject; SetToolbarSpan(_pageText.rectTransform, 2, 2, 7, 3); _pageText.fontSize = 15f; _pageText.alignment = (TextAlignmentOptions)514; ((Graphic)_pageText).color = DadsCraftingPlugin.InputTextColor.Value; SetToolbarSpan((RectTransform)((Component)val3).transform, 2, 5, 7, 1); SetToolbarSpan((RectTransform)((Component)obj).transform, 2, 6, 7, 1); ((UnityEvent)val.onClick).AddListener((UnityAction)delegate { SetPage(1); }); ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { SetPage(CraftingState.Page - 1); }); ((UnityEvent)val3.onClick).AddListener((UnityAction)delegate { SetPage(CraftingState.Page + 1); }); ((UnityEvent)obj.onClick).AddListener((UnityAction)delegate { SetPage(CraftingState.PageCount); }); bool active = DadsCraftingPlugin.IsOn(DadsCraftingPlugin.Paginator); ((Component)val).gameObject.SetActive(active); ((Component)val2).gameObject.SetActive(active); ((Component)val3).gameObject.SetActive(active); ((Component)obj).gameObject.SetActive(active); gameObject.SetActive(active); } private void SetPage(int page) { CraftingState.Page = Mathf.Clamp(page, 1, CraftingState.PageCount); RecipeListAccess.Decorate(_gui); } private void HandleControllerQuantity() { if (!((Object)(object)_amountInput == (Object)null) && ((TMP_InputField)_amountInput).isFocused) { int num = ((!ZInput.GetButton("JoyLTrigger")) ? 1 : DadsCraftingPlugin.IncrementalAmount.Value); if (ZInput.GetButtonDown("JoyDPadUp")) { AdjustAmount(num); } if (ZInput.GetButtonDown("JoyDPadDown")) { AdjustAmount(-num); } } } internal void AdjustAmount(int direction) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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) Recipe selectedRecipe = CraftingState.GetSelectedRecipe(_gui); ItemData selectedUpgradeItem = CraftingState.GetSelectedUpgradeItem(_gui); int quality = ((selectedUpgradeItem == null) ? 1 : (selectedUpgradeItem.m_quality + 1)); KeyboardShortcut value = DadsCraftingPlugin.MaxCraftModifier.Value; if (((KeyboardShortcut)(ref value)).IsPressed()) { SetAmount((direction <= 0) ? 1 : CraftingState.CalculateMax(selectedRecipe, quality)); return; } value = DadsCraftingPlugin.IncrementalModifier.Value; int num = ((!((KeyboardShortcut)(ref value)).IsPressed()) ? 1 : DadsCraftingPlugin.IncrementalAmount.Value); SetAmount(CraftingState.Amount + direction * num); } private void SetAmount(int amount) { CraftingState.SetAmount(amount); GuiInputField amountInput = _amountInput; if (amountInput != null) { ((TMP_InputField)amountInput).SetTextWithoutNotify(CraftingState.Amount.ToString()); } } private void ApplyCraftDurations() { if (!((Object)(object)_gui == (Object)null) && DadsCraftingPlugin.IsOn(DadsCraftingPlugin.OverrideCraftingSpeed)) { float num = Mathf.Clamp(DadsCraftingPlugin.CraftingSpeed.Value, 0.1f, 120f); _gui.m_craftDuration = num; _gui.m_multiCraftDuration = num; } } private void SpawnRequirementsInNoCostMode() { Player localPlayer = Player.m_localPlayer; Recipe selectedRecipe = CraftingState.GetSelectedRecipe(_gui); if ((Object)(object)localPlayer == (Object)null || (Object)(object)selectedRecipe == (Object)null) { return; } if (!localPlayer.NoCostCheat() && ((Object)(object)ZoneSystem.instance == (Object)null || !ZoneSystem.instance.GetGlobalKey((GlobalKeys)25))) { ((Character)localPlayer).Message((MessageType)2, "DadsCrafting: materials are available only in no-cost mode.", 0, (Sprite)null, false); return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); Requirement[] resources = selectedRecipe.m_resources; foreach (Requirement val in resources) { if (!((Object)(object)val?.m_resItem == (Object)null)) { int num = val.GetAmount(1) * CraftingState.Amount; if (num > 0 && HasOutputCapacity(inventory, val.m_resItem.m_itemData, num)) { inventory.AddItem(((Component)val.m_resItem).gameObject, num); } } } } internal static bool HasOutputCapacity(Inventory inventory, ItemData template, int amount) { if (inventory == null || template == null) { return false; } int num = inventory.FindFreeStackSpace(template.m_shared.m_name, (float)template.m_worldLevel); int num2 = inventory.GetEmptySlots() * template.m_shared.m_maxStackSize; return num + num2 >= amount; } private void EnsureTracker() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_007c: 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_009c: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0121: Expected O, but got Unknown //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_013f: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_trackerPanel != (Object)null) && !((Object)(object)Hud.instance == (Object)null)) { GameObject val = new GameObject("DadsCrafting_Tracker", new Type[3] { typeof(RectTransform), typeof(Image), typeof(TrackerDragHandler) }); val.transform.SetParent(((Component)Hud.instance).transform, false); _trackerPanel = val.GetComponent(); _trackerPanel.anchorMin = Vector2.one; _trackerPanel.anchorMax = Vector2.one; _trackerPanel.pivot = Vector2.one; _trackerPanel.anchoredPosition = DadsCraftingPlugin.TrackerPosition.Value; _trackerPanel.sizeDelta = new Vector2(330f, 260f); _trackerBackground = val.GetComponent(); ((Graphic)_trackerBackground).color = DadsCraftingPlugin.TrackerBackgroundColor.Value; GameObject val2 = new GameObject("Text", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val2.transform.SetParent(val.transform, false); RectTransform val3 = (RectTransform)val2.transform; val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(12f, 10f); val3.offsetMax = new Vector2(-12f, -10f); _trackerText = (TMP_Text)(object)val2.GetComponent(); _trackerText.font = _gui.m_recipeName.font; _trackerText.fontSizeMin = DadsCraftingPlugin.TrackerRequirementMin.Value; _trackerText.fontSizeMax = DadsCraftingPlugin.TrackerRequirementMax.Value; _trackerText.enableAutoSizing = true; ((Graphic)_trackerText).color = DadsCraftingPlugin.ItemNameColor.Value; _trackerText.alignment = (TextAlignmentOptions)257; ((Graphic)_trackerText).raycastTarget = false; } } private void RefreshTracker() { //IL_0090: 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_00b4: 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) //IL_00d8: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0281: 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_0286: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_02a1: 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_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_0305: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_trackerPanel == (Object)null) { return; } Player localPlayer = Player.m_localPlayer; bool flag = (Object)(object)localPlayer != (Object)null && (((Character)localPlayer).InAttack() || localPlayer.IsTargeted()); bool flag2 = !_trackerManuallyHidden && CraftingState.Tracked.Count > 0 && (Object)(object)localPlayer != (Object)null && !Minimap.IsOpen() && !flag; ((Component)_trackerPanel).gameObject.SetActive(flag2); if (!flag2) { return; } ((Graphic)_trackerBackground).raycastTarget = Menu.IsVisible(); _trackerPanel.anchoredPosition = DadsCraftingPlugin.TrackerPosition.Value; ((Transform)_trackerPanel).localScale = new Vector3(DadsCraftingPlugin.TrackerScale.Value.x, DadsCraftingPlugin.TrackerScale.Value.y, 1f); ((Graphic)_trackerText).color = DadsCraftingPlugin.ItemNameColor.Value; ((Graphic)_trackerBackground).color = DadsCraftingPlugin.TrackerBackgroundColor.Value; StringBuilder stringBuilder = new StringBuilder("CRAFTING TRACKER"); KeyValuePair[] array = CraftingState.Tracked.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair tracked = array[i]; Recipe val = ((IEnumerable)ObjectDB.instance?.m_recipes).FirstOrDefault((Func)((Recipe candidate) => CraftingState.RecipeId(candidate) == tracked.Key)); if ((Object)(object)val == (Object)null || (Object)(object)val.m_item == (Object)null) { continue; } stringBuilder.Append("\n\n") .Append(CraftingState.Localize(val.m_item.m_itemData.m_shared.m_name)) .Append(" x") .Append(tracked.Value) .Append(""); Requirement[] resources = val.m_resources; foreach (Requirement val2 in resources) { if (!((Object)(object)val2?.m_resItem == (Object)null)) { int num2 = val2.GetAmount(1) * tracked.Value; if (num2 > 0) { string name = val2.m_resItem.m_itemData.m_shared.m_name; int inventoryCount = ((Humanoid)localPlayer).GetInventory().CountItems(name, -1, true); inventoryCount = ContainerCompatibility.CountAvailable(name, inventoryCount); bool num3 = inventoryCount >= num2; Color val3 = (num3 ? DadsCraftingPlugin.CompleteNameColor.Value : DadsCraftingPlugin.IncompleteNameColor.Value); Color val4 = (num3 ? DadsCraftingPlugin.CompleteAmountColor.Value : DadsCraftingPlugin.IncompleteLeftColor.Value); Color val5 = (num3 ? DadsCraftingPlugin.CompleteAmountColor.Value : DadsCraftingPlugin.IncompleteRightColor.Value); stringBuilder.Append("\n ') .Append(CraftingState.Localize(val2.m_resItem.m_itemData.m_shared.m_name)) .Append(" (") .Append(inventoryCount) .Append("/') .Append(num2) .Append(")"); } } } } _trackerText.text = stringBuilder.ToString(); } private GuiInputField CreateInputField(Transform parent, string name, string placeholderText, int characterLimit) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00f8: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(Image), typeof(GuiInputField) }); val.transform.SetParent(parent, false); Image component = val.GetComponent(); Image component2 = ((Component)_gui.m_craftButton).GetComponent(); if ((Object)(object)component2 != (Object)null) { component.sprite = component2.sprite; ((Graphic)component).material = ((Graphic)component2).material; component.type = component2.type; component.pixelsPerUnitMultiplier = component2.pixelsPerUnitMultiplier; } ((Graphic)component).color = new Color(0.42f, 0.36f, 0.3f, 0.96f); GameObject val2 = new GameObject("Text Area", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }); val2.transform.SetParent(val.transform, false); RectTransform val3 = (RectTransform)val2.transform; val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(8f, 3f); val3.offsetMax = new Vector2(-8f, -3f); GameObject val4 = new GameObject("Placeholder", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val4.transform.SetParent((Transform)(object)val3, false); TextMeshProUGUI component3 = val4.GetComponent(); SetupInputText(component3, val3, new Color(0.65f, 0.62f, 0.58f, 0.8f)); ((TMP_Text)component3).text = placeholderText; ((TMP_Text)component3).fontStyle = (FontStyles)2; GameObject val5 = new GameObject("Text", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val5.transform.SetParent((Transform)(object)val3, false); TextMeshProUGUI component4 = val5.GetComponent(); SetupInputText(component4, val3, DadsCraftingPlugin.InputTextColor.Value); GuiInputField component5 = val.GetComponent(); ((TMP_InputField)component5).textViewport = val3; ((TMP_InputField)component5).textComponent = (TMP_Text)(object)component4; ((TMP_InputField)component5).placeholder = (Graphic)(object)component3; ((Selectable)component5).targetGraphic = (Graphic)(object)component; ((TMP_InputField)component5).characterLimit = characterLimit; ((TMP_InputField)component5).lineType = (LineType)0; component5.VirtualKeyboardTitle = (name.Contains("Search") ? "Search recipes" : "Craft amount"); component5.VirtualKeyboardOnActivate = true; component5.CaretOnGamepadUsage = true; return component5; } private void SetupInputText(TextMeshProUGUI text, RectTransform viewport, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_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_002c: 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) RectTransform val = (RectTransform)((TMP_Text)text).transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = Vector2.zero; val.offsetMax = Vector2.zero; ((TMP_Text)text).font = _gui.m_recipeName.font; ((TMP_Text)text).fontSize = 16f; ((Graphic)text).color = color; ((TMP_Text)text).alignment = (TextAlignmentOptions)4097; ((Graphic)text).raycastTarget = false; } private Button CreateButton(Transform parent, string name, string caption, out TMP_Text label) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: 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_0092: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)_gui.m_craftButton).gameObject, parent, false); ((Object)val).name = name; val.SetActive(true); Button component = val.GetComponent