From ab9ca14b93bea48922c38c2b1603a4fe32ca979f Mon Sep 17 00:00:00 2001 From: IgorEisberg Date: Tue, 2 Apr 2024 10:56:51 +0300 Subject: [PATCH] Updated for client version 0.14.1.2.29197 --- .../CustomInteractions.Prepatch.csproj | 2 +- CustomInteractions.Prepatch/Prepatch.cs | 3 +- CustomInteractions/CustomInteractions.cs | 34 ++++++++----------- CustomInteractions/CustomInteractions.csproj | 5 ++- CustomInteractions/Plugin.cs | 13 +++---- ItemAttributeFix/ItemAttributeFix.csproj | 2 +- ItemAttributeFix/Plugin.cs | 2 +- ItemContextMenuExt/ItemContextMenuExt.cs | 8 ++--- ItemContextMenuExt/ItemContextMenuExt.csproj | 2 +- ItemContextMenuExt/Plugin.cs | 2 +- ItemSellPrice/ItemSellPrice.cs | 2 +- ItemSellPrice/ItemSellPrice.csproj | 2 +- ItemSellPrice/Plugin.cs | 2 +- MagazineInspector/MagazineInspector.cs | 2 +- MagazineInspector/MagazineInspector.csproj | 2 +- MagazineInspector/Plugin.cs | 2 +- .../ConfigurationManagerAttributes.cs | 2 +- MunitionsExpert/MunitionsExpert.csproj | 2 +- MunitionsExpert/Plugin.cs | 4 +-- 19 files changed, 43 insertions(+), 50 deletions(-) diff --git a/CustomInteractions.Prepatch/CustomInteractions.Prepatch.csproj b/CustomInteractions.Prepatch/CustomInteractions.Prepatch.csproj index c987699..cf5bfd2 100644 --- a/CustomInteractions.Prepatch/CustomInteractions.Prepatch.csproj +++ b/CustomInteractions.Prepatch/CustomInteractions.Prepatch.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.CustomInteractions.Prepatch - 1.3.1 + 1.4.0 IcyClawz.CustomInteractions latest diff --git a/CustomInteractions.Prepatch/Prepatch.cs b/CustomInteractions.Prepatch/Prepatch.cs index 6adcb1b..8e294ba 100644 --- a/CustomInteractions.Prepatch/Prepatch.cs +++ b/CustomInteractions.Prepatch/Prepatch.cs @@ -10,8 +10,7 @@ public static class Prepatch public static void Patch(AssemblyDefinition assembly) { - TypeDefinition type = assembly.MainModule.GetType("GClass2816"); // DynamicInteraction - type.IsSealed = false; + TypeDefinition type = assembly.MainModule.GetType("DynamicInteractionClass"); FieldDefinition field = type.Fields.SingleOrDefault(c => c.Name is "action_0"); field.IsFamily = true; field.IsInitOnly = false; diff --git a/CustomInteractions/CustomInteractions.cs b/CustomInteractions/CustomInteractions.cs index d2a9463..f607632 100644 --- a/CustomInteractions/CustomInteractions.cs +++ b/CustomInteractions/CustomInteractions.cs @@ -1,3 +1,4 @@ +using Comfort.Common; using EFT.InventoryLogic; using EFT.UI; using JetBrains.Annotations; @@ -8,8 +9,7 @@ using System.Linq; using System.Reflection; using UnityEngine; -using DynamicInteraction = GClass2816; -using EmptyInteractions = GClass2817; +using EmptyInteractionsAbstractClass = GClass3039; namespace IcyClawz.CustomInteractions; @@ -34,7 +34,7 @@ public static class CustomInteractionsManager public class CustomInteraction() { - internal readonly CustomInteractionImpl Impl = new(); + internal readonly CustomInteractionImpl Impl = new(UnityEngine.Random.Range(0, int.MaxValue).ToString("x4")); public Func Caption { get => Impl.Caption; set => Impl.Caption = value; } public Func Icon { get => Impl.Icon; set => Impl.Icon = value; } @@ -44,8 +44,7 @@ public class CustomInteraction() public Func Error { get => Impl.Error; set => Impl.Error = value; } } -internal sealed class CustomInteractionImpl() - : DynamicInteraction(UnityEngine.Random.Range(0, int.MaxValue).ToString("x4")) +internal sealed class CustomInteractionImpl(string id) : DynamicInteractionClass(id, id) { public Func Caption { get; set; } public new Func Icon { get; set; } @@ -71,32 +70,27 @@ public abstract class CustomSubInteractions(ItemUiContext uiContext) public void AddRange(IEnumerable interactions) => interactions.ExecuteForEach(Impl.AddCustomInteraction); public void Remove(CustomInteraction interaction) => Impl.RemoveCustomInteraction(interaction); public void RemoveRange(IEnumerable interactions) => interactions.ExecuteForEach(Impl.RemoveCustomInteraction); - public void CallRedraw() => Impl.CallRedraw(); - public void CallRedraw(string templateId) => Impl.CallRedraw(templateId); } -internal sealed class CustomSubInteractionsImpl(ItemUiContext uiContext) - : EmptyInteractions(uiContext) +internal sealed class CustomSubInteractionsImpl(ItemUiContext uiContext) : EmptyInteractionsAbstractClass(uiContext) { public IEnumerable CustomInteractions => DynamicInteractions.OfType(); public bool ExaminationRequiredInternal { get; set; } = true; public override bool ExaminationRequired => ExaminationRequiredInternal; public override bool HasIcons => CustomInteractions.Any(interaction => interaction.Icon is not null); - - public void CallRedraw() => itemUiContext_0.RedrawContextMenus(null); } internal static class AbstractInteractionsExtensions { - private static Dictionary GetDynamicInteractions(this GClass2817 instance) where T : Enum => - typeof(GClass2817).GetField("dictionary_1", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(instance) as Dictionary; + private static Dictionary GetDynamicInteractions(this ItemInfoInteractionsAbstractClass instance) where T : struct, Enum => + typeof(ItemInfoInteractionsAbstractClass).GetField("dictionary_0", BindingFlags.NonPublic | BindingFlags.Instance) + .GetValue(instance) as Dictionary; - public static void AddCustomInteraction(this GClass2817 instance, CustomInteraction interaction) where T : Enum => + public static void AddCustomInteraction(this ItemInfoInteractionsAbstractClass instance, CustomInteraction interaction) where T : struct, Enum => instance.GetDynamicInteractions()[interaction.Impl.Key] = interaction.Impl; - public static void RemoveCustomInteraction(this GClass2817 instance, CustomInteraction interaction) where T : Enum => + public static void RemoveCustomInteraction(this ItemInfoInteractionsAbstractClass instance, CustomInteraction interaction) where T : struct, Enum => instance.GetDynamicInteractions().Remove(interaction.Impl.Key); } @@ -121,7 +115,7 @@ internal static class InteractionButtonsContainerExtensions CurrentButtonField.SetValue(instance, button); private static readonly MethodInfo CreateButtonMethod = - typeof(InteractionButtonsContainer).GetMethod("method_1", BindingFlags.NonPublic | BindingFlags.Instance); + typeof(InteractionButtonsContainer).GetMethod("method_1", BindingFlags.Public | BindingFlags.Instance); private static SimpleContextMenuButton CreateButton(this InteractionButtonsContainer instance, string key, string caption, SimpleContextMenuButton template, RectTransform container, @@ -132,13 +126,13 @@ internal static class InteractionButtonsContainerExtensions ]); private static readonly MethodInfo CloseSubMenuMethod = - typeof(InteractionButtonsContainer).GetMethod("method_4", BindingFlags.NonPublic | BindingFlags.Instance); + typeof(InteractionButtonsContainer).GetMethod("method_4", BindingFlags.Public | BindingFlags.Instance); private static void CloseSubMenu(this InteractionButtonsContainer instance) => CloseSubMenuMethod.Invoke(instance, null); private static readonly MethodInfo AddButtonMethod = - typeof(InteractionButtonsContainer).GetMethod("method_5", BindingFlags.NonPublic | BindingFlags.Instance); + typeof(InteractionButtonsContainer).GetMethod("method_5", BindingFlags.Public | BindingFlags.Instance); private static void AddButton(this InteractionButtonsContainer instance, SimpleContextMenuButton button) => AddButtonMethod.Invoke(instance, [button]); @@ -173,7 +167,7 @@ internal static class InteractionButtonsContainerExtensions false ); button.SetButtonInteraction( - (isInteractive, impl.Error?.Invoke() ?? "") + isInteractive ? SuccessfulResult.New : new FailedResult(impl.Error?.Invoke() ?? "", 0) ); instance.AddButton(button); } diff --git a/CustomInteractions/CustomInteractions.csproj b/CustomInteractions/CustomInteractions.csproj index 85a6ed9..08f961d 100644 --- a/CustomInteractions/CustomInteractions.csproj +++ b/CustomInteractions/CustomInteractions.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.CustomInteractions - 1.3.1 + 1.4.0 IcyClawz.CustomInteractions latest @@ -18,6 +18,9 @@ ..\Shared\BepInEx.dll + + ..\Shared\Comfort.dll + ..\Shared\Sirenix.Serialization.dll diff --git a/CustomInteractions/Plugin.cs b/CustomInteractions/Plugin.cs index 7c01750..ec15f64 100644 --- a/CustomInteractions/Plugin.cs +++ b/CustomInteractions/Plugin.cs @@ -4,13 +4,9 @@ using EFT.UI; using System.Linq; using System.Reflection; -using DynamicInteraction = GClass2816; -using ItemContext = GClass2623; -using ItemInfoInteractions = GClass2817; - namespace IcyClawz.CustomInteractions; -[BepInPlugin("com.IcyClawz.CustomInteractions", "IcyClawz.CustomInteractions", "1.3.1")] +[BepInPlugin("com.IcyClawz.CustomInteractions", "IcyClawz.CustomInteractions", "1.4.0")] public class Plugin : BaseUnityPlugin { private void Awake() @@ -26,7 +22,8 @@ internal class ItemUiContextPatch : ModulePatch typeof(ItemUiContext).GetMethod("GetItemContextInteractions", BindingFlags.Public | BindingFlags.Instance); [PatchPostfix] - private static void Postfix(ref ItemInfoInteractions __result, ref ItemUiContext __instance, ItemContext itemContext) + private static void Postfix(ref ItemInfoInteractionsAbstractClass __result, + ref ItemUiContext __instance, ItemContextClass itemContext) { foreach (var provider in CustomInteractionsManager.Providers.OfType()) { @@ -42,10 +39,10 @@ internal class ItemUiContextPatch : ModulePatch internal class InteractionButtonsContainerPatch : ModulePatch { protected override MethodBase GetTargetMethod() => - typeof(InteractionButtonsContainer).GetMethod("method_3", BindingFlags.NonPublic | BindingFlags.Instance); + typeof(InteractionButtonsContainer).GetMethod("method_3", BindingFlags.Public | BindingFlags.Instance); [PatchPrefix] - private static bool Prefix(ref InteractionButtonsContainer __instance, DynamicInteraction interaction) + private static bool Prefix(ref InteractionButtonsContainer __instance, DynamicInteractionClass interaction) { if (interaction is CustomInteractionImpl impl) { diff --git a/ItemAttributeFix/ItemAttributeFix.csproj b/ItemAttributeFix/ItemAttributeFix.csproj index 0c3e0c8..da0dcb2 100644 --- a/ItemAttributeFix/ItemAttributeFix.csproj +++ b/ItemAttributeFix/ItemAttributeFix.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.ItemAttributeFix - 1.2.0 + 1.3.0 IcyClawz.ItemAttributeFix latest diff --git a/ItemAttributeFix/Plugin.cs b/ItemAttributeFix/Plugin.cs index 6648a14..50c8247 100644 --- a/ItemAttributeFix/Plugin.cs +++ b/ItemAttributeFix/Plugin.cs @@ -5,7 +5,7 @@ using System.Reflection; namespace IcyClawz.ItemAttributeFix; -[BepInPlugin("com.IcyClawz.ItemAttributeFix", "IcyClawz.ItemAttributeFix", "1.2.0")] +[BepInPlugin("com.IcyClawz.ItemAttributeFix", "IcyClawz.ItemAttributeFix", "1.3.0")] public class Plugin : BaseUnityPlugin { private void Awake() => diff --git a/ItemContextMenuExt/ItemContextMenuExt.cs b/ItemContextMenuExt/ItemContextMenuExt.cs index 54beadf..b32780a 100644 --- a/ItemContextMenuExt/ItemContextMenuExt.cs +++ b/ItemContextMenuExt/ItemContextMenuExt.cs @@ -8,8 +8,8 @@ using System.Linq; using System.Reflection; using UnityEngine; -using ILightTemplate = GInterface246; -using ResourceCache = GClass1977; +using ILightTemplate = GInterface295; +using GlobalEvents = GClass3019; namespace IcyClawz.ItemContextMenuExt; @@ -60,12 +60,12 @@ internal sealed class CustomInteractionsProvider : IItemCustomInteractionsProvid yield return new() { Caption = () => (lightComponent.IsActive ? "TurnOff" : "TurnOn").Localized(), - Icon = () => ResourceCache.Pop(IconsPrefix + (lightComponent.IsActive ? "TurnOff" : "TurnOn")), + Icon = () => CacheResourcesPopAbstractClass.Pop(IconsPrefix + (lightComponent.IsActive ? "TurnOff" : "TurnOn")), Action = () => { Singleton.Instance.PlayUISound(EUISoundType.MenuContextMenu); ComponentUtils.SetLightState(lightComponent, !lightComponent.IsActive, lightComponent.SelectedMode); - uiContext.RedrawContextMenus([item.TemplateId]); + GlobalEvents.RequestGlobalRedraw(); } }; // Switch mode diff --git a/ItemContextMenuExt/ItemContextMenuExt.csproj b/ItemContextMenuExt/ItemContextMenuExt.csproj index 99eb56c..72735d2 100644 --- a/ItemContextMenuExt/ItemContextMenuExt.csproj +++ b/ItemContextMenuExt/ItemContextMenuExt.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.ItemContextMenuExt - 1.2.1 + 1.4.0 IcyClawz.ItemContextMenuExt latest diff --git a/ItemContextMenuExt/Plugin.cs b/ItemContextMenuExt/Plugin.cs index 11bf788..488b3e2 100644 --- a/ItemContextMenuExt/Plugin.cs +++ b/ItemContextMenuExt/Plugin.cs @@ -3,7 +3,7 @@ using IcyClawz.CustomInteractions; namespace IcyClawz.ItemContextMenuExt; -[BepInPlugin("com.IcyClawz.ItemContextMenuExt", "IcyClawz.ItemContextMenuExt", "1.2.1")] +[BepInPlugin("com.IcyClawz.ItemContextMenuExt", "IcyClawz.ItemContextMenuExt", "1.4.0")] [BepInDependency("com.IcyClawz.CustomInteractions")] public class Plugin : BaseUnityPlugin { diff --git a/ItemSellPrice/ItemSellPrice.cs b/ItemSellPrice/ItemSellPrice.cs index 88630ae..7eb6486 100644 --- a/ItemSellPrice/ItemSellPrice.cs +++ b/ItemSellPrice/ItemSellPrice.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Reflection; using UnityEngine; -using CurrencyUtil = GClass2334; +using CurrencyUtil = GClass2517; namespace IcyClawz.ItemSellPrice; diff --git a/ItemSellPrice/ItemSellPrice.csproj b/ItemSellPrice/ItemSellPrice.csproj index 52060ab..1df5fe0 100644 --- a/ItemSellPrice/ItemSellPrice.csproj +++ b/ItemSellPrice/ItemSellPrice.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.ItemSellPrice - 1.2.1 + 1.3.0 IcyClawz.ItemSellPrice latest diff --git a/ItemSellPrice/Plugin.cs b/ItemSellPrice/Plugin.cs index e4d9461..72f2ede 100644 --- a/ItemSellPrice/Plugin.cs +++ b/ItemSellPrice/Plugin.cs @@ -5,7 +5,7 @@ using System.Reflection; namespace IcyClawz.ItemSellPrice; -[BepInPlugin("com.IcyClawz.ItemSellPrice", "IcyClawz.ItemSellPrice", "1.2.1")] +[BepInPlugin("com.IcyClawz.ItemSellPrice", "IcyClawz.ItemSellPrice", "1.3.0")] public class Plugin : BaseUnityPlugin { private void Awake() diff --git a/MagazineInspector/MagazineInspector.cs b/MagazineInspector/MagazineInspector.cs index 2816864..d01c866 100644 --- a/MagazineInspector/MagazineInspector.cs +++ b/MagazineInspector/MagazineInspector.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; -using InGameStatus = GClass1716; +using InGameStatus = GClass1849; namespace IcyClawz.MagazineInspector; diff --git a/MagazineInspector/MagazineInspector.csproj b/MagazineInspector/MagazineInspector.csproj index d64e652..20d2fad 100644 --- a/MagazineInspector/MagazineInspector.csproj +++ b/MagazineInspector/MagazineInspector.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.MagazineInspector - 1.2.1 + 1.3.0 IcyClawz.MagazineInspector latest diff --git a/MagazineInspector/Plugin.cs b/MagazineInspector/Plugin.cs index 60eba78..98d0149 100644 --- a/MagazineInspector/Plugin.cs +++ b/MagazineInspector/Plugin.cs @@ -4,7 +4,7 @@ using System.Reflection; namespace IcyClawz.MagazineInspector; -[BepInPlugin("com.IcyClawz.MagazineInspector", "IcyClawz.MagazineInspector", "1.2.1")] +[BepInPlugin("com.IcyClawz.MagazineInspector", "IcyClawz.MagazineInspector", "1.3.0")] public class Plugin : BaseUnityPlugin { private void Awake() => diff --git a/MunitionsExpert/ConfigurationManagerAttributes.cs b/MunitionsExpert/ConfigurationManagerAttributes.cs index 6dc8950..aa1b065 100644 --- a/MunitionsExpert/ConfigurationManagerAttributes.cs +++ b/MunitionsExpert/ConfigurationManagerAttributes.cs @@ -39,7 +39,7 @@ internal sealed class ConfigurationManagerAttributes /// Custom setting editor (OnGUI code that replaces the default editor provided by ConfigurationManager). /// See below for a deeper explanation. Using a custom drawer will cause many of the other fields to do nothing. /// - public System.Action CustomDrawer; + public System.Action CustomDrawer; /// /// Show this setting in the settings screen at all? If false, don't show. diff --git a/MunitionsExpert/MunitionsExpert.csproj b/MunitionsExpert/MunitionsExpert.csproj index ee754f4..0340f4a 100644 --- a/MunitionsExpert/MunitionsExpert.csproj +++ b/MunitionsExpert/MunitionsExpert.csproj @@ -3,7 +3,7 @@ net472 IcyClawz.MunitionsExpert - 1.2.1 + 1.3.0 IcyClawz.MunitionsExpert latest diff --git a/MunitionsExpert/Plugin.cs b/MunitionsExpert/Plugin.cs index 5db318e..e074534 100644 --- a/MunitionsExpert/Plugin.cs +++ b/MunitionsExpert/Plugin.cs @@ -13,7 +13,7 @@ using UnityEngine.UI; namespace IcyClawz.MunitionsExpert; -[BepInPlugin("com.IcyClawz.MunitionsExpert", "IcyClawz.MunitionsExpert", "1.2.1")] +[BepInPlugin("com.IcyClawz.MunitionsExpert", "IcyClawz.MunitionsExpert", "1.3.0")] public class Plugin : BaseUnityPlugin { private static ConfigEntry ColorizeSwitch { get; set; } @@ -82,7 +82,7 @@ internal class ItemViewPatch : ModulePatch typeof(ItemView).GetField("BackgroundColor", BindingFlags.NonPublic | BindingFlags.Instance); protected override MethodBase GetTargetMethod() => - typeof(ItemView).GetMethod("UpdateColor", BindingFlags.NonPublic | BindingFlags.Instance); + typeof(ItemView).GetMethod("UpdateColor", BindingFlags.Public | BindingFlags.Instance); [PatchPrefix] private static void PatchPrefix(ref ItemView __instance)