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 ArtifactOfOrder v1.0.0
plugins/ArtifactOfOrder/ArtifactOfOrder.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; 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 Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.Networking; [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("ArtifactOfOrder")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ArtifactOfOrder")] [assembly: AssemblyTitle("ArtifactOfOrder")] [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 ArtifactOfOrder { public abstract class ArtifactBase { public 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 bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef); public abstract void Init(ConfigFile config); 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 Hooks(); } internal class ExampleArtifact : ArtifactBase { public static ConfigEntry<int> TimesToPrintMessageOnStart; public Dictionary<ItemTier, PickupIndex> itemList = new Dictionary<ItemTier, PickupIndex>(); public override string ArtifactName => "Artifact of Order"; public override string ArtifactLangTokenName => "ARTIFACT_OF_ORDER"; public override string ArtifactDescription => "When enabled, print a message to the chat at the start of the run."; public override Sprite ArtifactEnabledIcon => Main.mainBundle.LoadAsset<Sprite>("order_enabled.png"); public override Sprite ArtifactDisabledIcon => Main.mainBundle.LoadAsset<Sprite>("order_disabled.png"); public override void Init(ConfigFile config) { CreateConfig(config); CreateLang(); CreateArtifact(); Hooks(); } private void CreateConfig(ConfigFile config) { TimesToPrintMessageOnStart = config.Bind<int>("Artifact: " + ArtifactName, "Times to Print Message in Chat", 5, "How many times should a message be printed to the chat on run start?"); } public override void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += new hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3(CheckArtifactOfOrder); Run.onRunDestroyGlobal += ResetVars; } private void ResetVars(Run run) { itemList.Clear(); } private void CheckArtifactOfOrder(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && base.ArtifactEnabled) { ItemTier itemTier = PickupCatalog.GetPickupDef(((CreatePickupInfo)(ref pickupInfo)).pickupIndex).itemTier; if (itemList.ContainsKey(itemTier) && (int)itemTier != 5) { ((CreatePickupInfo)(ref pickupInfo)).pickupIndex = itemList[itemTier]; } else { itemList.Add(itemTier, ((CreatePickupInfo)(ref pickupInfo)).pickupIndex); } } orig.Invoke(pickupInfo, position, velocity); } } 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); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Nerdman.ArtifactOfOrder", "ArtifactOfOrder", "1.0.0")] public class Main : BaseUnityPlugin { public static AssetBundle mainBundle; public const string bundleName = "artifact_of_order"; public const string assetBundleFolder = "assetbundles"; public List<ArtifactBase> Artifacts = new List<ArtifactBase>(); public const string PluginGUID = "Nerdman.ArtifactOfOrder"; public const string PluginAuthor = "Nerdman"; public const string PluginName = "ArtifactOfOrder"; public const string PluginVersion = "1.0.0"; public static PluginInfo PInfo { get; private set; } public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(PInfo.Location), "assetbundles", "artifact_of_order"); public bool ValidateArtifact(ArtifactBase artifact, List<ArtifactBase> artifactList) { bool value = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifact: " + artifact.ArtifactName, "Enable Artifact?", true, "Should this artifact appear for selection?").Value; if (value) { artifactList.Add(artifact); } return value; } public void Awake() { PInfo = ((BaseUnityPlugin)this).Info; mainBundle = AssetBundle.LoadFromFile(AssetBundlePath); Log.Init(((BaseUnityPlugin)this).Logger); IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase)) select type; foreach (Type item in enumerable) { ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item); if (ValidateArtifact(artifactBase, Artifacts)) { artifactBase.Init(((BaseUnityPlugin)this).Config); } } } private void Update() { } } }