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 SecondWalkies v4.0.0
SecondWalkies.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOJP")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.0.0.0")] [assembly: AssemblyInformationalVersion("4.0.0")] [assembly: AssemblyProduct("SecondWalkies")] [assembly: AssemblyTitle("SecondWalkies")] [assembly: AssemblyVersion("4.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 REPOJP.SecondWalkies { [BepInPlugin("REPOJP.SecondWalkies", "SecondWalkies", "4.0.0")] public sealed class SecondWalkiesPlugin : BaseUnityPlugin { public const string PluginGuid = "REPOJP.SecondWalkies"; public const string PluginName = "SecondWalkies"; public const string PluginVersion = "4.0.0"; private Harmony? _harmony; internal static ManualLogSource ModLogger { get; private set; } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown ModLogger = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("REPOJP.SecondWalkies"); try { _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SecondWalkies 4.0.0 loaded. Semibot Walkies purchase limit is 2."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to apply Harmony patches: {arg}"); _harmony.UnpatchSelf(); } } private void OnDestroy() { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal static class SecondWalkiesPatches { private const string WalkieAssetName = "Item WalkieTalkieBox"; private const string WalkieDisplayName = "Semibot Walkies"; private const int PurchaseLimit = 2; private static bool _itemFound; private static bool _missingItemLogged; [HarmonyPrefix] [HarmonyPriority(0)] [HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")] private static void ApplyPurchaseLimit() { if ((Object)(object)StatsManager.instance == (Object)null) { return; } bool flag = false; foreach (Item value in StatsManager.instance.itemDictionary.Values) { if (IsWalkieBoxItem(value)) { int num = SemiFunc.StatGetItemsPurchased(((Object)value).name); value.maxAmountInShop = Math.Min(2, num + 1); value.maxAmount = 2; flag = true; _itemFound = true; } } if (!flag && !_itemFound && !_missingItemLogged) { _missingItemLogged = true; SecondWalkiesPlugin.ModLogger.LogWarning((object)"Could not find the vanilla Semibot Walkies item. Its purchase limit was not changed."); } } [HarmonyPrefix] [HarmonyPriority(0)] [HarmonyPatch(typeof(ItemManager), "GetPurchasedItems")] private static void PreserveSecondPurchasedBox() { if ((Object)(object)StatsManager.instance == (Object)null) { return; } foreach (Item value in StatsManager.instance.itemDictionary.Values) { if (IsWalkieBoxItem(value)) { value.maxAmount = 2; } } } private static bool IsWalkieBoxItem(Item? item) { if ((Object)(object)item == (Object)null) { return false; } if (string.Equals(((Object)item).name, "Item WalkieTalkieBox", StringComparison.Ordinal) || string.Equals(item.itemName, "Semibot Walkies", StringComparison.Ordinal)) { return true; } if (item.prefab != null) { return string.Equals(((PrefabRef<GameObject>)(object)item.prefab).PrefabName, "Item WalkieTalkieBox", StringComparison.Ordinal); } return false; } } }