chore: import code from github
This commit is contained in:
15
Plugin/Extensions/ItemExtensions.cs
Normal file
15
Plugin/Extensions/ItemExtensions.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using EFT.InventoryLogic;
|
||||
using SPT.Reflection.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LootValueEX.Extensions
|
||||
{
|
||||
internal static class ItemExtensions
|
||||
{
|
||||
internal static bool IsExamined(this Item? item) => item != null && ClientAppUtils.GetMainApp().GetClientBackEndSession().Profile.Examined(item);
|
||||
}
|
||||
}
|
||||
8
Plugin/Extensions/TarkovApplicationExtensions.cs
Normal file
8
Plugin/Extensions/TarkovApplicationExtensions.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace LootValueEX.Extensions
|
||||
{
|
||||
internal static class TarkovApplicationExtensions
|
||||
{
|
||||
internal static IEnumerable<TraderClass> GetValidTraders(this EFT.TarkovApplication client) => client.GetClientBackEndSession().DisplayableTraders.Where(trader => !Common.Settings.TraderBlacklistList.Contains(trader.Id.ToLower()));
|
||||
internal static bool RagfairUnlocked(this EFT.TarkovApplication client) => client.Session.RagFair.Available;
|
||||
}
|
||||
}
|
||||
34
Plugin/Patches/BarterItemPatch.cs
Normal file
34
Plugin/Patches/BarterItemPatch.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using EFT.UI;
|
||||
using EFT.UI.DragAndDrop;
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
/// <summary>
|
||||
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot
|
||||
/// </summary>
|
||||
internal class BarterItemPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod() => typeof(TradingRequisitePanel).GetMethod("method_1", BindingFlags.Instance | BindingFlags.Public);
|
||||
internal static bool PatchTooltip { get; private set; } = false;
|
||||
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
|
||||
|
||||
[PatchPrefix]
|
||||
static void EnableTooltipPatch(GClass2064 ___gclass2064_0)
|
||||
{
|
||||
//This does not check if the item has been examined since the game also show what the item is on the barter regardless
|
||||
PatchTooltip = true;
|
||||
HoveredItem = ___gclass2064_0.RequiredItem;
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
static void DisableTooltipPatch()
|
||||
{
|
||||
PatchTooltip = false;
|
||||
HoveredItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Plugin/Patches/GridItemTooltipPatch.cs
Normal file
35
Plugin/Patches/GridItemTooltipPatch.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using EFT.InventoryLogic;
|
||||
using EFT.UI.DragAndDrop;
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
/// <summary>
|
||||
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot
|
||||
/// </summary>
|
||||
internal class GridItemTooltipPatch : ModulePatch
|
||||
{
|
||||
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; }
|
||||
|
||||
[PatchPrefix]
|
||||
static void EnableTooltipPatch(GridItemView __instance)
|
||||
{
|
||||
if (!__instance.Item.IsExamined())
|
||||
return;
|
||||
PatchTooltip = true;
|
||||
HoveredItem = __instance.Item;
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
static void DisableTooltipPatch()
|
||||
{
|
||||
PatchTooltip = false;
|
||||
HoveredItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Plugin/Patches/HandbookPatching.cs
Normal file
34
Plugin/Patches/HandbookPatching.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
internal class HandbookPatching : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod() => typeof(EFT.HandBook.EntityIcon).GetMethod("method_1", BindingFlags.Public | BindingFlags.Instance);
|
||||
internal static bool PatchTooltip { get; private set; } = false;
|
||||
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
|
||||
|
||||
[PatchPrefix]
|
||||
internal static void EnableTooltipPatch(ref EFT.InventoryLogic.Item ___item_0)
|
||||
{
|
||||
if (!___item_0.IsExamined())
|
||||
return;
|
||||
|
||||
PatchTooltip = true;
|
||||
HoveredItem = ___item_0;
|
||||
}
|
||||
[PatchPostfix]
|
||||
internal static void DisableTooltipPatch()
|
||||
{
|
||||
PatchTooltip = false;
|
||||
HoveredItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Plugin/Patches/InsuranceGridPatch.cs
Normal file
28
Plugin/Patches/InsuranceGridPatch.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
class InsuranceGridPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod() => typeof(EFT.UI.Insurance.InsuranceItemView).GetMethod("OnPointerEnter", BindingFlags.Public | BindingFlags.Instance);
|
||||
internal static bool PatchTooltip { get; private set; } = false;
|
||||
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
|
||||
|
||||
[PatchPrefix]
|
||||
internal static void EnableTooltipPatch(ref EFT.InventoryLogic.Item ___item_0)
|
||||
{
|
||||
if (!___item_0.IsExamined())
|
||||
return;
|
||||
PatchTooltip = true;
|
||||
HoveredItem = ___item_0;
|
||||
}
|
||||
[PatchPostfix]
|
||||
internal static void DisableTooltipPatch()
|
||||
{
|
||||
PatchTooltip = false;
|
||||
HoveredItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Plugin/Patches/InsuranceSlotPatch.cs
Normal file
29
Plugin/Patches/InsuranceSlotPatch.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
class InsuranceSlotPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod() => typeof(EFT.UI.Insurance.InsuranceSlotItemView).GetMethod("OnPointerEnter", BindingFlags.Public | BindingFlags.Instance);
|
||||
internal static bool PatchTooltip { get; private set; } = false;
|
||||
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
|
||||
|
||||
[PatchPrefix]
|
||||
internal static void EnableTooltipPatch(EFT.UI.Insurance.InsuranceSlotItemView __instance)
|
||||
{
|
||||
if (!__instance.Item.IsExamined())
|
||||
return;
|
||||
PatchTooltip = true;
|
||||
HoveredItem = __instance.Item;
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
internal static void DisableTooltipPatch()
|
||||
{
|
||||
PatchTooltip = false;
|
||||
HoveredItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Plugin/Patches/ItemPricePatch.cs
Normal file
30
Plugin/Patches/ItemPricePatch.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using SPT.Reflection.Patching;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
internal class ItemPricePatch : ModulePatch
|
||||
{
|
||||
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)],
|
||||
null);
|
||||
internal static bool PatchTooltip { get; private set; } = false;
|
||||
|
||||
[PatchPrefix]
|
||||
internal static void EnableTooltipPatch()
|
||||
{
|
||||
if (TradingItemPatch.HoveredItem == null)
|
||||
return;
|
||||
|
||||
PatchTooltip = true;
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
internal static void DisableTooltipPatch()
|
||||
{
|
||||
PatchTooltip = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Plugin/Patches/TooltipPatch.cs
Normal file
50
Plugin/Patches/TooltipPatch.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using EFT.UI;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
internal class TooltipPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod() => typeof(SimpleTooltip).GetMethods(BindingFlags.Instance | BindingFlags.Public).Where(x => x.Name == "Show").ToList()[0];
|
||||
|
||||
[PatchPostfix]
|
||||
public static void AlterText(SimpleTooltip __instance, string text)
|
||||
{
|
||||
StackTrace stackTrace = new StackTrace();
|
||||
Plugin.Log.LogDebug("Stacktrace of tooltip call: \n" + stackTrace.ToString());
|
||||
if (GridItemTooltipPatch.PatchTooltip)
|
||||
{
|
||||
text += $"<br>TemplateID: {GridItemTooltipPatch.HoveredItem?.TemplateId}<br>Item hashsum: {GridItemTooltipPatch.HoveredItem?.GetHashSum()}<br><color=#ff0fff><b>GridItemView</b></color>";
|
||||
}
|
||||
if (InsuranceSlotPatch.PatchTooltip)
|
||||
{
|
||||
text += $"<br>TemplateID: {InsuranceSlotPatch.HoveredItem?.TemplateId}<br><color=#00ffff><b>InsuranceSlotItemView</b></color>";
|
||||
}
|
||||
if (ItemPricePatch.PatchTooltip)
|
||||
{
|
||||
text += $"<br>TemplateID: {TradingItemPatch.HoveredItem?.TemplateId}<br><color=#00ff00><b>PriceTooltip</b></color>";
|
||||
}
|
||||
if (HandbookPatching.PatchTooltip)
|
||||
{
|
||||
text += $"<br>TemplateID: {HandbookPatching.HoveredItem?.TemplateId}<br><color=#0000ff><b>EntityIcon</b></color>";
|
||||
}
|
||||
if (InsuranceGridPatch.PatchTooltip)
|
||||
{
|
||||
text += $"<br>TemplateID: {InsuranceGridPatch.HoveredItem?.TemplateId}<br><color=#21f788><b>InsuranceItemView</b></color>";
|
||||
}
|
||||
if (BarterItemPatch.PatchTooltip)
|
||||
{
|
||||
text += $"<br>TemplateID: {BarterItemPatch.HoveredItem?.TemplateId}<br><color=#ff6521><b>TradingRequisitePanel</b></color>";
|
||||
}
|
||||
__instance.SetText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Plugin/Patches/TradingItemPatch.cs
Normal file
26
Plugin/Patches/TradingItemPatch.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using LootValueEX.Extensions;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
|
||||
namespace LootValueEX.Patches
|
||||
{
|
||||
class TradingItemPatch : ModulePatch
|
||||
{
|
||||
protected override MethodBase GetTargetMethod() => typeof(EFT.UI.DragAndDrop.TradingItemView).GetMethod("ShowTooltip", BindingFlags.Instance | BindingFlags.Public);
|
||||
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
|
||||
|
||||
[PatchPrefix]
|
||||
internal static void GetHoveredItem(EFT.UI.DragAndDrop.TradingItemView __instance)
|
||||
{
|
||||
if (!__instance.Item.IsExamined())
|
||||
return;
|
||||
HoveredItem = __instance.Item;
|
||||
}
|
||||
[PatchPostfix]
|
||||
internal static void RemoveHoveredItem()
|
||||
{
|
||||
HoveredItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Plugin/Plugin.cs
Normal file
24
Plugin/Plugin.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Logging;
|
||||
|
||||
namespace LootValueEX
|
||||
{
|
||||
[BepInPlugin("pro.kaiden.lootvalueex", "LootValueEX", "0.1.0")]
|
||||
internal class Plugin : BaseUnityPlugin
|
||||
{
|
||||
internal static ManualLogSource Log { get; private set; }
|
||||
private void Awake()
|
||||
{
|
||||
Log = base.Logger;
|
||||
|
||||
new Patches.GridItemTooltipPatch().Enable();
|
||||
new Patches.TooltipPatch().Enable();
|
||||
new Patches.InsuranceGridPatch().Enable();
|
||||
new Patches.InsuranceSlotPatch().Enable();
|
||||
new Patches.ItemPricePatch().Enable();
|
||||
new Patches.TradingItemPatch().Enable();
|
||||
new Patches.HandbookPatching().Enable();
|
||||
new Patches.BarterItemPatch().Enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
91
Plugin/Plugin.csproj
Normal file
91
Plugin/Plugin.csproj
Normal file
@@ -0,0 +1,91 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>LootValueEX</AssemblyName>
|
||||
<RootNamespace>LootValueEX</RootNamespace>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AppDesignerFolder>..\Properties</AppDesignerFolder>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PhysicsModule">
|
||||
<HintPath>..\References\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>..\References\BepInEx\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="spt-common">
|
||||
<HintPath>..\References\SPT\spt-common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="spt-reflection">
|
||||
<HintPath>..\References\SPT\spt-reflection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\References\hollowed.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>..\References\BepInEx\BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort">
|
||||
<HintPath>..\References\Managed\Comfort.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Comfort.Unity, Version=1.0.0.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\Comfort.Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Serialization, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\Sirenix.Serialization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Unity.TextMeshPro, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\Unity.TextMeshPro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\References\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AssetBundleModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\References\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>..\References\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\References\Managed\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Utils\" />
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy "$(SolutionDir)Plugin\bin\$(ConfigurationName)\net472\LootValueEX.dll" "G:\Games\EFT Fika - DEV\BepInEx\plugins\"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user