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 MatSilawMistBender v1.0.0
MatSilawMistBender.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; 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.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MatSilawMistBender")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MatSilawMistBender")] [assembly: AssemblyTitle("MatSilawMistBender")] [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 MatSilawMistBender { [BepInPlugin("matsilaw.MistBender", "MatSilawMistBender", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private static Plugin instance; private ConfigEntry<float> radius; private ConfigEntry<bool> active; private Harmony harmony; private FieldInfo ball; private FieldInfo owner; private FieldInfo localPlayer; private GameObject currentBall; private readonly Dictionary<ParticleSystemForceField, float> defaults = new Dictionary<ParticleSystemForceField, float>(); private void Awake() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown instance = this; active = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Apply the configured radius to your equipped wisplight. OFF restores its original range."); radius = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "End Range", 6f, new ConfigDescription("Wisplight mist-clearing radius in metres. Updates live while equipped. Original-reference range: 6–50m.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(6f, 50f), Array.Empty<object>())); try { Type type = AccessTools.TypeByName("SE_Demister"); ball = AccessTools.Field(type, "m_ballInstance"); owner = AccessTools.Field(AccessTools.TypeByName("StatusEffect"), "m_character"); localPlayer = AccessTools.Field(AccessTools.TypeByName("Player"), "m_localPlayer"); if (ball == null || owner == null || localPlayer == null) { throw new MissingFieldException("Wisplight API changed"); } harmony = new Harmony("matsilaw.MistBender"); Harmony obj = harmony; MethodInfo methodInfo = AccessTools.Method(type, "UpdateStatusEffect", new Type[1] { typeof(float) }, (Type[])null); HarmonyMethod val = new HarmonyMethod(typeof(Plugin), "UpdateRadius", (Type[])null); val.after = new string[1] { "matsilaw.GodTouch.Features" }; obj.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MatSilawMistBender ready. Equip wisplight; configure End Range (6–50m)."); } catch (Exception ex) { Harmony obj2 = harmony; if (obj2 != null) { obj2.UnpatchSelf(); } ((BaseUnityPlugin)this).Logger.LogError((object)ex); ((Behaviour)this).enabled = false; } } private static void UpdateRadius(object __instance) { Plugin plugin = instance; if (!((Object)(object)plugin == (Object)null)) { object value = plugin.localPlayer.GetValue(null); if (value != null && plugin.owner.GetValue(__instance) == value) { object? value2 = plugin.ball.GetValue(__instance); plugin.Apply((GameObject)((value2 is GameObject) ? value2 : null)); } } } private void Apply(GameObject effect) { if ((Object)(object)effect != (Object)(object)currentBall) { Restore(); currentBall = effect; if ((Object)(object)effect != (Object)null) { ParticleSystemForceField[] componentsInChildren = effect.GetComponentsInChildren<ParticleSystemForceField>(true); foreach (ParticleSystemForceField val in componentsInChildren) { defaults[val] = val.endRange; } } } foreach (KeyValuePair<ParticleSystemForceField, float> @default in defaults) { if (!((Object)(object)@default.Key == (Object)null)) { float num = (active.Value ? radius.Value : @default.Value); if (!Mathf.Approximately(@default.Key.endRange, num)) { @default.Key.endRange = num; } } } } private void Restore() { foreach (KeyValuePair<ParticleSystemForceField, float> @default in defaults) { if ((Object)(object)@default.Key != (Object)null) { @default.Key.endRange = @default.Value; } } defaults.Clear(); currentBall = null; } private void OnDestroy() { Restore(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } if ((Object)(object)instance == (Object)(object)this) { instance = null; } } } }