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 RemoveStatusMatching v1.0.0
BepInEx/Plugins/RemoveStatusMatching.dll
Decompiled a day 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 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("RemoveStatusMatching")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RemoveStatusMatching")] [assembly: AssemblyTitle("RemoveStatusMatching")] [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 RemoveStatusMatching { [BepInPlugin("com.custom.removestatusmatching", "Remove Status Matching", "1.0.0")] public sealed class RemoveStatusMatchingPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__3_0; internal void <RegisterCommand>b__3_0(ConsoleEventArgs args) { <>c__DisplayClass3_0 CS$<>8__locals15 = new <>c__DisplayClass3_0 { args = args }; if (CS$<>8__locals15.args.Length < 2) { CS$<>8__locals15.args.Context.AddString("Usage: removestatus Timer | removestatus ^Timer | removestatus =TimerBoss [--dry-run]"); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { CS$<>8__locals15.args.Context.AddString("No local player. Dedicated server commands need an explicit player-targeting mechanism."); return; } string text = CS$<>8__locals15.args[1]; bool flag = Enumerable.Range(2, Math.Max(0, CS$<>8__locals15.args.Length - 2)).Any((int i) => string.Equals(CS$<>8__locals15.args[i], "--dry-run", StringComparison.OrdinalIgnoreCase)); if (string.IsNullOrWhiteSpace(text) || text == "^" || text == "=") { CS$<>8__locals15.args.Context.AddString("Empty search pattern."); return; } CS$<>8__locals15.mode = text[0]; CS$<>8__locals15.needle = ((CS$<>8__locals15.mode == '^' || CS$<>8__locals15.mode == '=') ? text.Substring(1) : text); SEMan sEMan = ((Character)localPlayer).GetSEMan(); List<StatusEffect> list = (from effect in sEMan.GetStatusEffects() where (Object)(object)effect != (Object)null && Matches(((Object)effect).name, CS$<>8__locals15.needle, CS$<>8__locals15.mode) select effect).ToList(); foreach (StatusEffect item in list) { CS$<>8__locals15.args.Context.AddString((flag ? "MATCH " : "REMOVE ") + ((Object)item).name); if (!flag) { sEMan.RemoveStatusEffect(item.NameHash(), false); } } CS$<>8__locals15.args.Context.AddString((flag ? "Found: " : "Removed: ") + list.Count); } } [CompilerGenerated] private sealed class <>c__DisplayClass3_0 { public ConsoleEventArgs args; public string needle; public char mode; internal bool <RegisterCommand>b__1(int i) { return string.Equals(args[i], "--dry-run", StringComparison.OrdinalIgnoreCase); } internal bool <RegisterCommand>b__2(StatusEffect effect) { return (Object)(object)effect != (Object)null && Matches(((Object)effect).name, needle, mode); } } private Harmony _harmony; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("com.custom.removestatusmatching"); _harmony.PatchAll(typeof(RemoveStatusMatchingPlugin)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Remove Status Matching loaded"); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] [HarmonyPostfix] private static void RegisterCommand() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { if (args.Length < 2) { args.Context.AddString("Usage: removestatus Timer | removestatus ^Timer | removestatus =TimerBoss [--dry-run]"); } else { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("No local player. Dedicated server commands need an explicit player-targeting mechanism."); } else { string text = args[1]; bool flag = Enumerable.Range(2, Math.Max(0, args.Length - 2)).Any((int i) => string.Equals(args[i], "--dry-run", StringComparison.OrdinalIgnoreCase)); if (string.IsNullOrWhiteSpace(text) || text == "^" || text == "=") { args.Context.AddString("Empty search pattern."); } else { char mode = text[0]; string needle = ((mode == '^' || mode == '=') ? text.Substring(1) : text); SEMan sEMan = ((Character)localPlayer).GetSEMan(); List<StatusEffect> list = (from effect in sEMan.GetStatusEffects() where (Object)(object)effect != (Object)null && Matches(((Object)effect).name, needle, mode) select effect).ToList(); foreach (StatusEffect item in list) { args.Context.AddString((flag ? "MATCH " : "REMOVE ") + ((Object)item).name); if (!flag) { sEMan.RemoveStatusEffect(item.NameHash(), false); } } args.Context.AddString((flag ? "Found: " : "Removed: ") + list.Count); } } } }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand("removestatus", "removestatus <text|^prefix|=exact> [--dry-run] - remove matching status effects from the local player", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static bool Matches(string name, string needle, char mode) { if (string.IsNullOrEmpty(name)) { return false; } return mode switch { '^' => name.StartsWith(needle, StringComparison.OrdinalIgnoreCase), '=' => string.Equals(name, needle, StringComparison.OrdinalIgnoreCase), _ => name.IndexOf(needle, StringComparison.OrdinalIgnoreCase) >= 0, }; } } }