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 ArtifactOfHaste v1.0.1
ArtifactOfHaste.dll
Decompiled 4 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using R2API; using RoR2; 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("ArtifactOfHaste")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cbad8f369a14cd5f5cf1d434bdcb59990a90b8eb")] [assembly: AssemblyProduct("ArtifactOfHaste")] [assembly: AssemblyTitle("ArtifactOfHaste")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ArtifactOfHaste { internal class Artifact : ArtifactBase<Artifact> { [CompilerGenerated] private static class <>O { public static Action<Run> <0>__SetTimescaleRunStart; public static Action<Run> <1>__RevertTimescaleRunEnd; public static ArtifactStateChangeDelegate <2>__SetTimescaleArtifactEnabled; public static ArtifactStateChangeDelegate <3>__SetTimescaleArtifactDisabled; public static Manipulator <4>__ScaleRunStopwatch; } private static float runStopwatchMult = 1f; private const float newTimescale = 1.2f; public override string artifactName => "Artifact of Haste"; public override string artifactLangTokenName => "ARTIFACT_OF_HASTE"; public override string artifactDescription => "The game plays 20% faster."; public override Sprite artifactEnabledIcon => Assets.assetBundle.LoadAsset<Sprite>("iconEnabled.png"); public override Sprite artifactDisabledIcon => Assets.assetBundle.LoadAsset<Sprite>("iconDisabled.png"); public override void ApplyLogic() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown Run.onRunStartGlobal += SetTimescaleRunStart; Run.onRunDestroyGlobal += RevertTimescaleRunEnd; object obj = <>O.<2>__SetTimescaleArtifactEnabled; if (obj == null) { ArtifactStateChangeDelegate val = SetTimescaleArtifactEnabled; <>O.<2>__SetTimescaleArtifactEnabled = val; obj = (object)val; } RunArtifactManager.onArtifactEnabledGlobal += (ArtifactStateChangeDelegate)obj; object obj2 = <>O.<3>__SetTimescaleArtifactDisabled; if (obj2 == null) { ArtifactStateChangeDelegate val2 = SetTimescaleArtifactDisabled; <>O.<3>__SetTimescaleArtifactDisabled = val2; obj2 = (object)val2; } RunArtifactManager.onArtifactDisabledGlobal += (ArtifactStateChangeDelegate)obj2; object obj3 = <>O.<4>__ScaleRunStopwatch; if (obj3 == null) { Manipulator val3 = ScaleRunStopwatch; <>O.<4>__ScaleRunStopwatch = val3; obj3 = (object)val3; } Run.FixedUpdate += (Manipulator)obj3; } private static void SetTimescaleRunStart(Run _) { if (ArtifactBase<Artifact>.artifactEnabled) { SetTimescale(); } } private static void RevertTimescaleRunEnd(Run _) { RevertTimescale(); } private static void SetTimescaleArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { if ((Object)(object)artifactDef == (Object)(object)ArtifactBase<Artifact>.artifactDef && (Object)(object)Run.instance != (Object)null) { SetTimescale(); } } private static void SetTimescaleArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef) { if ((Object)(object)artifactDef == (Object)(object)ArtifactBase<Artifact>.artifactDef) { RevertTimescale(); } } private static void ScaleRunStopwatch(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Time>(x, "get_fixedDeltaTime") })) { val.EmitDelegate<Func<float>>((Func<float>)(() => runStopwatchMult)); val.Emit(OpCodes.Mul); } else { Log.Error("ScaleRunStopwatch ILHook failed! The run stopwatch will also move faster!"); } } private static void SetTimescale() { Time.timeScale = 1.2f; runStopwatchMult = 5f / 6f; } private static void RevertTimescale() { Time.timeScale = 1f; runStopwatchMult = 1f; } } public abstract class ArtifactBase<T> where T : ArtifactBase<T> { public static ArtifactDef artifactDef; public abstract string artifactName { get; } public abstract string artifactLangTokenName { get; } public abstract string artifactDescription { get; } public abstract Sprite artifactEnabledIcon { get; } public abstract Sprite artifactDisabledIcon { get; } public static bool artifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(artifactDef); public virtual void Init() { CreateLang(); CreateArtifact(); ApplyLogic(); } protected void CreateLang() { LanguageAPI.Add("ARTIFACT_" + artifactLangTokenName + "_NAME", artifactName); LanguageAPI.Add("ARTIFACT_" + artifactLangTokenName + "_DESCRIPTION", artifactDescription); } protected void CreateArtifact() { artifactDef = ScriptableObject.CreateInstance<ArtifactDef>(); artifactDef.cachedName = "ARTIFACT_" + artifactLangTokenName; artifactDef.nameToken = "ARTIFACT_" + artifactLangTokenName + "_NAME"; artifactDef.descriptionToken = "ARTIFACT_" + artifactLangTokenName + "_DESCRIPTION"; artifactDef.smallIconSelectedSprite = artifactEnabledIcon; artifactDef.smallIconDeselectedSprite = artifactDisabledIcon; ContentAddition.AddArtifactDef(artifactDef); } public abstract void ApplyLogic(); } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Miyowi.ArtifactOfHaste", "ArtifactOfHaste", "1.0.1")] public class ArtifactOfHaste : BaseUnityPlugin { public static ArtifactOfHaste instance; public const string PluginGUID = "Miyowi.ArtifactOfHaste"; public const string PluginAuthor = "Miyowi"; public const string PluginName = "ArtifactOfHaste"; public const string PluginVersion = "1.0.1"; public static PluginInfo pluginInfo; public void Awake() { instance = this; pluginInfo = ((BaseUnityPlugin)this).Info; Log.Init(((BaseUnityPlugin)this).Logger); Assets.Init(); new Artifact().Init(); } } public static class Assets { public static AssetBundle assetBundle; public static void Init() { GetAssetBundle(); } private static void GetAssetBundle() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArtifactOfHaste.mwmwartifactofhastebundle"); if (stream != null) { assetBundle = AssetBundle.LoadFromStream(stream); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }