diff --git a/Live/CWX_AlarmChanger/AlarmChanger.cs b/Live/CWX_AlarmChanger/AlarmChanger.cs index e895691..cd1d33f 100644 --- a/Live/CWX_AlarmChanger/AlarmChanger.cs +++ b/Live/CWX_AlarmChanger/AlarmChanger.cs @@ -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(); - DontDestroyOnLoad(CWX_Component); - } - public void Start() { + CWX_GameObject = new GameObject("CWX_GameObject"); + CWX_Component = CWX_GameObject.AddComponent(); + DontDestroyOnLoad(CWX_GameObject); + new AlarmChangerPatch().Enable(); } } diff --git a/Live/CWX_AlarmChanger/AlarmChangerPatch.cs b/Live/CWX_AlarmChanger/AlarmChangerPatch.cs index 47448b4..59fd4f6 100644 --- a/Live/CWX_AlarmChanger/AlarmChangerPatch.cs +++ b/Live/CWX_AlarmChanger/AlarmChangerPatch.cs @@ -17,10 +17,9 @@ namespace CWX_AlarmChanger { var gameWorld = Singleton.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(); } } } diff --git a/Live/CWX_AlarmChanger/AlarmChangerScript.cs b/Live/CWX_AlarmChanger/AlarmChangerScript.cs index fa5e0bc..b4ca853 100644 --- a/Live/CWX_AlarmChanger/AlarmChangerScript.cs +++ b/Live/CWX_AlarmChanger/AlarmChangerScript.cs @@ -12,9 +12,10 @@ namespace CWX_AlarmChanger { private List _clips = new List(); - public void Start() + public void Init() { LoadAudioFilePaths(); + SetSounds(); } public void SetSounds() diff --git a/Live/CWX_DebuggingTool/BotmonClass.cs b/Live/CWX_DebuggingTool/BotmonClass.cs index b1fdf1f..43e505a 100644 --- a/Live/CWX_DebuggingTool/BotmonClass.cs +++ b/Live/CWX_DebuggingTool/BotmonClass.cs @@ -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); } diff --git a/Live/CWX_LockPicking/CWX_LockPicking.csproj b/Live/CWX_LockPicking/CWX_LockPicking.csproj new file mode 100644 index 0000000..5cfb411 --- /dev/null +++ b/Live/CWX_LockPicking/CWX_LockPicking.csproj @@ -0,0 +1,31 @@ + + + + net472 + + + + + ..\..\..\Shared\Aki.Reflection.dll + + + ..\..\..\Shared\Assembly-CSharp.dll + + + ..\..\..\Shared\BepInEx.dll + + + ..\..\..\Shared\Comfort.dll + + + ..\..\..\Shared\Mono.Cecil.dll + + + ..\..\..\Shared\Newtonsoft.Json.dll + + + ..\..\..\Shared\UnityEngine.CoreModule.dll + + + + diff --git a/Live/CWX_LockPicking/LockPicker.cs b/Live/CWX_LockPicking/LockPicker.cs new file mode 100644 index 0000000..9e141c5 --- /dev/null +++ b/Live/CWX_LockPicking/LockPicker.cs @@ -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() + { + + } + } +} + diff --git a/Live/CWX_LockPicking/LockPickerButtonPatch.cs b/Live/CWX_LockPicking/LockPickerButtonPatch.cs new file mode 100644 index 0000000..9e0e37d --- /dev/null +++ b/Live/CWX_LockPicking/LockPickerButtonPatch.cs @@ -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(); + } + } +} \ No newline at end of file diff --git a/Live/CWX_LockPicking/LockPickerUIPatch.cs b/Live/CWX_LockPicking/LockPickerUIPatch.cs new file mode 100644 index 0000000..6711033 --- /dev/null +++ b/Live/CWX_LockPicking/LockPickerUIPatch.cs @@ -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) + { + + } + } +} \ No newline at end of file diff --git a/Live/CWX_Mods.sln b/Live/CWX_Mods.sln index e1b9ee2..d7973a1 100644 --- a/Live/CWX_Mods.sln +++ b/Live/CWX_Mods.sln @@ -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 diff --git a/Live/test-layout/patch.cs b/Live/test-layout/patch.cs index 71bd2f0..eefd1c3 100644 --- a/Live/test-layout/patch.cs +++ b/Live/test-layout/patch.cs @@ -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(), + new LootItemClass("test", new GClass2348())); + test.IsMagnified = false; + test.name = "GridView 1"; + test.tag = "Untagged"; + + __result.GridViews = new[] { test }; + return true; } } diff --git a/Live/test-layout/Class1.cs b/Live/test-layout/program.cs similarity index 55% rename from Live/test-layout/Class1.cs rename to Live/test-layout/program.cs index 5d4e9b2..457a101 100644 --- a/Live/test-layout/Class1.cs +++ b/Live/test-layout/program.cs @@ -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(); } } } diff --git a/Live/test-layout/test-layout.csproj b/Live/test-layout/test-layout.csproj index 4df0237..8f41a64 100644 --- a/Live/test-layout/test-layout.csproj +++ b/Live/test-layout/test-layout.csproj @@ -18,6 +18,12 @@ ..\..\..\Shared\Comfort.dll + + ..\..\..\Shared\ItemComponent.Types.dll + + + ..\..\..\Shared\Newtonsoft.Json.dll + ..\..\..\Shared\UnityEngine.dll