using System.Collections.Generic; using HarmonyLib; namespace NecromancerTome { /// /// Кузнечные рецепты в двух версиях (плавильня - use_smelter, лом - replace_smelter) игра разводит по настройке мира /// только в списке верстака (FilterRecipesByWorkstation) и в поиске по имени (FilterRecipesByName). Список по предмету /// (клик по иконке в окне навыка), по id и по ингредиенту показывал обе версии - 22.10.2026 на стриме рецепт оссуария /// «задвоился» (4 строки вместо 2: кровь/сок × плавильня/лом), у кузнечных урн так же. Здесь тот же фильтр, что у игры. /// Выключатель - necrosmelterfilter off. /// public static class RecipeSmelterFilter { public static bool Enabled = true; public static void Apply(List _list) { if (!Enabled || _list == null) return; _list.RemoveAll(r => r != null && r.craftingArea == "forge" && ((XUiM_Recipes.DisableSmelter && r.tags.Test_AnySet(XUiM_Recipes.useSmelterTag)) || (!XUiM_Recipes.DisableSmelter && r.tags.Test_AnySet(XUiM_Recipes.replaceSmelterTag)))); } } [HarmonyPatch(typeof(XUiM_Recipes), nameof(XUiM_Recipes.FilterRecipesByItem))] public static class Patch_XUiM_Recipes_FilterRecipesByItem_Smelter { public static void Postfix(List __result) => RecipeSmelterFilter.Apply(__result); } [HarmonyPatch(typeof(XUiM_Recipes), nameof(XUiM_Recipes.FilterRecipesByID))] public static class Patch_XUiM_Recipes_FilterRecipesByID_Smelter { public static void Postfix(List __result) => RecipeSmelterFilter.Apply(__result); } [HarmonyPatch(typeof(XUiM_Recipes), nameof(XUiM_Recipes.FilterRecipesByIngredient))] public static class Patch_XUiM_Recipes_FilterRecipesByIngredient_Smelter { public static void Postfix(List __result) => RecipeSmelterFilter.Apply(__result); } public class ConsoleCmdNecroSmelterFilter : ConsoleCmdAbstract { public override bool IsExecuteOnClient => true; public override bool AllowedInMainMenu => true; public override string[] getCommands() { return new string[] { "necrosmelterfilter" }; } public override string getDescription() { return "Necromancer's Tome: hide forge recipe versions that do not match the smelter setting in item/ingredient recipe lists."; } public override string getHelp() { return "necrosmelterfilter on|off - off: lists by item/ingredient show both forge versions, as in the base game"; } public override void Execute(List _params, CommandSenderInfo _senderInfo) { SdtdConsole con = SingletonMonoBehaviour.Instance; if (_params.Count > 0 && (_params[0] == "on" || _params[0] == "off")) RecipeSmelterFilter.Enabled = _params[0] == "on"; con.Output("necrosmelterfilter: " + (RecipeSmelterFilter.Enabled ? "on" : "off")); } } }