feat: added inventory patch, in-raid and stash

This commit is contained in:
Yui
2024-11-04 01:37:34 -03:00
parent ac5140ce24
commit fa0821686b
10 changed files with 43 additions and 18 deletions

View File

@@ -0,0 +1,23 @@
using System.Reflection;
using EFT;
using EFT.HealthSystem;
using EFT.UI;
using LootValueEX.Extensions;
using SPT.Reflection.Patching;
namespace LootValueEX.Patches.Screens
{
internal class InventoryScreenPatch : ModulePatch
{
protected override MethodBase GetTargetMethod() => typeof(InventoryScreen).GetMethods().SingleOrDefault(method => method.Name == "Show" && method.GetParameters()[0].ParameterType == typeof(IHealthController));
[PatchPostfix]
private static void PatchPostfix(ref Profile ___profile_0, ref LootItemClass ___lootItemClass)
{
___profile_0.Inventory.GetPlayerItems(EFT.InventoryLogic.EPlayerItems.Equipment).ExecuteForEach(item => Plugin.Log.LogDebug($"{item.LocalizedName()} ({item.TemplateId}): {item.GetCustomHash()}"));
if(___lootItemClass != null)
___lootItemClass.GetAllItems().ExecuteForEach(item => Plugin.Log.LogDebug($"{item.LocalizedName()} ({item.TemplateId}): {item.GetCustomHash()}"));
}
}
}

View File

@@ -5,7 +5,7 @@ using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
using System.Reflection;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
/// <summary>
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot

View File

@@ -5,7 +5,7 @@ using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
using System.Reflection;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
/// <summary>
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot
@@ -14,7 +14,7 @@ namespace LootValueEX.Patches
{
protected override MethodBase GetTargetMethod() => typeof(GridItemView).GetMethod("ShowTooltip", BindingFlags.Instance | BindingFlags.Public);
internal static bool PatchTooltip { get; private set; } = false;
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
internal static Item? HoveredItem { get; private set; }
[PatchPrefix]
static void EnableTooltipPatch(GridItemView __instance)

View File

@@ -7,7 +7,7 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
internal class HandbookPatching : ModulePatch
{

View File

@@ -2,7 +2,7 @@
using SPT.Reflection.Patching;
using System.Reflection;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
class InsuranceGridPatch : ModulePatch
{

View File

@@ -2,7 +2,7 @@
using SPT.Reflection.Patching;
using System.Reflection;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
class InsuranceSlotPatch : ModulePatch
{

View File

@@ -1,11 +1,11 @@
using SPT.Reflection.Patching;
using System.Reflection;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
internal class ItemPricePatch : ModulePatch
{
protected override MethodBase GetTargetMethod() => typeof(EFT.UI.PriceTooltip).GetMethod("Show",
protected override MethodBase GetTargetMethod() => typeof(EFT.UI.PriceTooltip).GetMethod("Show",
BindingFlags.Instance | BindingFlags.Public,
null,
[typeof(EFT.InventoryLogic.EOwnerType), typeof(string), typeof(int), typeof(string)],

View File

@@ -10,7 +10,7 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
internal class TooltipPatch : ModulePatch
{

View File

@@ -3,7 +3,7 @@ using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
using System.Reflection;
namespace LootValueEX.Patches
namespace LootValueEX.Patches.Tooltips
{
class TradingItemPatch : ModulePatch
{