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 DadsCrafting v1.0.2
DadsCrafting.dll
Decompiled 4 hours agousing 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<float> val = default(ConfigEntry<float>); if (value.Instance.Config.TryGetEntry<float>(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<Recipe>) })] internal static class UpdateRecipeListPatch { private static void Prefix(List<Recipe> 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<string> Favorites = new HashSet<string>(StringComparer.Ordinal); internal static readonly Dictionary<string, int> Tracked = new Dictionary<string, int>(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<string> 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<CraftingUiManager>(); 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<RectTransform>(); _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<RectTransform>(); 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<RectTransform>(); _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<string>)(object)((TMP_InputField)_searchInput).onValueChanged).AddListener((UnityAction<string>)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<string>)(object)((TMP_InputField)_amountInput).onValueChanged).AddListener((UnityAction<string>)delegate(string value) { if (int.TryParse(value, out var result)) { CraftingState.SetAmount(result); } }); ((UnityEvent<string>)(object)((TMP_InputField)_amountInput).onEndEdit).AddListener((UnityAction<string>)delegate(string value) { SetAmount((!int.TryParse(value, out var result)) ? 1 : result); }); ((Component)_amountInput).gameObject.AddComponent<QuantityScrollHandler>().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<RectTransform>(); _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<Image>(); ((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<TextMeshProUGUI>(); _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("<b>CRAFTING TRACKER</b>"); KeyValuePair<string, int>[] array = CraftingState.Tracked.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<string, int> tracked = array[i]; Recipe val = ((IEnumerable<Recipe>)ObjectDB.instance?.m_recipes).FirstOrDefault((Func<Recipe, bool>)((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<color=#").Append(ColorUtility.ToHtmlStringRGBA(DadsCraftingPlugin.ItemNameColor.Value)).Append("><b>") .Append(CraftingState.Localize(val.m_item.m_itemData.m_shared.m_name)) .Append(" x") .Append(tracked.Value) .Append("</b></color>"); 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 <color=#").Append(ColorUtility.ToHtmlStringRGBA(val3)).Append('>') .Append(CraftingState.Localize(val2.m_resItem.m_itemData.m_shared.m_name)) .Append("</color> <color=#") .Append(ColorUtility.ToHtmlStringRGBA(val4)) .Append(">(") .Append(inventoryCount) .Append("/</color><color=#") .Append(ColorUtility.ToHtmlStringRGBA(val5)) .Append('>') .Append(num2) .Append(")</color>"); } } } } _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>(); Image component2 = ((Component)_gui.m_craftButton).GetComponent<Image>(); 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<TextMeshProUGUI>(); 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<TextMeshProUGUI>(); SetupInputText(component4, val3, DadsCraftingPlugin.InputTextColor.Value); GuiInputField component5 = val.GetComponent<GuiInputField>(); ((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<GameObject>(((Component)_gui.m_craftButton).gameObject, parent, false); ((Object)val).name = name; val.SetActive(true); Button component = val.GetComponent<Button>(); ((UnityEventBase)component.onClick).RemoveAllListeners(); Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component).navigation = navigation; label = val.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)label == (Object)null) { 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(3f, 1f); val3.offsetMax = new Vector2(-3f, -1f); label = (TMP_Text)(object)val2.GetComponent<TextMeshProUGUI>(); label.font = _gui.m_recipeName.font; } label.text = caption; label.fontSize = 14f; label.enableAutoSizing = true; label.fontSizeMin = 9f; label.fontSizeMax = 14f; label.alignment = (TextAlignmentOptions)514; ((Graphic)label).raycastTarget = false; RectTransform rectTransform = label.rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.offsetMin = new Vector2(2f, 1f); rectTransform.offsetMax = new Vector2(-2f, -1f); return component; } private TMP_Text CreateNativeText(Transform parent, string name) { //IL_005f: 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_007f: 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_0094: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(((Component)(((Component)_gui.m_craftButton).GetComponentInChildren<TMP_Text>(true) ?? _gui.m_recipeName)).gameObject, parent, false); ((Object)obj).name = name; obj.SetActive(true); TMP_Text component = obj.GetComponent<TMP_Text>(); component.text = string.Empty; component.enableAutoSizing = false; ((Graphic)component).raycastTarget = false; RectTransform rectTransform = component.rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; return component; } private static void SetButtonIcon(Button button, string prefabName) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00ce: 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_00ed: Unknown result type (might be due to invalid IL or missing references) ObjectDB instance = ObjectDB.instance; GameObject obj = ((instance != null) ? instance.GetItemPrefab(prefabName) : null); object obj2; if (obj == null) { obj2 = null; } else { ItemDrop component = obj.GetComponent<ItemDrop>(); obj2 = ((component != null) ? component.m_itemData.GetIcon() : null); } Sprite val = (Sprite)obj2; if (!((Object)(object)val == (Object)null)) { TMP_Text componentInChildren = ((Component)button).GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { ((Component)componentInChildren).gameObject.SetActive(false); } GameObject val2 = new GameObject("Icon", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(((Component)button).transform, false); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.anchoredPosition = Vector2.zero; component2.sizeDelta = new Vector2(24f, 24f); Image component3 = val2.GetComponent<Image>(); component3.sprite = val; component3.preserveAspect = true; ((Graphic)component3).raycastTarget = false; } } private static void SetToolbarSpan(RectTransform rect, int row, int column, int columns, int span) { //IL_0014: 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_0041: 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_006b: Unknown result type (might be due to invalid IL or missing references) float num = (float)row * 35f; rect.anchorMin = new Vector2((float)column / (float)columns, 1f); rect.anchorMax = new Vector2((float)(column + span) / (float)columns, 1f); rect.pivot = new Vector2(0.5f, 1f); rect.offsetMin = new Vector2(2f, 0f - num - 31f); rect.offsetMax = new Vector2(-2f, 0f - num); } private static void SetCentered(RectTransform rect, Vector2 position, Vector2 size) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0047: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition = position; rect.sizeDelta = size; } private static void SetTopLeft(RectTransform rect, Vector2 position, Vector2 size) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0047: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = new Vector2(0f, 1f); rect.anchorMax = new Vector2(0f, 1f); rect.pivot = new Vector2(0f, 1f); rect.anchoredPosition = position; rect.sizeDelta = size; } } internal sealed class QuantityScrollHandler : MonoBehaviour, IScrollHandler, IEventSystemHandler { internal CraftingUiManager Owner; public void OnScroll(PointerEventData eventData) { //IL_000f: 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) if ((Object)(object)Owner != (Object)null && Math.Abs(eventData.scrollDelta.y) > 0.01f) { Owner.AdjustAmount((eventData.scrollDelta.y > 0f) ? 1 : (-1)); } } } internal sealed class TrackerDragHandler : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler { private Vector2 _pointerOffset; public void OnBeginDrag(PointerEventData eventData) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //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_003b: 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) if (Menu.IsVisible()) { RectTransform val = (RectTransform)((Component)this).transform; Vector2 val2 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)((Transform)val).parent, eventData.position, eventData.pressEventCamera, ref val2); _pointerOffset = val.anchoredPosition - val2; } } public void OnDrag(PointerEventData eventData) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0035: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (Menu.IsVisible()) { RectTransform val = (RectTransform)((Component)this).transform; Vector2 val2 = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)((Transform)val).parent, eventData.position, eventData.pressEventCamera, ref val2)) { val.anchoredPosition = val2 + _pointerOffset; DadsCraftingPlugin.TrackerPosition.Value = val.anchoredPosition; } } } } [BepInPlugin("com.dadisbored.dadscrafting", "DadsCrafting", "1.0.2")] [BepInProcess("valheim.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class DadsCraftingPlugin : BaseUnityPlugin { internal enum Toggle { Off, On } internal enum GridSize { Default, Medium, Large } public const string PluginGuid = "com.dadisbored.dadscrafting"; public const string PluginName = "DadsCrafting"; public const string PluginVersion = "1.0.2"; internal static ConfigEntry<Toggle> LockConfiguration; internal static ConfigEntry<Toggle> VanillaLike; internal static ConfigEntry<GridSize> GridSizeOption; internal static ConfigEntry<Toggle> ResetCraftingValue; internal static ConfigEntry<Toggle> Paginator; internal static ConfigEntry<Toggle> FavoritingSystem; internal static ConfigEntry<int> IncrementalAmount; internal static ConfigEntry<Toggle> ShowMaxCraftAmount; internal static ConfigEntry<Toggle> LimitNoCostToStation; internal static ConfigEntry<Toggle> RespectStationLevelNoCost; internal static ConfigEntry<Toggle> OverrideCraftingSpeed; internal static ConfigEntry<float> CraftingSpeed; internal static ConfigEntry<Color> InputTextColor; internal static ConfigEntry<KeyboardShortcut> ShowMinusButton; internal static ConfigEntry<KeyboardShortcut> ToggleRecipeUi; internal static ConfigEntry<KeyboardShortcut> MaxCraftModifier; internal static ConfigEntry<KeyboardShortcut> IncrementalModifier; internal static ConfigEntry<KeyboardShortcut> FavoriteToggle; internal static ConfigEntry<Color> HeaderGlowColor; internal static ConfigEntry<Color> HeaderBraidColor; internal static ConfigEntry<Color> TrackerBackgroundColor; internal static ConfigEntry<Color> ItemNameColor; internal static ConfigEntry<Color> CompleteNameColor; internal static ConfigEntry<Color> IncompleteNameColor; internal static ConfigEntry<Color> CompleteAmountColor; internal static ConfigEntry<Color> IncompleteRightColor; internal static ConfigEntry<Color> IncompleteLeftColor; internal static ConfigEntry<Vector2> TrackerPosition; internal static ConfigEntry<Vector2> TrackerScale; internal static ConfigEntry<float> TrackerItemNameMin; internal static ConfigEntry<float> TrackerItemNameMax; internal static ConfigEntry<float> TrackerRequirementMin; internal static ConfigEntry<float> TrackerRequirementMax; internal static ManualLogSource ModLogger; private Harmony _harmony; private void Awake() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: 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_0407: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0477: 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_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Expected O, but got Unknown ModLogger = ((BaseUnityPlugin)this).Logger; LockConfiguration = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - General", "Lock Configuration", Toggle.On, "If on, configuration is locked to server administrators."); VanillaLike = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - General", "Vanilla-Like", Toggle.Off, "Use a single-column vanilla-style recipe list."); GridSizeOption = ((BaseUnityPlugin)this).Config.Bind<GridSize>("1 - General", "Grid Size", GridSize.Default, "Controls recipe icon size, grid cell size, columns, and items per page when Vanilla-Like is Off."); ResetCraftingValue = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - Crafting Tweaks", "Reset Crafting Value", Toggle.On, "Reset the crafting amount when the recipe changes or crafting completes."); Paginator = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - Crafting Tweaks", "Paginator", Toggle.On, "Enable recipe pages."); FavoritingSystem = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - Crafting Tweaks", "Favorting System", Toggle.On, "Enable favorite filters and recipe stars."); IncrementalAmount = ((BaseUnityPlugin)this).Config.Bind<int>("1 - Crafting Tweaks", "Incremental Amount", 10, new ConfigDescription("Amount used with the incremental modifier.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); ShowMaxCraftAmount = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - Crafting Tweaks", "Show Max Craft Amount", Toggle.On, "Show the maximum craftable amount."); LimitNoCostToStation = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - Crafting Tweaks", "Limit recipes to station with nocost mode", Toggle.Off, "In no-cost mode, show only recipes for the current station."); RespectStationLevelNoCost = ((BaseUnityPlugin)this).Config.Bind<Toggle>("1 - Crafting Tweaks", "Respect station level with nocost mode", Toggle.Off, "When station limiting is enabled, require its upgrade level."); OverrideCraftingSpeed = ((BaseUnityPlugin)this).Config.Bind<Toggle>("2 - Game", "Override Crafting Speed", Toggle.Off, "Override the native crafting duration."); CraftingSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Game", "Crafting Speed", 2f, new ConfigDescription("Craft duration in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 120f), Array.Empty<object>())); InputTextColor = ((BaseUnityPlugin)this).Config.Bind<Color>("3 - Input Tweaks", "Input Text Color", new Color(1f, 61f / 85f, 49f / 136f, 1f), "Craft amount and search-input text color."); ShowMinusButton = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 - Keys", "Show Minus Button", new KeyboardShortcut((KeyCode)306, Array.Empty<KeyCode>()), "Modifier used to remove tracked recipes from their recipe icon."); ToggleRecipeUi = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 - Keys", "Toggle RecipeUI", new KeyboardShortcut((KeyCode)280, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Toggle the recipe tracker."); MaxCraftModifier = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 - Keys", "Max Craft Modifier", new KeyboardShortcut((KeyCode)306, Array.Empty<KeyCode>()), "Scroll modifier that jumps between one and the maximum craftable amount."); IncrementalModifier = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 - Keys", "Incremental Modifier", new KeyboardShortcut((KeyCode)304, Array.Empty<KeyCode>()), "Scroll modifier that changes the amount by Incremental Amount."); FavoriteToggle = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 - Keys", "Favorite Toggle", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Toggle the favorite-only recipe filter."); HeaderGlowColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Header Glow Color", new Color(0.58f, 0.235f, 0.19f, 1f), "Tracker header glow color."); HeaderBraidColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Header Braid Color", new Color(1f, 0.717f, 0.356f, 1f), "Tracker header decoration color."); TrackerBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Recipe Container Background Color", new Color(0f, 0f, 0f, 0.5f), "Tracker background color."); ItemNameColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Item Name Color (Color)", new Color(1f, 61f / 85f, 49f / 136f, 1f), "Tracked item name color."); CompleteNameColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Recipe Complete Name Color", Color.white, "Completed requirement name color."); IncompleteNameColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Recipe Incomplete Name Color", new Color(1f, 1f, 1f, 0.192f), "Incomplete requirement name color."); CompleteAmountColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Recipe Complete Color", new Color(0f, 1f, 0.44f, 0.37f), "Completed amount color."); IncompleteRightColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Recipe Incomplete Right Color", new Color(1f, 0.31f, 0f, 1f), "Required amount color when incomplete."); IncompleteLeftColor = ((BaseUnityPlugin)this).Config.Bind<Color>("5 - Recipe Tracker (Color)", "Recipe Incomplete Left Color", Color.white, "Available amount color when incomplete."); TrackerPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("5 - Recipe Tracker (Position)", "Recipe Tracker Position", new Vector2(783f, 265f), "Anchored tracker position."); TrackerScale = ((BaseUnityPlugin)this).Config.Bind<Vector2>("5 - Recipe Tracker (Sizes)", "Recipe Tracker Panel Scale", new Vector2(0.75f, 0.75f), "Tracker panel scale."); TrackerItemNameMin = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Recipe Tracker (Sizes)", "Recipe Tracker Item Name Min", 12f, "Minimum tracked item-name size."); TrackerItemNameMax = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Recipe Tracker (Sizes)", "Recipe Tracker Item Name Max", 20f, "Maximum tracked item-name size."); TrackerRequirementMin = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Recipe Tracker (Sizes)", "Recipe Tracker Req Name Min", 12f, "Minimum requirement-text size."); TrackerRequirementMax = ((BaseUnityPlugin)this).Config.Bind<float>("5 - Recipe Tracker (Sizes)", "Recipe Tracker Req Name Max", 20f, "Maximum requirement-text size."); CraftingState.Load(); _harmony = new Harmony("com.dadisbored.dadscrafting"); _harmony.PatchAll(typeof(DadsCraftingPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"DadsCrafting 1.0.2 loaded."); } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) KeyboardShortcut value = FavoriteToggle.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CraftingUiManager.Instance?.ToggleFavoritesOnly(); } value = ToggleRecipeUi.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CraftingUiManager.Instance?.ToggleTracker(); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static bool IsOn(ConfigEntry<Toggle> entry) { if (entry == null) { return false; } return entry.Value == Toggle.On; } internal static (Vector2 Cell, Vector2 Spacing, int Columns, int PerPage, float Icon) GridPreset() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0086: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (IsOn(VanillaLike)) { return (Cell: new Vector2(0f, 51f), Spacing: new Vector2(0f, 7f), Columns: 1, PerPage: int.MaxValue, Icon: 43f); } return GridSizeOption.Value switch { GridSize.Medium => (Cell: new Vector2(65f, 62f), Spacing: new Vector2(5f, 5f), Columns: 4, PerPage: 24, Icon: 55f), GridSize.Large => (Cell: new Vector2(88f, 76f), Spacing: new Vector2(5f, 5f), Columns: 3, PerPage: 15, Icon: 65f), _ => (Cell: new Vector2(51f, 51f), Spacing: new Vector2(5f, 7f), Columns: 5, PerPage: 35, Icon: 43f), }; } } internal static class RecipeListAccess { private static readonly FieldInfo AvailableRecipesField = AccessTools.Field(typeof(InventoryGui), "m_availableRecipes"); private static Type _pairType; private static PropertyInfo _recipeProperty; private static PropertyInfo _elementProperty; internal static void Decorate(InventoryGui gui) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0269: 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_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gui == (Object)null || !(AvailableRecipesField?.GetValue(gui) is IList list)) { return; } (Vector2, Vector2, int, int, float) tuple = DadsCraftingPlugin.GridPreset(); bool flag = DadsCraftingPlugin.IsOn(DadsCraftingPlugin.VanillaLike); int num = (DadsCraftingPlugin.IsOn(DadsCraftingPlugin.Paginator) ? tuple.Item4 : int.MaxValue); CraftingState.PageCount = Mathf.Max(1, Mathf.CeilToInt((float)list.Count / (float)num)); CraftingState.Page = Mathf.Clamp(CraftingState.Page, 1, CraftingState.PageCount); int num2 = ((num != int.MaxValue) ? ((CraftingState.Page - 1) * num) : 0); int num3 = ((num == int.MaxValue) ? list.Count : Mathf.Min(list.Count, num2 + num)); Rect rect = gui.m_recipeListRoot.rect; float num4 = ((Rect)(ref rect)).width; Transform parent = ((Transform)gui.m_recipeListRoot).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val != (Object)null) { rect = val.rect; if (((Rect)(ref rect)).width > 1f) { float num5; if (!(num4 > 1f)) { rect = val.rect; num5 = ((Rect)(ref rect)).width; } else { float num6 = num4; rect = val.rect; num5 = Mathf.Min(num6, ((Rect)(ref rect)).width); } num4 = num5; } } num4 = Mathf.Max(1f, num4); float num7 = (num4 - tuple.Item2.x * (float)(tuple.Item3 - 1)) / (float)tuple.Item3; float num8 = (flag ? num4 : Mathf.Min(tuple.Item1.x, num7)); float num9 = (flag ? gui.m_recipeListSpace : tuple.Item1.y); int num10 = 0; Vector2 val6 = default(Vector2); for (int i = 0; i < list.Count; i++) { object obj = list[i]; EnsureProperties(obj); object? obj2 = _recipeProperty?.GetValue(obj, null); Recipe val2 = (Recipe)((obj2 is Recipe) ? obj2 : null); object? obj3 = _elementProperty?.GetValue(obj, null); GameObject val3 = (GameObject)((obj3 is GameObject) ? obj3 : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { continue; } bool flag2 = i >= num2 && i < num3; val3.SetActive(flag2); if (flag2) { int num11 = num10++; int num12 = num11 / tuple.Item3; int num13 = num11 % tuple.Item3; Transform transform = val3.transform; Transform obj4 = ((transform is RectTransform) ? transform : null); ((RectTransform)obj4).anchorMin = new Vector2(0f, 1f); ((RectTransform)obj4).anchorMax = new Vector2(0f, 1f); ((RectTransform)obj4).pivot = new Vector2(0f, 1f); ((RectTransform)obj4).sizeDelta = new Vector2(num8, num9); ((RectTransform)obj4).anchoredPosition = new Vector2((float)num13 * (num8 + tuple.Item2.x), (float)(-num12) * (num9 + tuple.Item2.y)); Transform obj5 = val3.transform.Find("name"); TMP_Text val4 = ((obj5 != null) ? ((Component)obj5).GetComponent<TMP_Text>() : null); if ((Object)(object)val4 != (Object)null) { ((Component)val4).gameObject.SetActive(flag); val4.text = CraftingState.Localize(val2.m_item.m_itemData.m_shared.m_name); } Transform obj6 = val3.transform.Find("icon"); RectTransform val5 = (RectTransform)(object)((obj6 is RectTransform) ? obj6 : null); if ((Object)(object)val5 != (Object)null && !flag) { ((Vector2)(ref val6))..ctor(0.5f, 0.5f); val5.pivot = val6; Vector2 anchorMin = (val5.anchorMax = val6); val5.anchorMin = anchorMin; val5.sizeDelta = Vector2.one * tuple.Item5; val5.anchoredPosition = Vector2.zero; } EnsureFavoriteButton(gui, val3, val2, flag); } } int num14 = Mathf.Max(1, Mathf.CeilToInt((float)num10 / (float)tuple.Item3)); gui.m_recipeListRoot.SetSizeWithCurrentAnchors((Axis)1, (float)num14 * (num9 + tuple.Item2.y)); CraftingUiManager.Instance?.RefreshPageLabel(); } private static void EnsureFavoriteButton(InventoryGui gui, GameObject element, Recipe recipe, bool vanilla) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_009c: 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_00aa: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0148: 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_0153: 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_015e: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown Transform val = element.transform.Find("DadsCrafting_FavoriteStar"); Button component; TMP_Text component2; if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("DadsCrafting_FavoriteStar", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Button) }); val2.transform.SetParent(element.transform, false); RectTransform val3 = (RectTransform)val2.transform; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(1f, 1f); val3.anchorMax = val4; val3.anchorMin = val4; val3.pivot = new Vector2(1f, 1f); val3.sizeDelta = new Vector2(24f, 24f); ((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.35f); component = val2.GetComponent<Button>(); GameObject val5 = new GameObject("Text", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val5.transform.SetParent(val2.transform, false); RectTransform val6 = (RectTransform)val5.transform; val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val4 = (val6.offsetMin = (val6.offsetMax = Vector2.zero)); component2 = (TMP_Text)(object)val5.GetComponent<TextMeshProUGUI>(); component2.font = gui.m_recipeName.font; component2.alignment = (TextAlignmentOptions)514; component2.fontSize = 17f; ((Graphic)component2).raycastTarget = false; } else { component = ((Component)val).GetComponent<Button>(); component2 = ((Component)val.Find("Text")).GetComponent<TMP_Text>(); } ((RectTransform)((Component)component).transform).anchoredPosition = (vanilla ? new Vector2(-4f, -3f) : new Vector2(-1f, -1f)); ((Component)component).gameObject.SetActive(DadsCraftingPlugin.IsOn(DadsCraftingPlugin.FavoritingSystem)); bool flag = CraftingState.Favorites.Contains(CraftingState.RecipeId(recipe)); component2.text = (flag ? "★" : "☆"); ((Graphic)component2).color = (flag ? Color.yellow : Color.white); ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { CraftingState.ToggleFavorite(recipe); if (CraftingState.FavoritesOnly) { CraftingState.RefreshRecipes(gui); } else { Decorate(gui); } }); } private static void EnsureProperties(object pair) { if (pair != null && !(pair.GetType() == _pairType)) { _pairType = pair.GetType(); _recipeProperty = _pairType.GetProperty("Recipe", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); _elementProperty = _pairType.GetProperty("InterfaceElement", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } } } }