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 MoreGuns v1.0.0
MoreGuns.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreWeapons")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoreWeapons")] [assembly: AssemblyTitle("MoreWeapons")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } } namespace MoItems { [BepInPlugin("me.brunson.MoreGuns", "MoreGuns", "1.0.0")] public class MoreItems : BaseUnityPlugin { [HarmonyPatch(typeof(Resources), "LoadAll", new Type[] { typeof(string), typeof(Type) })] private class Patch_Items { private static void Postfix(string path, Type systemTypeInstance, ref Object[] __result) { if (systemTypeInstance != typeof(Item) || path != "Items/Items") { return; } foreach (Item item in __result.OfType<Item>()) { if (gunConfigs.ContainsKey(item.itemName)) { ConfigEntry<int> val = gunConfigs[item.itemName]; item.maxAmount = val.Value; item.maxAmountInShop = val.Value; Debug.Log((object)$"patched {item.itemName}, {val.Value}"); } } } } public const string modGUID = "me.brunson.MoreGuns"; public const string modName = "MoreGuns"; public const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("me.brunson.MoreGuns"); private static string[] itemNames = new string[8] { "Gun", "Shotgun", "Tranq Gun", "Pulse Pistol", "Photon Blaster", "Boltzap", "C.A.R.T. Cannon", "C.A.R.T. Laser" }; private static Dictionary<string, ConfigEntry<int>> gunConfigs = new Dictionary<string, ConfigEntry<int>>(); private static string category = "Max Number of Guns"; private static int defaultValue = 2; private static ConfigDescription description = new ConfigDescription("The max number of this gun allowed in the game. (0 = none allowed)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()); public void Awake() { string[] array = itemNames; foreach (string text in array) { ConfigEntry<int> value = ((BaseUnityPlugin)this).Config.Bind<int>(category, text, defaultValue, description); gunConfigs[text] = value; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreGuns loaded"); } } }