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 MonsterPhobia v1.0.0
MonsterPhobia.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; 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.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("linkoid")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MonsterPhobia")] [assembly: AssemblyTitle("MonsterPhobia")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 Linkoid.Repo.MonsterPhobia { [HarmonyPatch] internal class AnimalPhobiaHelper : MonoBehaviour { private GameObject? legFrontL; private GameObject? legFrontR; private GameObject? legMidL; private GameObject? legMidR; private GameObject? legBackL; private GameObject? legBackR; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAnimalAnim), "Awake")] private static void Awake_Postfix(EnemyAnimalAnim __instance) { ((Component)__instance).gameObject.AddComponent<AnimalPhobiaHelper>(); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyAnimalAnim), "Update")] private static void Update_Postfix(EnemyAnimalAnim __instance) { Transform obj = ((Component)__instance).transform.parent.parent.Find("Audio Source"); if (obj != null) { ((Component)obj).gameObject.SetActive(MonsterPhobia.Instance.SpiderSounds.Value != SoundOverride.Mute); } } private void Awake() { FindLegs(); } private void LateUpdate() { SetLegs(MonsterPhobia.Instance.SpiderLegs.Value); } private void FindLegs() { Transform obj = ((Component)this).transform.Find("leg front L1"); legFrontL = ((obj != null) ? ((Component)obj).gameObject : null); Transform obj2 = ((Component)this).transform.Find("leg front R1"); legFrontR = ((obj2 != null) ? ((Component)obj2).gameObject : null); Transform obj3 = ((Component)this).transform.Find("leg mid L1"); legMidL = ((obj3 != null) ? ((Component)obj3).gameObject : null); Transform obj4 = ((Component)this).transform.Find("leg mid R1"); legMidR = ((obj4 != null) ? ((Component)obj4).gameObject : null); Transform obj5 = ((Component)this).transform.Find("leg back L1"); legBackL = ((obj5 != null) ? ((Component)obj5).gameObject : null); Transform obj6 = ((Component)this).transform.Find("leg back R1"); legBackR = ((obj6 != null) ? ((Component)obj6).gameObject : null); } private void SetLegs(SpiderLegCount legCount) { switch (legCount) { case SpiderLegCount.Zero: { GameObject? obj19 = legFrontL; if (obj19 != null) { obj19.SetActive(false); } GameObject? obj20 = legFrontR; if (obj20 != null) { obj20.SetActive(false); } GameObject? obj21 = legMidL; if (obj21 != null) { obj21.SetActive(false); } GameObject? obj22 = legMidR; if (obj22 != null) { obj22.SetActive(false); } GameObject? obj23 = legBackL; if (obj23 != null) { obj23.SetActive(false); } GameObject? obj24 = legBackR; if (obj24 != null) { obj24.SetActive(false); } break; } case SpiderLegCount.Two: { GameObject? obj7 = legFrontL; if (obj7 != null) { obj7.SetActive(false); } GameObject? obj8 = legFrontR; if (obj8 != null) { obj8.SetActive(false); } GameObject? obj9 = legMidL; if (obj9 != null) { obj9.SetActive(true); } GameObject? obj10 = legMidR; if (obj10 != null) { obj10.SetActive(true); } GameObject? obj11 = legBackL; if (obj11 != null) { obj11.SetActive(false); } GameObject? obj12 = legBackR; if (obj12 != null) { obj12.SetActive(false); } break; } case SpiderLegCount.Four: { GameObject? obj13 = legFrontL; if (obj13 != null) { obj13.SetActive(true); } GameObject? obj14 = legFrontR; if (obj14 != null) { obj14.SetActive(true); } GameObject? obj15 = legMidL; if (obj15 != null) { obj15.SetActive(false); } GameObject? obj16 = legMidR; if (obj16 != null) { obj16.SetActive(false); } GameObject? obj17 = legBackL; if (obj17 != null) { obj17.SetActive(true); } GameObject? obj18 = legBackR; if (obj18 != null) { obj18.SetActive(true); } break; } default: { GameObject? obj = legFrontL; if (obj != null) { obj.SetActive(true); } GameObject? obj2 = legFrontR; if (obj2 != null) { obj2.SetActive(true); } GameObject? obj3 = legMidL; if (obj3 != null) { obj3.SetActive(true); } GameObject? obj4 = legMidR; if (obj4 != null) { obj4.SetActive(true); } GameObject? obj5 = legBackL; if (obj5 != null) { obj5.SetActive(true); } GameObject? obj6 = legBackR; if (obj6 != null) { obj6.SetActive(true); } break; } } } } [HarmonyPatch] internal class BeamerPhobiaHelper : MonoBehaviour { private GameObject? clownNose; private GameObject? laserPos; private GameObject? eyeL; private GameObject? eyeR; private GameObject? mouth0; private GameObject? mouth1; private GameObject? footL; private GameObject? footR; private Vector3 originalLaserPos = new Vector3(0f, 0.48f, -0.02f); private ClownFeatures currentFeatures = ClownFeatures.All; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyBeamerAnim), "Awake")] private static void Awake_Postfix(EnemyBeamerAnim __instance) { ((Component)__instance).gameObject.AddComponent<BeamerPhobiaHelper>(); } private void Start() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) FindFeatures(); GameObject? obj = laserPos; originalLaserPos = ((obj != null) ? obj.transform.localPosition : originalLaserPos); SetFeatures(~MonsterPhobia.Instance.RemoveClownFeatures.Value); } private void Update() { ClownFeatures clownFeatures = ~MonsterPhobia.Instance.RemoveClownFeatures.Value; if (currentFeatures != clownFeatures) { SetFeatures(clownFeatures); } } private void FindFeatures() { clownNose = ((Component)this).gameObject.FindFirstChild("mesh_nose_03"); laserPos = ((Component)this).gameObject.FindFirstChild("Laser position"); eyeL = ((Component)this).gameObject.FindFirstChild("[ANIM EYE L]")?.Find("mesh_eye"); eyeR = ((Component)this).gameObject.FindFirstChild("[ANIM EYE R]")?.Find("mesh_eye"); mouth0 = ((Component)this).gameObject.FindFirstChild("mesh_mouth_attack"); mouth1 = ((Component)this).gameObject.FindFirstChild("mesh_mouth_idle"); footL = ((Component)this).gameObject.FindFirstChild("[ANIM FOOT L]")?.Find("mesh_foot"); footR = ((Component)this).gameObject.FindFirstChild("[ANIM FOOT R]")?.Find("mesh_foot"); } private void SetFeatures(ClownFeatures features) { bool flag = features.HasFlag(ClownFeatures.Nose); GameObject? obj = clownNose; if (obj != null) { obj.SetActive(false); } _ = (Object)(object)laserPos != (Object)null; bool active = features.HasFlag(ClownFeatures.Makeup); GameObject? obj2 = eyeL; if (obj2 != null) { obj2.SetActive(active); } GameObject? obj3 = eyeR; if (obj3 != null) { obj3.SetActive(active); } GameObject? obj4 = mouth0; if (obj4 != null) { ((Component)obj4.transform.parent).gameObject.SetActive(active); } bool active2 = features.HasFlag(ClownFeatures.Costume); GameObject? obj5 = footL; if (obj5 != null) { obj5.SetActive(active2); } GameObject? obj6 = footR; if (obj6 != null) { obj6.SetActive(active2); } } } [Flags] internal enum ClownFeatures { None = 0, Nose = 1, Makeup = 2, Costume = 3, All = -1 } internal static class GameObjectExtensions { public static GameObject? Find(this GameObject parent, string name) { Transform obj = parent.transform.Find(name); if (obj == null) { return null; } return ((Component)obj).gameObject; } public static GameObject? FindFirstChild(this GameObject parent, string name) { Transform? obj = parent.transform.FindFirstChild(name); if (obj == null) { return null; } return ((Component)obj).gameObject; } public static Transform? FindFirstChild(this Transform parent, string name) { Queue<Transform> queue = new Queue<Transform>(); queue.Enqueue(parent); while (queue.Count > 0) { parent = queue.Dequeue(); Transform val = parent.Find(name); if ((Object)(object)val != (Object)null) { return val; } int childCount = parent.childCount; for (int i = 0; i < childCount; i++) { queue.Enqueue(parent.GetChild(i)); } } return null; } } [BepInPlugin("Linkoid.Repo.MonsterPhobia", "Monster Phobia", "1.0")] public class MonsterPhobia : BaseUnityPlugin { internal ConfigEntry<SpiderLegCount> SpiderLegs; internal ConfigEntry<SoundOverride> SpiderSounds; internal ConfigEntry<ClownFeatures> RemoveClownFeatures; internal static MonsterPhobia Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00a0: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; SpiderLegs = ((BaseUnityPlugin)this).Config.Bind<SpiderLegCount>("Arachnophobia", "SpiderLegs", SpiderLegCount.Two, (ConfigDescription)null); SpiderSounds = ((BaseUnityPlugin)this).Config.Bind<SoundOverride>("Arachnophobia", "SpiderSounds", SoundOverride.Unchanged, (ConfigDescription)null); RemoveClownFeatures = ((BaseUnityPlugin)this).Config.Bind<ClownFeatures>("Coulrophobia", "RemoveClownFeatures", ClownFeatures.None, (ConfigDescription)null); if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } } internal enum SoundOverride { Unchanged, Mute } internal enum SpiderLegCount { Zero = 0, Two = 2, Four = 4, Six = 6, All = int.MaxValue } [HarmonyPatch] internal class UpscreamPhobiaHelper : MonoBehaviour { private GameObject? handL; private GameObject? handR; private GameObject? footL; private GameObject? footR; private GameObject? legFrontL; private GameObject? legFrontR; private GameObject? legBackL; private GameObject? legBackR; private SpiderLegCount currentLegCount; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyUpscreamAnim), "Awake")] private static void Awake_Postfix(EnemyUpscreamAnim __instance) { ((Component)__instance).gameObject.AddComponent<UpscreamPhobiaHelper>(); } private void Awake() { FindLegs(); SetLegs(SpiderLegCount.Two); } private void Update() { SpiderLegCount spiderLegCount = SpiderLegCount.Two; if (spiderLegCount != currentLegCount) { SetLegs(spiderLegCount); } } private void FindLegs() { handL = ((Component)((Component)this).transform.FindFirstChild("leg_front_03_L")).gameObject; handR = ((Component)((Component)this).transform.FindFirstChild("leg_front_03_R")).gameObject; footL = ((Component)((Component)this).transform.FindFirstChild("leg_back_03_L")).gameObject; footR = ((Component)((Component)this).transform.FindFirstChild("leg_back_03_R")).gameObject; legFrontL = ((Component)((Component)this).transform.FindFirstChild("leg_front_01_L")).gameObject; legFrontR = ((Component)((Component)this).transform.FindFirstChild("leg_front_01_R")).gameObject; legBackL = ((Component)((Component)this).transform.FindFirstChild("leg_back_01_L")).gameObject; legBackR = ((Component)((Component)this).transform.FindFirstChild("leg_back_01_R")).gameObject; } private void SetLegs(SpiderLegCount legCount) { currentLegCount = legCount; switch (legCount) { case SpiderLegCount.Zero: { GameObject? obj17 = handL; if (obj17 != null) { obj17.SetActive(true); } GameObject? obj18 = handR; if (obj18 != null) { obj18.SetActive(true); } GameObject? obj19 = legFrontL; if (obj19 != null) { obj19.SetActive(false); } GameObject? obj20 = legFrontR; if (obj20 != null) { obj20.SetActive(false); } GameObject? obj21 = footL; if (obj21 != null) { obj21.SetActive(false); } GameObject? obj22 = footR; if (obj22 != null) { obj22.SetActive(false); } GameObject? obj23 = legBackL; if (obj23 != null) { obj23.SetActive(false); } GameObject? obj24 = legBackR; if (obj24 != null) { obj24.SetActive(false); } break; } case SpiderLegCount.Two: { GameObject? obj9 = handL; if (obj9 != null) { obj9.SetActive(true); } GameObject? obj10 = handR; if (obj10 != null) { obj10.SetActive(true); } GameObject? obj11 = legFrontL; if (obj11 != null) { obj11.SetActive(true); } GameObject? obj12 = legFrontR; if (obj12 != null) { obj12.SetActive(true); } GameObject? obj13 = footL; if (obj13 != null) { obj13.SetActive(false); } GameObject? obj14 = footR; if (obj14 != null) { obj14.SetActive(false); } GameObject? obj15 = legBackL; if (obj15 != null) { obj15.SetActive(false); } GameObject? obj16 = legBackR; if (obj16 != null) { obj16.SetActive(false); } break; } default: { GameObject? obj = handL; if (obj != null) { obj.SetActive(true); } GameObject? obj2 = handR; if (obj2 != null) { obj2.SetActive(true); } GameObject? obj3 = legFrontL; if (obj3 != null) { obj3.SetActive(true); } GameObject? obj4 = legFrontR; if (obj4 != null) { obj4.SetActive(true); } GameObject? obj5 = footL; if (obj5 != null) { obj5.SetActive(true); } GameObject? obj6 = footR; if (obj6 != null) { obj6.SetActive(true); } GameObject? obj7 = legBackL; if (obj7 != null) { obj7.SetActive(true); } GameObject? obj8 = legBackR; if (obj8 != null) { obj8.SetActive(true); } break; } } } } }