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 EternalNight v1.0.0
EternalNight/EternalNight.dll
Decompiled 10 months 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 GlobalSettings; using HutongGames.PlayMaker; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; 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("EternalNight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EternalNight")] [assembly: AssemblyTitle("EternalNight")] [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace EternalNight { [BepInPlugin("me.cometcake575.eternalnight", "EternalNight", "1.0.0")] public class EternalNightPlugin : BaseUnityPlugin { private class CustomBlackThreadState : BlackThreadState { public BlackThreadAttack customAttack; public bool instantThread; private void Start() { if (!CustomStart()) { ((Behaviour)this).enabled = false; return; } base.attacks = (BlackThreadAttack[])(object)new BlackThreadAttack[1] { customAttack }; ((BlackThreadState)this).SetupThreaded(true); } private bool CustomStart() { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) ((BlackThreadState)this).GetSingFsm(); if (!Object.op_Implicit((Object)(object)base.singFsm)) { tk2dSpriteAnimator component = ((Component)this).GetComponent<tk2dSpriteAnimator>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } string name = (component.GetClipByName("Sing") ?? component.GetClipByName("Idle") ?? component.currentClip ?? component.DefaultClip).name; PlayMakerFSM component2 = ((Component)this).GetComponent<PlayMakerFSM>(); if (!Object.op_Implicit((Object)(object)component2)) { return false; } AddState(component2, "Sing"); ((BlackThreadState)this).GetSingFsm(); if (!Object.op_Implicit((Object)(object)base.singFsm)) { return false; } SingPatcher singPatcher = ((Component)this).gameObject.AddComponent<SingPatcher>(); singPatcher.fsm = component2; singPatcher.bts = (BlackThreadState)(object)this; singPatcher.animator = component; singPatcher.animClip = name; base.centreOffset = Vector2.zero; } if (base.hasStarted) { return false; } base.hasStarted = true; ((BlackThreadState)this).OnAwake(); base.isBlackThreadWorld = true; GameObject val = Object.Instantiate<GameObject>(customAttack.Prefab, ((Component)this).transform); val.transform.localPosition = Vector3.zero; val.SetActive(false); base.spawnedAttackObjs[customAttack] = val; base.chosenAttack = customAttack; base.hasChosenAttack = true; ((BlackThreadState)this).PreSpawnBlackThreadEffects(); ((BlackThreadState)this).FirstThreadedSetUp(); if (instantThread) { ((BlackThreadState)this).BecomeThreadedNoSing(); } return true; } } private class SingPatcher : MonoBehaviour { public BlackThreadState bts; public PlayMakerFSM fsm; public tk2dSpriteAnimator animator; public string animClip; private bool _forcedSing; private string _lastStateName; private string _lastClip; private void Update() { bool isInForcedSing = bts.IsInForcedSing; if (isInForcedSing == _forcedSing) { return; } if (isInForcedSing) { string activeStateName = fsm.ActiveStateName; if (!activeStateName.Contains("Idle") && !activeStateName.Contains("Walk") && !activeStateName.Contains("Stationary") && !activeStateName.Contains("Chase")) { return; } _lastStateName = fsm.ActiveStateName; fsm.SetState("Sing"); _lastClip = animator.currentClip.name; animator.Play(animClip); } else { fsm.SetState(_lastStateName); animator.Play(_lastClip); } _forcedSing = isInForcedSing; } } public const string Id = "me.cometcake575.eternalnight"; public static string Name => "EternalNight"; public static string Version => "1.0.0"; private void Awake() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (me.cometcake575.eternalnight) has loaded!")); new Hook((MethodBase)typeof(HealthManager).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)(Action<Action<HealthManager>, HealthManager>)delegate(Action<HealthManager> orig, HealthManager self) { orig(self); BlackThreadState component = ((Component)self).gameObject.GetComponent<BlackThreadState>(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } BlackThread(((Component)self).gameObject); }); } public void BlackThread(GameObject target) { HealthManager component = target.GetComponent<HealthManager>(); if (Object.op_Implicit((Object)(object)component)) { CustomBlackThreadState customBlackThreadState = target.AddComponent<CustomBlackThreadState>(); customBlackThreadState.customAttack = Effects.BlackThreadAttacksDefault[Random.RandomRangeInt(0, 4)]; ((BlackThreadState)customBlackThreadState).extraSpriteRenderers = Array.Empty<SpriteRenderer>(); ((BlackThreadState)customBlackThreadState).extraMeshRenderers = Array.Empty<MeshRenderer>(); component.blackThreadState = (BlackThreadState)(object)customBlackThreadState; component.hasBlackThreadState = true; customBlackThreadState.instantThread = true; } } public static void AddState(PlayMakerFSM fsm, string state) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown FsmState[] states = fsm.fsm.States; FsmState[] array = (FsmState[])(object)new FsmState[states.Length + 1]; for (int i = 0; i < states.Length; i++) { array[i] = states[i]; } FsmState val = new FsmState(fsm.fsm) { Name = state }; array[states.Length] = val; fsm.fsm.States = array; } } }