diff --git a/.gitignore b/.gitignore
index 97ea84d..c15ec8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -398,4 +398,5 @@ FodyWeavers.xsd
# JetBrains Rider
*.sln.iml
-/libs
\ No newline at end of file
+/libs
+.idea
diff --git a/Patches/MultiSelectPatches.cs b/Patches/MultiSelectPatches.cs
index af99c0c..93080c3 100644
--- a/Patches/MultiSelectPatches.cs
+++ b/Patches/MultiSelectPatches.cs
@@ -13,9 +13,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
+using UIFixes.util;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
+using FleaRequirement = GClass1859;
namespace UIFixes;
@@ -174,6 +176,8 @@ public static class MultiSelectPatches
public class ItemViewClickPatch : ModulePatch
{
+ private static ISession Session => ClientAppUtils.GetMainApp().GetClientBackEndSession();
+
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(GridItemView), nameof(GridItemView.OnClick));
@@ -191,6 +195,10 @@ public static class MultiSelectPatches
bool shiftDown = Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift);
bool altDown = Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt);
+ if (shiftDown && altDown) {
+ SellAllToFlea();
+ }
+
if (ctrlDown && !shiftDown && !altDown)
{
QuickMove(__instance, ___ItemUiContext, ___ItemController);
@@ -205,7 +213,7 @@ public static class MultiSelectPatches
if (shiftDown)
{
- // Nothing to do, mousedown handled it.
+ // Nothing to do, mousedown handled it.
return true;
}
@@ -274,6 +282,32 @@ public static class MultiSelectPatches
}
}
}
+
+ public static void SellAllToFlea() {
+ foreach (DragItemContext selectedItemContext in MultiSelect.SortedItemContexts()) {
+ try {
+ SellToFlea(selectedItemContext.Item);
+ }
+ catch (Exception e) {
+ Console.WriteLine("Oopsie!");
+ Console.WriteLine(e);
+ }
+ }
+ }
+
+ private static void SellToFlea(Item item) {
+ double? fleaPrice = FleaPriceCache.FetchPrice(item.TemplateId);
+ Console.WriteLine("Flea price for " + item.Name + ":" + fleaPrice);
+
+ if (fleaPrice.HasValue) {
+ var req = new FleaRequirement {
+ count = (int)(fleaPrice.Value * 1.4),
+ _tpl = "5449016a4bdc2d6f028b456f"
+ };
+ Console.WriteLine("Selling " + item.Name + " for " + req.count + " roubl");
+ Session.RagFair.AddOffer(false, [item.Id], [req], null);
+ }
+ }
}
public class ContextActionsPatch : ModulePatch
@@ -1110,7 +1144,7 @@ public static class MultiSelectPatches
}
}
- // Reimplement this method because BSG ignores the operation that is passed in and re-does the entire logic,
+ // Reimplement this method because BSG ignores the operation that is passed in and re-does the entire logic,
// like the dumb assholes they are
public class TradingTableGetHighlightColorPatch : ModulePatch
{
@@ -1217,7 +1251,7 @@ public static class MultiSelectPatches
}
// This is an insane way of doing this, but inside of the above method, I want ItemAddress.Equals to always return false, to allow
- // same place moves.
+ // same place moves.
public class AllowFindSameSpotPatch : ModulePatch
{
public static bool DisableItemAddressEquals = false;
diff --git a/UIFixes.csproj b/UIFixes.csproj
index 915d242..dd139ca 100644
--- a/UIFixes.csproj
+++ b/UIFixes.csproj
@@ -15,8 +15,7 @@
- ..\..\..\..\SPT\3.9.2-debug
- ..\..\..\..\SPT\3.9.2
+ C:\Games\Escape from Tarkov\Escape from Tarkov
@@ -83,6 +82,18 @@
+
+
+
+
+
+
+
+
+
+
+
+