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 DisableItemsInShop v1.1.0
DisableItemsInShop.dll
Decompiled 8 hours agousing System; 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DisableItemsInShop")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DisableItemsInShop")] [assembly: AssemblyTitle("DisableItemsInShop")] [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 DisableItemsInShop { [BepInPlugin("ozoka.disableitemsinshop", "DisableItemsInShop", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static Plugin Instance; internal static ConfigEntry<bool> ShopDisableExplosives; internal static ConfigEntry<bool> ShopDisableCartWeapons; internal static ConfigEntry<bool> ShopDisableGuns; internal static ConfigEntry<bool> ShopDisableMelees; internal static ConfigEntry<bool> ShopDisableDrones; internal static ConfigEntry<bool> ShopDisableOrbs; internal static ConfigEntry<bool> ShopDisableRubberDuck; internal static ConfigEntry<bool> ShopDisableStaffZeroGravity; internal static ConfigEntry<bool> ShopDisableStaffVoid; internal static ConfigEntry<bool> ShopDisableStaffTorque; internal static ConfigEntry<bool> LobbyDisableExplosives; internal static ConfigEntry<bool> LobbyDisableCartWeapons; internal static ConfigEntry<bool> LobbyDisableGuns; internal static ConfigEntry<bool> LobbyDisableMelees; internal static ConfigEntry<bool> LobbyDisableDrones; internal static ConfigEntry<bool> LobbyDisableOrbs; internal static ConfigEntry<bool> LobbyDisableRubberDuck; internal static ConfigEntry<bool> LobbyDisableStaffZeroGravity; internal static ConfigEntry<bool> LobbyDisableStaffVoid; internal static ConfigEntry<bool> LobbyDisableStaffTorque; private readonly Harmony _harmony = new Harmony("ozoka.disableitemsinshop"); private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; ShopDisableExplosives = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Explosives", true, "Disables grenades and mines in the shop."); ShopDisableCartWeapons = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Cart Weapons", true, "Disables cart cannons and cart lasers in the shop."); ShopDisableGuns = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Guns", false, "Disables guns in the shop."); ShopDisableMelees = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Melees", false, "Disables melee weapons in the shop."); ShopDisableDrones = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Drones", false, "Disables drones in the shop."); ShopDisableOrbs = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Orbs", false, "Disables orbs in the shop."); ShopDisableRubberDuck = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Rubber Duck", false, "Disables the rubber duck in the shop."); ShopDisableStaffZeroGravity = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Zero Gravity Staff", false, "Disables the Zero Gravity Staff in the shop."); ShopDisableStaffVoid = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Void Staff", false, "Disables the Void Staff in the shop."); ShopDisableStaffTorque = ((BaseUnityPlugin)this).Config.Bind<bool>("Shop", "Disable Roll Staff", false, "Disables the Roll Staff in the shop."); LobbyDisableExplosives = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Explosives", true, "Disables grenades and mines in the lobby."); LobbyDisableCartWeapons = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Cart Weapons", true, "Disables cart cannons and cart lasers in the lobby."); LobbyDisableGuns = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Guns", false, "Disables guns in the lobby."); LobbyDisableMelees = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Melees", false, "Disables melee weapons in the lobby."); LobbyDisableDrones = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Drones", false, "Disables drones in the lobby."); LobbyDisableOrbs = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Orbs", false, "Disables orbs in the lobby."); LobbyDisableRubberDuck = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Rubber Duck", false, "Disables the rubber duck in the lobby."); LobbyDisableStaffZeroGravity = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Zero Gravity Staff", false, "Disables the Zero Gravity Staff in the lobby."); LobbyDisableStaffVoid = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Void Staff", false, "Disables the Void Staff in the lobby."); LobbyDisableStaffTorque = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "Disable Roll Staff", false, "Disables the Roll Staff in the lobby."); Log.LogInfo((object)"DisableItemsInShop 1.1.0 geladen!"); _harmony.PatchAll(); } internal static bool ShouldDisable(string itemName) { bool flag = SemiFunc.RunIsShop(); bool flag2 = SemiFunc.RunIsLobby(); if (!flag && !flag2) { return false; } bool flag3 = (flag ? ShopDisableExplosives.Value : LobbyDisableExplosives.Value); bool flag4 = (flag ? ShopDisableCartWeapons.Value : LobbyDisableCartWeapons.Value); bool flag5 = (flag ? ShopDisableGuns.Value : LobbyDisableGuns.Value); bool flag6 = (flag ? ShopDisableMelees.Value : LobbyDisableMelees.Value); bool flag7 = (flag ? ShopDisableDrones.Value : LobbyDisableDrones.Value); bool flag8 = (flag ? ShopDisableOrbs.Value : LobbyDisableOrbs.Value); bool flag9 = (flag ? ShopDisableRubberDuck.Value : LobbyDisableRubberDuck.Value); bool flag10 = (flag ? ShopDisableStaffZeroGravity.Value : LobbyDisableStaffZeroGravity.Value); bool flag11 = (flag ? ShopDisableStaffVoid.Value : LobbyDisableStaffVoid.Value); bool flag12 = (flag ? ShopDisableStaffTorque.Value : LobbyDisableStaffTorque.Value); if (flag3 && (itemName.StartsWith("Item Grenade") || itemName.StartsWith("Item Mine"))) { return true; } if (flag4 && (itemName.StartsWith("Item Cart Cannon") || itemName.StartsWith("Item Cart Laser"))) { return true; } if (flag5 && itemName.StartsWith("Item Gun")) { return true; } if (flag7 && itemName.StartsWith("Item Drone")) { return true; } if (flag8 && itemName.StartsWith("Item Orb")) { return true; } if (flag9 && itemName.StartsWith("Item Rubber Duck")) { return true; } if (flag10 && itemName.StartsWith("Item Staff Zero Gravity")) { return true; } if (flag11 && itemName.StartsWith("Item Staff Void")) { return true; } if (flag12 && itemName.StartsWith("Item Staff Torque")) { return true; } return false; } internal static bool ShouldDisableStaff(string itemName) { bool flag = SemiFunc.RunIsShop(); bool flag2 = SemiFunc.RunIsLobby(); if (!flag && !flag2) { return false; } if (itemName.StartsWith("Item Staff Zero Gravity")) { return flag ? ShopDisableStaffZeroGravity.Value : LobbyDisableStaffZeroGravity.Value; } if (itemName.StartsWith("Item Staff Void")) { return flag ? ShopDisableStaffVoid.Value : LobbyDisableStaffVoid.Value; } if (itemName.StartsWith("Item Staff Torque")) { return flag ? ShopDisableStaffTorque.Value : LobbyDisableStaffTorque.Value; } return false; } } [HarmonyPatch(typeof(ItemToggle))] internal class ItemTogglePatch { [HarmonyPatch("Start")] [HarmonyPostfix] internal static void StartPatch(ItemToggle __instance) { string name = ((Object)__instance).name; if (Plugin.ShouldDisable(name)) { __instance.ToggleDisable(true); Plugin.Log.LogInfo((object)("[DisableItemsInShop] Deaktiviert: " + name)); } } } [HarmonyPatch(typeof(ItemGun))] internal class ItemGunPatch { [HarmonyPatch("Misfire")] [HarmonyPrefix] internal static bool MisfirePatch(ItemGun __instance) { bool flag = SemiFunc.RunIsShop(); bool flag2 = SemiFunc.RunIsLobby(); if (!flag && !flag2) { return true; } bool flag3 = (flag ? Plugin.ShopDisableGuns.Value : Plugin.LobbyDisableGuns.Value); return !flag3; } } [HarmonyPatch(typeof(ItemMelee))] internal class ItemMeleePatch { [HarmonyPatch("Update")] [HarmonyPrefix] internal static bool UpdatePatch(ItemMelee __instance) { bool flag = SemiFunc.RunIsShop(); bool flag2 = SemiFunc.RunIsLobby(); if (!flag && !flag2) { return true; } bool flag3 = (flag ? Plugin.ShopDisableMelees.Value : Plugin.LobbyDisableMelees.Value); return !flag3; } } [HarmonyPatch(typeof(ItemRubberDuck))] internal class ItemRubberDuckPatch { [HarmonyPatch("Quack")] [HarmonyPrefix] internal static bool QuackPatch(ItemRubberDuck __instance) { bool flag = SemiFunc.RunIsShop(); bool flag2 = SemiFunc.RunIsLobby(); if (!flag && !flag2) { return true; } bool flag3 = (flag ? Plugin.ShopDisableRubberDuck.Value : Plugin.LobbyDisableRubberDuck.Value); return !flag3; } } [HarmonyPatch(typeof(ItemStaffZeroGravity))] internal class ItemStaffZeroGravityPatch { [HarmonyPatch("CastSpell")] [HarmonyPrefix] internal static bool CastSpellPatch(ItemStaffZeroGravity __instance) { string name = ((Object)__instance).name; return !Plugin.ShouldDisableStaff(name); } } [HarmonyPatch(typeof(ItemStaffVoid))] internal class ItemStaffVoidPatch { [HarmonyPatch("CastSpell")] [HarmonyPrefix] internal static bool CastSpellPatch(ItemStaffVoid __instance) { string name = ((Object)__instance).name; return !Plugin.ShouldDisableStaff(name); } } [HarmonyPatch(typeof(ItemStaffTorque))] internal class ItemStaffTorquePatch { [HarmonyPatch("CastSpell")] [HarmonyPrefix] internal static bool CastSpellPatch(ItemStaffTorque __instance) { string name = ((Object)__instance).name; return !Plugin.ShouldDisableStaff(name); } } }