- Resolve foot level loot check

- Add new patch to disallow dragging quest items into your inventory. Can be collected with Ctrl+Click
- Update version
This commit is contained in:
DrakiaXYZ
2024-04-22 22:37:15 -07:00
parent bd6984557f
commit 71ef6f4fc6
5 changed files with 64 additions and 28 deletions

View File

@@ -0,0 +1,41 @@
using Aki.Reflection.Patching;
using EFT.InventoryLogic;
using EFT.UI.DragAndDrop;
using HarmonyLib;
using System.Linq;
using System.Reflection;
namespace DrakiaXYZ.LootRadius.Patches
{
internal class QuestItemDragPatch : ModulePatch
{
private static FieldInfo _itemOwnerField;
protected override MethodBase GetTargetMethod()
{
_itemOwnerField = AccessTools.GetDeclaredFields(typeof(GridView)).Single(x => x.FieldType == typeof(IItemOwner));
return typeof(GridView).GetMethod(nameof(GridView.CanDrag));
}
[PatchPrefix]
public static bool PatchPrefix(GridView __instance, ref bool __result, ItemContextAbstractClass itemContext)
{
// If not the RadiusStash GridView, run original
IItemOwner gridOwner = _itemOwnerField.GetValue(__instance) as IItemOwner;
if (gridOwner.ID != "RadiusStash")
{
return true;
}
// If this is a quest item, return false
if (itemContext.Item.QuestItem)
{
__result = false;
return false;
}
// Otherwise allow original function to run
return true;
}
}
}