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 Valuable Vecnas Clock v1.0.0
clock22.dll
Decompiled 15 hours agousing System; 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.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; [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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("ezekiel")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("clock22")] [assembly: AssemblyTitle("clock22")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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; } } } public class VecnasClockTrap : Trap { public UnityEvent bellRingTimer; [Header("Trap Activated Animation")] [Header("Pendulum")] public Transform pendulum; private float angle = 6.25f; private bool angleLerpRev; private float angleLerp; public AnimationCurve angleCurve; private float pendulumSpeed = 0f; private float offset = 0.49f; private bool ticPlayed; private bool tocPlayed; [Header("Sounds")] public Sound Tic; private float ticVolume; public Sound Toc; private float tocVolume; public Sound Bell; private float bellVolume; private int bellRingCount; [Header("Sound Distance Settings")] public float soundMinDistance = 3f; public float soundMaxDistance = 25f; public float minVolumeAtMaxDistance = 0.05f; private float masterVolume = 2f; private Rigidbody rb; private readonly Vector3 pendulumBaseLocalPosition = new Vector3(-0.73f, 4.4f, 0f); private readonly Vector3 pendulumBaseLocalEuler = new Vector3(0.514f, -90.351f, 90.205f); private readonly Vector3 pendulumBaseLocalScale = new Vector3(17.5338f, 17.5339f, 5.881546f); private Quaternion pendulumBaseRotation; public override void Start() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Start(); ticVolume = Tic.Volume; tocVolume = Toc.Volume; bellVolume = Bell.Volume; rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)pendulum != (Object)null) { pendulum.localPosition = pendulumBaseLocalPosition; pendulum.localScale = pendulumBaseLocalScale; pendulumBaseRotation = Quaternion.Euler(pendulumBaseLocalEuler); pendulum.localRotation = pendulumBaseRotation; } } public override void Update() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Update(); UpdateDistanceVolume(); if (base.trapStart) { GrandfatherClockActivate(); } if (!angleLerpRev) { angleLerp += Time.deltaTime + pendulumSpeed * Time.deltaTime; if (angleLerp > 1f) { angleLerp = 1f; angleLerpRev = true; } } else { angleLerp -= Time.deltaTime + pendulumSpeed * Time.deltaTime; if (angleLerp < 0f) { angleLerp = 0f; angleLerpRev = false; } } float num = Mathf.Lerp(0f - angle, angle, angleCurve.Evaluate(angleLerp)); if ((Object)(object)pendulum != (Object)null) { pendulum.localRotation = pendulumBaseRotation * Quaternion.Euler(0f, 0f, num); } if (angleLerp >= 1f - offset && !ticPlayed) { PlaySoundWithDistance(Tic); ticPlayed = true; tocPlayed = false; } if (angleLerp <= 0f + offset && !tocPlayed) { PlaySoundWithDistance(Toc); tocPlayed = true; ticPlayed = false; } } private void UpdateDistanceVolume() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pendulum == (Object)null || (Object)(object)Camera.main == (Object)null) { masterVolume = 1f; } else { float num = Vector3.Distance(((Component)Camera.main).transform.position, pendulum.position); float num2 = Mathf.InverseLerp(soundMinDistance, soundMaxDistance, num); masterVolume = Mathf.Lerp(1f, minVolumeAtMaxDistance, num2); } Tic.Volume = ticVolume * masterVolume; Toc.Volume = tocVolume * masterVolume; Bell.Volume = bellVolume * masterVolume; } private void PlaySoundWithDistance(Sound sound) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) UpdateDistanceVolume(); if ((Object)(object)pendulum != (Object)null) { sound.Play(pendulum.position, 1f, 1f, 1f, 1f); } } public void GrandfatherClockBell() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (bellRingCount < 3) { PlaySoundWithDistance(Bell); base.enemyInvestigate = true; base.enemyInvestigateRange = 60f; bellRingCount++; bellRingTimer.Invoke(); GameDirector.instance.CameraImpact.ShakeDistance(5f, 6f, 12f, pendulum.position, 0.2f); } } public void GrandfatherClockActivate() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!base.trapTriggered) { PlaySoundWithDistance(Bell); base.trapTriggered = true; bellRingTimer.Invoke(); GameDirector.instance.CameraImpact.ShakeDistance(5f, 6f, 12f, pendulum.position, 0.2f); } } } namespace clock22 { [BepInPlugin("ezekiel.clock22", "clock22", "1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class clock22 : BaseUnityPlugin { internal static clock22 Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: 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_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { clock22.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { clock22.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } }