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 ZooServer v3 v0.1.5
plugins/ZooServerReclaimCompat/ZooServerReclaimCompat.dll
Decompiled 13 hours agousing System; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Bootstrap; using HarmonyLib; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] [BepInPlugin("zooserver.v3.reclaimcompat", "ZooServer Reclaim compatibility", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ZooServerReclaimCompat : BaseUnityPlugin { private static PropertyInfo holderProperty; private static MethodInfo inTabMethod; private static object cachedHolder; private static Func<bool> cachedInTab; private Harmony harmony; private void Awake() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown if (!Chainloader.PluginInfos.TryGetValue("s992.CraftFromStorage", out var value) || !Chainloader.PluginInfos.TryGetValue("Azumatt.Recycle_N_Reclaim", out var value2)) { return; } Type type = ((object)value.Instance).GetType().Assembly.GetType("CraftFromStorage.Hooks"); MethodInfo methodInfo = AccessTools.Method(type, "Active", new Type[1] { typeof(bool) }, (Type[])null); holderProperty = AccessTools.Property(((object)value2.Instance).GetType(), "RecyclingTabButtonHolder"); if (methodInfo == null || holderProperty == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Unsupported storage/reclaim version; guard not installed."); return; } inTabMethod = AccessTools.Method(holderProperty.PropertyType, "InRecycleTab", Type.EmptyTypes, (Type[])null); if (inTabMethod == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Reclaim tab detection unavailable; guard not installed."); return; } harmony = new Harmony("zooserver.v3.reclaimcompat"); harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ZooServerReclaimCompat), "StoragePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Reclaim guard installed: chest crafting is bypassed only while Reclaim tab is open."); } private static bool IsReclaimTabOpen() { object value = holderProperty.GetValue(null, null); if (value == null) { cachedHolder = null; cachedInTab = null; return false; } if (!object.ReferenceEquals(value, cachedHolder)) { cachedHolder = value; cachedInTab = (Func<bool>)Delegate.CreateDelegate(typeof(Func<bool>), value, inTabMethod); } return cachedInTab(); } public static bool Guard(bool reclaimTabOpen, ref bool result) { if (!reclaimTabOpen) { return true; } result = false; return false; } private static bool StoragePrefix(ref bool __result) { return Guard(IsReclaimTabOpen(), ref __result); } private void OnDestroy() { if (harmony != null) { harmony.UnpatchSelf(); } } }