feat: added support to get item durability

This commit is contained in:
Yui 2024-10-12 19:38:51 -03:00
parent ee7ff8111b
commit fd6e821f3e
Signed by: yui
GPG Key ID: F368D23A0ABA04B4
31 changed files with 2260 additions and 0 deletions

438
.gitignore vendored Normal file
View File

@ -0,0 +1,438 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Nuget personal access tokens and Credentials
nuget.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
.idea/
*.sln.iml
hub/CheckmarkThumb.png
hub/Untitled-1.png
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.swp
pids
logs
results
tmp
# Build
public/css/main.css
# Coverage reports
coverage
# API keys and secrets
.env
# Dependency directory
node_modules
bower_components
# Editors
.idea
*.iml
# OS metadata
.DS_Store
Thumbs.db
# Ignore built ts files
dist/**/*
# ignore yarn.lock
yarn.lock
Shared/*
.vscode/*
References/Managed
*.js
*.js.map

33
LootValueEX.sln Normal file
View File

@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin", "Plugin\Plugin.csproj", "{C1D4EBD1-0704-4CD5-9C28-B8AE44309458}"
EndProject
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "Server", "Server\Server.esproj", "{0E138EE5-6600-4CE5-BE8F-925E699D9776}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C1D4EBD1-0704-4CD5-9C28-B8AE44309458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1D4EBD1-0704-4CD5-9C28-B8AE44309458}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1D4EBD1-0704-4CD5-9C28-B8AE44309458}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1D4EBD1-0704-4CD5-9C28-B8AE44309458}.Release|Any CPU.Build.0 = Release|Any CPU
{0E138EE5-6600-4CE5-BE8F-925E699D9776}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E138EE5-6600-4CE5-BE8F-925E699D9776}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E138EE5-6600-4CE5-BE8F-925E699D9776}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0E138EE5-6600-4CE5-BE8F-925E699D9776}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E138EE5-6600-4CE5-BE8F-925E699D9776}.Release|Any CPU.Build.0 = Release|Any CPU
{0E138EE5-6600-4CE5-BE8F-925E699D9776}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5C855E23-C409-48AB-9372-FCF26B192E1E}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,45 @@
using EFT.InventoryLogic;
using SPT.Reflection.Utils;
using System.Text;
namespace LootValueEX.Extensions
{
internal static class ItemExtensions
{
internal static bool IsExamined(this Item? item) => item != null && ClientAppUtils.GetMainApp().GetClientBackEndSession().Profile.Examined(item);
internal static string CustomHash(this Item? item)
{
if (item == null)
return string.Empty;
string itemHashTemplate = string.Format("{0}|{1}|{2}", item.TemplateId, item.StackMaxSize, item.StackObjectsCount);
return "0";
}
internal static string AttributesToString(this Item? item)
{
if (item == null)
return String.Empty;
if (item.Attributes.IsNullOrEmpty())
return String.Empty;
StringBuilder sb = new StringBuilder();
item.Attributes.ForEach(attr => sb.Append($"\n{attr.Id}\n\tName: {attr.Name}\n\tBase Value: {attr.Base()}\n\tString value: {attr.StringValue()}\n\tDisplay Type: {attr.DisplayType()}"));
return sb.ToString();
}
internal static float GetDurability(this Item? item)
{
if (item == null)
return -1f;
try
{
return item.Attributes.Single(att => att.Id.Equals(EItemAttributeId.Durability)).Base();
}catch(InvalidOperationException)
{
return -1f;
}
}
}
}

View File

@ -0,0 +1,8 @@
namespace LootValueEX.Extensions
{
internal static class TarkovApplicationExtensions
{
internal static IEnumerable<TraderClass> GetValidTraders(this EFT.TarkovApplication client) => client.GetClientBackEndSession().DisplayableTraders;
internal static bool RagfairUnlocked(this EFT.TarkovApplication client) => client.Session.RagFair.Available;
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View File

@ -0,0 +1,52 @@
using EFT.UI;
using LootValueEX.Extensions;
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>Item durability: {GridItemTooltipPatch.HoveredItem?.GetDurability()}<br><color=#ff0fff><b>GridItemView</b></color>";
Plugin.Log.LogDebug(GridItemTooltipPatch.HoveredItem?.AttributesToString());
}
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);
}
}
}

View 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
View 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();
}
}
}

88
Plugin/Plugin.csproj Normal file
View File

@ -0,0 +1,88 @@
<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>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy &quot;$(SolutionDir)Plugin\bin\$(ConfigurationName)\net472\LootValueEX.dll&quot; &quot;G:\Games\eft-dev\BepInEx\plugins\&quot;" />
</Target>
</Project>

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace LootValueEX.Utils
{
internal class HashingUtils
{
internal static string ConvertToSha256(string value)
{
StringBuilder sb = new StringBuilder();
using (var hash = SHA256.Create())
{
Encoding encoding = Encoding.UTF8;
byte[] result = hash.ComputeHash(encoding.GetBytes(value));
foreach (byte b in result)
{
sb.Append(b.ToString("x2"));
}
}
return sb.ToString();
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
References/SPT/spt-core.dll Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
References/hollowed.dll Normal file

Binary file not shown.

14
Server/.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,14 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [ "<node_internals>/**" ],
"program": "${workspaceFolder}/app.js",
"cwd": "${workspaceFolder}",
"console": "externalTerminal"
}
]
}

16
Server/CHANGELOG.md Normal file
View File

@ -0,0 +1,16 @@
This file explains how Visual Studio created the project.
The following tools were used to generate this project:
- TypeScript Compiler (tsc)
The following steps were used to generate this project:
- Create project file (`Server.esproj`).
- Create `launch.json` to enable debugging.
- Create `nuget.config` to specify location of the JavaScript Project System SDK (which is used in the first line in `Server.esproj`).
- Install npm packages and create `tsconfig.json`: `npm init && npm i --save-dev eslint typescript @types/node && npx tsc --init --sourceMap true`.
- Create `app.ts`.
- Update `package.json` entry point.
- Update TypeScript build scripts in `package.json`.
- Create `eslint.config.js` to enable linting.
- Add project to solution.
- Write this file.

3
Server/Server.esproj Normal file
View File

@ -0,0 +1,3 @@
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.1184077">
</Project>

1
Server/app.ts Normal file
View File

@ -0,0 +1 @@
console.log('Hello world');

1168
Server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
Server/package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "LootValueEX - Server Plugin",
"version": "0.1.0",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc --build",
"clean": "tsc --build --clean"
},
"keywords": [],
"author": "",
"license": "GPL-3.0-only",
"description": "",
"devDependencies": {
"@types/node": "^22.5.2",
"eslint": "^9.9.1",
"typescript": "^5.5.4"
}
}

108
Server/tsconfig.json Normal file
View File

@ -0,0 +1,108 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./build/", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}