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 Drake FX Fix v0.2.3
plugins/DrakeFxFix.dll
Decompiled 5 days 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 BepInEx.Logging; using DrakeFxFix.Logic; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("DrakeFxFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.3.0")] [assembly: AssemblyInformationalVersion("0.2.3+65bf6aa3c2ffd2b49ad138bda6bef8f460818fd4")] [assembly: AssemblyProduct("DrakeFxFix")] [assembly: AssemblyTitle("DrakeFxFix")] [assembly: AssemblyVersion("0.2.3.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 DrakeFxFix { [BepInPlugin("aznan.valheim.drakefxfix", "DrakeFxFix", "0.2.3")] public class Plugin : BaseUnityPlugin { internal const string Version = "0.2.3"; internal static ManualLogSource Log; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> FullLogging; internal static string[] Blocked = new string[0]; private void Awake() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; NameFilter.SelfCheck(); Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Remove the particles of the objects listed in BlockedNames."); ConfigEntry<string> names = ((BaseUnityPlugin)this).Config.Bind<string>("General", "BlockedNames", "hatchling_cold_projectile,vfx_ColdBall", "Comma-separated, case-insensitive parts of projectile/effect names whose particles are removed."); Blocked = NameFilter.Parse(names.Value); names.SettingChanged += delegate { Blocked = NameFilter.Parse(names.Value); }; ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogMatches", false, "Old name of FullLogging."); bool value = val.Value; ((BaseUnityPlugin)this).Config.Remove(((ConfigEntryBase)val).Definition); FullLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "FullLogging", false, "True = the BepInEx log gets every projectile/effect name seen, to find other effects to add to BlockedNames. False = only loading, version and errors. Default false."); if (value) { FullLogging.Value = true; } new Harmony("aznan.valheim.drakefxfix").PatchAll(); Log.LogInfo((object)"DrakeFxFix 0.2.3 loaded"); } } } namespace DrakeFxFix.Patches { internal static class ParticleStripper { private static readonly HashSet<string> Logged = new HashSet<string>(); internal static void Strip(GameObject go) { bool value = Plugin.Enabled.Value; bool flag = value && NameFilter.Matches(((Object)go).name, Plugin.Blocked); int num = 0; if (flag) { ParticleSystem[] componentsInChildren = go.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val in componentsInChildren) { val.Stop(true, (ParticleSystemStopBehavior)0); if ((Object)(object)((Component)val).gameObject != (Object)(object)go) { ((Component)val).gameObject.SetActive(false); } num++; } } if (Plugin.FullLogging.Value && Logged.Add(((Object)go).name + (flag ? "|blocked" : (value ? "|kept" : "|off")))) { Plugin.Log.LogInfo((object)(flag ? $"{((Object)go).name}: {num} particle system(s) removed (in BlockedNames)" : ("seen: " + ((Object)go).name + " (" + (value ? "not in BlockedNames, kept" : "mod off, kept") + ")"))); } } } [HarmonyPatch(typeof(Projectile), "Awake")] internal static class ProjectileAwakePatch { private static void Postfix(Projectile __instance) { ParticleStripper.Strip(((Component)__instance).gameObject); } } [HarmonyPatch(typeof(EffectList), "Create")] internal static class EffectListCreatePatch { private static void Postfix(GameObject[] __result) { if (__result == null) { return; } foreach (GameObject val in __result) { if (Object.op_Implicit((Object)(object)val)) { ParticleStripper.Strip(val); } } } } } namespace DrakeFxFix.Logic { public static class NameFilter { public static string[] Parse(string csv) { return (from s in (csv ?? "").Split(new char[1] { ',' }) select s.Trim() into s where s.Length > 0 select s).ToArray(); } public static bool Matches(string name, string[] blocked) { if (!string.IsNullOrEmpty(name)) { return blocked.Any((string b) => name.IndexOf(b, StringComparison.OrdinalIgnoreCase) >= 0); } return false; } public static void SelfCheck() { string[] array = Parse(" hatchling_cold_projectile, ,vfx_ColdBall "); if (array.Length != 2 || !Matches("hatchling_cold_projectile(Clone)", array) || !Matches("VFX_COLDBALL(Clone)", array) || Matches("Hatchling", array) || Matches(null, array)) { throw new InvalidOperationException("NameFilter is wrong."); } } } }