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
Signed by: yui
GPG Key ID: F368D23A0ABA04B4
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 SPT.Reflection.Utils;
using System.Reflection; using System.Reflection;
namespace LootValueEX.Patches namespace LootValueEX.Patches.Tooltips
{ {
/// <summary> /// <summary>
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot /// 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 SPT.Reflection.Utils;
using System.Reflection; using System.Reflection;
namespace LootValueEX.Patches namespace LootValueEX.Patches.Tooltips
{ {
/// <summary> /// <summary>
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot /// 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); protected override MethodBase GetTargetMethod() => typeof(GridItemView).GetMethod("ShowTooltip", BindingFlags.Instance | BindingFlags.Public);
internal static bool PatchTooltip { get; private set; } = false; 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] [PatchPrefix]
static void EnableTooltipPatch(GridItemView __instance) static void EnableTooltipPatch(GridItemView __instance)

View File

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

View File

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

View File

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

View File

@ -1,11 +1,11 @@
using SPT.Reflection.Patching; using SPT.Reflection.Patching;
using System.Reflection; using System.Reflection;
namespace LootValueEX.Patches namespace LootValueEX.Patches.Tooltips
{ {
internal class ItemPricePatch : ModulePatch 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, BindingFlags.Instance | BindingFlags.Public,
null, null,
[typeof(EFT.InventoryLogic.EOwnerType), typeof(string), typeof(int), typeof(string)], [typeof(EFT.InventoryLogic.EOwnerType), typeof(string), typeof(int), typeof(string)],

View File

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

View File

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

View File

@ -11,14 +11,16 @@ namespace LootValueEX
{ {
Log = base.Logger; Log = base.Logger;
new Patches.GridItemTooltipPatch().Enable(); new Patches.Tooltips.GridItemTooltipPatch().Enable();
new Patches.TooltipPatch().Enable(); new Patches.Tooltips.TooltipPatch().Enable();
new Patches.InsuranceGridPatch().Enable(); new Patches.Tooltips.InsuranceGridPatch().Enable();
new Patches.InsuranceSlotPatch().Enable(); new Patches.Tooltips.InsuranceSlotPatch().Enable();
new Patches.ItemPricePatch().Enable(); new Patches.Tooltips.ItemPricePatch().Enable();
new Patches.TradingItemPatch().Enable(); new Patches.Tooltips.TradingItemPatch().Enable();
new Patches.HandbookPatching().Enable(); new Patches.Tooltips.HandbookPatching().Enable();
new Patches.BarterItemPatch().Enable(); new Patches.Tooltips.BarterItemPatch().Enable();
new Patches.Screens.InventoryScreenPatch().Enable();
} }
} }
} }