First release
This commit is contained in:
parent
d98f59117b
commit
92ed9b1748
51
.gitignore
vendored
51
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
##
|
##
|
||||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.rsuser
|
*.rsuser
|
||||||
@ -23,7 +23,6 @@ mono_crash.*
|
|||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
[Ww][Ii][Nn]32/
|
|
||||||
[Aa][Rr][Mm]/
|
[Aa][Rr][Mm]/
|
||||||
[Aa][Rr][Mm]64/
|
[Aa][Rr][Mm]64/
|
||||||
bld/
|
bld/
|
||||||
@ -62,9 +61,6 @@ project.lock.json
|
|||||||
project.fragment.lock.json
|
project.fragment.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
|
|
||||||
# ASP.NET Scaffolding
|
|
||||||
ScaffoldingReadMe.txt
|
|
||||||
|
|
||||||
# StyleCop
|
# StyleCop
|
||||||
StyleCopReport.xml
|
StyleCopReport.xml
|
||||||
|
|
||||||
@ -90,7 +86,6 @@ StyleCopReport.xml
|
|||||||
*.tmp_proj
|
*.tmp_proj
|
||||||
*_wpftmp.csproj
|
*_wpftmp.csproj
|
||||||
*.log
|
*.log
|
||||||
*.tlog
|
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*.vssscc
|
*.vssscc
|
||||||
.builds
|
.builds
|
||||||
@ -143,9 +138,7 @@ _TeamCity*
|
|||||||
!.axoCover/settings.json
|
!.axoCover/settings.json
|
||||||
|
|
||||||
# Coverlet is a free, cross platform Code Coverage Tool
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
coverage*.json
|
coverage*[.json, .xml, .info]
|
||||||
coverage*.xml
|
|
||||||
coverage*.info
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
# Visual Studio code coverage results
|
||||||
*.coverage
|
*.coverage
|
||||||
@ -294,17 +287,6 @@ node_modules/
|
|||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
*.vbw
|
*.vbw
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
|
||||||
*.vbp
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
|
||||||
*.dsw
|
|
||||||
*.dsp
|
|
||||||
|
|
||||||
# Visual Studio 6 technical files
|
|
||||||
*.ncb
|
|
||||||
*.aps
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
# Visual Studio LightSwitch build output
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
@ -361,9 +343,6 @@ ASALocalRun/
|
|||||||
# Local History for Visual Studio
|
# Local History for Visual Studio
|
||||||
.localhistory/
|
.localhistory/
|
||||||
|
|
||||||
# Visual Studio History (VSHistory) files
|
|
||||||
.vshistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
# BeatPulse healthcheck temp database
|
||||||
healthchecksdb
|
healthchecksdb
|
||||||
|
|
||||||
@ -372,27 +351,5 @@ MigrationBackup/
|
|||||||
|
|
||||||
# Ionide (cross platform F# VS Code tools) working folder
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
.ionide/
|
.ionide/
|
||||||
|
.idea/
|
||||||
# Fody - auto-generated XML schema
|
*.DotSettings
|
||||||
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
|
|
||||||
*.sln.iml
|
|
||||||
|
25
src/CactusPie.ContainerQuickLoot.sln
Normal file
25
src/CactusPie.ContainerQuickLoot.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.2.32616.157
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CactusPie.ContainerQuickLoot", "CactusPie.ContainerQuickLoot\CactusPie.ContainerQuickLoot.csproj", "{9C38A2B1-5F09-49FE-AC57-9FBEF7717582}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{9C38A2B1-5F09-49FE-AC57-9FBEF7717582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9C38A2B1-5F09-49FE-AC57-9FBEF7717582}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9C38A2B1-5F09-49FE-AC57-9FBEF7717582}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9C38A2B1-5F09-49FE-AC57-9FBEF7717582}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {26F91A8D-3767-457A-821C-F66AFD620885}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
@ -0,0 +1,50 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<Version>1.1.0</Version>
|
||||||
|
<Authors>CactusPie</Authors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BepInEx.Core" Version="5.4.21">
|
||||||
|
<ExcludeAssets>runtime</ExcludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Aki.Reflection">
|
||||||
|
<HintPath>..\References\EFT_Managed\Aki.Reflection.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Assembly-CSharp">
|
||||||
|
<HintPath>..\References\EFT_Managed\Assembly-CSharp.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Comfort">
|
||||||
|
<HintPath>..\References\EFT_Managed\Comfort.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Comfort.Unity">
|
||||||
|
<HintPath>..\References\EFT_Managed\Comfort.Unity.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ItemComponent.Types">
|
||||||
|
<HintPath>..\References\EFT_Managed\ItemComponent.Types.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine">
|
||||||
|
<HintPath>..\References\EFT_Managed\UnityEngine.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.CoreModule">
|
||||||
|
<HintPath>..\References\EFT_Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.InputLegacyModule">
|
||||||
|
<HintPath>..\References\EFT_Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
31
src/CactusPie.ContainerQuickLoot/CollectionExtensions.cs
Normal file
31
src/CactusPie.ContainerQuickLoot/CollectionExtensions.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace CactusPie.ContainerQuickLoot
|
||||||
|
{
|
||||||
|
public static class CollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>Returns the only element of a sequence, or a default value if the sequence is empty or contains more than one element</summary>
|
||||||
|
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the single element of.</param>
|
||||||
|
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||||
|
/// <returns>The single element of the input sequence, or <see langword="default" />(<paramref name="TSource" />) if the sequence contains more than one or no elements.</returns>
|
||||||
|
/// <exception cref="T:System.ArgumentNullException">
|
||||||
|
/// <paramref name="source" /> is <see langword="null" />.</exception>
|
||||||
|
public static TSource SingleOrDefaultWithoutException<TSource>(this IEnumerable<TSource> source)
|
||||||
|
where TSource : class
|
||||||
|
{
|
||||||
|
TSource result = default;
|
||||||
|
|
||||||
|
foreach (TSource element in source)
|
||||||
|
{
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
src/CactusPie.ContainerQuickLoot/ContainerQuickLootPlugin.cs
Normal file
15
src/CactusPie.ContainerQuickLoot/ContainerQuickLootPlugin.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using BepInEx;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
|
namespace CactusPie.ContainerQuickLoot
|
||||||
|
{
|
||||||
|
[BepInPlugin("com.cactuspie.containerquikloot", "CactusPie.ContainerQuickLoot", "1.0.0")]
|
||||||
|
public class ContainerQuickLootPlugin : BaseUnityPlugin
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
internal void Start()
|
||||||
|
{
|
||||||
|
new QuickTransferPatch().Enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
107
src/CactusPie.ContainerQuickLoot/QuickTransferPatch.cs
Normal file
107
src/CactusPie.ContainerQuickLoot/QuickTransferPatch.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using Aki.Reflection.Patching;
|
||||||
|
using Comfort.Common;
|
||||||
|
using EFT;
|
||||||
|
using EFT.InventoryLogic;
|
||||||
|
|
||||||
|
namespace CactusPie.ContainerQuickLoot
|
||||||
|
{
|
||||||
|
public class QuickTransferPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
MethodInfo method = typeof(GClass2585).GetMethod("QuickFindAppropriatePlace", BindingFlags.Public | BindingFlags.Static);
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPostfix]
|
||||||
|
public static void PatchPostfix(
|
||||||
|
ref GStruct375<GInterface275> __result,
|
||||||
|
object __instance,
|
||||||
|
Item item,
|
||||||
|
TraderControllerClass controller,
|
||||||
|
IEnumerable<LootItemClass> targets,
|
||||||
|
GClass2585.EMoveItemOrder order,
|
||||||
|
bool simulate)
|
||||||
|
{
|
||||||
|
if (order == GClass2585.EMoveItemOrder.MoveToAnotherSide)
|
||||||
|
{
|
||||||
|
GameWorld gameWorld = Singleton<GameWorld>.Instance;
|
||||||
|
|
||||||
|
if (gameWorld == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = GetLocalPlayerFromWorld(gameWorld);
|
||||||
|
var inventory = (Inventory)typeof(Player).GetProperty("Inventory", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(player);
|
||||||
|
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ContainerCollection containerCollection = null;
|
||||||
|
|
||||||
|
Item targetContainer = inventory.Equipment.GetAllItems().FirstOrDefault(x =>
|
||||||
|
x.IsContainer &&
|
||||||
|
x.TryGetItemComponent(out TagComponent tagComponent) &&
|
||||||
|
tagComponent.Name.Contains("@loot") &&
|
||||||
|
(containerCollection = x as ContainerCollection) != null &&
|
||||||
|
containerCollection.Containers.Any(y => y.CanAccept(item)));
|
||||||
|
|
||||||
|
if (targetContainer == null || containerCollection == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (IContainer collectionContainer in containerCollection.Containers)
|
||||||
|
{
|
||||||
|
var container = collectionContainer as GClass2318;
|
||||||
|
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReSharper disable once PossibleMultipleEnumeration
|
||||||
|
if (!(targets.SingleOrDefaultWithoutException() is EquipmentClass))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GClass2580 location = container.FindLocationForItem(item);
|
||||||
|
if (location == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GStruct375<GClass2597> moveResult = GClass2585.Move(item, location, controller, simulate);
|
||||||
|
if (moveResult.Failed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!moveResult.Value.ItemsDestroyRequired)
|
||||||
|
{
|
||||||
|
__result = moveResult.Cast<GClass2597, GInterface275>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Player GetLocalPlayerFromWorld(GameWorld gameWorld)
|
||||||
|
{
|
||||||
|
if (gameWorld == null || gameWorld.MainPlayer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gameWorld.MainPlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
src/NuGet.Config
Normal file
14
src/NuGet.Config
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageRestore>
|
||||||
|
<add key="enabled" value="True" />
|
||||||
|
<add key="automatic" value="True" />
|
||||||
|
</packageRestore>
|
||||||
|
<activePackageSource>
|
||||||
|
<add key="All" value="(Aggregate source)" />
|
||||||
|
</activePackageSource>
|
||||||
|
<packageSources>
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||||
|
<add key="BepInEx" value="https://nuget.bepinex.dev/v3/index.json" protocolVersion="3" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
Loading…
x
Reference in New Issue
Block a user