empty slot linked search
This commit is contained in:
55
Patches/FleaSlotSearchPatches.cs
Normal file
55
Patches/FleaSlotSearchPatches.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using EFT.UI.Ragfair;
|
||||
using HarmonyLib;
|
||||
using SPT.Reflection.Patching;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace UIFixes
|
||||
{
|
||||
public static class FleaSlotSearchPatches
|
||||
{
|
||||
public static void Enable()
|
||||
{
|
||||
new HandbookWorkaroundPatch().Enable();
|
||||
}
|
||||
|
||||
public class HandbookWorkaroundPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(RagFairClass), nameof(RagFairClass.method_24));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
public static void Prefix(GClass3219[] searches, ref string __state, HandbookClass ___handbookClass)
|
||||
{
|
||||
if (!Settings.EnableSlotSearch.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GClass3219 search = searches.FirstOrDefault(s => s.Type == EFilterType.LinkedSearch && s.StringValue.Contains(":"));
|
||||
if (search != null)
|
||||
{
|
||||
__state = search.StringValue.Split(':')[0];
|
||||
___handbookClass[__state].Data.Id = search.StringValue;
|
||||
searches[searches.IndexOf(search)] = new GClass3219(EFilterType.LinkedSearch, __state, search.Add);
|
||||
}
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void Postfix(ref string __state, HandbookClass ___handbookClass)
|
||||
{
|
||||
if (!Settings.EnableSlotSearch.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (__state != null)
|
||||
{
|
||||
___handbookClass[__state].Data.Id = __state;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user