This commit is contained in:
CWX 2023-10-06 18:46:03 +01:00
parent bd8cceeb6e
commit 3377384c45
12 changed files with 132 additions and 46 deletions

View File

@ -10,16 +10,12 @@ namespace CWX_AlarmChanger
public static GameObject CWX_GameObject;
public static AlarmChangerScript CWX_Component;
public void Awake()
{
CWX_GameObject = new GameObject("CWX_GameObject");
DontDestroyOnLoad(CWX_GameObject);
CWX_Component = CWX_GameObject.AddComponent<AlarmChangerScript>();
DontDestroyOnLoad(CWX_Component);
}
public void Start()
{
CWX_GameObject = new GameObject("CWX_GameObject");
CWX_Component = CWX_GameObject.AddComponent<AlarmChangerScript>();
DontDestroyOnLoad(CWX_GameObject);
new AlarmChangerPatch().Enable();
}
}

View File

@ -17,10 +17,9 @@ namespace CWX_AlarmChanger
{
var gameWorld = Singleton<GameWorld>.Instance;
if (gameWorld != null && gameWorld.MainPlayer.Location.ToLower() == "rezervbase")
{
AlarmChanger.CWX_Component.SetSounds();
}
if (gameWorld == null || gameWorld.MainPlayer.Location.ToLower() != "rezervbase") return;
AlarmChanger.CWX_Component.Init();
}
}
}

View File

@ -12,9 +12,10 @@ namespace CWX_AlarmChanger
{
private List<AudioClip> _clips = new List<AudioClip>();
public void Start()
public void Init()
{
LoadAudioFilePaths();
SetSounds();
}
public void SetSounds()

View File

@ -111,10 +111,10 @@ namespace CWX_DebuggingTool
public BotRoleAndDiffClass GetBotRoleAndDiffClass(InfoClass info)
{
var settings = info.GetType().GetField("Settings", BindingFlags.Public | BindingFlags.Instance).GetValue(info);
var settings = info.GetType().GetField("Settings", BindingFlags.Public | BindingFlags.Instance)?.GetValue(info);
var role = settings.GetType().GetField("Role", BindingFlags.Instance | BindingFlags.Public).GetValue(settings).ToString();
var diff = settings.GetType().GetField("BotDifficulty", BindingFlags.Instance | BindingFlags.Public).GetValue(settings).ToString();
var role = settings.GetType().GetField("Role", BindingFlags.Instance | BindingFlags.Public)?.GetValue(settings).ToString();
var diff = settings.GetType().GetField("BotDifficulty", BindingFlags.Instance | BindingFlags.Public)?.GetValue(settings).ToString();
return new BotRoleAndDiffClass(string.IsNullOrEmpty(role) ? "" : role, string.IsNullOrEmpty(diff) ? "" : diff);
}

View File

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aki.Reflection">
<HintPath>..\..\..\Shared\Aki.Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\Shared\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\..\..\Shared\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Comfort">
<HintPath>..\..\..\Shared\Comfort.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil">
<HintPath>..\..\..\Shared\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\Shared\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\Shared\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,14 @@
using BepInEx;
namespace CWX_LockPicking
{
[BepInPlugin("com.CWX.LockPicker", "CWX-LockPicker", "1.0.0")]
public class LockPicker : BaseUnityPlugin
{
private void Awake()
{
}
}
}

View File

@ -0,0 +1,13 @@
using System.Reflection;
using Aki.Reflection.Patching;
namespace CWX_LockPicking
{
public class LockPickerButtonPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
throw new System.NotImplementedException();
}
}
}

View File

@ -0,0 +1,22 @@
using System.Reflection;
using Aki.Reflection.Patching;
using Aki.Reflection.Utils;
using EFT.UI;
namespace CWX_LockPicking
{
public class LockPickerUIPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(ItemUiContext).GetMethod("GetItemContextInteractions", PatchConstants.PublicFlags);
}
[PatchPostfix]
private static void PostFixPatch(ref ItemInfoInteractions __result, ItemUiContext __instance,
ItemContext itemContext)
{
}
}
}

View File

@ -25,6 +25,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_GrassCutter", "CWX_Gras
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TraderScrolling", "TraderScrolling\TraderScrolling.csproj", "{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CWX_LockPicking", "CWX_LockPicking\CWX_LockPicking.csproj", "{A9363B69-7848-48FB-8562-4B694778F679}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -75,6 +77,10 @@ Global
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9FC19BC-2155-4900-B14D-2F16D13ED2DA}.Release|Any CPU.Build.0 = Release|Any CPU
{A9363B69-7848-48FB-8562-4B694778F679}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9363B69-7848-48FB-8562-4B694778F679}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9363B69-7848-48FB-8562-4B694778F679}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9363B69-7848-48FB-8562-4B694778F679}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,47 +1,45 @@
using Aki.Reflection.Patching;
using System;
using Aki.Reflection.Patching;
using EFT.InventoryLogic;
using EFT.UI.DragAndDrop;
using System.Reflection;
using EFT.UI;
using UnityEngine;
using Newtonsoft.Json;
namespace test_layout
namespace Test_layout
{
public class test_layoutPatch : ModulePatch
public class Test_layoutPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
Debug.LogError("fucker");
var methods = getMethods();
foreach (var method in methods)
{
Debug.LogError(method.Name);
}
return typeof(ContainedGridsView).GetMethod("CreateGrids", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
return typeof(ContainedGridsView).GetMethod("CreateGrids", BindingFlags.Public | BindingFlags.Static);
}
public MethodInfo[] getMethods()
{
return typeof(ContainedGridsView).GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
}
[PatchPrefix]
private static bool PatchPrefix(ref ContainedGridsView __result, Item item, ContainedGridsView containedGridsTemplate)
[PatchPostfix]
private static bool PatchPostfix(ref ContainedGridsView __result, Item item, ContainedGridsView containedGridsTemplate)
{
Debug.LogError(item.TemplateId);
if (item.TemplateId == "5648a69d4bdc2ded0b8b457b")
{
foreach (var grid in containedGridsTemplate.GridViews)
{
Debug.LogError(grid.transform.ToString());
}
if (item.TemplateId != "5648a69d4bdc2ded0b8b457b") return true;
Debug.LogError("Test!");
__result = Object.Instantiate(containedGridsTemplate);
return false;
foreach (var gridView in __result.GridViews)
{
Debug.LogError(JsonConvert.SerializeObject(gridView));
}
var test = new GridView();
test.enabled = true;
test.Grid = new GClass2317("1", 1, 2, false, false, Array.Empty<ItemFilter>(),
new LootItemClass("test", new GClass2348()));
test.IsMagnified = false;
test.name = "GridView 1";
test.tag = "Untagged";
__result.GridViews = new[] { test };
return true;
}
}

View File

@ -1,13 +1,13 @@
using BepInEx;
namespace test_layout
namespace Test_layout
{
[BepInPlugin("com.test_layout", "test_layout", "1.0.0")]
public class test_layout : BaseUnityPlugin
public class Test_layout : BaseUnityPlugin
{
private void Awake()
{
new test_layoutPatch().Enable();
new Test_layoutPatch().Enable();
}
}
}

View File

@ -18,6 +18,12 @@
<Reference Include="Comfort">
<HintPath>..\..\..\Shared\Comfort.dll</HintPath>
</Reference>
<Reference Include="ItemComponent.Types">
<HintPath>..\..\..\Shared\ItemComponent.Types.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\Shared\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\Shared\UnityEngine.dll</HintPath>
</Reference>