Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NoVehicleAutoStore v1.0.0
plugins/NoVehicleAutoStore.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("NoVehicleAutoStore")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoVehicleAutoStore")] [assembly: AssemblyTitle("NoVehicleAutoStore")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NoVehicleAutoStore { [BepInPlugin("sansara.NoVehicleAutoStore", "No Vehicle AutoStore", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "sansara.NoVehicleAutoStore"; public const string Name = "No Vehicle AutoStore"; public const string Version = "1.0.0"; private const string ServersideQoLGuid = "ArgusMagnus.ServersideQoL"; private const string AutoStoreGuid = "ArgusMagnus.ServersideQoL.AutoStore"; private const string RegistryProcessor = "ServersideQoL.Processors.ContainerRegistryProcessor"; private const string SortProcessor = "ServersideQoL.AutoStore.ContainerProcessor"; internal static ManualLogSource Log; internal static ConfigEntry<bool> ExcludeCarts; internal static ConfigEntry<bool> ExcludeShips; internal static ConfigEntry<bool> ExcludeFromAutoSort; private static PropertyInfo _prefabProperty; private static readonly HashSet<string> Logged = new HashSet<string>(); private void Awake() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ExcludeCarts = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExcludeCarts", true, "Телеги не участвуют в автоподборе ServersideQoL (с земли и эмоцией). Применяется после перезапуска."); ExcludeShips = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExcludeShips", true, "Корабли не участвуют в автоподборе ServersideQoL (с земли и эмоцией). Применяется после перезапуска."); ExcludeFromAutoSort = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExcludeFromAutoSort", true, "Исключённые телеги и корабли также не сортируются автоматически. Применяется после перезапуска."); Type type = AccessTools.TypeByName("ServersideQoL.Processor"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "InitializePrefabInfoInternal", (Type[])null, (Type[])null)); if (methodInfo == null) { Log.LogWarning((object)"ServersideQoL не найден или изменился (нет Processor.InitializePrefabInfoInternal); мод ничего не делает."); return; } _prefabProperty = AccessTools.Property(methodInfo.GetParameters()[0].ParameterType, "Prefab"); if (_prefabProperty == null) { Log.LogWarning((object)"ServersideQoL изменился (нет PrefabInfo.Prefab); мод ничего не делает."); return; } new Harmony("sansara.NoVehicleAutoStore").Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "InitializePrefabInfoPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)("Автосбор ServersideQoL отключён: телеги " + (ExcludeCarts.Value ? "да" : "нет") + ", корабли " + (ExcludeShips.Value ? "да" : "нет") + ", сортировка " + (ExcludeFromAutoSort.Value ? "да" : "нет") + ".")); } private static void InitializePrefabInfoPostfix(object __instance, object prefabInfo, ref bool __result) { if (!__result || __instance == null || prefabInfo == null) { return; } string fullName = __instance.GetType().FullName; bool flag = fullName == "ServersideQoL.Processors.ContainerRegistryProcessor"; if (!flag && (!(fullName == "ServersideQoL.AutoStore.ContainerProcessor") || !ExcludeFromAutoSort.Value)) { return; } try { object? value = _prefabProperty.GetValue(prefabInfo, null); GameObject val = (GameObject)((value is GameObject) ? value : null); if (val != null && IsExcludedVehicle(val)) { __result = false; if (Logged.Add(fullName + "|" + ((Object)val).name)) { Log.LogInfo((object)(((Object)val).name + ": исключён из " + (flag ? "автоподбора" : "автосортировки") + ".")); } } } catch (Exception arg) { Log.LogError((object)$"Ошибка проверки префаба: {arg}"); } } private static bool IsExcludedVehicle(GameObject prefab) { if (ExcludeCarts.Value && (Object)(object)prefab.GetComponentInChildren<Vagon>(true) != (Object)null) { return true; } if (ExcludeShips.Value) { return (Object)(object)prefab.GetComponentInChildren<Ship>(true) != (Object)null; } return false; } } }