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 CraftFilter v1.1.4
plugins/CraftFilter.dll
Decompiled 40 minutes agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using GUIFramework; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; 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("CraftFilter")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: AssemblyInformationalVersion("1.1.4+ec531d51dd8e4a292fc286bc228da4d10f47a9e4")] [assembly: AssemblyProduct("CraftFilter")] [assembly: AssemblyTitle("CraftFilter")] [assembly: AssemblyVersion("1.1.4.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 CraftFilter { internal enum IconShape { Close, ChevronDown, ChevronRight, ChevronLeft } internal sealed class ControlIcon : MaskableGraphic { private const float HalfStroke = 0.85f; private IconShape shape; public void SetShape(IconShape value) { shape = value; ((Graphic)this).SetVerticesDirty(); } protected override void OnPopulateMesh(VertexHelper mesh) { //IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00de: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_00be: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); Rect pixelAdjustedRect = ((Graphic)this).GetPixelAdjustedRect(); Vector2 center = ((Rect)(ref pixelAdjustedRect)).center; if (shape == IconShape.Close) { AddStroke(mesh, center + new Vector2(-3.5f, -3.5f), center + new Vector2(3.5f, 3.5f)); AddStroke(mesh, center + new Vector2(-3.5f, 3.5f), center + new Vector2(3.5f, -3.5f)); return; } Vector2 val = ((shape == IconShape.ChevronDown) ? Vector2.down : ((shape == IconShape.ChevronRight) ? Vector2.right : Vector2.left)); Vector2 val2 = center + val * 2.25f; Vector2 val3 = center - val * 2.25f; Vector2 val4 = Vector2.Perpendicular(val) * 4.5f; Vector2 value = -val * (0.85f * Mathf.Sqrt(2f)); Vector2 start = val3 - val4; Vector2? endJoin = value; AddStroke(mesh, start, val2, null, endJoin); AddStroke(mesh, val2, val3 + val4, value); } private void AddStroke(VertexHelper mesh, Vector2 start, Vector2 end, Vector2? startJoin = null, Vector2? endJoin = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0031: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.Perpendicular(end - start); Vector2 val2 = ((Vector2)(ref val)).normalized * 0.85f; Vector2 val3 = startJoin ?? val2; Vector2 val4 = endJoin ?? val2; int currentVertCount = mesh.currentVertCount; mesh.AddVert(Vector2.op_Implicit(start + val3), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(end + val4), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(end - val4), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddVert(Vector2.op_Implicit(start - val3), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero)); mesh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); mesh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3); } } internal sealed class FilterBar { private sealed class PresetMenu { public const float RowHeight = 24f; private const int MaxVisibleRows = 8; private static readonly Color32 LabelColor = new Color32((byte)241, (byte)232, (byte)215, byte.MaxValue); private static readonly Color32 NavigationColor = new Color32((byte)199, (byte)179, (byte)154, byte.MaxValue); private static readonly Color32 SelectedColor = new Color32(byte.MaxValue, (byte)195, (byte)99, byte.MaxValue); private readonly RectTransform control; private readonly TMP_Text caption; private readonly TMP_Text fontSource; private readonly ScrollRect recipeScroll; private readonly Action<string> onChanged; private readonly string allRecipes; private readonly string back; private IReadOnlyList<PresetOption> options = Array.Empty<PresetOption>(); private string selectedId; private RectTransform overlay; private RectTransform page; public PresetMenu(RectTransform header, TMP_Text fontSource, Image background, ScrollRect recipeScroll, bool isFrench, Action<string> onChanged) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) this.fontSource = fontSource; this.recipeScroll = recipeScroll; this.onChanged = onChanged; allRecipes = (isFrench ? "Toutes les recettes" : "All recipes"); back = (isFrench ? "Retour" : "Back"); control = CreateRect("Presets", (Transform)(object)header); ((Component)control).gameObject.SetActive(false); PlaceBelow(control, 4f, 24f); Image obj = ((Component)control).gameObject.AddComponent<Image>(); obj.sprite = background.sprite; obj.type = background.type; obj.pixelsPerUnitMultiplier = background.pixelsPerUnitMultiplier; ((Graphic)obj).color = ((Graphic)background).color; caption = AddButton(control, allRecipes, IconShape.ChevronDown, selected: false, Open); } public void SetOptions(IReadOnlyList<PresetOption> updated, string selection) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (!(selectedId == selection) || !HasSameOptions(updated)) { Close(); options = updated.ToArray(); selectedId = selection; PresetOption presetOption = options.FirstOrDefault((PresetOption option) => option.Id == selectedId); caption.text = presetOption?.Label ?? allRecipes; Button component = ((Component)control).GetComponent<Button>(); ColorBlock colors = ((Selectable)component).colors; ((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit((presetOption == null) ? LabelColor : SelectedColor); ((Selectable)component).colors = colors; ((Component)control).gameObject.SetActive(options.Count > 0); } } private bool HasSameOptions(IReadOnlyList<PresetOption> updated) { if (options.Count != updated.Count) { return false; } for (int i = 0; i < options.Count; i++) { PresetOption presetOption = options[i]; PresetOption presetOption2 = updated[i]; if (presetOption.Id != presetOption2.Id || presetOption.Label != presetOption2.Label || presetOption.Group != presetOption2.Group) { return false; } } return true; } private void Open() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)overlay)) { Close(); return; } Canvas componentInParent = ((Component)control).GetComponentInParent<Canvas>(); if (Object.op_Implicit((Object)(object)componentInParent)) { Transform transform = ((Component)componentInParent.rootCanvas).transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val != null) { Canvas val2 = (componentInParent.overrideSorting ? componentInParent : componentInParent.rootCanvas); overlay = CreateRect("Preset overlay", (Transform)(object)control); Inset(overlay, 0f, 0f, 0f, 0f); Canvas obj = ((Component)overlay).gameObject.AddComponent<Canvas>(); obj.overrideSorting = true; obj.sortingLayerID = val2.sortingLayerID; obj.sortingOrder = val2.sortingOrder + 1; obj.additionalShaderChannels = componentInParent.additionalShaderChannels; ((Component)overlay).gameObject.AddComponent<GraphicRaycaster>(); RectTransform obj2 = CreateRect("Close presets", (Transform)(object)overlay); obj2.anchorMin = overlay.pivot; obj2.anchorMax = overlay.pivot; RectTransform obj3 = overlay; Rect rect = val.rect; obj2.offsetMin = Vector2.op_Implicit(((Transform)obj3).InverseTransformPoint(((Transform)val).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).min)))); RectTransform obj4 = overlay; rect = val.rect; obj2.offsetMax = Vector2.op_Implicit(((Transform)obj4).InverseTransformPoint(((Transform)val).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).max)))); ((Graphic)((Component)obj2).gameObject.AddComponent<Image>()).color = Color.clear; Button obj5 = ((Component)obj2).gameObject.AddComponent<Button>(); ((Selectable)obj5).transition = (Transition)0; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj5).navigation = navigation; ((UnityEvent)obj5.onClick).AddListener(new UnityAction(Close)); ShowPage(null); } } } public void Close() { if (Object.op_Implicit((Object)(object)overlay)) { ((Component)overlay).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)overlay).gameObject); } overlay = null; page = null; } private void ShowPage(string group) { if (Object.op_Implicit((Object)(object)page)) { ((Component)page).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)page).gameObject); } IGrouping<string, PresetOption>[] array = ((group == null) ? (from presetOption in options group presetOption by presetOption.Group).ToArray() : null); PresetOption[] array2 = ((group != null) ? options.Where((PresetOption presetOption) => presetOption.Group == group).ToArray() : null); int rowCount = 1 + ((group == null) ? array.Length : array2.Length); RectTransform content = CreatePage(rowCount); if (group == null) { AddChoice(content, 0, allRecipes, null, selectedId == null, delegate { Select(null); }); for (int num = 0; num < array.Length; num++) { IGrouping<string, PresetOption> category = array[num]; AddChoice(content, num + 1, category.Key, IconShape.ChevronRight, category.Any((PresetOption presetOption) => presetOption.Id == selectedId), delegate { ShowPage(category.Key); }); } return; } AddChoice(content, 0, back, IconShape.ChevronLeft, selected: false, delegate { ShowPage(null); }); for (int num2 = 0; num2 < array2.Length; num2++) { PresetOption option = array2[num2]; AddChoice(content, num2 + 1, option.Label, null, option.Id == selectedId, delegate { Select(option.Id); }); } } private RectTransform CreatePage(int rowCount) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_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) bool flag = rowCount > 8; page = CreateRect("Preset choices", (Transform)(object)overlay); PlaceBelow(page, 2f, (float)Mathf.Min(rowCount, 8) * 24f + 4f); ((Graphic)((Component)page).gameObject.AddComponent<Image>()).color = Color32.op_Implicit(new Color32((byte)43, (byte)35, (byte)30, byte.MaxValue)); RectTransform val = CreateRect("Viewport", (Transform)(object)page); Inset(val, 2f, 2f, flag ? 11f : 2f, 2f); ((Component)val).gameObject.AddComponent<RectMask2D>(); RectTransform val2 = CreateRect("Choices", (Transform)(object)val); val2.pivot = new Vector2(0.5f, 1f); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = Vector2.one; val2.sizeDelta = new Vector2(0f, (float)rowCount * 24f); val2.anchoredPosition = Vector2.zero; ScrollRect val3 = ((Component)page).gameObject.AddComponent<ScrollRect>(); val3.content = val2; val3.viewport = val; val3.horizontal = false; val3.vertical = flag; val3.movementType = (MovementType)2; val3.scrollSensitivity = recipeScroll.scrollSensitivity; if (flag) { AddScrollbar(val3); } return val2; } private void AddScrollbar(ScrollRect scroll) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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) RectTransform val = CreateRect("Scrollbar", (Transform)(object)page); val.anchorMin = new Vector2(1f, 0f); val.anchorMax = Vector2.one; val.offsetMin = new Vector2(-9f, 2f); val.offsetMax = new Vector2(-2f, -2f); ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = Color32.op_Implicit(new Color32((byte)58, (byte)46, (byte)39, byte.MaxValue)); RectTransform val2 = CreateRect("Sliding area", (Transform)(object)val); Inset(val2, 1f, 1f, 1f, 1f); RectTransform val3 = CreateRect("Handle", (Transform)(object)val2); Inset(val3, 0f, 0f, 0f, 0f); Image val4 = ((Component)val3).gameObject.AddComponent<Image>(); ((Graphic)val4).color = Color32.op_Implicit(new Color32((byte)185, (byte)177, (byte)162, byte.MaxValue)); Scrollbar val5 = ((Component)val).gameObject.AddComponent<Scrollbar>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val4; val5.handleRect = val3; val5.direction = (Direction)2; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val5).navigation = navigation; val5.value = 1f; scroll.verticalScrollbar = val5; } private void Select(string id) { Close(); if (selectedId != id) { onChanged(id); } } private void AddChoice(RectTransform content, int index, string label, IconShape? iconShape, bool selected, Action clicked) { //IL_0017: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CreateRect("Choice", (Transform)(object)content); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = Vector2.one; val.offsetMin = new Vector2(0f, (float)(-(index + 1)) * 24f); val.offsetMax = new Vector2(0f, (float)(-index) * 24f); ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = Color32.op_Implicit((iconShape == IconShape.ChevronLeft) ? new Color32((byte)43, (byte)35, (byte)30, byte.MaxValue) : (selected ? new Color32((byte)87, (byte)61, (byte)39, byte.MaxValue) : new Color32((byte)58, (byte)46, (byte)39, byte.MaxValue))); AddButton(val, label, iconShape, selected, clicked); } private TMP_Text AddButton(RectTransform rect, string label, IconShape? iconShape, bool selected, Action clicked) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) bool flag = iconShape == IconShape.ChevronLeft; TextMeshProUGUI val = CreateText("Label", rect, fontSource, (TextAlignmentOptions)4097); Inset(((TMP_Text)val).rectTransform, flag ? 24f : 9f, 0f, (iconShape.HasValue && !flag) ? 26f : 9f, 0f); ((TMP_Text)val).text = label; ((TMP_Text)val).richText = false; ((TMP_Text)val).enableAutoSizing = true; ((TMP_Text)val).fontSizeMin = ((TMP_Text)val).fontSize * 0.8f; ((TMP_Text)val).fontSizeMax = ((TMP_Text)val).fontSize; ((TMP_Text)val).overflowMode = (TextOverflowModes)1; if (iconShape.HasValue) { RectTransform obj = CreateRect("Chevron", (Transform)(object)rect); float num = (flag ? 0f : 1f); obj.anchorMin = new Vector2(num, 0f); obj.anchorMax = new Vector2(num, 1f); obj.offsetMin = new Vector2(flag ? 4f : (-26f), 0f); obj.offsetMax = new Vector2(flag ? 24f : (-4f), 0f); ControlIcon controlIcon = ((Component)obj).gameObject.AddComponent<ControlIcon>(); controlIcon.SetShape(iconShape.Value); ((Graphic)controlIcon).color = Color32.op_Implicit(NavigationColor); ((Graphic)controlIcon).raycastTarget = false; } Button obj2 = ((Component)rect).gameObject.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj2).navigation = navigation; ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(flag ? NavigationColor : (selected ? SelectedColor : LabelColor)); ((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(SelectedColor); ((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)224, (byte)149, (byte)61, byte.MaxValue)); ((Selectable)obj2).colors = colors; ((UnityEvent)obj2.onClick).AddListener(new UnityAction(clicked.Invoke)); return (TMP_Text)(object)val; } private static void PlaceBelow(RectTransform rect, float top, float height) { //IL_0001: 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_002a: 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) rect.anchorMin = Vector2.zero; rect.anchorMax = new Vector2(1f, 0f); rect.offsetMin = new Vector2(0f, 0f - top - height); rect.offsetMax = new Vector2(0f, 0f - top); } } private const float Height = 28f; private const float Gap = 4f; private const float ClearWidth = 26f; private const float ReservedHeight = 36f; private readonly ScrollRect scroll; private readonly RectTransform frame; private readonly RectTransform header; private readonly TMP_InputField input; private readonly PresetMenu presets; public bool IsFocused { get { if (Object.op_Implicit((Object)(object)input) && ((Behaviour)input).isActiveAndEnabled) { return input.isFocused; } return false; } } public float PresetReservedHeight { get; private set; } public static FilterBar Create(InventoryGui gui, Action<string> onTextChanged, Action<string> onPresetChanged) { if (!Object.op_Implicit((Object)(object)gui.m_recipeEnsureVisible)) { return null; } ScrollRect component = ((Component)gui.m_recipeEnsureVisible).GetComponent<ScrollRect>(); if (Object.op_Implicit((Object)(object)component)) { Transform parent = ((Component)component).transform.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val != null && Object.op_Implicit((Object)(object)((Transform)val).parent)) { return new FilterBar(gui, component, val, onTextChanged, onPresetChanged); } } return null; } private FilterBar(InventoryGui gui, ScrollRect scroll, RectTransform frame, Action<string> onTextChanged, Action<string> onPresetChanged) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) this.scroll = scroll; this.frame = frame; header = CreateRect("CraftFilter", ((Transform)frame).parent); ((Component)header).gameObject.SetActive(false); header.anchorMin = new Vector2(frame.anchorMin.x, frame.anchorMax.y); header.anchorMax = frame.anchorMax; float num; if (Object.op_Implicit((Object)(object)gui.m_recipeListScroll)) { Transform transform = ((Component)gui.m_recipeListScroll).transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (val != null) { Rect rect = val.rect; num = ((Rect)(ref rect)).width; goto IL_00a9; } } num = 0f; goto IL_00a9; IL_00a9: float num2 = num; header.offsetMin = new Vector2(frame.offsetMin.x, frame.offsetMax.y - 4f - 28f); header.offsetMax = new Vector2(frame.offsetMax.x - num2, frame.offsetMax.y - 4f); TMP_Text component = ((Component)gui.m_recipeElementPrefab.transform.Find("name")).GetComponent<TMP_Text>(); RectTransform val2 = CreateRect("Filter", (Transform)(object)header); Inset(val2, 0f, 0f, 0f, 0f); Image val3 = ((Component)val2).gameObject.AddComponent<Image>(); ((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)42, (byte)36, (byte)33, byte.MaxValue)); Image image = ((Selectable)gui.m_tabCraft).image; if (Object.op_Implicit((Object)(object)image) && Object.op_Implicit((Object)(object)image.sprite)) { val3.sprite = image.sprite; val3.type = image.type; val3.pixelsPerUnitMultiplier = image.pixelsPerUnitMultiplier; ((Graphic)val3).color = Color32.op_Implicit(new Color32((byte)181, (byte)171, (byte)157, byte.MaxValue)); } RectTransform val4 = CreateRect("Text Area", (Transform)(object)val2); Inset(val4, 9f, 1f, 28f, 1f); ((Component)val4).gameObject.AddComponent<RectMask2D>(); TextMeshProUGUI val5 = CreateText("Placeholder", val4, component, (TextAlignmentOptions)4097); bool flag = Localization.instance.GetSelectedLanguage() == "French"; ((TMP_Text)val5).text = (flag ? "Filtrer" : "Filter"); ((Graphic)val5).color = Color32.op_Implicit(new Color32((byte)185, (byte)177, (byte)162, byte.MaxValue)); TextMeshProUGUI val6 = CreateText("Text", val4, component, (TextAlignmentOptions)4097); ((Graphic)val6).color = Color32.op_Implicit(new Color32((byte)241, (byte)232, (byte)215, byte.MaxValue)); input = (TMP_InputField)(object)((Component)val2).gameObject.AddComponent<GuiInputField>(); ((Selectable)input).targetGraphic = (Graphic)(object)val3; input.textViewport = val4; input.textComponent = (TMP_Text)(object)val6; input.placeholder = (Graphic)(object)val5; input.lineType = (LineType)0; input.richText = false; TMP_InputField obj = input; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj).navigation = navigation; ((UnityEvent<string>)(object)input.onValueChanged).AddListener((UnityAction<string>)onTextChanged.Invoke); RectTransform obj2 = CreateRect("Clear", (Transform)(object)val2); obj2.anchorMin = new Vector2(1f, 0f); obj2.anchorMax = Vector2.one; obj2.offsetMin = new Vector2(-26f, 0f); obj2.offsetMax = Vector2.zero; ControlIcon controlIcon = ((Component)obj2).gameObject.AddComponent<ControlIcon>(); controlIcon.SetShape(IconShape.Close); ((Graphic)controlIcon).raycastTarget = true; Button obj3 = ((Component)obj2).gameObject.AddComponent<Button>(); ((Selectable)obj3).targetGraphic = (Graphic)(object)controlIcon; ColorBlock colors = ((Selectable)obj3).colors; ((ColorBlock)(ref colors)).normalColor = Color32.op_Implicit(new Color32((byte)185, (byte)177, (byte)162, byte.MaxValue)); ((ColorBlock)(ref colors)).highlightedColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)195, (byte)99, byte.MaxValue)); ((ColorBlock)(ref colors)).pressedColor = Color32.op_Implicit(new Color32((byte)224, (byte)149, (byte)61, byte.MaxValue)); ((Selectable)obj3).colors = colors; navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj3).navigation = navigation; ((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate { input.text = string.Empty; }); presets = new PresetMenu(header, component, val3, scroll, flag, onPresetChanged); frame.offsetMax -= new Vector2(0f, 36f); ((Component)header).gameObject.SetActive(true); } public void SetPresets(IReadOnlyList<PresetOption> options, string selectedId) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)header) && Object.op_Implicit((Object)(object)frame)) { presets.SetOptions(options, selectedId); float num = ((options.Count == 0) ? 0f : 28f); if (num != PresetReservedHeight) { RectTransform obj = frame; obj.offsetMax -= new Vector2(0f, num - PresetReservedHeight); PresetReservedHeight = num; } } } public void ResetScroll() { scroll.StopMovement(); scroll.verticalNormalizedPosition = 1f; } public void Reset() { presets.Close(); if (Object.op_Implicit((Object)(object)input)) { input.DeactivateInputField(false); input.SetTextWithoutNotify(string.Empty); } } public void Remove() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)header)) { ((Component)header).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)header).gameObject); } if (Object.op_Implicit((Object)(object)frame)) { RectTransform obj = frame; obj.offsetMax += new Vector2(0f, 36f + PresetReservedHeight); } } private static RectTransform CreateRect(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent(parent, false); ((Component)val).gameObject.layer = ((Component)parent).gameObject.layer; return val; } private static void Inset(RectTransform rect, float left, float bottom, float right, float top) { //IL_0001: 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_0019: 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) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.offsetMin = new Vector2(left, bottom); rect.offsetMax = new Vector2(0f - right, 0f - top); } private static TextMeshProUGUI CreateText(string name, RectTransform parent, TMP_Text source, TextAlignmentOptions alignment) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = CreateRect(name, (Transform)(object)parent); Inset(obj, 0f, 0f, 0f, 0f); TextMeshProUGUI obj2 = ((Component)obj).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj2).font = source.font; ((TMP_Text)obj2).fontSharedMaterial = source.fontSharedMaterial; ((TMP_Text)obj2).fontSize = source.fontSize; ((TMP_Text)obj2).alignment = alignment; ((TMP_Text)obj2).textWrappingMode = (TextWrappingModes)0; ((Graphic)obj2).raycastTarget = false; return obj2; } } [Flags] internal enum FoodPreset { None = 0, Health = 1, Stamina = 2, Eitr = 4 } internal static class FoodPresets { public static FoodPreset FromFood(float health, float stamina, float eitr) { float num = Math.Max(health, Math.Max(stamina, eitr)); if (!(num <= 0f)) { return FromEffects(health == num, stamina == num, eitr == num); } return FoodPreset.None; } public static FoodPreset FromEffects(bool health, bool stamina, bool eitr) { return (FoodPreset)((health ? 1 : 0) | (stamina ? 2 : 0) | (eitr ? 4 : 0)); } } [BepInPlugin("fr.romaindurand.craftfilter", "CraftFilter", "1.1.4")] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(InventoryGui), "Awake")] private static class InitializeInventory { private static void Prefix(InventoryGui __instance) { instance.Attach(__instance); } } [HarmonyPatch(typeof(InventoryGui), "Hide")] private static class HideInventory { private static void Postfix(InventoryGui __instance) { if ((Object)(object)instance.inventory == (Object)(object)__instance) { instance.bar?.Reset(); instance.search = default(RecipeSearch); instance.selectedPreset = null; } } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")] private static class PreparePresets { private static void Prefix(InventoryGui __instance, List<Recipe> __0, ref float ___m_recipeListBaseSize) { if ((Object)(object)instance.inventory == (Object)(object)__instance && instance.bar != null) { instance.UpdatePresets(__0, ref ___m_recipeListBaseSize); } } } [HarmonyPatch(typeof(InventoryGui), "AddRecipeToList")] private static class AddRecipe { private static bool Prefix(InventoryGui __instance, Recipe __1) { if ((Object)(object)instance.inventory != (Object)(object)__instance) { return true; } string selectedPreset = instance.selectedPreset; if (selectedPreset != null && (!instance.recipeTags.TryGetValue(__1, out var value) || !value.Contains(selectedPreset))) { return false; } if (instance.search.IsEmpty) { return true; } string localizedName = Localization.instance.Localize(__1.m_item.m_itemData.m_shared.m_name); return instance.search.Matches(localizedName); } } [HarmonyPatch(typeof(PlayerController), "TakeInput")] private static class PlayerControls { private static bool Prefix(ref bool __result) { FilterBar bar = instance.bar; if (bar != null && bar.IsFocused) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(ZInput), "GetButtonDown")] private static class InventoryShortcuts { private static bool Prefix(string __0, ref bool __result) { if (__0 == "Inventory" || __0 == "Use") { FilterBar bar = instance.bar; if (bar != null && bar.IsFocused) { __result = false; return false; } } return true; } } private const string Guid = "fr.romaindurand.craftfilter"; private const string Version = "1.1.4"; private static Plugin instance; private Harmony harmony; private MethodInfo updateCraftingPanel; private InventoryGui inventory; private FilterBar bar; private RecipeSearch search; private CraftingStation presetStation; private string selectedPreset; private readonly Dictionary<Recipe, HashSet<string>> recipeTags = new Dictionary<Recipe, HashSet<string>>(); private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown updateCraftingPanel = AccessTools.Method(typeof(InventoryGui), "UpdateCraftingPanel", new Type[1] { typeof(bool) }, (Type[])null); if (updateCraftingPanel == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"CraftFilter: InventoryGui.UpdateCraftingPanel introuvable."); return; } instance = this; harmony = new Harmony("fr.romaindurand.craftfilter"); harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CraftFilter 1.1.4 chargé."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } bar?.Remove(); instance = null; } private void Attach(InventoryGui gui) { if (!((Object)(object)inventory == (Object)(object)gui)) { bar?.Remove(); search = default(RecipeSearch); selectedPreset = null; presetStation = null; recipeTags.Clear(); inventory = gui; bar = FilterBar.Create(gui, OnSearchChanged, OnPresetChanged); if (bar == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"CraftFilter: liste de recettes introuvable."); } } } private void OnSearchChanged(string text) { search = new RecipeSearch(text); RefreshRecipes(); } private void OnPresetChanged(string id) { selectedPreset = id; RefreshRecipes(); } private void RefreshRecipes() { if (bar != null && Object.op_Implicit((Object)(object)inventory) && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { bar.ResetScroll(); updateCraftingPanel.Invoke(inventory, new object[1] { true }); } } private void UpdatePresets(List<Recipe> recipes, ref float recipeListBaseSize) { Player localPlayer = Player.m_localPlayer; CraftingStation val = (Object.op_Implicit((Object)(object)localPlayer) ? localPlayer.GetCurrentCraftingStation() : null); if ((Object)(object)presetStation != (Object)(object)val) { presetStation = val; selectedPreset = null; recipeTags.Clear(); } float presetReservedHeight = bar.PresetReservedHeight; PresetStation station = RecipeCategories.GetStation(val); if (station == PresetStation.None) { selectedPreset = null; bar.SetPresets(Array.Empty<PresetOption>(), null); } else { bool flag = inventory.InCraftTab(); HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); if (!flag) { foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (allItem.m_quality < allItem.m_shared.m_maxQuality) { hashSet.Add(allItem.m_shared.m_name); } } } HashSet<string> hashSet2 = new HashSet<string>(StringComparer.Ordinal); foreach (Recipe recipe in recipes) { if (Object.op_Implicit((Object)(object)recipe) && Object.op_Implicit((Object)(object)recipe.m_item) && !(flag ? recipe.m_noCraftOnlyUpgrade : (!hashSet.Contains(recipe.m_item.m_itemData.m_shared.m_name)))) { if (!recipeTags.TryGetValue(recipe, out var value)) { value = RecipeCategories.GetTags(recipe, station); recipeTags.Add(recipe, value); } hashSet2.UnionWith(value); } } if (selectedPreset != null && !hashSet2.Contains(selectedPreset)) { selectedPreset = null; } bool french = Localization.instance.GetSelectedLanguage() == "French"; bar.SetPresets(PresetCatalog.GetOptions(station, hashSet2, french), selectedPreset); } recipeListBaseSize += presetReservedHeight - bar.PresetReservedHeight; } } internal sealed class PresetOption { public string Id { get; } public string Label { get; } public string Group { get; } public PresetOption(string id, string label, string group) { Id = id; Label = label; Group = group; } } internal static class PresetCatalog { private static readonly (string Id, string English, string French)[] Food = new(string, string, string)[5] { ("Stamina", "Stamina", "Endurance"), ("Health", "Health", "Santé"), ("Eitr", "Eitr", "Eitr"), ("Potions", "Potions and resistances", "Potions et résistances"), ("Bait", "Bait", "Appâts") }; private static readonly (string Id, string English, string French)[] Weapons = new(string, string, string)[14] { ("Weapons", "All weapons", "Toutes les armes"), ("Swords", "Swords", "Épées"), ("Knives", "Knives", "Couteaux"), ("Clubs", "Clubs and hammers", "Masses et marteaux"), ("Axes", "Axes", "Haches"), ("Polearms", "Polearms", "Armes d’hast"), ("Spears", "Spears", "Lances"), ("Bows", "Bows", "Arcs"), ("Crossbows", "Crossbows", "Arbalètes"), ("ElementalMagic", "Elemental magic", "Magie élémentaire"), ("BloodMagic", "Blood magic", "Magie du sang"), ("Unarmed", "Fist weapons", "Armes de poing"), ("Shield", "Shields", "Boucliers"), ("Ammo", "Ammunition", "Munitions") }; private static readonly (string Id, string English, string French)[] Damage = new(string, string, string)[8] { ("Blunt", "Blunt", "Contondant"), ("Slash", "Slash", "Tranchant"), ("Pierce", "Pierce", "Perforant"), ("Fire", "Fire", "Feu"), ("Frost", "Frost", "Gel"), ("Lightning", "Lightning", "Foudre"), ("Poison", "Poison", "Poison"), ("Spirit", "Spirit", "Esprit") }; private static readonly (string Id, string English, string French)[] Armor = new(string, string, string)[6] { ("Armor", "All armor", "Toutes les armures"), ("Helmet", "Helmets", "Casques"), ("Chest", "Chest armor", "Plastrons"), ("Legs", "Leg armor", "Jambières"), ("Hands", "Gloves", "Gants"), ("Shoulder", "Capes", "Capes") }; private static readonly (string Id, string English, string French)[] Other = new(string, string, string)[3] { ("BombsAndMisc", "Bombs and misc.", "Bombes et divers"), ("Trinket", "Trinkets", "Breloques"), ("Tool", "Tools", "Outils") }; private static readonly (string Id, string English, string French)[] Biomes = new(string, string, string)[9] { ("Meadows", "Meadows", "Prairies"), ("Black Forest", "Black Forest", "Forêt-Noire"), ("Swamp", "Swamp", "Marais"), ("Mountain", "Mountains", "Montagnes"), ("Ocean", "Ocean", "Océan"), ("Plains", "Plains", "Plaines"), ("Mistlands", "Mistlands", "Brumes"), ("Ashlands", "Ashlands", "Terres de cendres"), ("Deep North", "Deep North", "Grand Nord") }; public static IReadOnlyList<PresetOption> GetOptions(PresetStation station, HashSet<string> tags, bool french) { List<PresetOption> options = new List<PresetOption>(); if (station == PresetStation.Equipment) { Add(Weapons, french ? "Armes" : "Weapons"); Add(Damage, french ? "Types de dégâts" : "Damage types"); Add(Armor, french ? "Armures" : "Armor"); Add(Other, french ? "Autres types" : "Other types"); } else { Add(Food, french ? "Effets et usages" : "Effects and uses"); } Add(Biomes, "Biomes"); return options; void Add((string Id, string English, string French)[] entries, string group) { for (int i = 0; i < entries.Length; i++) { (string, string, string) tuple = entries[i]; if (tags.Contains(tuple.Item1)) { options.Add(new PresetOption(tuple.Item1, french ? tuple.Item3 : tuple.Item2, group)); } } } } } internal static class RecipeBiomes { public static string GetBiome(Recipe recipe) { if (!Object.op_Implicit((Object)(object)recipe)) { return null; } return RecipeProgression.GetBiome(((Object)recipe).name); } } internal enum PresetStation { None, Food, Equipment } internal static class RecipeCategories { public static PresetStation GetStation(CraftingStation station) { switch (Object.op_Implicit((Object)(object)station) ? station.m_name : null) { case "$piece_preptable": case "$piece_meadcauldron": case "$piece_cauldron": return PresetStation.Food; case "$piece_magetable": case "$piece_workbench": case "$piece_forge": case "$piece_blackforge": return PresetStation.Equipment; default: return PresetStation.None; } } public static HashSet<string> GetTags(Recipe recipe, PresetStation station) { HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); if (!Object.op_Implicit((Object)(object)recipe) || !Object.op_Implicit((Object)(object)recipe.m_item)) { return hashSet; } string biome = RecipeBiomes.GetBiome(recipe); if (biome != null) { hashSet.Add(biome); } if (station == PresetStation.Food) { AddFoodTags(recipe.m_item, hashSet); } else { AddEquipmentTags(recipe.m_item, hashSet); } return hashSet; } private static void AddFoodTags(ItemDrop item, HashSet<string> tags) { if (((Object)item).name.StartsWith("FishingBait", StringComparison.OrdinalIgnoreCase)) { tags.Add("Bait"); return; } SharedData shared = GetConsumable(item).m_itemData.m_shared; FoodPreset foodPreset = FoodPresets.FromFood(shared.m_food, shared.m_foodStamina, shared.m_foodEitr); StatusEffect consumeStatusEffect = shared.m_consumeStatusEffect; if (foodPreset == FoodPreset.None) { SE_Stats val = (SE_Stats)(object)((consumeStatusEffect is SE_Stats) ? consumeStatusEffect : null); if (val != null) { foodPreset = FoodPresets.FromEffects(val.m_healthUpFront > 0f || val.m_healthOverTime > 0f || val.m_healthPerTick > 0f || val.m_healthRegenMultiplier > 1f, val.m_staminaUpFront > 0f || val.m_staminaOverTime > 0f || val.m_staminaRegenMultiplier > 1f, val.m_eitrUpFront > 0f || val.m_eitrOverTime > 0f || val.m_eitrRegenMultiplier > 1f); } } if (foodPreset == FoodPreset.None && Object.op_Implicit((Object)(object)consumeStatusEffect)) { tags.Add("Potions"); } if ((foodPreset & FoodPreset.Stamina) != FoodPreset.None) { tags.Add("Stamina"); } if ((foodPreset & FoodPreset.Health) != FoodPreset.None) { tags.Add("Health"); } if ((foodPreset & FoodPreset.Eitr) != FoodPreset.None) { tags.Add("Eitr"); } } private static ItemDrop GetConsumable(ItemDrop item) { SharedData shared = item.m_itemData.m_shared; if (shared.m_food > 0f || shared.m_foodStamina > 0f || shared.m_foodEitr > 0f || Object.op_Implicit((Object)(object)shared.m_consumeStatusEffect)) { return item; } ZNetScene instance = ZNetScene.instance; if (!Object.op_Implicit((Object)(object)instance)) { return item; } if (((Object)item).name.StartsWith("Feast", StringComparison.Ordinal) && ((Object)item).name.EndsWith("_Material", StringComparison.Ordinal)) { string text = ((Object)item).name.Substring(0, ((Object)item).name.Length - "_Material".Length); GameObject prefab = instance.GetPrefab(text); ItemDrop val = ((prefab != null) ? prefab.GetComponent<ItemDrop>() : null); if (Object.op_Implicit((Object)(object)val)) { return val; } } GameObject prefab2 = instance.GetPrefab("fermenter"); Fermenter val2 = ((prefab2 != null) ? prefab2.GetComponent<Fermenter>() : null); if (Object.op_Implicit((Object)(object)val2)) { foreach (ItemConversion item2 in val2.m_conversion) { if (Object.op_Implicit((Object)(object)item2.m_from) && ((Object)item2.m_from).name == ((Object)item).name && Object.op_Implicit((Object)(object)item2.m_to)) { return item2.m_to; } } } GameObject prefab3 = instance.GetPrefab("piece_oven"); CookingStation val3 = ((prefab3 != null) ? prefab3.GetComponent<CookingStation>() : null); if (Object.op_Implicit((Object)(object)val3)) { foreach (ItemConversion item3 in val3.m_conversion) { if (Object.op_Implicit((Object)(object)item3.m_from) && ((Object)item3.m_from).name == ((Object)item).name && Object.op_Implicit((Object)(object)item3.m_to)) { return item3.m_to; } } } return item; } private static void AddEquipmentTags(ItemDrop item, HashSet<string> tags) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected I4, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Invalid comparison between Unknown and I4 //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Invalid comparison between Unknown and I4 //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Invalid comparison between Unknown and I4 //IL_017f: Unknown result type (might be due to invalid IL or missing references) SharedData shared = item.m_itemData.m_shared; if (((Object)item).name.StartsWith("Bomb", StringComparison.OrdinalIgnoreCase) || ((Object)item).name.StartsWith("Tankard", StringComparison.OrdinalIgnoreCase)) { tags.Add("BombsAndMisc"); return; } if (((Object)item).name == "GrapplingHook" || ((Object)item).name == "KnifeButcher") { tags.Add("Tool"); return; } ItemType itemType = shared.m_itemType; switch (itemType - 3) { case 3: case 4: case 8: case 9: case 14: tags.Add("Armor"); tags.Add(((object)Unsafe.As<ItemType, ItemType>(ref shared.m_itemType)/*cast due to .constrained prefix*/).ToString()); break; case 21: tags.Add("Trinket"); break; case 12: case 16: tags.Add("Tool"); break; case 0: case 11: case 17: case 19: if ((int)shared.m_skillType == 12 || (int)shared.m_skillType == 104 || (int)shared.m_skillType == 13) { tags.Add("Tool"); break; } if ((int)shared.m_skillType == 7 && shared.m_damages.m_chop > 0f) { tags.Add("Tool"); } AddWeaponTags(((object)Unsafe.As<SkillType, SkillType>(ref shared.m_skillType)/*cast due to .constrained prefix*/).ToString(), shared.m_damages, tags); break; case 1: AddWeaponTags(((int)shared.m_skillType == 14) ? "Crossbows" : "Bows", shared.m_damages, tags); break; case 2: AddWeaponTags("Shield", shared.m_damages, tags); break; case 6: case 20: AddWeaponTags("Ammo", shared.m_damages, tags); break; default: tags.Add("BombsAndMisc"); break; } } private static void AddWeaponTags(string type, DamageTypes damage, HashSet<string> tags) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) tags.Add("Weapons"); tags.Add(type); if (damage.m_blunt > 0f) { tags.Add("Blunt"); } if (damage.m_slash > 0f) { tags.Add("Slash"); } if (damage.m_pierce > 0f) { tags.Add("Pierce"); } if (damage.m_fire > 0f) { tags.Add("Fire"); } if (damage.m_frost > 0f) { tags.Add("Frost"); } if (damage.m_lightning > 0f) { tags.Add("Lightning"); } if (damage.m_poison > 0f) { tags.Add("Poison"); } if (damage.m_spirit > 0f) { tags.Add("Spirit"); } } } internal static class RecipeProgression { public static string GetBiome(string recipeId) { switch (recipeId) { case "Recipe_ArmorLeatherChest": case "Recipe_ArmorLeatherLegs": case "Recipe_ArmorRagsChest": case "Recipe_ArmorRagsLegs": case "Recipe_ArrowFire": case "Recipe_ArrowFlint": case "Recipe_ArrowWood": case "Recipe_AxeEarly": case "Recipe_AxeFlint": case "Recipe_Bow": case "Recipe_CapeOdin": case "Recipe_HelmetLeather": case "Recipe_HelmetOdin": case "Recipe_Hoe": case "Recipe_KnifeFlint": case "Recipe_PickaxeAntler": case "Recipe_ShieldWood": case "Recipe_ShieldWoodTower": case "Recipe_SpearFlint": case "Recipe_Tankard": case "Recipe_TankardOdin": return "Meadows"; case "Recipe_ArmorBerserkerChest": case "Recipe_ArmorBerserkerLegs": case "Recipe_ArmorBronzeChest": case "Recipe_ArmorBronzeLegs": case "Recipe_ArmorTrollLeatherChest": case "Recipe_ArmorTrollLeatherLegs": case "Recipe_ArrowBronze": case "Recipe_AtgeirBronze": case "Recipe_AxeBronze": case "Recipe_BoarJerky": case "Recipe_BowFineWood": case "Recipe_Bronze": case "Recipe_Bronze5": case "Recipe_BronzeNails": case "Recipe_CapeDeerHide": case "Recipe_CapeTrollHide": case "Recipe_CarrotSoup": case "Recipe_Cultivator": case "Recipe_DeerStew": case "Recipe_FistBjornClaw": case "Recipe_HelmetBerserker": case "Recipe_HelmetBronze": case "Recipe_HelmetCelebration": case "Recipe_HelmetTrollLeather": case "Recipe_KnifeButcher": case "Recipe_KnifeCopper": case "Recipe_MaceBronze": case "Recipe_MeadBaseHealthMinor": case "Recipe_MeadBasePoisonResist": case "Recipe_MeadBaseStaminaMinor": case "Recipe_MeadBaseTasty": case "Recipe_MinceMeatSauce": case "Recipe_PickaxeBronze": case "Recipe_PulledBear": case "Recipe_QueensJam": case "Recipe_ShieldBoneTower": case "Recipe_ShieldBronzeBuckler": case "Recipe_SledgeStagbreaker": case "Recipe_SpearBronze": case "Recipe_SwordBronze": case "Recipe_SwordWood": case "Recipe_TrinketBronzeHealth": case "Recipe_TrinketBronzeStamina": return "Black Forest"; case "Recipe_ArmorIronChest": case "Recipe_ArmorIronLegs": case "Recipe_ArmorRootChest": case "Recipe_ArmorRootLegs": case "Recipe_ArrowIron": case "Recipe_AtgeirIron": case "Recipe_AxeIron": case "Recipe_Battleaxe": case "Recipe_Blacksoup": case "Recipe_BombBlob_Poison": case "Recipe_BombBlob_PoisonElite": case "Recipe_BombOoze": case "Recipe_BowHuntsman": case "Recipe_FeastBlackforest": case "Recipe_FeastMeadows": case "Recipe_FeastSwamps": case "Recipe_Fish1": case "Recipe_FishingBaitForest": case "Recipe_FishingBaitSwamp": case "Recipe_HelmetIron": case "Recipe_HelmetRoot": case "Recipe_IronNails": case "Recipe_MaceIron": case "Recipe_MeadBaseFrostResist": case "Recipe_MeadBaseHasty": case "Recipe_MeadBaseHealthMedium": case "Recipe_MeadBaseStrength": case "Recipe_MeadBaseSwimmer": case "Recipe_PickaxeIron": case "Recipe_Sausages": case "Recipe_ShieldBanded": case "Recipe_ShieldIronBuckler": case "Recipe_ShieldIronTower": case "Recipe_ShieldRoots": case "Recipe_ShocklateSmoothie": case "Recipe_SledgeIron": case "Recipe_SpearElderbark": case "Recipe_SwordIron": case "Recipe_TankardAnniversary": case "Recipe_TrinketIronHealth": case "Recipe_TrinketIronStamina": case "Recipe_TurnipStew": return "Swamp"; case "Recipe_ArmorFenrirChest": case "Recipe_ArmorFenrirLegs": case "Recipe_ArmorWolfChest": case "Recipe_ArmorWolfLegs": case "Recipe_ArrowFrost": case "Recipe_ArrowObsidian": case "Recipe_ArrowPoison": case "Recipe_ArrowSilver": case "Recipe_Battleaxe_Crystal": case "Recipe_BombBlob_Frost": case "Recipe_BowDraugrFang": case "Recipe_CapeWolf": case "Recipe_Eyescream": case "Recipe_FeastMountains": case "Recipe_FishingBaitCave": case "Recipe_FishingBaitDeepNorth": case "Recipe_FistFenrirClaw": case "Recipe_HelmetDrake": case "Recipe_HelmetFenrir": case "Recipe_KnifeSilver": case "Recipe_MaceSilver": case "Recipe_MeadBaseBzerker": case "Recipe_MeadBaseTamer": case "Recipe_Onionsoup": case "Recipe_Scythe": case "Recipe_ShieldSilver": case "Recipe_SpearWolfFang": case "Recipe_SwordSilver": case "Recipe_TrinketSilverDamage": case "Recipe_TrinketSilverResist": case "Recipe_WolfJerky": case "Recipe_WolfSkewer": return "Mountain"; case "Recipe_FeastOceans": case "Recipe_FishingBaitOcean": case "Recipe_KnifeChitin": case "Recipe_SerpentStew": case "Recipe_ShieldSerpentscale": case "Recipe_SpearChitin": case "Recipe_TrinketChitinSwim": return "Ocean"; case "Recipe_ArmorBerserkerUndeadChest": case "Recipe_ArmorBerserkerUndeadLegs": case "Recipe_ArmorLoxChest": case "Recipe_ArmorLoxLegs": case "Recipe_ArmorPaddedCuirass": case "Recipe_ArmorPaddedGreaves": case "Recipe_ArrowNeedle": case "Recipe_AtgeirBlackmetal": case "Recipe_AxeBlackMetal": case "Recipe_BarleyWineBase": case "Recipe_Battleaxe_Blackmetal": case "Recipe_BloodPudding": case "Recipe_BombBlob_Tar": case "Recipe_Bread": case "Recipe_CapeLinen": case "Recipe_CapeLox": case "Recipe_CookedEgg": case "Recipe_Demister": case "Recipe_FeastPlains": case "Recipe_FireworksBlue": case "Recipe_FireworksCyan": case "Recipe_FireworksGreen": case "Recipe_FireworksPurple": case "Recipe_FireworksRed": case "Recipe_FireworksYellow": case "Recipe_FishWraps": case "Recipe_FishingBaitMistlands": case "Recipe_FishingBaitPlains": case "Recipe_FistUnbjornClaw": case "Recipe_HelmetBerserkerUndead": case "Recipe_HelmetLox": case "Recipe_HelmetPadded": case "Recipe_KnifeBlackmetal": case "Recipe_LoxPie": case "Recipe_MaceNeedle": case "Recipe_MeadBaseBugRepellent": case "Recipe_MeadBaseStaminaMedium": case "Recipe_SadleLox": case "Recipe_ShieldBlackmetal": case "Recipe_ShieldBlackmetalTower": case "Recipe_SwordBlackmetal": case "Recipe_TrinketBlackDamageHealth": case "Recipe_TrinketBlackStamina": case "Recipe_VikingCupcake": return "Plains"; case "Recipe_ArmorCarapaceChest": case "Recipe_ArmorCarapaceLegs": case "Recipe_ArmorMageChest": case "Recipe_ArmorMageLegs": case "Recipe_ArrowCarapace": case "Recipe_AtgeirHimminAfl": case "Recipe_AxeJotunBane": case "Recipe_Battleaxe_SkullSplittur": case "Recipe_BoltBlackmetal": case "Recipe_BoltBone": case "Recipe_BoltCarapace": case "Recipe_BoltIron": case "Recipe_BombBile": case "Recipe_BowSpineSnap": case "Recipe_CapeFeather": case "Recipe_CrossbowArbalest": case "Recipe_DvergrKey": case "Recipe_FeastMistlands": case "Recipe_FishAndBread": case "Recipe_GrapplingHook": case "Recipe_HelmetCarapace": case "Recipe_HelmetMage": case "Recipe_HoneyGlazedChicken": case "Recipe_KnifeSkollAndHati": case "Recipe_Lantern": case "Recipe_MagicallyStuffedShroom": case "Recipe_MeadBaseEitrMinor": case "Recipe_MeadBaseHealthMajor": case "Recipe_MeadBaseLightFoot": case "Recipe_MeadBaseStaminaLingering": case "Recipe_MeatPlatter": case "Recipe_MisthareSupreme": case "Recipe_MushroomOmelette": case "Recipe_PickaxeBlackMetal": case "Recipe_Salad": case "Recipe_SeekerAspic": case "Recipe_ShieldCarapace": case "Recipe_ShieldCarapaceBuckler": case "Recipe_SledgeDemolisher": case "Recipe_SpearCarapace": case "Recipe_StaffFireball": case "Recipe_StaffIceShards": case "Recipe_StaffShield": case "Recipe_StaffSkeleton": case "Recipe_SwordKrom": case "Recipe_SwordMistwalker": case "Recipe_TrinketCarapaceEitr": case "Recipe_TrinketScaleStaminaDamage": case "Recipe_YggdrasilPorridge": return "Mistlands"; case "Recipe_ArmorFlametalChest": case "Recipe_ArmorFlametalLegs": case "Recipe_ArmorMageChest_Ashlands": case "Recipe_ArmorMageLegs_Ashlands": case "Recipe_ArmorMediumChest_Ashlands": case "Recipe_ArmorMediumLegs_Ashlands": case "Recipe_ArrowCharred": case "Recipe_AxeBerzerkr": case "Recipe_AxeBerzerkr_Blood": case "Recipe_AxeBerzerkr_Lightning": case "Recipe_AxeBerzerkr_Nature": case "Recipe_Bell": case "Recipe_BoltCharred": case "Recipe_BombBlob_Lava": case "Recipe_BombLava": case "Recipe_BombSiege": case "Recipe_BombSmoke": case "Recipe_BowAshlands": case "Recipe_BowAshlands_Blood": case "Recipe_BowAshlands_Lightning": case "Recipe_BowAshlands_Nature": case "Recipe_CapeAsh": case "Recipe_CapeAsksvin": case "Recipe_CatapultPayload_Grausten": case "Recipe_CrossbowRipper": case "Recipe_CrossbowRipper_Blood": case "Recipe_CrossbowRipper_Lightning": case "Recipe_CrossbowRipper_Nature": case "Recipe_FeastAshlands": case "Recipe_FierySvinstew": case "Recipe_FishingBaitAshlands": case "Recipe_HelmetFlametal": case "Recipe_HelmetMage_Ashlands": case "Recipe_HelmetMedium_Ashlands": case "Recipe_MaceEldner": case "Recipe_MaceEldner_Blood": case "Recipe_MaceEldner_Lightning": case "Recipe_MaceEldner_Nature": case "Recipe_MarinatedGreens": case "Recipe_MashedMeat": case "Recipe_MeadBaseEitrLingering": case "Recipe_MeadBaseHealthLingering": case "Recipe_PiquantPie": case "Recipe_RoastedCrustPie": case "Recipe_SaddleAsksvin": case "Recipe_ScorchingMedley": case "Recipe_ShieldFlametal": case "Recipe_ShieldFlametalTower": case "Recipe_SizzlingBerryBroth": case "Recipe_SnowShovel": case "Recipe_SparklingShroomshake": case "Recipe_SpearSplitner": case "Recipe_SpearSplitner_Blood": case "Recipe_SpearSplitner_Lightning": case "Recipe_SpearSplitner_Nature": case "Recipe_SpiceInducedMarmalade": case "Recipe_StaffClusterbomb": case "Recipe_StaffGreenRoots": case "Recipe_StaffLightning": case "Recipe_StaffRedTroll": case "Recipe_SwordFire": case "Recipe_SwordNiedhogg": case "Recipe_SwordNiedhogg_Blood": case "Recipe_SwordNiedhogg_Lightning": case "Recipe_SwordNiedhogg_Nature": case "Recipe_SwordSlayer": case "Recipe_SwordSlayer_Blood": case "Recipe_SwordSlayer_Lightning": case "Recipe_SwordSlayer_Nature": case "Recipe_TrinketFlametalEitr": case "Recipe_TrinketFlametalStaminaHealth": return "Ashlands"; case "Recipe_ArmorGoldChest": case "Recipe_ArmorGoldChestUncooked": case "Recipe_ArmorGoldLegs": case "Recipe_ArmorGoldLegsUncooked": case "Recipe_ArmorGoldMageChest": case "Recipe_ArmorGoldMageChestUncooked": case "Recipe_ArmorGoldMageLegs": case "Recipe_ArmorGoldMageLegsUncooked": case "Recipe_ArmorGoldMediumChest": case "Recipe_ArmorGoldMediumChestUncooked": case "Recipe_ArmorGoldMediumLegs": case "Recipe_ArmorGoldMediumLegsUncooked": case "Recipe_ArrowBloodGold": case "Recipe_AtgeirGold": case "Recipe_AtgeirGoldUncooked": case "Recipe_AtgeirGold_BloodLightning": case "Recipe_AtgeirGold_FrostFire": case "Recipe_AxeGold": case "Recipe_AxeGoldUncooked": case "Recipe_AxeGold_BloodLightning": case "Recipe_AxeGold_FrostFire": case "Recipe_BakedPoteitr": case "Recipe_BattleaxeGold": case "Recipe_BattleaxeGoldUncooked": case "Recipe_BattleaxeGold_BloodLightning": case "Recipe_BattleaxeGold_FrostFire": case "Recipe_BloodGoldKeyUncooked": case "Recipe_BoltBloodGold": case "Recipe_BombBlob_Morkhalla": case "Recipe_BombDynamite": case "Recipe_BowGold": case "Recipe_BowGoldUncooked": case "Recipe_BowGold_BloodLightning": case "Recipe_BowGold_FrostFire": case "Recipe_CapeDeepNorth": case "Recipe_CapeDeepNorthMage": case "Recipe_Catapult_Ammo_BloodGold": case "Recipe_CrossbowGold": case "Recipe_CrossbowGoldUncooked": case "Recipe_CrossbowGold_BloodLightning": case "Recipe_CrossbowGold_FrostFire": case "Recipe_FeastDeepNorth": case "Recipe_FishSoup": case "Recipe_FistGold_BloodLightning": case "Recipe_FistGold_FrostFire": case "Recipe_FistweaponGold": case "Recipe_FistweaponGoldUncooked": case "Recipe_HelmetCrownOfValheim": case "Recipe_HelmetFishingHat": case "Recipe_HelmetGold": case "Recipe_HelmetGoldMage": case "Recipe_HelmetGoldMageUncooked": case "Recipe_HelmetGoldMedium": case "Recipe_HelmetGoldMediumUncooked": case "Recipe_HelmetGoldUncooked": case "Recipe_KaleChips": case "Recipe_KnifeGold": case "Recipe_KnifeGoldUncooked": case "Recipe_KnifeGold_BloodLightning": case "Recipe_KnifeGold_FrostFire": case "Recipe_LingonDricka": case "Recipe_MaceGold": case "Recipe_MaceGoldUncooked": case "Recipe_MaceGold_BloodLightning": case "Recipe_MaceGold_FrostFire": case "Recipe_MeatballsMashedPoteitr": case "Recipe_MooseKebab": case "Recipe_OatMilk": case "Recipe_OatmealLingonberryJam": case "Recipe_OvenPancake": case "Recipe_Pancakes": case "Recipe_SaddleMoose": case "Recipe_SealSoup": case "Recipe_ShieldBucklerGold": case "Recipe_ShieldBucklerGoldUncooked": case "Recipe_ShieldRoundGold": case "Recipe_ShieldRoundGoldUncooked": case "Recipe_ShieldTowerGold": case "Recipe_ShieldTowerGoldUncooked": case "Recipe_SledgeGold": case "Recipe_SledgeGoldUncooked": case "Recipe_SledgeGold_BloodLightning": case "Recipe_SledgeGold_FrostFire": case "Recipe_SmokedFish": case "Recipe_SmokedMooseMeat": case "Recipe_SpearGold": case "Recipe_SpearGoldUncooked": case "Recipe_SpearGold_BloodLightning": case "Recipe_SpearGold_FrostFire": case "Recipe_StaffFrostOrbs": case "Recipe_StaffFrostOrbs_Upgrade": case "Recipe_StaffOrbOfAhri": case "Recipe_StaffOrbOfAhri_Upgrade": case "Recipe_StaffSpiritCaller": case "Recipe_StaffSpiritCaller_Upgrade": case "Recipe_StaffThunderBlood": case "Recipe_StaffThunderBlood_Upgrade": case "Recipe_SwordGold": case "Recipe_SwordGoldUncooked": case "Recipe_SwordGold_BloodLightning": case "Recipe_SwordGold_FrostFire": case "Recipe_THSwordGold": case "Recipe_THSwordGoldUncooked": case "Recipe_THSwordGold_BloodLightning": case "Recipe_THSwordGold_FrostFire": case "Recipe_TrinketBloodGoldHealth": case "Recipe_TrinketBloodGoldStamina": return "Deep North"; default: return null; } } } internal readonly struct RecipeSearch { private readonly string text; public bool IsEmpty => string.IsNullOrEmpty(text); public RecipeSearch(string input) { text = input.Trim(); } public bool Matches(string localizedName) { if (!IsEmpty) { return localizedName.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0; } return true; } } }