clear filters on searchbar enter
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using EFT.UI.Ragfair;
|
||||
using EFT.UI;
|
||||
using EFT.UI.Ragfair;
|
||||
using HarmonyLib;
|
||||
using SPT.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
@@ -18,6 +19,8 @@ public static class FixFleaPatches
|
||||
|
||||
new OfferItemFixMaskPatch().Enable();
|
||||
new OfferViewTweaksPatch().Enable();
|
||||
|
||||
new SearchPatch().Enable();
|
||||
}
|
||||
|
||||
public class DoNotToggleOnMouseOverPatch : ModulePatch
|
||||
@@ -95,4 +98,35 @@ public static class FixFleaPatches
|
||||
timeLeft.childControlWidth = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class SearchPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(RagfairCategoriesPanel), nameof(RagfairCategoriesPanel.method_9));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
public static bool Prefix(RagfairCategoriesPanel __instance, string arg)
|
||||
{
|
||||
if (!Settings.ClearFiltersOnSearch.Value)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (arg.StartsWith("#") || __instance.Ragfair == null || __instance.EViewListType_0 != EViewListType.AllOffers)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
__instance.Ragfair.CancellableFilters.Clear();
|
||||
|
||||
FilterRule filterRule = __instance.Ragfair.method_3(EViewListType.AllOffers);
|
||||
filterRule.HandbookId = string.Empty;
|
||||
|
||||
__instance.Ragfair.AddSearchesInRule(filterRule, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
Settings.cs
10
Settings.cs
@@ -117,6 +117,7 @@ internal class Settings
|
||||
public static ConfigEntry<bool> EnableSlotSearch { get; set; }
|
||||
public static ConfigEntry<bool> ShowRequiredQuest { get; set; }
|
||||
public static ConfigEntry<bool> AutoExpandCategories { get; set; }
|
||||
public static ConfigEntry<bool> ClearFiltersOnSearch { get; set; }
|
||||
public static ConfigEntry<bool> KeepAddOfferOpen { get; set; }
|
||||
public static ConfigEntry<KeyboardShortcut> PurchaseAllKeybind { get; set; }
|
||||
public static ConfigEntry<bool> KeepAddOfferOpenIgnoreMaxOffers { get; set; } // Advanced
|
||||
@@ -663,6 +664,15 @@ internal class Settings
|
||||
null,
|
||||
new ConfigurationManagerAttributes { })));
|
||||
|
||||
configEntries.Add(ClearFiltersOnSearch = config.Bind(
|
||||
FleaMarketSection,
|
||||
"Clear Filters on Search",
|
||||
true,
|
||||
new ConfigDescription(
|
||||
"Pressing Enter after typing in the flea search bar will clear non-default filters",
|
||||
null,
|
||||
new ConfigurationManagerAttributes { })));
|
||||
|
||||
configEntries.Add(ShowRequiredQuest = config.Bind(
|
||||
FleaMarketSection,
|
||||
"Show Required Quest for Locked Offers",
|
||||
|
Reference in New Issue
Block a user